Example #1
0
        public KeyValuePair <bool, Guid> WorkShopUserInsert(Guid congressId, Guid workShopId, User parentUser,
                                                            List <DiscountType> discountAttaches, string callBackurl, FormStructure formModel, List <Guid> users)
        {
            KeyValuePair <bool, Guid> keyValuePair;
            var entitiys = new ModelView.InFormEntitiyList <WorkShopUser>();

            try
            {
                this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                this.PaymentConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                this.FormGeneratorConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                var shopUserInsertGroup = new WorkShopUserBO().WorkShopUserInsert(this.ConnectionHandler,
                                                                                  this.PaymentConnection, this.FormGeneratorConnection, workShopId, parentUser, discountAttaches,
                                                                                  callBackurl, formModel, users);
                if (shopUserInsertGroup.Key && users.Count > 0)
                {
                    entitiys.Add(

                        new WorkShopUser()
                    {
                        WorkShopId = workShopId, UserId = parentUser.Id
                    },
                        Resources.Congress.WorkShopInsertEmail,
                        Resources.Congress.WorkShopInsertSMS
                        );
                }
                this.ConnectionHandler.CommitTransaction();
                this.PaymentConnection.CommitTransaction();
                this.FormGeneratorConnection.CommitTransaction();
                keyValuePair = new KeyValuePair <bool, Guid>(shopUserInsertGroup.Key, shopUserInsertGroup.Value);
            }
            catch (KnownException ex)
            {
                this.ConnectionHandler.RollBack();
                this.PaymentConnection.RollBack();
                this.FormGeneratorConnection.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.FormGeneratorConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            try
            {
                if (keyValuePair.Key)
                {
                    new WorkShopUserBO().InformWorkShopReserv(this.ConnectionHandler, congressId, entitiys);
                }
            }
            catch (Exception)
            {
            }
            return(keyValuePair);
        }
Example #2
0
        public void DailyEvaulation()
        {
            var  workShopUserBo = new WorkShopUserBO();
            var  hotelUserBo    = new HotelUserBO();
            var  userBoothBo    = new UserBoothBO();
            var  keyValuePairs  = new Dictionary <Guid, ModelView.ModifyResult <UserBooth> >();
            var  workShopUsers  = new Dictionary <Guid, ModelView.ModifyResult <WorkShopUser> >();
            var  hotelUsers     = new Dictionary <Guid, ModelView.ModifyResult <HotelUser> >();
            bool result         = false;

            try
            {
                this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                if (!new HomaBO().DailyEvaulation(this.ConnectionHandler, keyValuePairs, workShopUsers, hotelUsers))
                {
                    throw new Exception(Resources.Congress.ErrorInWorkDailyScheduler);
                }
                this.ConnectionHandler.CommitTransaction();
                result = true;
            }
            catch (Exception ex)
            {
                this.ConnectionHandler.RollBack();
                throw new KnownException(ex.Message, ex);
            }
            try
            {
                if (result)
                {
                    foreach (var modifyResult in hotelUsers)
                    {
                        hotelUserBo.InformHotelReserv(ConnectionHandler, modifyResult.Key, modifyResult.Value.InformList);
                    }
                    foreach (var modifyResult in workShopUsers)
                    {
                        workShopUserBo.InformWorkShopReserv(ConnectionHandler, modifyResult.Key, modifyResult.Value.InformList);
                    }
                    foreach (var modifyResult in keyValuePairs)
                    {
                        userBoothBo.InformUserboothReserv(ConnectionHandler, modifyResult.Key, modifyResult.Value.InformList);
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Example #3
0
        public bool WorkShopUserUpdate(Guid congressId, WorkShopUser WorkShop, FormStructure formModel)
        {
            bool result   = false;
            var  entitiys = new ModelView.InFormEntitiyList <WorkShopUser>();

            try
            {
                this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                this.FormGeneratorConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                result = new WorkShopUserBO().WorkShopUserUpdate(this.ConnectionHandler,
                                                                 this.FormGeneratorConnection, WorkShop, formModel);
                entitiys.Add(

                    WorkShop,
                    Resources.Congress.WorkShopInsertEmail,
                    Resources.Congress.WorkShopInsertSMS
                    );

                this.ConnectionHandler.CommitTransaction();
                this.FormGeneratorConnection.CommitTransaction();
            }
            catch (KnownException ex)
            {
                this.ConnectionHandler.RollBack();
                this.FormGeneratorConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            catch (Exception ex)
            {
                this.ConnectionHandler.RollBack();
                this.FormGeneratorConnection.RollBack();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            try
            {
                if (result)
                {
                    new WorkShopUserBO().InformWorkShopReserv(this.ConnectionHandler, congressId, entitiys);
                }
            }
            catch (Exception)
            {
            }
            return(result);
        }
Example #4
0
 public IEnumerable <WorkShopUser> Search(Guid id, byte?status, string registerDate, string searchvalue,
                                          FormStructure formStructure)
 {
     try
     {
         var workShopUserBO = new WorkShopUserBO();
         var outlist        = workShopUserBO.Search(this.ConnectionHandler, id, status, registerDate, searchvalue, formStructure);
         return(outlist);
     }
     catch (KnownException ex)
     {
         Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
         throw new KnownException(ex.Message, ex);
     }
     catch (Exception ex)
     {
         Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
         throw new KnownException(ex.Message, ex);
     }
 }
Example #5
0
 public Guid UpdateStatusAfterTransaction(Guid congressid, Guid userId, Guid tempId)
 {
     ModelView.ModifyResult <WorkShopUser> afterTransactionModel;
     try
     {
         this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
         this.PaymentConnection.StartTransaction(IsolationLevel.ReadUncommitted);
         afterTransactionModel = new WorkShopUserBO().UpdateStatusAfterTransaction(this.ConnectionHandler, this.PaymentConnection, userId, tempId);
         this.ConnectionHandler.CommitTransaction();
         this.PaymentConnection.CommitTransaction();
     }
     catch (KnownException ex)
     {
         this.ConnectionHandler.RollBack();
         this.PaymentConnection.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();
         Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
         throw new KnownException(ex.Message, ex);
     }
     try
     {
         if (afterTransactionModel.SendInform)
         {
             new WorkShopUserBO().InformWorkShopReserv(ConnectionHandler, congressid, afterTransactionModel.InformList);
         }
     }
     catch (Exception)
     {
     }
     return(afterTransactionModel == null ? Guid.Empty : afterTransactionModel.TransactionId);
 }
Example #6
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);
     }
 }
Example #7
0
        public bool UpdateList(Guid congressId, List <WorkShopUser> list)
        {
            var  shopUserBo = new WorkShopUserBO();
            var  entitiys   = new ModelView.InFormEntitiyList <WorkShopUser>();
            bool result;

            try
            {
                this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                this.PaymentConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                var transactionTransactionalFacade =
                    PaymentComponenets.Instance.TransactionTransactionalFacade(this.PaymentConnection);
                var userBo = new UserBO();
                foreach (var workShopUser1 in list)
                {
                    var workShopUser = shopUserBo.Get(this.ConnectionHandler, workShopUser1.UserId,
                                                      workShopUser1.WorkShopId);
                    if (workShopUser == null)
                    {
                        continue;
                    }
                    workShopUser.Status = workShopUser1.Status;
                    if (workShopUser.Status == (byte)Enums.WorkShopRezervState.PayConfirm)
                    {
                        if (workShopUser.TransactionId != null)
                        {
                            if (!transactionTransactionalFacade.Done((Guid)workShopUser.TransactionId))
                            {
                                throw new Exception(Resources.Congress.ErrorInEditWorkShop);
                            }
                        }
                    }
                    if (!shopUserBo.Update(this.ConnectionHandler, workShopUser))
                    {
                        throw new Exception(Resources.Congress.ErrorInEditWorkShop);
                    }
                    var user = userBo.Get(this.ConnectionHandler, workShopUser1.UserId);
                    if (entitiys.All(x => x.obj.UserId != workShopUser.UserId))
                    {
                        entitiys.Add(
                            workShopUser,
                            Resources.Congress.WorkShopChangeStatusEmail,
                            Resources.Congress.WorkShopChangeStatusSMS
                            );
                    }


                    if (!user.ParentId.HasValue || entitiys.Any(x => x.obj.UserId == user.ParentId))
                    {
                        continue;
                    }
                    entitiys.Add(
                        new WorkShopUser()
                    {
                        UserId     = (Guid)user.ParentId,
                        WorkShopId = workShopUser1.WorkShopId,
                        Status     = workShopUser1.Status
                    },
                        Resources.Congress.WorkShopChangeStatusEmail,
                        Resources.Congress.WorkShopChangeStatusSMS
                        );
                }
                this.ConnectionHandler.CommitTransaction();
                this.PaymentConnection.CommitTransaction();
                result = true;
            }
            catch (KnownException ex)
            {
                this.ConnectionHandler.RollBack();
                this.PaymentConnection.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();
                Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
                throw new KnownException(ex.Message, ex);
            }
            try
            {
                if (result)
                {
                    shopUserBo.InformWorkShopReserv(this.ConnectionHandler, congressId, entitiys);
                }
            }
            catch (Exception)
            {
            }
            return(result);
        }