Example #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     this.label7.Text = "";
     try
     {
         CardUserModule.LoadCardUsers();
         this.label4.Text      = CardUserModule.GetAllCardUser(true).Count.ToString();
         this.label7.ForeColor = Color.Green;
         this.label7.Text      = "更新成功";
     }
     catch
     {
         this.label7.ForeColor = Color.Red;
         this.label7.Text      = "更新失败";
     }
 }
Example #2
0
        //启动时,设备全部显示离线
        #region 2015-8-7 每次启动时,将登陆状态置为0
        void installDeviceState()
        {
            try
            {
                BaseModule.LoadBaseInfo();
                CardUserModule.LoadCardUsers();
                DistrictModule.UpdateLevelInfo();
                DistrictModule.UpdateDistrictInfo();

                //将在线状态置为0
                DeviceModule.SetOnline0();

                DeviceModule.LoadDevices();

                /*
                 * IList<Device> deviceList = DeviceModule.GetAllDevice();
                 *
                 * foreach (Device d in deviceList)
                 * {
                 *  if (d.Online == 1)
                 *  {
                 *      d.Online = 0;
                 *      DeviceModule.ModifyDevice(d);
                 *  }
                 * }
                 * */

                AlarmService.Init();
                int alarmCount = AlarmService.GetCount();
                //logHelper.Info("程序启动报警数量为:" + alarmCount);
                ShowLogData.add("程序启动报警数量为:" + alarmCount);
            }
            catch (Exception e)
            {
                if (showErrorLog)
                {
                    string error = string.Format("在将设备登陆状态置为0时,读取数据库时出错,错误信息{0}", e.Message);
                    logHelper.Error(error);
                }
            }
            finally
            {
            }
        }
Example #3
0
        private void Refresh()
        {
            int i = 0;

            while (!isClose)
            {
                i++;
                if (i == 2 * 10)
                {
                    WaterUserModule.LoadWaterUsers();
                    CardUserModule.LoadCardUsers();
                    i = 0;
                }
                DeviceModule.LoadDevices();

                //间隔30秒
                Thread.Sleep(30 * 1000);
            }
        }
        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));
        }
Example #5
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("网站启动完成!");
        }