コード例 #1
0
ファイル: HomaFacade.cs プロジェクト: davoodkosari/Zibasazi
        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)
            {
            }
        }
コード例 #2
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);
        }