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); }
private static CompanyHelper GetCompanyByCode(string CompanyCode) { CompanyHelper companyObject = null; if (_companyMap.ContainsKey(CompanyCode)) // True { companyObject = _companyMap[CompanyCode]; } return(companyObject); }
public static DataStoreTableInfo GetDeviceDataStoreConfigItem(string companyCode, string deviceCode, string tableName) { CompanyHelper tempCompany = GetCompanyByCode(companyCode); if (tempCompany == null) { return(null); } return(tempCompany.GetDeviceDataStoreConfigItem(deviceCode, tableName)); }
public static List <DataStoreTableInfo> GetDeviceDataStoreConfig(string companyCode, string deviceCode) { CompanyHelper tempCompany = GetCompanyByCode(companyCode); if (tempCompany == null) { return(null); } return(tempCompany.GetDeviceDataStoreConfig(deviceCode)); }
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)); }
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)); }
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)); }
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); }