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 List <Booth> GetunusedByUserId(IConnectionHandler connectionHandler, Guid userId, Guid congressId)
        {
            var predicateBuilder = new PredicateBuilder <Booth>();
            var @select          = new UserBoothBO().Select(connectionHandler, x => x.BoothId, x => x.UserId == userId && x.Booth.CongressId == congressId);

            if (select.Any())
            {
                predicateBuilder.And(x => x.Id.NotIn(select));
            }
            predicateBuilder.And(x => x.CongressId == congressId);
            return(OrderBy(connectionHandler, x => x.Code, predicateBuilder.GetExpression()));
        }
Example #3
0
        public IEnumerable <Tools.ModelView.ReportChartModel> ChartChash(IConnectionHandler connectionHandler,
                                                                         Guid congressId, string year = "", string month = "")
        {
            var list             = new List <Tools.ModelView.ReportChartModel>();
            var workShopUsers    = new WorkShopUserBO().GetTransactionId(connectionHandler, congressId, year, month);
            var hotelUsers       = new HotelUserBO().GetTransactionId(connectionHandler, congressId, year, month);
            var users            = new UserBO().GetTransactionId(connectionHandler, congressId, year, month);
            var transactionId    = new ArticleBO().GetTransactionId(connectionHandler, congressId, year, month);
            var enumerable       = new UserBoothBO().GetTransactionId(connectionHandler, congressId, year, month);
            var reportChartModel = new Tools.ModelView.ReportChartModel
            {
                Count        = (long)workShopUsers,
                Value        = Resources.Congress.Workshop,
                StringFormat = "N0"
            };

            list.Add(reportChartModel);
            var chartModel = new Tools.ModelView.ReportChartModel
            {
                Count        = (long)hotelUsers,
                Value        = Resources.Congress.Hotel,
                StringFormat = "N0"
            };

            list.Add(chartModel);
            var model = new Tools.ModelView.ReportChartModel
            {
                Count        = (long)enumerable,
                Value        = Resources.Congress.booth,
                StringFormat = "N0"
            };

            list.Add(model);
            var chartModel1 = new Tools.ModelView.ReportChartModel
            {
                Count        = (long)users,
                Value        = Resources.Congress.User,
                StringFormat = "N0"
            };

            list.Add(chartModel1);
            var item = new Tools.ModelView.ReportChartModel
            {
                Count        = (long)transactionId,
                Value        = Resources.Congress.Article,
                StringFormat = "N0"
            };

            list.Add(item);
            return(list);
        }
Example #4
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;
            }
        }
Example #5
0
        private bool DailyEvaulationForConfig(IConnectionHandler connectionHandler, Configuration configuration,
                                              Tools.ModelView.ModifyResult <UserBooth> keyValuePairs, Tools.ModelView.ModifyResult <WorkShopUser> workShopUsers, Tools.ModelView.ModifyResult <HotelUser> hotelUsers)
        {
            bool result;

            var userBoothBo = new UserBoothBO();

            if (configuration.DayCountDeleteBoothReserveNotPay != null &&
                configuration.DayCountDeleteBoothReserveNotPay > 0)
            {
                var list = userBoothBo.Where(connectionHandler,
                                             x => x.Booth.CongressId == configuration.CongressId && x.TransactionId == null);
                foreach (var userBooth in list)
                {
                    var dateTime =
                        DateTimeUtil.ShamsiDateToGregorianDate(userBooth.RegisterDate)
                        .AddDays((double)configuration.DayCountDeleteBoothReserveNotPay)
                        .ShamsiDate();
                    if (dateTime.CompareTo(DateTime.Now.ShamsiDate()) < 0)
                    {
                        if (!userBoothBo.Delete(connectionHandler, userBooth))
                        {
                            throw new Exception(Resources.Congress.ErrorInWorkDailyScheduler);
                        }
                        keyValuePairs.AddInform(
                            userBooth, Resources.Congress.BoothChangeStatusEmail, Resources.Congress.BoothChangeStatusSMS
                            );
                    }
                }
            }
            var hotelUserBo = new HotelUserBO();

            if (configuration.DayCountDeleteHotelReserveNotPay != null &&
                configuration.DayCountDeleteHotelReserveNotPay > 0)
            {
                var list = hotelUserBo.Where(connectionHandler,
                                             x => x.Hotel.CongressId == configuration.CongressId && x.TransactionId == null);
                foreach (var hotelUser in list)
                {
                    var user     = hotelUser;
                    var dateTime =
                        DateTimeUtil.ShamsiDateToGregorianDate(user.RegisterDate)
                        .AddDays((double)configuration.DayCountDeleteHotelReserveNotPay)
                        .ShamsiDate();
                    if (dateTime.CompareTo(DateTime.Now.ShamsiDate()) < 0)
                    {
                        if (!hotelUserBo.Delete(connectionHandler, hotelUser))
                        {
                            throw new Exception(Resources.Congress.ErrorInWorkDailyScheduler);
                        }
                        if (hotelUsers.InformList.All(x => x.obj.UserId != user.UserId))
                        {
                            hotelUsers.AddInform(

                                user,
                                Resources.Congress.HotelChangeStatusEmail, Resources.Congress.HotelChangeStatusSMS
                                );
                        }

                        if (!user.User.ParentId.HasValue || hotelUsers.InformList.Any(x => x.obj.UserId == user.User.ParentId))
                        {
                            continue;
                        }
                        hotelUsers.AddInform(

                            new HotelUser()
                        {
                            UserId  = (Guid)user.User.ParentId,
                            HotelId = user.HotelId,
                            Status  = user.Status
                        },
                            Resources.Congress.HotelChangeStatusEmail, Resources.Congress.HotelChangeStatusSMS
                            );
                    }
                }
            }
            var workShopUserBo = new WorkShopUserBO();

            if (configuration.DayCountDeleteWorkShopReserveNotPay != null &&
                configuration.DayCountDeleteWorkShopReserveNotPay > 0)
            {
                var list = workShopUserBo.Where(connectionHandler,
                                                x =>
                                                x.WorkShop.CongressId == configuration.CongressId && x.TransactionId == null);
                foreach (var shopUser in list)
                {
                    var workShopUser = shopUser;
                    var addDays      =
                        DateTimeUtil.ShamsiDateToGregorianDate(workShopUser.RegisterDate)
                        .AddDays((double)configuration.DayCountDeleteWorkShopReserveNotPay);
                    var dateTime = addDays.ShamsiDate();
                    if (dateTime.CompareTo(DateTime.Now.ShamsiDate()) < 0)
                    {
                        if (!workShopUserBo.Delete(connectionHandler, shopUser))
                        {
                            throw new Exception(Resources.Congress.ErrorInWorkDailyScheduler);
                        }
                        if (workShopUsers.InformList.All(x => x.obj.UserId != workShopUser.UserId))
                        {
                            workShopUsers.AddInform(

                                workShopUser,
                                Resources.Congress.WorkShopChangeStatusEmail,
                                Resources.Congress.WorkShopChangeStatusSMS
                                );
                        }

                        if (!workShopUser.User.ParentId.HasValue ||
                            workShopUsers.InformList.Any(x => x.obj.UserId == workShopUser.User.ParentId))
                        {
                            continue;
                        }
                        workShopUsers.AddInform(


                            new WorkShopUser()
                        {
                            UserId     = (Guid)workShopUser.User.ParentId,
                            WorkShopId = workShopUser.WorkShopId,
                            Status     = workShopUser.Status
                        }
                            , Resources.Congress.WorkShopChangeStatusEmail
                            , Resources.Congress.WorkShopChangeStatusSMS
                            );
                    }
                }
            }
            result = true;

            return(result);
        }