Esempio n. 1
0
        /// <summary>
        /// 初始化基本变量
        /// </summary>
        /// <returns></returns>
        static bool Init()
        {
            var serverUser = GeneralProcess.GetUserByLoginName(AppConfig.ServerAccount);

            if (serverUser == null)
            {
                Log("通信管理员账号信息错误,请检查配置!");
                return(false);
            }

            ProcessInvoke.SetupGlobalRepositoryContext(serverUser, serverUser.Domain);

            using (var context = new RepositoryDbContext())
            {
                foreach (var data in AppConfig.CommandDatas)
                {
                    ProduceDatas.Add(context.Set <CommandData>().First(obj => obj.DataName == data));
                }

                foreach (var data in AppConfig.RunningTimeDatas)
                {
                    RunningTimeDatas.Add(context.Set <CommandData>().First(obj => obj.DataName == data));
                }

                _hotelGuids = context.Set <HotelRestaurant>().ToList();
            }

            _produceEndDayHour = DateTime.Now.AddHours(-1).GetCurrentHour();
            _produceEndDay     = DateTime.Now.AddDays(-1).GetToday();

            Log($"【{DateTime.Now:yyyy-MM-dd HH:mm:ss}】系统初始化完成。");
            return(true);
        }
Esempio n. 2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
            Current.DispatcherUnhandledException       += AppUnhandleExceptionHandler;

            //DbRepository.ConnectionName = "Lampblack_Platform";

            var serverUser = GeneralProcess.GetUserByLoginName(AppConfig.ServerAccount);

            if (serverUser == null)
            {
                MessageBox.Show("通信管理员账号信息错误,请检查配置!");
                return;
            }

            ProcessInvoke.SetupGlobalRepositoryContext(serverUser, serverUser.Domain);

            ActiveClientManager.Init(AppConfig.DeviceConnectionChevkInterval, AppConfig.DeviceDisconnectInterval);

            base.OnStartup(e);
        }