Exemplo n.º 1
0
        public CongressXml GetXmlData(IConnectionHandler connectionHandler)
        {
            var homaXml = new CongressXml
            {
                AttendanceType = new List <KeyValueXml>()
                {
                    new KeyValueXml()
                    {
                        Key = "Congress", Value = "همایش"
                    },
                    new KeyValueXml()
                    {
                        Key = "WorkShop", Value = "کارگاه"
                    },
                }
            };
            var currentCongress = new HomaBO().GetCurrentCongress(connectionHandler);

            foreach (var homa in currentCongress)
            {
                var congressModelXml = new CongressModelXml()
                {
                    CongressId = homa.Id, Title = homa.CongressTitle
                };
                var users = new UserBO().SelectKeyValuePair(connectionHandler, x => x.Number, x => x.EnterpriseNode.RealEnterpriseNode.FirstName + " " + x.EnterpriseNode.RealEnterpriseNode.LastName + "(" + x.Username + ")", x => x.CongressId == homa.Id);
                foreach (var user in users)
                {
                    congressModelXml.UserList.Add(new KeyValueXml()
                    {
                        Value = user.Value, Key = user.Key
                    });
                }
                var @where = new WorkShopBO().Where(connectionHandler, x => x.CongressId == homa.Id);
                foreach (var shop in @where)
                {
                    var shopModelXml = new WorkShopModelXml()
                    {
                        Key = shop.Id.ToString(), Value = shop.Subject
                    };
                    var shopUsers = new WorkShopUserBO().SelectKeyValuePair(connectionHandler, x => x.User.Number, x => x.User.EnterpriseNode.RealEnterpriseNode.FirstName + " " + x.User.EnterpriseNode.RealEnterpriseNode.LastName + "(" + x.User.Username + ")", x => x.WorkShopId == shop.Id);
                    foreach (var user in shopUsers)
                    {
                        shopModelXml.UserList.Add(new KeyValueXml()
                        {
                            Value = user.Value, Key = user.Key
                        });
                    }
                    congressModelXml.WorkShopModelList.Add(shopModelXml);
                }
                homaXml.CongressModelXml.Add(congressModelXml);
            }
            return(homaXml);
        }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
        public ModelView.ModifyResult <WorkShopUser> UpdateStatusAfterTransaction(IConnectionHandler connectionHandler, IConnectionHandler paymentConnection, Guid userId, Guid tempId)
        {
            WorkShopUserBO      workShopUserBo = new WorkShopUserBO();
            var                 result         = new ModelView.ModifyResult <WorkShopUser>();
            List <WorkShopUser> shopUser       = workShopUserBo.Where(connectionHandler, x => x.TempId == tempId);

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

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

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

            foreach (WorkShopUser valuePair in shopUser)
            {
                valuePair.TransactionId = tr.Id;
                valuePair.TempId        = null;
                if (tr.PreDone)
                {
                    valuePair.Status = (byte)Enums.WorkShopRezervState.Pay;
                }

                if (!workShopUserBo.Update(connectionHandler, valuePair))
                {
                    throw new Exception(Resources.Congress.ErrorInReservWorkShop);
                }
            }
            WorkShopUser workshop = shopUser.FirstOrDefault();

            if (workshop != null)
            {
                if (tr.PreDone)
                {
                    result.AddInform(new WorkShopUser()
                    {
                        WorkShopId = workshop.WorkShopId, UserId = userId
                    },
                                     Resources.Congress.WorkShopPaymentEmail,
                                     Resources.Congress.WorkShopPaymentSMS);
                }
            }
            result.TransactionId = tr.Id;
            result.Result        = true;
            result.SendInform    = true;
            return(result);
        }
Exemplo n.º 4
0
        public void SetCapacity(IConnectionHandler connectionHandler, List <WorkShop> list, Guid congressId)
        {
            var groupBy = new WorkShopUserBO().GroupBy(connectionHandler,
                                                       new Expression <Func <WorkShopUser, object> >[] { x => x.WorkShopId },
                                                       new GroupByModel <WorkShopUser>[]
            {
                new GroupByModel <WorkShopUser>()
                {
                    Expression           = x => x.WorkShopId,
                    AggrigateFuntionType = AggrigateFuntionType.Count
                },
            },
                                                       x =>
                                                       x.WorkShop.CongressId == congressId && x.Status != (byte)Enums.WorkShopRezervState.Denial &&
                                                       x.Status != (byte)Enums.WorkShopRezervState.DenialPay);

            foreach (var item in list)
            {
                var firstOrDefault = groupBy.FirstOrDefault(x => x.WorkShopId == item.Id);
                int reservCount    = firstOrDefault != null ? firstOrDefault.CountWorkShopId : 0;
                item.FreeCapicity = item.Capacity - reservCount;
                item.RezervCount  = reservCount;
            }
        }
Exemplo n.º 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);
        }