Browse Source

更新部分service文件

lcl 2 years ago
parent
commit
29d6b7fba4

BIN
.DS_Store


+ 3 - 4
Areas/Api/Controllers/v1/MainServer/ActivityInfoController.cs

@@ -40,10 +40,9 @@ namespace MySystem.Areas.Api.Controllers.v1
             int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
             int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<int> query = RedisDbconn.Instance.GetList<int>("ActivityInfoList", PageNum, PageSize);
-            foreach (var ActId in query)
+            List<ActivityInfo> query = new ActivityInfoService().List(new List<FieldItem>(), "", PageNum, PageSize);
+            foreach (ActivityInfo subdata in query)
             {
-                ActivityInfo subdata = RedisDbconn.Instance.Get<ActivityInfo>("ActivityInfo:" + ActId) ?? new ActivityInfo();
                 Dictionary<string, object> curData = new Dictionary<string, object>();
                 curData.Add("ActBanner", DefaultPic(subdata.ActBanner)); //活动Banner图片
                 curData.Add("Id", subdata.Id); //Id
@@ -70,7 +69,7 @@ namespace MySystem.Areas.Api.Controllers.v1
             JsonData data = JsonMapper.ToObject(value);
             Dictionary<string, object> Obj = new Dictionary<string, object>();
             int Id = int.Parse(function.CheckInt(data["Id"].ToString()));
-            ActivityInfo query = RedisDbconn.Instance.Get<ActivityInfo>("ActivityInfo:" + Id) ?? new ActivityInfo();
+            ActivityInfo query = new ActivityInfoService().Query(Id);
             Obj.Add("ActContent", query.ActContent); //活动详情
             return Obj;
         }

+ 2 - 2
Areas/Api/Controllers/v1/MainServer/AdvertismentController.cs

@@ -39,7 +39,7 @@ namespace MySystem.Areas.Api.Controllers.v1
             JsonData data = JsonMapper.ToObject(value);
             Dictionary<string, object> Obj = new Dictionary<string, object>();
             int Id = int.Parse(function.CheckInt(data["Id"].ToString()));
-            Advertisment query = RedisDbconn.Instance.Get<Advertisment>("Advertisment:" + Id) ?? new Advertisment();
+            Advertisment query = new AdvertismentService().Query(Id);
             Obj.Add("Title", query.Title); //标题
             Obj.Add("Contents", CheckContentImage(query.Contents)); //内容
             return Obj;
@@ -62,7 +62,7 @@ namespace MySystem.Areas.Api.Controllers.v1
             int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
             int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<Advertisment> query = RedisDbconn.Instance.GetList<Advertisment>("Advertisment:003001", PageNum, PageSize);
+            List<Advertisment> query = new AdvertismentService().List(new List<FieldItem>(), " and ColId like '003001%'", PageNum, PageSize);
             foreach (var subdata in query)
             {
                 Dictionary<string, object> curData = new Dictionary<string, object>();

+ 1 - 1
Areas/Api/Controllers/v1/MainServer/ColController.cs

@@ -40,7 +40,7 @@ namespace MySystem.Areas.Api.Controllers.v1
             int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
             int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
-            List<Col> query = RedisDbconn.Instance.GetList<Col>("Col:004", PageNum, PageSize);
+            List<Models.Col> query = new ColService().List(new List<FieldItem>(), " and ColId like '004%'", PageNum, PageSize);
             foreach (var subdata in query)
             {
                 Dictionary<string, object> curData = new Dictionary<string, object>();

BIN
BLL/MySystemLib.dll


+ 18 - 0
Config/Base.cs

@@ -0,0 +1,18 @@
+using System.Collections.Generic;
+using Library;
+
+namespace AppConfig
+{
+    public class Base
+    {
+        public static string ApiKey = "G6H7@J8%";
+        public static string Host = Library.ConfigurationManager.AppSettings["Host"].ToString();
+        public static string Database = Library.ConfigurationManager.AppSettings["Database"].ToString();
+        public static string defaultImage = Library.ConfigurationManager.AppSettings["Host"].ToString() + "/skin/app/default/static/images/default.jpg";
+        #region 数据库结构
+        public static Dictionary<string, Dictionary<string, string>> mainTables = new Dictionary<string, Dictionary<string, string>>();
+        public static Dictionary<string, Dictionary<string, string>> bsTables = new Dictionary<string, Dictionary<string, string>>();
+
+        #endregion
+    }
+}

+ 132 - 0
Services/ActivityInfoService.cs

@@ -0,0 +1,132 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using MySystem.MainModels;
+using Library;
+using LitJson;
+
+namespace MySystem
+{
+    public class ActivityInfoService
+    {
+        string _conn = "";
+        public ActivityInfoService()
+        {
+            _conn = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+        }
+
+        /// <summary>
+        /// 查询列表
+        /// </summary>
+        /// <param name="fields">查询条件(单个字段)</param>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <param name="page">页码</param>
+        /// <param name="limit">每页条数</param>
+        /// <returns></returns>
+        public List<ActivityInfo> List(List<FieldItem> fields, string condition, int page = 1, int limit = 30)
+        {
+            Dictionary<string, object> obj = new DbService(AppConfig.Base.mainTables, _conn).IndexData("ActivityInfo", fields, "Id desc", "0", page, limit, condition);
+            List<ActivityInfo> diclist = obj["data"] as List<ActivityInfo>;
+            return diclist;
+        }
+
+        /// <summary>
+        /// 查询一条记录
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <returns></returns>
+        public ActivityInfo Query(int Id)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            ActivityInfo editData = db.ActivityInfo.FirstOrDefault(m => m.Id == Id) ?? new ActivityInfo();
+            db.Dispose();
+            return editData;
+        }
+
+        /// <summary>
+        /// 添加数据
+        /// </summary>
+        /// <param name="Fields">要设置的字段</param>
+        /// <returns></returns>
+        public int Add(Dictionary<string, object> Fields)
+        {
+            return new DbService(AppConfig.Base.mainTables, _conn).Add("ActivityInfo", Fields, 0);
+        }
+
+        /// <summary>
+        /// 修改数据
+        /// </summary>
+        /// <param name="Fields">要设置的字段</param>
+        /// <param name="Id">主键Id</param>
+        public void Edit(Dictionary<string, object> Fields, int Id)
+        {
+            new DbService(AppConfig.Base.mainTables, _conn).Edit("ActivityInfo", Fields, Id);
+        }
+
+        /// <summary>
+        /// 删除数据
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        public void Delete(int Id)
+        {
+            new DbService(AppConfig.Base.mainTables, _conn).Delete("ActivityInfo", Id);
+        }
+
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <param name="Sort">排序序号</param>
+        public void Sort(int Id, int Sort)
+        {
+            new DbService(AppConfig.Base.mainTables, _conn).Sort("ActivityInfo", Sort, Id);
+        }
+
+        /// <summary>
+        /// 导入数据
+        /// </summary>
+        /// <param name="ExcelData">json数据</param>
+        public void Import(string ExcelData)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            JsonData list = JsonMapper.ToObject(ExcelData);
+            for (int i = 1; i < list.Count;i++ )
+            {
+                JsonData dr = list[i];
+                
+                db.ActivityInfo.Add(new ActivityInfo()
+                {
+                    CreateDate = DateTime.Now,
+                    UpdateDate = DateTime.Now,
+                    
+                });
+                db.SaveChanges();
+            }
+            db.Dispose();
+        }
+
+        /// <summary>
+        /// 导出excel表格
+        /// </summary>
+        /// <param name="fields">查询条件(单个字段)</param>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <returns></returns>
+        public Dictionary<string, object> ExportExcel(List<FieldItem> fields, string condition)
+        {
+            Dictionary<string, object> obj = new DbService(AppConfig.Base.mainTables, _conn).IndexData("ActivityInfo", fields, "Id desc", "0", 1, 20000, condition, "Id", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+            }
+
+            Dictionary<string, object> result = new Dictionary<string, object>();
+            result.Add("Status", "1");
+            result.Add("Info", "Excel报表-" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + ".xlsx");
+            result.Add("Obj", diclist);
+            Dictionary<string, object> ReturnFields = new Dictionary<string, object>();
+
+            result.Add("Fields", ReturnFields);
+            return result;
+        }
+    }
+}

+ 132 - 0
Services/AdvertismentService.cs

@@ -0,0 +1,132 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using MySystem.Models;
+using Library;
+using LitJson;
+
+namespace MySystem
+{
+    public class AdvertismentService
+    {
+        string _conn = "";
+        public AdvertismentService()
+        {
+            _conn = ConfigurationManager.AppSettings["BsSqlConnStr"].ToString();
+        }
+
+        /// <summary>
+        /// 查询列表
+        /// </summary>
+        /// <param name="fields">查询条件(单个字段)</param>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <param name="page">页码</param>
+        /// <param name="limit">每页条数</param>
+        /// <returns></returns>
+        public List<Advertisment> List(List<FieldItem> fields, string condition, int page = 1, int limit = 30)
+        {
+            Dictionary<string, object> obj = new DbService(AppConfig.Base.bsTables, _conn).IndexData("Advertisment", fields, "Id desc", "0", page, limit, condition);
+            List<Advertisment> diclist = obj["data"] as List<Advertisment>;
+            return diclist;
+        }
+
+        /// <summary>
+        /// 查询一条记录
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <returns></returns>
+        public Advertisment Query(int Id)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            Advertisment editData = db.Advertisment.FirstOrDefault(m => m.Id == Id) ?? new Advertisment();
+            db.Dispose();
+            return editData;
+        }
+
+        /// <summary>
+        /// 添加数据
+        /// </summary>
+        /// <param name="Fields">要设置的字段</param>
+        /// <returns></returns>
+        public int Add(Dictionary<string, object> Fields)
+        {
+            return new DbService(AppConfig.Base.bsTables, _conn).Add("Advertisment", Fields, 0);
+        }
+
+        /// <summary>
+        /// 修改数据
+        /// </summary>
+        /// <param name="Fields">要设置的字段</param>
+        /// <param name="Id">主键Id</param>
+        public void Edit(Dictionary<string, object> Fields, int Id)
+        {
+            new DbService(AppConfig.Base.bsTables, _conn).Edit("Advertisment", Fields, Id);
+        }
+
+        /// <summary>
+        /// 删除数据
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        public void Delete(int Id)
+        {
+            new DbService(AppConfig.Base.bsTables, _conn).Delete("Advertisment", Id);
+        }
+
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <param name="Sort">排序序号</param>
+        public void Sort(int Id, int Sort)
+        {
+            new DbService(AppConfig.Base.bsTables, _conn).Sort("Advertisment", Sort, Id);
+        }
+
+        /// <summary>
+        /// 导入数据
+        /// </summary>
+        /// <param name="ExcelData">json数据</param>
+        public void Import(string ExcelData)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            JsonData list = JsonMapper.ToObject(ExcelData);
+            for (int i = 1; i < list.Count;i++ )
+            {
+                JsonData dr = list[i];
+                
+                db.Advertisment.Add(new Advertisment()
+                {
+                    CreateDate = DateTime.Now,
+                    UpdateDate = DateTime.Now,
+                    
+                });
+                db.SaveChanges();
+            }
+            db.Dispose();
+        }
+
+        /// <summary>
+        /// 导出excel表格
+        /// </summary>
+        /// <param name="fields">查询条件(单个字段)</param>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <returns></returns>
+        public Dictionary<string, object> ExportExcel(List<FieldItem> fields, string condition)
+        {
+            Dictionary<string, object> obj = new DbService(AppConfig.Base.bsTables, _conn).IndexData("Advertisment", fields, "Id desc", "0", 1, 20000, condition, "Id", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+            }
+
+            Dictionary<string, object> result = new Dictionary<string, object>();
+            result.Add("Status", "1");
+            result.Add("Info", "Excel报表-" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + ".xlsx");
+            result.Add("Obj", diclist);
+            Dictionary<string, object> ReturnFields = new Dictionary<string, object>();
+
+            result.Add("Fields", ReturnFields);
+            return result;
+        }
+    }
+}

+ 132 - 0
Services/ColService.cs

@@ -0,0 +1,132 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using MySystem.Models;
+using Library;
+using LitJson;
+
+namespace MySystem
+{
+    public class ColService
+    {
+        string _conn = "";
+        public ColService()
+        {
+            _conn = ConfigurationManager.AppSettings["BsSqlConnStr"].ToString();
+        }
+
+        /// <summary>
+        /// 查询列表
+        /// </summary>
+        /// <param name="fields">查询条件(单个字段)</param>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <param name="page">页码</param>
+        /// <param name="limit">每页条数</param>
+        /// <returns></returns>
+        public List<Col> List(List<FieldItem> fields, string condition, int page = 1, int limit = 30)
+        {
+            Dictionary<string, object> obj = new DbService(AppConfig.Base.bsTables, _conn).IndexData("Col", fields, "Id desc", "0", page, limit, condition);
+            List<Col> diclist = obj["data"] as List<Col>;
+            return diclist;
+        }
+
+        /// <summary>
+        /// 查询一条记录
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <returns></returns>
+        public Col Query(int Id)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            Col editData = db.Col.FirstOrDefault(m => m.Id == Id) ?? new Col();
+            db.Dispose();
+            return editData;
+        }
+
+        /// <summary>
+        /// 添加数据
+        /// </summary>
+        /// <param name="Fields">要设置的字段</param>
+        /// <returns></returns>
+        public int Add(Dictionary<string, object> Fields)
+        {
+            return new DbService(AppConfig.Base.bsTables, _conn).Add("Col", Fields, 0);
+        }
+
+        /// <summary>
+        /// 修改数据
+        /// </summary>
+        /// <param name="Fields">要设置的字段</param>
+        /// <param name="Id">主键Id</param>
+        public void Edit(Dictionary<string, object> Fields, int Id)
+        {
+            new DbService(AppConfig.Base.bsTables, _conn).Edit("Col", Fields, Id);
+        }
+
+        /// <summary>
+        /// 删除数据
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        public void Delete(int Id)
+        {
+            new DbService(AppConfig.Base.bsTables, _conn).Delete("Col", Id);
+        }
+
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <param name="Sort">排序序号</param>
+        public void Sort(int Id, int Sort)
+        {
+            new DbService(AppConfig.Base.bsTables, _conn).Sort("Col", Sort, Id);
+        }
+
+        /// <summary>
+        /// 导入数据
+        /// </summary>
+        /// <param name="ExcelData">json数据</param>
+        public void Import(string ExcelData)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            JsonData list = JsonMapper.ToObject(ExcelData);
+            for (int i = 1; i < list.Count;i++ )
+            {
+                JsonData dr = list[i];
+                
+                db.Col.Add(new Col()
+                {
+                    CreateDate = DateTime.Now,
+                    UpdateDate = DateTime.Now,
+                    
+                });
+                db.SaveChanges();
+            }
+            db.Dispose();
+        }
+
+        /// <summary>
+        /// 导出excel表格
+        /// </summary>
+        /// <param name="fields">查询条件(单个字段)</param>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <returns></returns>
+        public Dictionary<string, object> ExportExcel(List<FieldItem> fields, string condition)
+        {
+            Dictionary<string, object> obj = new DbService(AppConfig.Base.bsTables, _conn).IndexData("Col", fields, "Id desc", "0", 1, 20000, condition, "Id", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+            }
+
+            Dictionary<string, object> result = new Dictionary<string, object>();
+            result.Add("Status", "1");
+            result.Add("Info", "Excel报表-" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + ".xlsx");
+            result.Add("Obj", diclist);
+            Dictionary<string, object> ReturnFields = new Dictionary<string, object>();
+
+            result.Add("Fields", ReturnFields);
+            return result;
+        }
+    }
+}

+ 132 - 0
Services/ConsumerOrdersService.cs

@@ -0,0 +1,132 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using MySystem.MainModels;
+using Library;
+using LitJson;
+
+namespace MySystem
+{
+    public class ConsumerOrdersService
+    {
+        string _conn = "";
+        public ConsumerOrdersService()
+        {
+            _conn = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+        }
+
+        /// <summary>
+        /// 查询列表
+        /// </summary>
+        /// <param name="fields">查询条件(单个字段)</param>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <param name="page">页码</param>
+        /// <param name="limit">每页条数</param>
+        /// <returns></returns>
+        public List<ConsumerOrders> List(List<FieldItem> fields, string condition, int page = 1, int limit = 30)
+        {
+            Dictionary<string, object> obj = new DbService(AppConfig.Base.mainTables, _conn).IndexData("ConsumerOrders", fields, "Id desc", "0", page, limit, condition);
+            List<ConsumerOrders> diclist = obj["data"] as List<ConsumerOrders>;
+            return diclist;
+        }
+
+        /// <summary>
+        /// 查询一条记录
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <returns></returns>
+        public ConsumerOrders Query(int Id)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            ConsumerOrders editData = db.ConsumerOrders.FirstOrDefault(m => m.Id == Id) ?? new ConsumerOrders();
+            db.Dispose();
+            return editData;
+        }
+
+        /// <summary>
+        /// 添加数据
+        /// </summary>
+        /// <param name="Fields">要设置的字段</param>
+        /// <returns></returns>
+        public int Add(Dictionary<string, object> Fields)
+        {
+            return new DbService(AppConfig.Base.mainTables, _conn).Add("ConsumerOrders", Fields, 0);
+        }
+
+        /// <summary>
+        /// 修改数据
+        /// </summary>
+        /// <param name="Fields">要设置的字段</param>
+        /// <param name="Id">主键Id</param>
+        public void Edit(Dictionary<string, object> Fields, int Id)
+        {
+            new DbService(AppConfig.Base.mainTables, _conn).Edit("ConsumerOrders", Fields, Id);
+        }
+
+        /// <summary>
+        /// 删除数据
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        public void Delete(int Id)
+        {
+            new DbService(AppConfig.Base.mainTables, _conn).Delete("ConsumerOrders", Id);
+        }
+
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id">主键Id</param>
+        /// <param name="Sort">排序序号</param>
+        public void Sort(int Id, int Sort)
+        {
+            new DbService(AppConfig.Base.mainTables, _conn).Sort("ConsumerOrders", Sort, Id);
+        }
+
+        /// <summary>
+        /// 导入数据
+        /// </summary>
+        /// <param name="ExcelData">json数据</param>
+        public void Import(string ExcelData)
+        {
+            WebCMSEntities db = new WebCMSEntities();
+            JsonData list = JsonMapper.ToObject(ExcelData);
+            for (int i = 1; i < list.Count;i++ )
+            {
+                JsonData dr = list[i];
+                
+                db.ConsumerOrders.Add(new ConsumerOrders()
+                {
+                    CreateDate = DateTime.Now,
+                    UpdateDate = DateTime.Now,
+                    
+                });
+                db.SaveChanges();
+            }
+            db.Dispose();
+        }
+
+        /// <summary>
+        /// 导出excel表格
+        /// </summary>
+        /// <param name="fields">查询条件(单个字段)</param>
+        /// <param name="condition">查询条件(sql语句)</param>
+        /// <returns></returns>
+        public Dictionary<string, object> ExportExcel(List<FieldItem> fields, string condition)
+        {
+            Dictionary<string, object> obj = new DbService(AppConfig.Base.mainTables, _conn).IndexData("ConsumerOrders", fields, "Id desc", "0", 1, 20000, condition, "Id", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+            }
+
+            Dictionary<string, object> result = new Dictionary<string, object>();
+            result.Add("Status", "1");
+            result.Add("Info", "Excel报表-" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + ".xlsx");
+            result.Add("Obj", diclist);
+            Dictionary<string, object> ReturnFields = new Dictionary<string, object>();
+
+            result.Add("Fields", ReturnFields);
+            return result;
+        }
+    }
+}

+ 48 - 4
Startup.cs

@@ -96,11 +96,9 @@ namespace MySystem
 
             //services.AddHttpContextAccessor();
 
-            // 必须打开
-            // services.AddHostedService<SycnStartService>();
-            // 必须打开
-
             MySystemLib.SystemPublicFuction.appcheck = "success";
+            InitMain();
+            InitBs();
         }
 
         // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
@@ -149,5 +147,51 @@ namespace MySystem
             });
 
         }
+
+        private void InitMain()
+        {
+            Dictionary<string, Dictionary<string, string>> tables = new Dictionary<string, Dictionary<string, string>>();
+            string connstr = Configuration["Setting:SqlConnStr"];
+            System.Data.DataTable tablecollection = Library.CustomerSqlConn.dtable("select DISTINCT TABLE_NAME from information_schema.columns where table_schema = 'QrCodePlateMainServer'", connstr);
+            foreach (System.Data.DataRow subtable in tablecollection.Rows)
+            {
+                Dictionary<string, string> Columns = new Dictionary<string, string>();
+                System.Data.DataTable columncollection = Library.CustomerSqlConn.dtable("select COLUMN_NAME,DATA_TYPE from information_schema.columns where table_schema = 'QrCodePlateMainServer' and TABLE_NAME='" + subtable["TABLE_NAME"].ToString() + "'", connstr);
+                foreach (System.Data.DataRow column in columncollection.Rows)
+                {
+                    string datatype = column["DATA_TYPE"].ToString();
+                    if (datatype == "decimal")
+                    {
+                        datatype = "numeric";
+                    }
+                    Columns.Add(column["COLUMN_NAME"].ToString(), datatype);
+                }
+                tables.Add(subtable["TABLE_NAME"].ToString(), Columns);
+            }
+            AppConfig.Base.mainTables = tables;
+        }
+
+        private void InitBs()
+        {
+            Dictionary<string, Dictionary<string, string>> tables = new Dictionary<string, Dictionary<string, string>>();
+            string connstr = Configuration["Setting:BsSqlConnStr"];
+            System.Data.DataTable tablecollection = Library.CustomerSqlConn.dtable("select DISTINCT TABLE_NAME from information_schema.columns where table_schema = 'QrCodePlateBsServer'", connstr);
+            foreach (System.Data.DataRow subtable in tablecollection.Rows)
+            {
+                Dictionary<string, string> Columns = new Dictionary<string, string>();
+                System.Data.DataTable columncollection = Library.CustomerSqlConn.dtable("select COLUMN_NAME,DATA_TYPE from information_schema.columns where table_schema = 'QrCodePlateBsServer' and TABLE_NAME='" + subtable["TABLE_NAME"].ToString() + "'", connstr);
+                foreach (System.Data.DataRow column in columncollection.Rows)
+                {
+                    string datatype = column["DATA_TYPE"].ToString();
+                    if (datatype == "decimal")
+                    {
+                        datatype = "numeric";
+                    }
+                    Columns.Add(column["COLUMN_NAME"].ToString(), datatype);
+                }
+                tables.Add(subtable["TABLE_NAME"].ToString(), Columns);
+            }
+            AppConfig.Base.bsTables = tables;
+        }
     }
 }