Esempio n. 1
0
 public Guid UpdateStatusAfterTransactionGroupTemp(Guid userId, Guid id)
 {
     try
     {
         this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
         this.PaymentConnection.StartTransaction(IsolationLevel.ReadUncommitted);
         this.FileManagerConnection.StartTransaction(IsolationLevel.ReadUncommitted);
         this.ReservationConnection.StartTransaction(IsolationLevel.ReadUncommitted);
         var tempTransactionalFacade = PaymentComponenets.Instance.TempTransactionalFacade(this.PaymentConnection);
         var tr = tempTransactionalFacade.RemoveTempAndReturnTransaction(id);
         if (tr == null)
         {
             return(Guid.Empty);
         }
         var byFilter = tempTransactionalFacade.Where(x => x.ParentId == id);
         if (byFilter.Any())
         {
             var userBo         = new UserBO();
             var userBoothBo    = new UserBoothBO();
             var articleBo      = new ArticleBO();
             var hotelUserBo    = new HotelUserBO();
             var workShopUserBo = new WorkShopUserBO();
             foreach (var temp in byFilter)
             {
                 workShopUserBo.UpdateStatusAfterTransaction(this.ConnectionHandler, this.PaymentConnection,
                                                             userId, temp.Id);
                 hotelUserBo.UpdateStatusAfterTransaction(this.ConnectionHandler, this.PaymentConnection, userId,
                                                          temp.Id);
                 articleBo.UpdateStatusAfterTransaction(this.ConnectionHandler, this.PaymentConnection,
                                                        this.FileManagerConnection, temp.Id, new ModelView.InFormEntitiyList <RefereeCartable>());
                 userBoothBo.UpdateStatusAfterTransaction(this.ConnectionHandler, this.PaymentConnection, temp.Id);
                 userBo.UpdateStatusAfterTransaction(this.ConnectionHandler, this.PaymentConnection,
                                                     this.ReservationConnection, userId, temp.Id);
                 tempTransactionalFacade.RemoveTempAndReturnTransaction(temp.Id);
             }
         }
         this.ConnectionHandler.CommitTransaction();
         this.PaymentConnection.CommitTransaction();
         this.FileManagerConnection.CommitTransaction();
         this.ReservationConnection.CommitTransaction();
         return(tr.Id);
     }
     catch (KnownException ex)
     {
         this.ConnectionHandler.RollBack();
         this.PaymentConnection.RollBack();
         this.FileManagerConnection.RollBack();
         this.ReservationConnection.RollBack();
         Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
         throw new KnownException(ex.Message, ex);
     }
     catch (Exception ex)
     {
         this.ConnectionHandler.RollBack();
         this.PaymentConnection.RollBack();
         this.FileManagerConnection.RollBack();
         this.ReservationConnection.RollBack();
         Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
         throw new KnownException(ex.Message, ex);
     }
 }