コード例 #1
0
        public void CloseCurrentErfassungsperiod(ErfassungsabschlussModel erfassungsabschlussModel)
        {
            Guid closedPeriodId;

            try
            {
                var closedPeriod = CloseCurrentPeriod(erfassungsabschlussModel);
                closedPeriodId = closedPeriod.Id;
                var currentPeriod = CreateNewPeriod(closedPeriod);
                erfassungsPeriodService.InvalidateCurrentErfassungsPeriodCache();
                CreateNewErfassungsPeriodData(closedPeriod, currentPeriod);

                ereignisLogService.LogEreignis(EreignisTyp.Jahresabschluss,
                                               new Dictionary <string, object> {
                    { "abgeschlossene jahr", closedPeriod.Erfassungsjahr.Year }
                });
                transactionScopeProvider.CurrentTransactionScope.Commit();
            }
            catch (Exception e)
            {
                Loggers.ApplicationLogger.Warn(String.Format("Error during CloseCurrentErfassungsperiod: {0}", e.ToString()));
                transactionScopeProvider.CurrentTransactionScope.Rollback();
                throw;
            }
            finally
            {
                transactionScopeProvider.ResetCurrentTransactionScope();
            }
            //Run the DeleteNotUsedData in its own transaction to avoid deadlocks in the database
            DeleteNotUsedData(closedPeriodId);
        }
コード例 #2
0
        protected void Application_EndRequest()
        {
            if (transactionScopeProvider.HasRequestTransaction)
            {
                try
                {
                    if (HttpContext.Current.Server.GetLastError() != null || httpRequestService.LastException != null)
                    {
                        transactionScopeProvider.CurrentTransactionScope.Rollback();
                    }
                    else
                    {
                        transactionScopeProvider.CurrentTransactionScope.Commit();
                    }
                }
                catch (Exception ex)
                {
                    Loggers.ApplicationLogger.Error(ex.Message, ex);
                }
                finally
                {
                    transactionScopeProvider.ResetCurrentTransactionScope();
                }
            }

            if (serverConfigurationProvider.EnableMiniProfiler)
            {
                MiniProfiler.Stop();
            }
        }
コード例 #3
0
 public ActionResult StartAxisUpdate()
 {
     try
     {
         achsenupdateService.StartAchsenUpdate();
         return(View("AchsenUpdateSuccessful"));
     }
     catch (Exception ex)
     {
         //since the Exception is caught in order to display an ErrorMessage there is no reason to for the Application_EndRequest to rollback the session, so we rollback manually
         transactionScopeProvider.CurrentTransactionScope.Rollback();
         transactionScopeProvider.ResetCurrentTransactionScope();
         Loggers.ApplicationLogger.Error(string.Format("msg: {0}, stacktrace: {1}", ex.Message.ToString(), ex.StackTrace.ToString()));
         ViewBag.Message = ex.Message.ToString();
         return(View("AchsenUpdateFailed"));
     }
 }