/// <summary> /// 根据name获取日期 /// </summary> /// <param name="name"></param> /// <returns></returns> private static string GetByName(string name) { BD_StatusTableInfo statusTable = null; BD_StatusTableDal bd_StatusTableDal = new BD_StatusTableDal(); try { statusTable = bd_StatusTableDal.GetModel(name); } catch (Exception ex) { LogHelper.WriteError(ex.Message, ex); } if (statusTable == null) { return(""); } return(statusTable.value); }
/// <summary> /// 上次程序是否正常退出 /// </summary> private static bool GetNormalExitLastTime() { bool isNormalExit = false; BD_StatusTableDal statusTableDal = new BD_StatusTableDal(); try { var model = statusTableDal.GetModel(ISNORMALEXIT); if (model != null) { isNormalExit = true; } } catch (Exception ex) { LogHelper.WriteError(ex.Message, ex); } return(isNormalExit); }
/// <summary> /// 更新当前日期到数据库状态表中 /// </summary> /// <param name="name"></param> /// <param name="tm"></param> private static void DoUpdate(string name, ReckoningTransaction tm) { BD_StatusTableDal dal = new BD_StatusTableDal(); BD_StatusTableInfo statusTable = dal.GetModel(name); if (statusTable != null) { if (tm == null) { dal.Delete(name); } else { dal.Delete(name, tm); } } statusTable = new BD_StatusTableInfo(); statusTable.name = name; statusTable.value = DateTime.Now.ToString(); if (tm != null) { dal.Add(statusTable, tm.Database, tm.Transaction); } else { dal.Add(statusTable); } string format = "更新系统状态表[Name={0},Date={1}]"; string desc = string.Format(format, name, statusTable.value); LogHelper.WriteInfo(desc); }