コード例 #1
0
        private static void OnTimedEvent(object source, System.Timers.ElapsedEventArgs e)
        {
            myTimer.Stop();
            AppLog.WriteLog(AppMember.AppText["SystemUser"], LogType.Debug, "AutoTask", string.Format(AppMember.AppText["AutoDepreciationProcess"]));
            AssetsDepreciationRepository rep = new AssetsDepreciationRepository();
            DataUpdate dbUpdate = new DataUpdate();

            try
            {
                dbUpdate.BeginTransaction();
                rep.DbUpdate = dbUpdate;
                rep.UpdateAuto(AppMember.AppText["MonthAutoUpdate"]);
                dbUpdate.Commit();
            }
            catch (Exception ex)
            {
                dbUpdate.Rollback();
                throw ex;
            }
            finally
            {
                dbUpdate.Close();
                myTimer.Start();
            }
        }
コード例 #2
0
 public static void ExcuteAutoUpdateByThread()
 {
     if (!TaskExcuting)
     {
         TaskExcuting = true;
         //AppLog.WriteLog(AppMember.AppText["SystemUser"], LogType.Debug, "AutoTask", string.Format(AppMember.AppText["AutoDepreciationProcess"]));
         AssetsDepreciationRepository rep = new AssetsDepreciationRepository();
         DataUpdate dbUpdate = new DataUpdate();
         try
         {
             dbUpdate.BeginTransaction();
             rep.DbUpdate = dbUpdate;
             rep.UpdateAuto(AppMember.AppText["MonthAutoUpdate"]);
             dbUpdate.Commit();
         }
         catch (Exception ex)
         {
             dbUpdate.Rollback();
             AppLog.WriteLog(AppMember.AppText["SystemUser"], LogType.Error, "AutoTask", ex.Message);
             throw ex;
         }
         finally
         {
             dbUpdate.Close();
             TaskExcuting = false;
         }
     }
 }