Пример #1
0
        public ModelView.ModifyResult <HotelUser> UpdateStatusAfterTransaction(IConnectionHandler connectionHandler, IConnectionHandler paymentConnection, Guid userId, Guid tempId)
        {
            HotelUserBO hotelUserBo = new HotelUserBO();
            var         result      = new ModelView.ModifyResult <HotelUser>();


            bool             informUser = false;
            List <HotelUser> shopUser   = hotelUserBo.Where(connectionHandler, x => x.TempId == tempId);

            if (!shopUser.Any())
            {
                return(result);
            }

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

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

            foreach (HotelUser hotelUser in shopUser)
            {
                hotelUser.TransactionId = tr.Id;
                hotelUser.TempId        = null;
                if (tr.PreDone)
                {
                    hotelUser.Status = (byte)Enums.RezervState.Pay;
                }

                if (!hotelUserBo.Update(connectionHandler, hotelUser))
                {
                    throw new Exception(Resources.Congress.ErrorInReservWorkShop);
                }
            }
            HotelUser hotel = shopUser.FirstOrDefault();

            if (hotel != null)
            {
                if (tr.PreDone)
                {
                    result.AddInform(new HotelUser()
                    {
                        HotelId = hotel.HotelId, UserId = userId
                    }, Resources.Congress.HotelPaymentEmail, Resources.Congress.HotelPaymentSMS);
                    result.SendInform = true;
                }
            }
            result.TransactionId = tr.Id;
            return(result);
        }
Пример #2
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);
        }
Пример #3
0
        public void SetCapacity(IConnectionHandler connectionHandler, List <Hotel> list, Guid congressId)
        {
            var groupBy = new HotelUserBO().GroupBy(connectionHandler,
                                                    new Expression <Func <HotelUser, object> >[] { x => x.HotelId },
                                                    new GroupByModel <HotelUser>[]
            {
                new GroupByModel <HotelUser>()
                {
                    Expression           = x => x.HotelId,
                    AggrigateFuntionType = AggrigateFuntionType.Count
                },
            },
                                                    x =>
                                                    x.Hotel.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.HotelId == item.Id);
                int reservCount    = firstOrDefault != null? firstOrDefault.CountHotelId:0;
                item.FreeCapicity = item.Capacity - reservCount;
                item.RezervCount  = reservCount;
            }
        }
Пример #4
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);
        }