Esempio n. 1
0
        /// <summary>
        /// 添加正常退出标志
        /// </summary>
        public static void AddNormalFlag()
        {
            BD_StatusTableDal statusTableDal = new BD_StatusTableDal();

            //if (statusTableDal.Exists(ISNORMALEXITVALUE))
            statusTableDal.Delete(ISNORMALEXITVALUE);

            BD_StatusTableInfo model = new BD_StatusTableInfo();

            model.name  = ISNORMALEXIT;
            model.value = ISNORMALEXITVALUE;

            bool isSuccess = false;

            try
            {
                AddOrUpdate(statusTableDal, model);

                isSuccess = true;
            }
            catch (Exception ex)
            {
                LogHelper.WriteError(ex.Message, ex);
            }

            if (!isSuccess)
            {
                statusTableDal.Delete(ISNORMALEXITVALUE);

                try
                {
                    AddOrUpdate(statusTableDal, model);
                }
                catch (Exception ex)
                {
                    LogHelper.WriteError(ex.Message, ex);
                }
            }
        }
Esempio n. 2
0
        /// <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);
        }
Esempio n. 3
0
        /// <summary>
        /// 删除正常退出标志
        /// </summary>
        public static void DeleteNormalFlag()
        {
            BD_StatusTableDal statusTableDal = new BD_StatusTableDal();

            statusTableDal.Delete(ISNORMALEXIT);
        }