Exemplo n.º 1
0
        private bool bClearRegisterRoute = false; //是否已经清除,已清除,则禁止重启定时器,否则继续

        void Application_Start(object sender, EventArgs e)
        {
            RegisterRoutes();
            IBatisNetManager.Init();//数据初始化

            GlobalManager.Init(GlobalManager.SmartLife_CertManage_ManageServices);
            GlobalManager.ReadParams();
            //GlobalManager.ReadRegInfo();//读取注册信息
            Assembly     assem             = Assembly.GetExecutingAssembly();
            StreamReader srForErrorMessage = new StreamReader(assem.GetManifestResourceStream("SmartLife.CertManage.ManageServices.ErrorCode.txt"));

            string[] lines = srForErrorMessage.ReadToEnd().Split('\n');
            srForErrorMessage.Close();
            foreach (var line in lines)
            {
                if (line.Trim() != "")
                {
                    var keyValues = line.Split("=".ToCharArray());
                    if (!GlobalManager.errorCodeMessages.ContainsKey(keyValues[0]))
                    {
                        GlobalManager.errorCodeMessages.Add(keyValues[0], keyValues[1].Replace("\r", ""));
                    }
                }
            }

            //初始化引用访问性
            GlobalManager.ApplicationAccessible.AddRange(BuilderFactory.DefaultBulder().List <ApplicationAccessibility>(new ApplicationAccessibility {
                InterfaceApplicationId = GlobalManager.SmartLife_CertManage_ManageServices
            }).Select(item => item.AccessApplicationId).ToList());
            GlobalManager.DeployNodes.AddRange(BuilderFactory.DefaultBulder().List <DeployNode>(new DeployNode {
                ApplicationIdTo = GlobalManager.SmartLife_CertManage_ManageServices
            }));
            CacheManager.Init();
            GlobalManager.CurrentIPCC_CallCenterId = BuilderFactory.DefaultBulder().List <SmartLife.Share.Models.Oca.CallCenter>().First().StationId;

            //注册数据连接
            var itemsOfProvider = BuilderFactory.DefaultBulder().List <DictionaryItem>(new DictionaryItem {
                DictionaryId = "00015"
            });
            IList <DatabaseConnect> databaseConnects = BuilderFactory.DefaultBulder().List <DatabaseConnect>();
            IList <dynamic>         connects         = databaseConnects.Select(item => {
                dynamic connect               = new ExpandoObject();
                connect.ConnectId             = item.ConnectId;
                connect.Provider              = itemsOfProvider.Single(it => it.ItemId == item.Provider).ItemName;
                connect.ServerName            = e0571.web.core.Service.ServiceManager.Instance.CryptoService.StringCrypto.Decrypt(item.ServerName);
                connect.UserCode              = e0571.web.core.Service.ServiceManager.Instance.CryptoService.StringCrypto.Decrypt(item.UserCode);
                connect.UserPassword          = e0571.web.core.Service.ServiceManager.Instance.CryptoService.StringCrypto.Decrypt(item.UserPassword);
                connect.DatabaseName          = e0571.web.core.Service.ServiceManager.Instance.CryptoService.StringCrypto.Decrypt(item.DatabaseName);
                connect.IbatisConfigFileRefer = item.IbatisConfigFileRefer;
                connect.IbatisConfigFileValue = e0571.web.core.Service.ServiceManager.Instance.CryptoService.StringCrypto.Decrypt(item.IbatisConfigFileValue);
                return(connect);
            }).ToList();

            IBatisNetManager.RegisterIBATIS(connects);

            //GlobalManager.Activiate();

            //定时清除路由
            ClearRegisterRoutes();
        }
Exemplo n.º 2
0
        void Application_Start(object sender, EventArgs e)
        {
            StreamReader srForSettings = new StreamReader(HttpContext.Current.Server.MapPath("~/bin/Settings.txt"));

            string[] lines0 = srForSettings.ReadToEnd().Split('\n');
            srForSettings.Close();
            foreach (var line in lines0)
            {
                if (line.Trim() != "")
                {
                    var keyValues = line.Split("=".ToCharArray());
                    if (!GlobalManager.settingsForPhysicalDeploy.ContainsKey(keyValues[0]))
                    {
                        GlobalManager.settingsForPhysicalDeploy.Add(keyValues[0], keyValues[1].Replace("\r", ""));
                    }
                }
            }

            RegisterRoutes();
            IBatisNetManager.Init();//数据初始化

            oldConnectString = IBatisNet.DataAccess.DaoManager.GetInstance().LocalDataSource.ConnectionString;
            GlobalManager.Init(GlobalManager.SmartLife_Auth_CertServices);

            Assembly     assem             = Assembly.GetExecutingAssembly();
            StreamReader srForErrorMessage = new StreamReader(assem.GetManifestResourceStream("SmartLife.Auth.CertServices.ErrorCode.txt"));

            string[] lines = srForErrorMessage.ReadToEnd().Split('\n');
            srForErrorMessage.Close();
            foreach (var line in lines)
            {
                if (line.Trim() != "")
                {
                    var keyValues = line.Split("=".ToCharArray());
                    if (!GlobalManager.errorCodeMessages.ContainsKey(keyValues[0]))
                    {
                        GlobalManager.errorCodeMessages.Add(keyValues[0], keyValues[1].Replace("\r", ""));
                    }
                }
            }

            redirects.AddRange(BuilderFactory.DefaultBulder().List <Redirect>());

            GlobalManager.DeployNodes.AddRange(BuilderFactory.DefaultBulder().List <DeployNode>());
            CacheManager.Init();

            //注册数据连接
            var itemsOfProvider = BuilderFactory.DefaultBulder().List <DictionaryItem>(new DictionaryItem {
                DictionaryId = "00015"
            });
            IList <DatabaseConnect> databaseConnects = BuilderFactory.DefaultBulder().List <DatabaseConnect>();
            IList <dynamic>         connects         = databaseConnects.Select(item =>
            {
                dynamic connect               = new ExpandoObject();
                connect.ConnectId             = item.ConnectId;
                connect.Provider              = itemsOfProvider.Single(it => it.ItemId == item.Provider).ItemName;
                connect.ServerName            = e0571.web.core.Service.ServiceManager.Instance.CryptoService.StringCrypto.Decrypt(item.ServerName);
                connect.UserCode              = e0571.web.core.Service.ServiceManager.Instance.CryptoService.StringCrypto.Decrypt(item.UserCode);
                connect.UserPassword          = e0571.web.core.Service.ServiceManager.Instance.CryptoService.StringCrypto.Decrypt(item.UserPassword);
                connect.DatabaseName          = e0571.web.core.Service.ServiceManager.Instance.CryptoService.StringCrypto.Decrypt(item.DatabaseName);
                connect.IbatisConfigFileRefer = item.IbatisConfigFileRefer;
                connect.IbatisConfigFileValue = e0571.web.core.Service.ServiceManager.Instance.CryptoService.StringCrypto.Decrypt(item.IbatisConfigFileValue);
                return(connect);
            }).ToList();

            IBatisNetManager.RegisterIBATIS(connects);
        }
Exemplo n.º 3
0
 public static void RegisterDatabaseConnection(IList <dynamic> connections)
 {
     IBatisNetManager.RegisterIBATIS(connections);
 }