private string GetLastUpTimeAndId(string _name) { LogContext log = new LogContext(); string logPath = System.IO.Directory.GetCurrentDirectory() + "\\LogContext\\" + _name + ".txt"; string lastUpTime = log.ReadDataLog(logPath).TrimEnd((char[])"\r\n".ToCharArray()); if (lastUpTime.Trim() == "") { lastUpTime = "2013-01-01 08:00:00" + "|" + "0"; } return(lastUpTime); }
/// <summary> /// 获取上次更新时间和id /// </summary> /// <param name="_name"></param> /// <returns></returns> public static string GetLastUpTimeAndId(string _name) { LogContext log = new LogContext(); string logPath = System.IO.Directory.GetCurrentDirectory() + "\\LogContext\\ND.FlightKGService\\" + _name + ".txt"; string lastUpTime = log.ReadDataLog(logPath).TrimEnd((char[])"\r\n".ToCharArray()); if (lastUpTime.Trim() == "") { return("2015-10-10 08:00:00|0"); } else { string lastUpdateTime = lastUpTime.Trim().Split('|')[0]; string lastId = lastUpTime.Trim().Split('|')[1]; return(lastUpdateTime + "|" + lastId); } }
/// <summary> /// 获取上次更新时间和id /// </summary> /// <param name="_name"></param> /// <returns></returns> public static PolicyRecord GetLastUpTimeAndId(string _name) { PolicyRecord rec = new PolicyRecord(); LogContext log = new LogContext(); string logPath = ConfigurationManager.AppSettings["LogRecPath"].ToString() + "\\LogContext\\ND.PolicyUploadService\\" + _name + ".txt"; string lastUpTime = log.ReadDataLog(logPath).TrimEnd((char[])"\r\n".ToCharArray()); if (lastUpTime.Trim() == "") { rec.LastPolicyId = 0; rec.LastUpdateTime = Convert.ToDateTime("2015-10-10 08:00:00"); } else { rec.LastUpdateTime = Convert.ToDateTime(lastUpTime.Trim().Split('|')[0]); rec.LastPolicyId = int.Parse(lastUpTime.Trim().Split('|')[1]); } return(rec); }