Esempio n. 1
0
        protected void RgGoodsTypeListNeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
            var percentageValues = ConfManager.GetAppsetting("Percentage");

            if (string.IsNullOrEmpty(percentageValues))
            {
                RAM.Alert("配置文件中未配置Percentage(默认税率列表)");
                return;
            }
            var percentages      = percentageValues.Split(',').Select(Convert.ToDecimal);
            var otherPercentages = _taxrateProportion.AllPercentage();

            otherPercentages.AddRange(percentages.Where(ent => !otherPercentages.Contains(ent)));
            DataSource = otherPercentages;
            var dics = _taxrateProportion.GetNewPercentages(null).ToDictionary(k => k.GoodsType, v => v);
            IDictionary <Int32, string> goodsTypes = Enum.Attribute.EnumAttribute.GetDict <GoodsKindType>();
            var index      = 1;
            var dataSource = new List <ShowGridProportion>();

            foreach (var item in goodsTypes.Where(ent => ent.Key != (int)GoodsKindType.NoSet).OrderBy(ent => ent.Key))
            {
                var proportion = dics.ContainsKey(item.Key) ? dics[item.Key] : new TaxrateProportionInfo();
                dataSource.Add(new ShowGridProportion(index, item.Key, item.Value, proportion.GoodsTypeCode, proportion.Percentage, 0));
                index++;
            }
            RgGoodsTypeList.DataSource = dataSource;
        }
Esempio n. 2
0
        static GlobalConfig()
        {
            var keepYear = ConfManager.GetAppsetting("KeepYearsData");

            if (!int.TryParse(keepYear, out _keepYear))
            {
                _keepYear = 2;
            }
            _iamgeSize         = ConfManager.GetAppsetting("ImageSize");
            _ResourceServerImg = ConfManager.GetAppsetting("ResourceServerImg");
            var expire = ConfManager.GetAppsetting("Expire");

            if (!int.TryParse(expire, out _Expire))
            {
                _Expire = 30;
            }

            _isTestOrder   = Configuration.AppSettings["IsTestOrder"] == "true";
            _isTestWebSite = Configuration.AppSettings["IsTestWebSite"] == "true";


            _timer.Elapsed += (sender, e) =>
            {
                var needDelList = _dbExecuteLog.Where(a => (DateTime.Now - a.Value).TotalSeconds >= 20).ToList();
                foreach (var d in needDelList)
                {
                    _dbExecuteLog.Remove(d.Key);
                }
            };
            _timer.Start();
        }
Esempio n. 3
0
        public static bool IsStopTask(TaskKind task)
        {
            //读取停止任务列表
            var stopTasks = ConfManager.GetAppsetting("StopTask").Split('|').ToList();

            return(stopTasks.Contains(task.ToString()));
        }
Esempio n. 4
0
        /// <summary>发送短信 eg:SendShortMessage('13761746053','短信内容')
        /// </summary>
        /// <param name="saleFilialeId"></param>
        /// <param name="salePlatformId"></param>
        /// <param name="mobile">电话号码</param>
        /// <param name="msg">消息</param>
        public static string SendShortMessage(Guid saleFilialeId, Guid salePlatformId, string mobile, string msg)
        {
            var send   = new SimpleNotificationPushClient(ConfManager.GetAppsetting("NotificationPushApiUrl"), ConfManager.GetAppsetting("NotificationPushSignKey"), new JsonSerialize());
            var result = send.Push(new SimpleMessageTaskDTO
            {
                ExpectNotifyTime = DateTime.Now,
                MessageContent   = new MessageContentDTO
                {
                    Content     = msg,
                    MessageType = 1,
                    Signature   = "会员提现"
                },
                SaleFilialeID  = saleFilialeId,
                SalePlatformID = salePlatformId,
                TaskID         = Guid.NewGuid(),
                IsGroupSend    = false,
                Targets        = new List <NotificationTargetDTO>
                {
                    new NotificationTargetDTO
                    {
                        IsVoiceType   = false,
                        JsonParameter = null,
                        TargetNo      = mobile,
                        TargetType    = 1
                    }
                }
            });

            return(result != null ? result.IsSuccess?"" : result.FailMessage:"发送短信失败!");
        }
 /// <summary>
 /// 生成公司毛利记录存档
 /// </summary>
 public static void RunCompanyGrossProfitTask()
 {
     try
     {
         var date = DateTime.Now;
         if (date.Day == _excuteday)
         {
             return;
         }
         var createStockHour = ConfManager.GetAppsetting("CreateStockHour");
         var hours           = createStockHour.Split(',');
         if (!hours.Contains(string.Format("{0}", date.Hour)))
         {
             return;
         }
         string errorMsg;
         //6月份算4月份存档
         var result = _companyGrossProfitRecordBll.AddCompanyGrossProfitRecord(date, out errorMsg);
         if (!result)
         {
             ERP.SAL.LogCenter.LogService.LogError("生成公司毛利记录失败", "公司毛利记录", new Exception(errorMsg));
         }
         else
         {
             _excuteday = date.Day;
         }
     }
     catch (Exception exp)
     {
         ERP.SAL.LogCenter.LogService.LogError("生成公司毛利异常", "公司毛利记录", exp);
     }
 }
Esempio n. 6
0
        public static void Init()
        {
            //触发的小时段,如果不设置,则表示不限制
            _triggerStartHour = ConfManager.GetAppsetting("GenerateSaleOrderGoodsSettlement.TriggerStartHour").ToInt();
            if (_triggerStartHour < 0 || _triggerStartHour >= 24)
            {
                _triggerStartHour = 0;
            }
            _triggerEndHour = ConfManager.GetAppsetting("GenerateSaleOrderGoodsSettlement.TriggerEndHour").ToInt();
            if (_triggerEndHour <= 0 || _triggerEndHour >= 24)
            {
                _triggerEndHour = 23;
            }

            _daysBefore = ConfManager.GetAppsetting("GenerateSaleOrderGoodsSettlement.DaysBefore").ToInt();
            if (_daysBefore <= 0)
            {
                _daysBefore = 2;
            }

            _maxRowCount = ConfManager.GetAppsetting("GenerateSaleOrderGoodsSettlement.MaxRowCount").ToInt();
            if (_maxRowCount <= 0)
            {
                _maxRowCount = 100;
            }
        }
Esempio n. 7
0
        static string GetAndVerifySetting(string settingName)
        {
            var val = ConfManager.GetAppsetting(settingName);

            if (string.IsNullOrEmpty(val))
            {
                throw new System.ArgumentNullException(settingName, settingName + " => AppSetting Need config!");
            }
            return(val);
        }
Esempio n. 8
0
        public void Init()
        {
            ConfManager.Init();
            // ERP 读写分离配置
            var readConnectionsOfErp = new List <string>();

            readConnectionsOfErp.Add(ConfManager.GetAppsetting("db_ERP_ReadConnections_1"));
            readConnectionsOfErp.Add(ConfManager.GetAppsetting("db_ERP_ReadConnections_2"));
            readConnectionsOfErp.Add(ConfManager.GetAppsetting("db_ERP_ReadConnections_3"));
            var writeConnectionOfErp = ConfManager.GetAppsetting("db_ERP_WriteConnection");

            Keede.DAL.RWSplitting.ConnectionContainer.AddDbConnections(GlobalConfig.ERP_DB_NAME, writeConnectionOfErp, readConnectionsOfErp.Where(m => !string.IsNullOrEmpty(m)).ToArray(), Keede.DAL.RWSplitting.EnumStrategyType.Loop);
        }
 public static void Init()
 {
     //触发的小时段,如果不设置,则表示不限制
     _triggerStartHour = ConfManager.GetAppsetting("SaleFilialeGenerateStockInAndPurchase.TriggerStartHour").ToInt();
     if (_triggerStartHour < 0 || _triggerStartHour >= 24)
     {
         _triggerStartHour = 0;
     }
     _triggerEndHour = ConfManager.GetAppsetting("SaleFilialeGenerateStockInAndPurchase.TriggerEndHour").ToInt();
     if (_triggerEndHour <= 0 || _triggerEndHour >= 24)
     {
         _triggerEndHour = 23;
     }
 }
Esempio n. 10
0
            public static FilialeInfo Get()
            {
                var val = HttpContext.Current.Session[Key];

                if (val == null)
                {
                    var filialeId = ConfManager.GetAppsetting("FilialeId");
                    if (!string.IsNullOrEmpty(filialeId))
                    {
                        val = CacheCollection.Filiale.GetList().FirstOrDefault(ent => ent.ID == new Guid(filialeId));
                        if (val != null)
                        {
                            HttpContext.Current.Session[Key] = val;
                        }
                    }
                }
                return((FilialeInfo)val);
            }
Esempio n. 11
0
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        static void Main()
        {
            ConfManager.Init();
            // ERP 读写分离配置
            var readConnectionsOfErp = new List <string>();

            readConnectionsOfErp.Add(ConfManager.GetAppsetting("db_ERP_ReadConnections_1"));
            readConnectionsOfErp.Add(ConfManager.GetAppsetting("db_ERP_ReadConnections_2"));
            readConnectionsOfErp.Add(ConfManager.GetAppsetting("db_ERP_ReadConnections_3"));
            var writeConnectionOfErp = ConfManager.GetAppsetting("db_ERP_WriteConnection");

            Keede.DAL.RWSplitting.ConnectionContainer.AddDbConnections(GlobalConfig.ERP_DB_NAME, writeConnectionOfErp, readConnectionsOfErp.Where(m => !string.IsNullOrEmpty(m)).ToArray(), Keede.DAL.RWSplitting.EnumStrategyType.Loop);


            //var sh = new ServiceHost(typeof(Implement.Service));
            //sh.Open();

            var es = new Implement.Service();
            var mm = es.GetFilialeIdGoodsIdAvgSettlePrice(DateTime.Now);

            Console.WriteLine("ERP服务已启动!");
            Console.ReadLine();
        }
Esempio n. 12
0
        /// <summary>初始化任务
        /// </summary>
        private void Init()
        {
            ConfManager.Init();

            //设置推送数据的连接字符串名称
            Instance.Init.SetDataBaseConnectionString("System.Data.SqlClient", ConfManager.GetAppsetting("db_ERP_WriteConnection"));

            var readConnectionsOfErp = new List <string>();

            readConnectionsOfErp.Add(ConfManager.GetAppsetting("db_ERP_ReadConnections_1"));
            readConnectionsOfErp.Add(ConfManager.GetAppsetting("db_ERP_ReadConnections_2"));
            readConnectionsOfErp.Add(ConfManager.GetAppsetting("db_ERP_ReadConnections_3"));
            var writeConnectionOfErp = ConfManager.GetAppsetting("db_ERP_WriteConnection");

            Keede.DAL.RWSplitting.ConnectionContainer.AddDbConnections(GlobalConfig.ERP_DB_NAME, writeConnectionOfErp, readConnectionsOfErp.Where(m => !string.IsNullOrEmpty(m)).ToArray(), Keede.DAL.RWSplitting.EnumStrategyType.Loop);


            // ERP 备份库读写分离配置
            var readConnectionsOfErpHistory = new List <string>();

            readConnectionsOfErpHistory.Add(ConfManager.GetAppsetting("db_ERP_HISTORY_ReadConnections_1"));
            readConnectionsOfErpHistory.Add(ConfManager.GetAppsetting("db_ERP_HISTORY_ReadConnections_2"));
            readConnectionsOfErpHistory.Add(ConfManager.GetAppsetting("db_ERP_HISTORY_ReadConnections_3"));
            var writeConnectionOfErpHistory = ConfManager.GetAppsetting("db_ERP_HISTORY_WriteConnection");
            int maxYear = DateTime.Now.Year + 2;// 历史备份库年份,假定2年以后才会重启Web(事实可能吗?所以完全够了)

            for (var i = 2007; i <= maxYear; i++)
            {
                var readConnectionStringList = new List <string>();
                for (var j = 0; j < readConnectionsOfErpHistory.Count; j++)
                {
                    var readConnectionString = readConnectionsOfErpHistory[j];
                    if (string.IsNullOrEmpty(readConnectionString))
                    {
                        continue;
                    }

                    var connectionlist = readConnectionString.Split(';').ToList();
                    var oldReadDbName  = connectionlist.FirstOrDefault(c => c.IndexOf("database=", StringComparison.CurrentCultureIgnoreCase) > -1);
                    var newReadDbName  = oldReadDbName + i;
                    readConnectionString = readConnectionString.Replace(oldReadDbName, newReadDbName);
                    readConnectionStringList.Add(readConnectionString);
                }

                var writeConnectionString = writeConnectionOfErpHistory;
                var oldWriteDbName        = writeConnectionString.Split(';').ToList().FirstOrDefault(c => c.IndexOf("database=", StringComparison.CurrentCultureIgnoreCase) > -1);
                var newWriteDbName        = oldWriteDbName + i;
                writeConnectionString = writeConnectionString.Replace(oldWriteDbName, newWriteDbName);
                Keede.DAL.RWSplitting.ConnectionContainer.AddDbConnections(GlobalConfig.ERP_HISTORY_DB_NAME + i, writeConnectionString, readConnectionStringList.Where(m => !string.IsNullOrEmpty(m)).ToArray(), Keede.DAL.RWSplitting.EnumStrategyType.Loop);
            }

            // ERP Report 读写分离配置
            var readConnectionsOfErpReport = new List <string>();

            readConnectionsOfErpReport.Add(ConfManager.GetAppsetting("db_ERP_REPORT_ReadConnections_1"));
            readConnectionsOfErpReport.Add(ConfManager.GetAppsetting("db_ERP_REPORT_ReadConnections_2"));
            readConnectionsOfErpReport.Add(ConfManager.GetAppsetting("db_ERP_REPORT_ReadConnections_3"));
            var writeConnectionOfErpReport = ConfManager.GetAppsetting("db_ERP_REPORT_WriteConnection");

            Keede.DAL.RWSplitting.ConnectionContainer.AddDbConnections(GlobalConfig.ERP_REPORT_DB_NAME, writeConnectionOfErpReport, readConnectionsOfErpReport.Where(m => !string.IsNullOrEmpty(m)).ToArray(), Keede.DAL.RWSplitting.EnumStrategyType.Loop);

            Dapper.Extension.TypeMapper.Initialize(typeof(Keede.Ecsoft.Model.GoodsOrderInfo).Assembly);

            //初始化AOP
            ConfigManager.Init();
            //全局异常记录
            TaskScheduler.UnobservedTaskException += (sender, exceptionArgs) =>
            {
                Exception ex = exceptionArgs.Exception.InnerException ?? exceptionArgs.Exception;
                if (ex.InnerException != null)
                {
                    ex = ex.InnerException;
                }
                LogAggregateException(ex, sender);
                exceptionArgs.SetObserved();
            };

            //记录添加出库任务器
            AddTask(TaskKind.AddSellOut, AddStorageTaskManager.AddSellOutTask, 60);

            //往来帐生成任务
            AddTask(TaskKind.BuildReckoning, ReckoningTaskManager.AddTask, 60);

            //完成订单第二步骤任务
            AddTask(TaskKind.CompleteOrderWithSecond, CompleteOrderTask.Core.CompleteSecondTask.RunWaitConsignmentOrderTask, 60);

            //自动报备(采购)
            AddTask(TaskKind.AutoPurchasing, AutoPurchasing.Core.RunAutoPurchasingTask.RunAutoPurchasing, 60);

            //进货申报
            AddTask(TaskKind.AutoStockDeclare, AutoStockDeclare.Core.StockDeclareTask.RunStockDeclare, 60);

            //商品结算价、库存及供应商销售额存档
            AddTask(TaskKind.GoodsStockRecordAndSales, GoodsStockRecordTask.Core.GoodsStockRecordTaskManager.RunGoodsStockRecordTask, 60 * ConfigManager.ExcuteMinutes());

            //每月商品毛利数据存档
            AddTask(TaskKind.GoodsGrossProfit, GoodsStockRecordTask.Core.GoodsGrossProfitManager.RunGoodsGrossProfitTask, 1800);

            //每月公司毛利数据存档
            AddTask(TaskKind.CompanyGrossProfit, GoodsStockRecordTask.Core.CompanyGrossProfitManager.RunCompanyGrossProfitTask, 1800);

            //供应商资质检索
            AddTask(TaskKind.QualificationManager, GoodsStockRecordTask.Core.QualificationTaskManager.RunQualificationTask, 43200);

            //销量异步任务
            AddTask(TaskKind.GoodsDaySalesStatisticsAsynTask, GoodsDaySalesStatisticsAsynTaskManager.RecordGoodsDaySalesStatistics, 60);

            //销售公司每天凌晨生成采购单及入库单任务(来自B2C的订单)
            SaleFilialeGenerateStockInAndPurchaseFormTaskConfig.Init();
            AddTask(TaskKind.GenerateSaleFilialeStockInAndPurchaseFormTask, GenerateSaleFilialeStockInAndPurchaseFormTask.Generate, 3600);

            //销售订单关联的即时结算价
            GenerateSaleOrderGoodsSettlementTaskConfig.Init();
            AddTask(TaskKind.GenerateSaleOrderGoodsSettlement, GenerateSaleOrderGoodsSettlementTask.Generate, 3600);

            //商品即时结算价按月归档
            ArchiveLastMonthGoodsSettlementTaskConfig.Init();
            AddTask(TaskKind.ArchiveLastMonthGoodsSettlement, ArchiveLastMonthGoodsSettlementTask.Generate, 3600);
        }
Esempio n. 13
0
 public static void Init()
 {
     //读取读取待添加出入库的条数
     ConfigInfo.NeedAddStorageReadQuantity =
         ConfManager.GetAppsetting("NeedAddStorageReadQuantity").ToInt();
 }
Esempio n. 14
0
 public static int ExcuteMinutes()
 {
     return(ConfManager.GetAppsetting("Minutes").ToInt());
 }
Esempio n. 15
0
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        static void Main()
        {
            ConfManager.Init();

            //设置推送数据的连接字符串名称
            Instance.Init.SetDataBaseConnectionString("System.Data.SqlClient", ConfManager.GetAppsetting("db_ERP_WriteConnection"));

            // ERP 读写分离配置
            var readConnectionsOfErp = new List <string>();

            readConnectionsOfErp.Add(ConfManager.GetAppsetting("db_ERP_ReadConnections_1"));
            readConnectionsOfErp.Add(ConfManager.GetAppsetting("db_ERP_ReadConnections_2"));
            readConnectionsOfErp.Add(ConfManager.GetAppsetting("db_ERP_ReadConnections_3"));
            var writeConnectionOfErp = ConfManager.GetAppsetting("db_ERP_WriteConnection");

            Keede.DAL.RWSplitting.ConnectionContainer.AddDbConnections(GlobalConfig.ERP_DB_NAME, writeConnectionOfErp, readConnectionsOfErp.Where(m => !string.IsNullOrEmpty(m)).ToArray(), Keede.DAL.RWSplitting.EnumStrategyType.Loop);


            // ERP 备份库读写分离配置
            var readConnectionsOfErpHistory = new List <string>();

            readConnectionsOfErpHistory.Add(ConfManager.GetAppsetting("db_ERP_HISTORY_ReadConnections_1"));
            readConnectionsOfErpHistory.Add(ConfManager.GetAppsetting("db_ERP_HISTORY_ReadConnections_2"));
            readConnectionsOfErpHistory.Add(ConfManager.GetAppsetting("db_ERP_HISTORY_ReadConnections_3"));
            var writeConnectionOfErpHistory = ConfManager.GetAppsetting("db_ERP_HISTORY_WriteConnection");
            int maxYear = DateTime.Now.Year + 2;// 历史备份库年份,假定2年以后才会重启Web(事实可能吗?所以完全够了)

            for (var i = 2007; i <= maxYear; i++)
            {
                var readConnectionStringList = new List <string>();
                for (var j = 0; j < readConnectionsOfErpHistory.Count; j++)
                {
                    var readConnectionString = readConnectionsOfErpHistory[j];
                    if (string.IsNullOrEmpty(readConnectionString))
                    {
                        continue;
                    }

                    var connectionlist = readConnectionString.Split(';').ToList();
                    var oldReadDbName  = connectionlist.FirstOrDefault(c => c.IndexOf("database=", StringComparison.CurrentCultureIgnoreCase) > -1);
                    var newReadDbName  = oldReadDbName + i;
                    readConnectionString = readConnectionString.Replace(oldReadDbName, newReadDbName);
                    readConnectionStringList.Add(readConnectionString);
                }

                var writeConnectionString = writeConnectionOfErpHistory;
                var oldWriteDbName        = writeConnectionString.Split(';').ToList().FirstOrDefault(c => c.IndexOf("database=", StringComparison.CurrentCultureIgnoreCase) > -1);
                var newWriteDbName        = oldWriteDbName + i;
                writeConnectionString = writeConnectionString.Replace(oldWriteDbName, newWriteDbName);
                Keede.DAL.RWSplitting.ConnectionContainer.AddDbConnections(GlobalConfig.ERP_HISTORY_DB_NAME + i, writeConnectionString, readConnectionStringList.Where(m => !string.IsNullOrEmpty(m)).ToArray(), Keede.DAL.RWSplitting.EnumStrategyType.Loop);
            }

            // ERP Report 读写分离配置
            var readConnectionsOfErpReport = new List <string>();

            readConnectionsOfErpReport.Add(ConfManager.GetAppsetting("db_ERP_REPORT_ReadConnections_1"));
            readConnectionsOfErpReport.Add(ConfManager.GetAppsetting("db_ERP_REPORT_ReadConnections_2"));
            readConnectionsOfErpReport.Add(ConfManager.GetAppsetting("db_ERP_REPORT_ReadConnections_3"));
            var writeConnectionOfErpReport = ConfManager.GetAppsetting("db_ERP_REPORT_WriteConnection");

            Keede.DAL.RWSplitting.ConnectionContainer.AddDbConnections(GlobalConfig.ERP_REPORT_DB_NAME, writeConnectionOfErpReport, readConnectionsOfErpReport.Where(m => !string.IsNullOrEmpty(m)).ToArray(), Keede.DAL.RWSplitting.EnumStrategyType.Loop);

            Dapper.Extension.TypeMapper.Initialize(typeof(Keede.Ecsoft.Model.GoodsOrderInfo).Assembly);

#if DEBUG
            ServiceHost sh = new ServiceHost(typeof(Implement.Service));
            sh.Open();
            ServiceHost hostForTest = new ServiceHost(typeof(Implement.TestForJMeter));
            hostForTest.Open();
            var form = new Form();
            form.Text = "ERP服务";
            Application.Run(form);
#else
            var _servicesToRun = new ServiceBase[] { new Service() };
            ServiceBase.Run(_servicesToRun);
#endif
        }
Esempio n. 16
0
        protected void Application_Start(object sender, EventArgs e)
        {
            ConfManager.Init();

            //设置推送数据的连接字符串名称
            Instance.Init.SetDataBaseConnectionString("System.Data.SqlClient", ConfManager.GetAppsetting("db_ERP_WriteConnection"));

            //设置操作日志的异步本地数据库连接
            OperationLog.Core.Init.InitSyncConnectionString(ConfManager.GetAppsetting("db_ERP_WriteConnection"));

            // ERP 读写分离配置
            var readConnectionsOfErp = new List <string>();

            readConnectionsOfErp.Add(ConfManager.GetAppsetting("db_ERP_ReadConnections_1"));
            readConnectionsOfErp.Add(ConfManager.GetAppsetting("db_ERP_ReadConnections_2"));
            readConnectionsOfErp.Add(ConfManager.GetAppsetting("db_ERP_ReadConnections_3"));
            var writeConnectionOfErp = ConfManager.GetAppsetting("db_ERP_WriteConnection");

            Keede.DAL.RWSplitting.ConnectionContainer.AddDbConnections(GlobalConfig.ERP_DB_NAME, writeConnectionOfErp, readConnectionsOfErp.Where(m => !string.IsNullOrEmpty(m)).ToArray(), Keede.DAL.RWSplitting.EnumStrategyType.Loop);

            // ERP 备份库读写分离配置
            var readConnectionsOfErpHistory = new List <string>();

            readConnectionsOfErpHistory.Add(ConfManager.GetAppsetting("db_ERP_HISTORY_ReadConnections_1"));
            readConnectionsOfErpHistory.Add(ConfManager.GetAppsetting("db_ERP_HISTORY_ReadConnections_2"));
            readConnectionsOfErpHistory.Add(ConfManager.GetAppsetting("db_ERP_HISTORY_ReadConnections_3"));
            var writeConnectionOfErpHistory = ConfManager.GetAppsetting("db_ERP_HISTORY_WriteConnection");
            int maxYear = DateTime.Now.Year + 2;// 历史备份库年份,假定2年以后才会重启Web(事实可能吗?所以完全够了)

            for (var i = 2007; i <= maxYear; i++)
            {
                var readConnectionStringList = new List <string>();
                for (var j = 0; j < readConnectionsOfErpHistory.Count; j++)
                {
                    var readConnectionString = readConnectionsOfErpHistory[j];
                    if (string.IsNullOrEmpty(readConnectionString))
                    {
                        continue;
                    }

                    var connectionlist = readConnectionString.Split(';').ToList();
                    var oldReadDbName  = connectionlist.FirstOrDefault(c => c.IndexOf("database=", StringComparison.CurrentCultureIgnoreCase) > -1);
                    var newReadDbName  = oldReadDbName + i;
                    readConnectionString = readConnectionString.Replace(oldReadDbName, newReadDbName);
                    readConnectionStringList.Add(readConnectionString);
                }

                var writeConnectionString = writeConnectionOfErpHistory;
                var oldWriteDbName        = writeConnectionString.Split(';').ToList().FirstOrDefault(c => c.IndexOf("database=", StringComparison.CurrentCultureIgnoreCase) > -1);
                var newWriteDbName        = oldWriteDbName + i;
                writeConnectionString = writeConnectionString.Replace(oldWriteDbName, newWriteDbName);
                Keede.DAL.RWSplitting.ConnectionContainer.AddDbConnections(GlobalConfig.ERP_HISTORY_DB_NAME + i, writeConnectionString, readConnectionStringList.Where(m => !string.IsNullOrEmpty(m)).ToArray(), Keede.DAL.RWSplitting.EnumStrategyType.Loop);
            }

            // ERP Report 读写分离配置
            var readConnectionsOfErpReport = new List <string>();

            readConnectionsOfErpReport.Add(ConfManager.GetAppsetting("db_ERP_REPORT_ReadConnections_1"));
            readConnectionsOfErpReport.Add(ConfManager.GetAppsetting("db_ERP_REPORT_ReadConnections_2"));
            readConnectionsOfErpReport.Add(ConfManager.GetAppsetting("db_ERP_REPORT_ReadConnections_3"));
            var writeConnectionOfErpReport = ConfManager.GetAppsetting("db_ERP_REPORT_WriteConnection");

            Keede.DAL.RWSplitting.ConnectionContainer.AddDbConnections(GlobalConfig.ERP_REPORT_DB_NAME, writeConnectionOfErpReport, readConnectionsOfErpReport.Where(m => !string.IsNullOrEmpty(m)).ToArray(), Keede.DAL.RWSplitting.EnumStrategyType.Loop);

            Dapper.Extension.TypeMapper.Initialize(typeof(Keede.Ecsoft.Model.GoodsOrderInfo).Assembly);

            SAL.LogCenter.LogService.LogInfo("网站启动", "应用程序异常信息", null);
        }
Esempio n. 17
0
 static Service()
 {
     //设置推送数据的连接字符串名称
     PUSH.Core.Instance.Init.SetDataBaseConnectionString("System.Data.SqlClient", ConfManager.GetAppsetting("db_ERP_WriteConnection"));
 }