public string RefreshCache(string loginIdentifer, string CacheName)
        {
            JavaScriptObject obj2 = new JavaScriptObject();

            obj2["Result"]  = false;
            obj2["Message"] = "";
            LoginUser loginUser = GlobalAppModule.GetLoginUser(loginIdentifer);

            if (loginUser == null)
            {
                obj2["Message"] = "未登录";
                return(JavaScriptConvert.SerializeObject(obj2));
            }
            if (loginUser.LoginTimeout)
            {
                obj2["Message"] = "登录超时";
                return(JavaScriptConvert.SerializeObject(obj2));
            }
            loginUser.LastOperateTime = DateTime.Now;
            CommonUtil.WaitMainLibInit();

            GlobalAppModule.IsInitMainLib = true;
            try
            {
                if (CacheName == "基础信息")
                {
                    BaseModule.LoadBaseInfo();
                    MenuModule.MenuInit();
                    RoleModule.UpdateRoleInfo();
                    SysUserModule.UpdateUserInfo();
                    DeviceTypeCodeModule.LoadDeviceTypeCodeInfos();
                    PriceModule.LoadPriceTypes();
                    PriceModule.LoadPriceInfos();
                    CropModule.LoadUnitQuotaInfos();
                    obj2["Result"] = true;
                }
                else if (CacheName == "用水户")
                {
                    WaterUserModule.LoadWaterUsers();
                    obj2["Result"] = true;
                }
                else if (CacheName == "用户卡")
                {
                    CardUserModule.LoadCardUsers();
                    obj2["Result"] = true;
                }
                else if (CacheName == "设备")
                {
                    DeviceModule.LoadDevices();
                    obj2["Result"] = true;
                }
                else if (CacheName == "区域")
                {
                    DistrictModule.UpdateLevelInfo();
                    DistrictModule.UpdateDistrictInfo();
                    obj2["Result"] = true;
                }
                else
                {
                    obj2["Message"] = "参数错误!【" + CacheName + "】";
                }
            }
            catch (Exception ex)
            {
                obj2["Message"] = "刷新缓存【" + CacheName + "】出错!" + ex.Message;
            }

            GlobalAppModule.IsInitMainLib = false;
            return(JavaScriptConvert.SerializeObject(obj2));
        }
Beispiel #2
0
        protected void Application_Start(object sender, EventArgs e)
        {
            string path = Server.MapPath("~/");

            SysInfo.IsReg   = false;
            SysInfo.DRegStr = "jssl160721";
            SysInfo.RegStr  = SysInfo.DRegStr;

            if (SysInfo.IsReg)
            {
                myLogger.Info("判断注册!");

                SysInfo.SetFilePath(path);

                SysInfo.IsRegSuccess = false;
                string regStr = "";
                if (FileHelper.IsExists(SysInfo.fileName))
                {
                    regStr = FileHelper.ReadFile(SysInfo.fileName);
                }
                else
                {
                    regStr = "00000000000000000000000000000000";
                    FileHelper.writeFile(SysInfo.fileName, regStr);
                }

                if (regStr != SysInfo.GetRegStr2())
                {
                    myLogger.Info("注册码不对!序列号为:" + SysInfo.GetRegStr1());
                }
                else
                {
                    myLogger.Info("注册码正确");
                    SysInfo.IsRegSuccess = true;
                }
            }

            isClose = false;
            myLogger.Info("网站启动");

            DbHelperSQL.SetConnectionString(ConfigurationManager.AppSettings["ConnectionString"]);

            GlobalAppModule.IsInitMainLib = true;
            BaseModule.LoadBaseInfo();
            MenuModule.MenuInit();
            RoleModule.UpdateRoleInfo();
            SysUserModule.UpdateUserInfo();
            //SysUserConfigModule.LoadSysUserConfig();
            DeviceTypeCodeModule.LoadDeviceTypeCodeInfos();
            PriceModule.LoadPriceTypes();
            PriceModule.LoadPriceInfos();
            CropModule.LoadUnitQuotaInfos();
            DistrictModule.UpdateLevelInfo();
            DistrictModule.UpdateDistrictInfo();
            WaterUserModule.LoadWaterUsers();
            DeviceModule.LoadDevices();
            //Device_GroundWaterModule.LoadDevices();
            CardUserModule.LoadCardUsers();

            GlobalAppModule.IsInitMainLib = false;

            Thread thread = new Thread(new ThreadStart(testConnect));

            thread.Start();

            Thread threadDeleteXLS = new Thread(new ThreadStart(DeleteXLS));

            threadDeleteXLS.Start();

            Thread threadRefresh = new Thread(new ThreadStart(Refresh));

            threadRefresh.Start();

            myLogger.Info("网站启动完成!");
        }