예제 #1
0
        private static bool InitializeCompanyManager()
        {
            MySqlDataReader companyReader = MySqlHelper.ExecuteReader(Conn, CommandType.Text, "select * from companyinfo", null);

            while (companyReader.Read())
            {
                CompanyInfoEx companyItem = new CompanyInfoEx();
                companyItem.Redis = new RedisInfo();

                companyItem.CompanyCode = (string)companyReader["CompanyCode"];
                companyItem.CompanyName = (string)companyReader["CompanyName"];
                companyItem.DeviceCount = (int)companyReader["DeviceCount"];

                companyItem.Redis.Host     = (string)companyReader["Redis_IP"];
                companyItem.Redis.Port     = (int)companyReader["Redis_Port"];
                companyItem.Redis.Passowrd = (string)companyReader["Redis_Password"];
                companyItem.Redis.DB       = (int)companyReader["Redis_DB"];

                companyItem.Database      = new DBInfo();
                companyItem.Database.host = (string)companyReader["DB_IP"];


                companyItem.Database.port     = (int)companyReader["DB_Port"];
                companyItem.Database.userName = (string)companyReader["DB_UserName"];
                companyItem.Database.password = (string)companyReader["DB_UserPassword"];
                CompanyHelper tempCompanyItem = new CompanyHelper(companyItem);



                _companyMap.Add(companyItem.CompanyCode, tempCompanyItem);
            }


            return(true);
        }
예제 #2
0
        private static CompanyHelper GetCompanyByCode(string CompanyCode)
        {
            CompanyHelper companyObject = null;

            if (_companyMap.ContainsKey(CompanyCode)) // True
            {
                companyObject = _companyMap[CompanyCode];
            }

            return(companyObject);
        }
예제 #3
0
        public static DataStoreTableInfo GetDeviceDataStoreConfigItem(string companyCode, string deviceCode, string tableName)
        {
            CompanyHelper tempCompany = GetCompanyByCode(companyCode);

            if (tempCompany == null)
            {
                return(null);
            }

            return(tempCompany.GetDeviceDataStoreConfigItem(deviceCode, tableName));
        }
예제 #4
0
        public static List <DataStoreTableInfo> GetDeviceDataStoreConfig(string companyCode, string deviceCode)
        {
            CompanyHelper tempCompany = GetCompanyByCode(companyCode);

            if (tempCompany == null)
            {
                return(null);
            }

            return(tempCompany.GetDeviceDataStoreConfig(deviceCode));
        }
예제 #5
0
        public static List <AlarmInfoEx> QueryRealtimeAlarmEx(RealtimeAlarmQueryParam QueryParams)
        {
            CompanyHelper companyObject = GetCompanyByCode(QueryParams.companyCode);

            if (companyObject == null)
            {
                LoggerManager.Log.Error($"没有需要查询实时故障的公司[{QueryParams.companyCode}]");
                return(null);
            }

            return(companyObject.QueryRealtimeAlarmEx(QueryParams));
        }
예제 #6
0
        public static List <AlarmInfo> QueryHistoryAlarm(AlarmQueryParam QueryParams)
        {
            CompanyHelper companyObject = GetCompanyByCode(QueryParams.CompanyCode);

            if (companyObject == null)
            {
                LoggerManager.Log.Error($"没有需要查询历史故障的公司[{QueryParams.CompanyCode}]");
                return(null);
            }

            return(companyObject.QueryHistoryAlarm(QueryParams));
        }
예제 #7
0
        public static DeviceStatusBase[] GetDeviceStatusList(string companyCode, string userPhone)
        {
            CompanyHelper tempCompany = GetCompanyByCode(companyCode);

            if (tempCompany == null)
            {
                return(null);
            }



            string[] tempDeviceNames = UserManagerHelper.GetDeviceList(userPhone);



            return(tempCompany.GetDeviceStat(tempDeviceNames));
        }
예제 #8
0
        public static bool CheckDeviceCode(DeviceBase deviceCheck)
        {
            CompanyHelper tempCompany = GetCompanyByCode(deviceCheck.CompanyCode);

            if (tempCompany == null)
            {
                LoggerManager.Log.Info($"系统中不存在[{deviceCheck.CompanyCode}]的公司代码!\n");
                return(false);
            }

            if (tempCompany.CheckDeviceCode(deviceCheck) == false)
            {
                LoggerManager.Log.Info($"系统中不存在[{deviceCheck.DeviceCode}]的设备代码!\n");
                return(false);
            }



            return(true);
        }