예제 #1
0
 public CNetProxy(CSystemLog systemLog, CSystemConfig systemConfig)
 {
     _SystemLog    = systemLog;
     _SystemConfig = systemConfig;
     _DbConnection = new CDbConnection(_SystemConfig.getConfigItem("DB_MYSQL_CONNECT_STR").ToString(), _SystemLog);
     Id            = Guid.NewGuid().ToString().ToUpper();
 }
예제 #2
0
        public void printSystemConfig(CSystemLog systemLog)
        {
            string message = string.Empty;

            foreach (KeyValuePair <string, object> kvp in _ConfigItemTable)
            {
                message = string.Format("{0}={1}", kvp.Key, kvp.Value.ToString());
                systemLog.writeLog(LOG_LEVEL.NOTICE, message);
            }
        }
예제 #3
0
        public CBeiDevieManager(string queryServiceUrl, CDbConnection dbConnection, CSystemLog systemLog)

        {
            _QueryServiceUrl               = queryServiceUrl;
            _DbConnection                  = dbConnection;
            _SystemLog                     = systemLog;
            _DbBeiDouDeviceTable           = new Dictionary <string, CBeiDouDevice>();
            _RemoteServerBeiDouDeviceTable = new Dictionary <string, CBeiDouDevice>();
            _InsertDeviceArray             = new List <CBeiDouDevice>();
            _DeleteDeviceArray             = new List <CBeiDouDevice>();
            _UpdateDeviceArray             = new List <CBeiDouDevice>();
        }
예제 #4
0
 public CDbConnection(string connectString, CSystemLog systemLog)
 {
     _DbConnectString = connectString;
     _SystemLog       = systemLog;
 }
예제 #5
0
 public CBeiDouDevice(CSystemLog systemLog, CDbConnection dbConnection)
 {
     _SystemLog    = systemLog;
     _DbConnection = dbConnection;
 }
예제 #6
0
        private static E_ERROR_CODE loadConfigData()
        {
            object configItem = null;

            configItem = _SystemConfig.getConfigItem(CONFIG_ITEM_USER_LOG_PATH);
            if (configItem == null)
            {
                Console.Write(string.Format("Not config<{0}>, plase config it.", CONFIG_ITEM_USER_LOG_PATH));
                return(E_ERROR_CODE.ERROR_CONFIG_ITEM_USER_LOG_PATH_NOT_EXIST);
            }

            _LogStorePath = configItem.ToString();

            configItem = _SystemConfig.getConfigItem(CONFIG_ITEM_IS_WRITE_LOG_TO_SCREEN);
            if (configItem == null)
            {
                Console.Write(string.Format("Not config<{0}>, plase config it.", CONFIG_ITEM_IS_WRITE_LOG_TO_SCREEN));
                return(E_ERROR_CODE.CONFIG_ITEM_IS_WRITE_LOG_TO_SCREEN_NOT_EXIST);
            }

            try
            {
                _IsWriteLog2Screen = Boolean.Parse(configItem.ToString());
            }
            catch
            {
                _IsWriteLog2Screen = false;
            }

            configItem = _SystemConfig.getConfigItem(CONFIG_ITEM_WRITR_LOG_LEVEL);
            if (configItem == null)
            {
                Console.Write(string.Format("Not config<{0}>, plase config it.", CONFIG_ITEM_WRITR_LOG_LEVEL));
                return(E_ERROR_CODE.CONFIG_ITEM_WRITR_LOG_LEVEL_NOT_EXIST);
            }

            if (!Enum.TryParse(configItem.ToString(), out _FilterLogLevel))
            {
                _FilterLogLevel = LOG_LEVEL.WARNING;
            }

            _SystemLog = new CSystemLog(_LogStorePath, _FilterLogLevel, _IsWriteLog2Screen);
            configItem = _SystemConfig.getConfigItem(CONFIG_ITEM_DB_MYSQL_CONNECT_STR);
            if (configItem == null)
            {
                Console.Write(string.Format("Not config<{0}>, plase config it.", CONFIG_ITEM_DB_MYSQL_CONNECT_STR));
                return(E_ERROR_CODE.CONFIG_ITEM_DB_MYSQL_CONNECT_STR_NOT_EXIST);
            }

            _DbConnectStr = configItem.ToString();

            configItem = _SystemConfig.getConfigItem(CONFIG_ITEM_UPDATE_BEIDOU_SERVICE_URL);
            if (configItem == null)
            {
                Console.Write(string.Format("Not config<{0}>, plase config it.", CONFIG_ITEM_UPDATE_BEIDOU_SERVICE_URL));
                return(E_ERROR_CODE.CONFIG_ITEM_PINEN_BEIDOU_SERVICE_URL_NOT_EXIST);
            }

            _PinenBeiDouServiceUrl = configItem.ToString();

            configItem = _SystemConfig.getConfigItem(CONFIG_ITEM_REQUEST_CYCLE);
            if (configItem == null)
            {
                Console.Write(string.Format("Not config<{0}>, plase config it.", CONFIG_ITEM_REQUEST_CYCLE));
                return(E_ERROR_CODE.CONFIG_ITEM_REQUEST_CYCLE_NOT_EXIST);
            }

            try
            {
                _RequestCycle = int.Parse(configItem.ToString());
            }
            catch
            {
                _RequestCycle = 30;
            }

            return(E_ERROR_CODE.OK);
        }