Example #1
0
        public ModelView.ModifyResult <UserBooth> UpdateStatusAfterTransaction(IConnectionHandler connectionHandler, IConnectionHandler paymentConnection, Guid tempId)
        {
            UserBoothBO userBoothBo = new UserBoothBO();
            var         result      = new ModelView.ModifyResult <UserBooth>();
            UserBooth   userBooth   = userBoothBo.FirstOrDefault(connectionHandler, x => x.TempId == tempId);

            if (userBooth == null)
            {
                return(result);
            }

            Transaction tr = PaymentComponenets.Instance.TempTransactionalFacade(paymentConnection).RemoveTempAndReturnTransaction(tempId);

            if (tr == null)
            {
                return(result);
            }

            userBooth.TransactionId = tr.Id;
            userBooth.TempId        = null;
            if (tr.PreDone)
            {
                userBooth.Status = (byte)Enums.RezervState.Pay;
                result.AddInform(userBooth, Resources.Congress.BoothPaymentEmail, Resources.Congress.BoothPaymentSMS);
            }
            if (!userBoothBo.Update(paymentConnection, userBooth))
            {
                throw new Exception(Resources.Congress.ErrorInReservBooth);
            }
            result.TransactionId = tr.Id;
            result.SendInform    = true;
            return(result);
        }
Example #2
0
        public void SetCapacity(IConnectionHandler connectionHandler, List <Booth> list, Guid congressId)
        {
            var groupBy = new UserBoothBO().GroupBy(connectionHandler,
                                                    new Expression <Func <UserBooth, object> >[] { x => x.BoothId },
                                                    new GroupByModel <UserBooth>[]
            {
                new GroupByModel <UserBooth>()
                {
                    Expression           = x => x.BoothId,
                    AggrigateFuntionType = AggrigateFuntionType.Count
                },
            },
                                                    x =>
                                                    x.Booth.CongressId == congressId && x.Status != (byte)Enums.RezervState.Denial &&
                                                    x.Status != (byte)Enums.RezervState.DenialPay);

            foreach (var item in list)
            {
                var firstOrDefault = groupBy.FirstOrDefault(x => x.BoothId == item.Id);
                int reservCount    = firstOrDefault != null? firstOrDefault.CountBoothId:0;
                item.FreeCapicity = item.ReservCapacity - reservCount;
                item.RezervCount  = reservCount;
            }
        }