示例#1
0
        private CarBeBackTimeInfo getCarBeBackInfo(DataRow dr)
        {
            CarBeBackTimeInfo carBeBackTimeInfo;

            try
            {
                CarBeBackTimeInfo str = new CarBeBackTimeInfo()
                {
                    ID     = Convert.ToInt32(dr["ID"]),
                    SimNum = dr["SimNum"].ToString()
                };
                DateTime dateTime = Convert.ToDateTime(dr["beginTime"]);
                str.BeginTime = dateTime.ToString("HH:mm:ss");
                DateTime dateTime1 = Convert.ToDateTime(dr["endTime"]);
                str.EndTime       = dateTime1.ToString("HH:mm:ss");
                str.RegionID      = Convert.ToInt32(dr["regionID"]);
                str.RegionDot     = dr["regionDot"].ToString();
                str.RegionName    = dr["regionName"].ToString();
                carBeBackTimeInfo = str;
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                ErrorMsg  errorMsg  = new ErrorMsg()
                {
                    ClassName    = "CarBeBackOnTime",
                    FunctionName = "getCarBeBackInfo",
                    ErrorText    = string.Concat("将DataRow信息转换成CarBeBackTimeInfo错误,", exception.Message)
                };
                this.logHelper.WriteError(errorMsg);
                carBeBackTimeInfo = null;
            }
            return(carBeBackTimeInfo);
        }
示例#2
0
 private CarBeBackTimeInfo getCarBeBackInfo(DataRow dr)
 {
     CarBeBackTimeInfo carBeBackTimeInfo;
     try
     {
         CarBeBackTimeInfo str = new CarBeBackTimeInfo()
         {
             ID = Convert.ToInt32(dr["ID"]),
             SimNum = dr["SimNum"].ToString()
         };
         DateTime dateTime = Convert.ToDateTime(dr["beginTime"]);
         str.BeginTime = dateTime.ToString("HH:mm:ss");
         DateTime dateTime1 = Convert.ToDateTime(dr["endTime"]);
         str.EndTime = dateTime1.ToString("HH:mm:ss");
         str.RegionID = Convert.ToInt32(dr["regionID"]);
         str.RegionDot = dr["regionDot"].ToString();
         str.RegionName = dr["regionName"].ToString();
         carBeBackTimeInfo = str;
     }
     catch (Exception exception1)
     {
         Exception exception = exception1;
         ErrorMsg errorMsg = new ErrorMsg()
         {
             ClassName = "CarBeBackOnTime",
             FunctionName = "getCarBeBackInfo",
             ErrorText = string.Concat("将DataRow信息转换成CarBeBackTimeInfo错误,", exception.Message)
         };
         this.logHelper.WriteError(errorMsg);
         carBeBackTimeInfo = null;
     }
     return carBeBackTimeInfo;
 }
示例#3
0
 private void tGetConfigInfo_Elapsed(object sender, ElapsedEventArgs e)
 {
     this.tGetConfigInfo.Enabled  = false;
     this.tGetConfigInfo.Interval = (double)this.iGetConfigInfo;
     try
     {
         try
         {
             string str = ReadDataFromDB.GetSvrTime().ToString("HH:mm:ss");
             lock (this.infoList)
             {
                 List <int> nums = new List <int>();
                 foreach (KeyValuePair <int, CarBeBackTimeInfo> keyValuePair in this.infoList)
                 {
                     if (this.IsInConfigTime(keyValuePair.Value.BeginTime, keyValuePair.Value.EndTime, str))
                     {
                         continue;
                     }
                     nums.Add(keyValuePair.Key);
                     LogMsg   logMsg = new LogMsg("CarBeBackOnTime", "tGetConfigInfo_Elapsed", "");
                     object[] d      = new object[] { "删除设置时间段外的配置信息ID:", keyValuePair.Value.ID, ",simnum:", keyValuePair.Value.SimNum, ",起始时间:", keyValuePair.Value.BeginTime, ",终止时间: ", keyValuePair.Value.EndTime, ",区域ID:", keyValuePair.Value.RegionID };
                     logMsg.Msg = string.Concat(d);
                     this.logHelper.WriteLog(logMsg);
                 }
                 foreach (int num in nums)
                 {
                     this.infoList.Remove(num);
                 }
                 DataTable configInfo = this.getConfigInfo(str);
                 if (configInfo != null && configInfo.Rows.Count > 0)
                 {
                     foreach (DataRow row in configInfo.Rows)
                     {
                         int num1 = Convert.ToInt32(row["ID"]);
                         if (this.infoList.Keys.Contains <int>(num1))
                         {
                             continue;
                         }
                         CarBeBackTimeInfo carBeBackInfo = this.getCarBeBackInfo(row);
                         if (carBeBackInfo == null)
                         {
                             continue;
                         }
                         this.infoList.Add(num1, carBeBackInfo);
                         LogMsg   logMsg1 = new LogMsg("CarBeBackOnTime", "tGetConfigInfo_Elapsed", "");
                         object[] simNum  = new object[] { "增加配置信息ID:", num1, ",simnum:", carBeBackInfo.SimNum, ",起始时间:", carBeBackInfo.BeginTime, ",终止时间: ", carBeBackInfo.EndTime, ",区域ID:", carBeBackInfo.RegionID };
                         logMsg1.Msg = string.Concat(simNum);
                         this.logHelper.WriteLog(logMsg1);
                     }
                 }
             }
         }
         catch (Exception exception1)
         {
             Exception exception = exception1;
             ErrorMsg  errorMsg  = new ErrorMsg()
             {
                 ClassName    = "CarBeBackOnTime",
                 FunctionName = "tGetConfigInfo_Elapsed",
                 ErrorText    = string.Concat("获取配置信息错误,", exception.Message)
             };
             this.logHelper.WriteError(errorMsg);
         }
     }
     finally
     {
         this.tGetConfigInfo.Enabled = true;
     }
 }