示例#1
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)
            {
            }
        }
示例#2
0
        public bool UpdateList(Guid congressId, List <HotelUser> list)
        {
            bool result;
            var  hotelUserBO = new HotelUserBO();
            var  entitiys    = new ModelView.InFormEntitiyList <HotelUser>();

            try
            {
                this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted);
                this.PaymentConnection.StartTransaction(IsolationLevel.ReadUncommitted);
                var transactionTransactionalFacade =
                    PaymentComponenets.Instance.TransactionTransactionalFacade(this.PaymentConnection);
                var userBo = new UserBO();
                foreach (var hotelUser1 in list)
                {
                    var hotelUser = Get(hotelUser1.HotelId, hotelUser1.UserId);
                    if (hotelUser == null)
                    {
                        continue;
                    }
                    hotelUser.Status = hotelUser1.Status;
                    if (hotelUser.Status == (byte)Enums.RezervState.PayConfirm)
                    {
                        if (hotelUser.TransactionId != null)
                        {
                            if (!transactionTransactionalFacade.Done((Guid)hotelUser.TransactionId))
                            {
                                return(false);
                            }
                        }
                    }
                    if (!hotelUserBO.Update(this.ConnectionHandler, hotelUser))
                    {
                        throw new Exception(Resources.Congress.ErrorInEditHotelReserv);
                    }
                    var user = userBo.Get(this.ConnectionHandler, hotelUser1.UserId);
                    if (entitiys.All(x => x.obj.UserId != hotelUser.UserId))
                    {
                        entitiys.Add(hotelUser
                                     , Resources.Congress.HotelChangeStatusEmail, Resources.Congress.HotelChangeStatusSMS);
                    }
                    if (!user.ParentId.HasValue || entitiys.Any(x => x.obj.UserId == user.ParentId))
                    {
                        continue;
                    }
                    entitiys.Add(
                        new HotelUser()
                    {
                        UserId  = (Guid)user.ParentId,
                        HotelId = hotelUser1.HotelId,
                        Status  = hotelUser1.Status
                    }

                        ,
                        Resources.Congress.HotelChangeStatusEmail,
                        Resources.Congress.HotelChangeStatusSMS
                        );
                }
                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)
                {
                    hotelUserBO.InformHotelReserv(this.ConnectionHandler, congressId, entitiys);
                }
            }
            catch (Exception)
            {
            }
            return(result);
        }