示例#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);
        }
示例#2
0
        public bool Delete(IConnectionHandler connectionHandler,
                           IConnectionHandler enterpriseNodeConnectionconnectionHandler,
                           IConnectionHandler statisticConnectionconnectionHandler, params object[] keys)
        {
            var obj         = new HomaBO().Get(connectionHandler, keys);
            var homaAliasBo = new HomaAliasBO();
            var list        = homaAliasBo.Where(connectionHandler, x => x.CongressId == obj.Id);

            foreach (var homaAliase in list)
            {
                if (!homaAliasBo.Delete(connectionHandler, homaAliase.Id))
                {
                    throw new Exception(Resources.Congress.ErrorInSaveCongress);
                }
            }
            if (!new HomaBO().Delete(connectionHandler, keys))
            {
                throw new Exception(Resources.Congress.ErrorInDeleteCongress);
            }
            var webSiteTransactionalFacade =
                StatisticComponents.Instance.WebSiteTransactionalFacade(statisticConnectionconnectionHandler);


            var byFilter = webSiteTransactionalFacade.Where(x => x.OwnerId == obj.OwnerId);

            if (byFilter != null)
            {
                foreach (var webSite in byFilter)
                {
                    if (!webSiteTransactionalFacade.Delete(webSite.Id))
                    {
                        throw new Exception("خطایی در حذف آمار سایت وجود دارد");
                    }
                }
            }
            else
            {
                if (
                    !EnterpriseNodeComponent.Instance.EnterpriseNodeTransactionalFacade(
                        enterpriseNodeConnectionconnectionHandler).Delete(obj.OwnerId))
                {
                    return(false);
                }
            }
            return(true);
        }
示例#3
0
        public bool SentToUser(IConnectionHandler connectionHandler, Guid congressId, int newsId)
        {
            var news = NewsComponent.Instance.NewsFacade.Get(newsId);
            if (news == null) return false;
            var homa = new HomaBO().Get(connectionHandler, congressId);
            var strings = this.Select(connectionHandler, x=>x.Email,x=>x.CongressId==congressId,true).ToArray();
            var configuration = homa.Configuration;
            var newsContent = news.GetNewsContent(System.Globalization.CultureInfo.CurrentUICulture.Name);
            if (
                !MessageComponenet.Instance.MailFacade.SendGroupMailWithInterval(configuration.MailHost,
                    configuration.MailPassword, configuration.MailUserName, configuration.MailFrom,
                    configuration.MailPort, homa.CongressTitle, configuration.EnableSSL,
                    strings, newsContent.Title1,
                   newsContent.Body, intervalSecond: configuration.GroupEmailInterval))
                return false;

            return true;
        }
示例#4
0
        public Dictionary <Homa, bool> GetUserCongressList(IConnectionHandler connectionHandler, Guid?userId)
        {
            var getHomalList     = new Dictionary <Homa, bool>();
            var predicateBuilder = new PredicateBuilder <SecurityUser>();

            if (userId.HasValue)
            {
                predicateBuilder.And(x => x.UserId == userId);
            }
            var @select  = new SecurityUserBO().Select(connectionHandler, x => x.CongressId, predicateBuilder.GetExpression());
            var byFilter = new HomaBO().Where(connectionHandler, x => x.Enabled);

            foreach (var homa in byFilter)
            {
                var added = @select.Any(x => x.Equals(homa.Id));
                getHomalList.Add(homa, added);
            }
            return(getHomalList);
        }
示例#5
0
        public void InformHotelReserv(IConnectionHandler connectionHandler, Guid congressId, ModelView.InFormEntitiyList <HotelUser> hotelUser)
        {
            if (!hotelUser.Any())
            {
                return;
            }
            Homa          homa   = new HomaBO().Get(connectionHandler, congressId);
            Configuration config = homa.Configuration;

            if (config.UserHotelReserveInformType == null)
            {
                return;
            }
            string        titlehoma     = homa.CongressTitle;
            CustomMessage custommessage = new CustomMessageBO().FirstOrDefault(connectionHandler, x => x.CongressId == congressId && x.Type == MessageInformType.Hotel);
            var           @where        = this.Where(connectionHandler,
                                                     x => x.HotelId.In(hotelUser.Select(i => i.obj.HotelId)) &&
                                                     x.UserId.In(hotelUser.Select(i => i.obj.UserId)));

            foreach (var hotelUser1 in hotelUser)
            {
                var firstOrDefault = @where.FirstOrDefault(x => x.HotelId == hotelUser1.obj.HotelId && x.UserId == hotelUser1.obj.UserId);
                if (firstOrDefault == null)
                {
                    continue;
                }
                var    enterpriseNode  = firstOrDefault.User.EnterpriseNode;
                var    hotel           = firstOrDefault.Hotel;
                var    status          = ((Enums.RezervState)hotelUser1.obj.Status).GetDescriptionInLocalization();
                var    homaCompleteUrl = homa.GetHomaCompleteUrl();
                string sms             = string.Format(hotelUser1.SmsBody, homa.CongressTitle, enterpriseNode.DescriptionFieldWithGender, hotel.Name, status);
                string email           = string.Format(hotelUser1.EmailBody, homa.CongressTitle, enterpriseNode.DescriptionFieldWithGender, hotel.Name, homaCompleteUrl, status);
                if (custommessage != null)
                {
                    if (!string.IsNullOrEmpty(custommessage.EmailText))
                    {
                        email = custommessage.EmailText.Replace($"[{HotelMessageKey.HotelName.ToString()}]", hotel.Name);
                        email = email.Replace($"[{HotelMessageKey.UsersName.ToString()}]", enterpriseNode.DescriptionFieldWithGender);
                        email = email.Replace($"[{HotelMessageKey.CongressTitle.ToString()}]", homa.CongressTitle);
                        email = email.Replace($"[{HotelMessageKey.CongressAddress.ToString()}]", homaCompleteUrl);
                        email = email.Replace($"[{HotelMessageKey.Status.ToString()}]", status);
                    }
                    if (!string.IsNullOrEmpty(custommessage.SmsText))
                    {
                        sms = custommessage.SmsText.Replace($"[{HotelMessageKey.HotelName.ToString()}]", hotel.Name);
                        sms = sms.Replace($"[{HotelMessageKey.UsersName.ToString()}]", enterpriseNode.DescriptionFieldWithGender);
                        sms = sms.Replace($"[{HotelMessageKey.CongressTitle.ToString()}]", homa.CongressTitle);
                        sms = sms.Replace($"[{HotelMessageKey.CongressAddress.ToString()}]", homaCompleteUrl);
                        sms = sms.Replace($"[{HotelMessageKey.Status.ToString()}]", status);
                    }
                }

                Message.Tools.ModelView.MessageModel inform = new Message.Tools.ModelView.MessageModel()
                {
                    Email      = enterpriseNode.Email,
                    Mobile     = enterpriseNode.Cellphone,
                    EmailTitle = homa.CongressTitle,
                    EmailBody  = email,
                    SMSBody    = sms
                };
                new HomaBO().SendInform((byte)config.UserHotelReserveInformType, inform, config, titlehoma);
                MessageComponenet.SentInternalMessageInstance.MailBoxFacade.SendInternalMail(homa.OwnerId, config.CongressId,
                                                                                             new[] { enterpriseNode.Id.ToString() }, homa.CongressTitle, inform.SMSBody);
            }
        }
示例#6
0
        public void InformUserboothReserv(IConnectionHandler connectionHandler, Guid CongressId, ModelView.InFormEntitiyList <UserBooth> keyValuePairs)
        {
            if (!keyValuePairs.Any())
            {
                return;
            }
            Homa homa = new HomaBO().Get(connectionHandler, CongressId);

            if (homa.Configuration.BoothReserveInformType == null)
            {
                return;
            }
            string        titlehoma     = homa.CongressTitle;
            CustomMessage custommessage = new CustomMessageBO().FirstOrDefault(connectionHandler, x => x.CongressId == CongressId && x.Type == MessageInformType.Booth);
            var           @where        = this.Where(connectionHandler,
                                                     x => x.BoothId.In(keyValuePairs.Select(i => i.obj.BoothId)) &&
                                                     x.UserId.In(keyValuePairs.Select(i => i.obj.UserId)));

            foreach (var shopUser in keyValuePairs)
            {
                var orDefault = @where.FirstOrDefault(x => x.BoothId == shopUser.obj.BoothId && x.UserId == shopUser.obj.UserId);
                if (orDefault == null)
                {
                    continue;
                }
                var    enterpriseNode  = orDefault.EnterpriseNode;
                var    status          = ((Enums.RezervState)orDefault.Status).GetDescriptionInLocalization();
                var    homaCompleteUrl = homa.GetHomaCompleteUrl();
                var    boothCode       = orDefault.Booth.Code;
                string sms             = string.Format(shopUser.EmailBody, homa.CongressTitle, enterpriseNode.DescriptionFieldWithGender, boothCode, status);
                string email           = string.Format(shopUser.SmsBody, homa.CongressTitle, enterpriseNode.DescriptionFieldWithGender, boothCode, homaCompleteUrl, status);
                if (custommessage != null)
                {
                    if (!string.IsNullOrEmpty(custommessage.EmailText))
                    {
                        email = custommessage.EmailText.Replace($"[{BoothMessageKey.BoothCode.ToString()}]", boothCode);
                        email = email.Replace($"[{BoothMessageKey.CongressTitle.ToString()}]", homa.CongressTitle);
                        email = email.Replace($"[{BoothMessageKey.UsersName.ToString()}]", enterpriseNode.DescriptionFieldWithGender);
                        email = email.Replace($"[{BoothMessageKey.Status.ToString()}]", status);
                        email = email.Replace($"[{BoothMessageKey.CongressAddress.ToString()}]", homaCompleteUrl);
                    }
                    if (!string.IsNullOrEmpty(custommessage.SmsText))
                    {
                        sms = custommessage.SmsText.Replace($"[{BoothMessageKey.BoothCode.ToString()}]", boothCode);
                        sms = sms.Replace($"[{BoothMessageKey.CongressTitle.ToString()}]", homa.CongressTitle);
                        sms = sms.Replace($"[{BoothMessageKey.UsersName.ToString()}]", enterpriseNode.DescriptionFieldWithGender);
                        sms = sms.Replace($"[{BoothMessageKey.Status.ToString()}]", status);
                        sms = sms.Replace($"[{BoothMessageKey.CongressAddress.ToString()}]", homaCompleteUrl);
                    }
                }


                Message.Tools.ModelView.MessageModel inform = new Message.Tools.ModelView.MessageModel
                {
                    Email      = enterpriseNode.Email,
                    Mobile     = enterpriseNode.Cellphone,
                    EmailTitle = homa.CongressTitle,
                    EmailBody  = email,
                    SMSBody    = sms
                };
                new HomaBO().SendInform((byte)homa.Configuration.BoothReserveInformType, inform, homa.Configuration, titlehoma);
                MessageComponenet.SentInternalMessageInstance.MailBoxFacade.SendInternalMail(homa.OwnerId, homa.Configuration.CongressId,
                                                                                             new[] { enterpriseNode.Id.ToString() }, homa.CongressTitle, inform.SMSBody);
            }
        }
示例#7
0
        public void InformRefereeAddArticle(IConnectionHandler connectionHandler, Guid congressId, ModelView.InFormEntitiyList <RefereeCartable> keyValuePairs)
        {
            if (!keyValuePairs.Any())
            {
                return;
            }
            var refereeBo = new RefereeBO();
            var arti      = keyValuePairs.FirstOrDefault();
            var referee   = refereeBo.Get(connectionHandler, arti.obj.RefereeId);
            var homa1     = new HomaBO().Get(connectionHandler, congressId);
            var articleBo = new ArticleBO();
            var config    = homa1.Configuration;

            if (config.RefereeInformType == null)
            {
                return;
            }
            CustomMessage custommessage = new CustomMessageBO().FirstOrDefault(connectionHandler, x => x.CongressId == congressId && x.Type == Enums.MessageInformType.RefereeArticle);

            foreach (var article in keyValuePairs)
            {
                var article1 = articleBo.Get(connectionHandler, article.obj.ArticleId);
                if (article1 == null)
                {
                    continue;
                }
                var name                       = referee.EnterpriseNode.DescriptionFieldWithGender;
                var homaCompleteUrl            = homa1.GetHomaCompleteUrl();
                var homaArticleRefereePanelUrl = homa1.GetHomaArticleRefereePanelUrl(article1.Id, referee.Id);
                var email                      = string.Format(article.EmailBody, homa1.CongressTitle, name, article1.Title, homaCompleteUrl, homaArticleRefereePanelUrl);
                var sms = string.Format(article.SmsBody, homa1.CongressTitle, name, article1.Code);

                if (custommessage != null)
                {
                    if (!string.IsNullOrEmpty(custommessage.EmailText))
                    {
                        email = custommessage.EmailText.Replace($"[{Enums.RefereeArticleMessageKey.FullName.ToString()}]", name);
                        email = email.Replace($"[{Enums.RefereeArticleMessageKey.Username.ToString()}]", referee.Username);
                        email = email.Replace($"[{Enums.RefereeArticleMessageKey.ArticleCode.ToString()}]", article1.Code.ToString());
                        email = email.Replace($"[{Enums.RefereeArticleMessageKey.ArticleTitle.ToString()}]", article1.Title);
                        email = email.Replace($"[{Enums.RefereeArticleMessageKey.CongressTitle.ToString()}]", homa1.CongressTitle);
                        email = email.Replace($"[{Enums.RefereeArticleMessageKey.CongressAddress.ToString()}]", homaCompleteUrl);
                    }
                    if (!string.IsNullOrEmpty(custommessage.SmsText))
                    {
                        sms = custommessage.SmsText.Replace($"[{Enums.RefereeArticleMessageKey.FullName.ToString()}]", name);
                        sms = sms.Replace($"[{Enums.RefereeArticleMessageKey.Username.ToString()}]", referee.Username);
                        sms = sms.Replace($"[{Enums.RefereeArticleMessageKey.ArticleCode.ToString()}]", article1.Code.ToString());
                        sms = sms.Replace($"[{Enums.RefereeArticleMessageKey.ArticleTitle.ToString()}]", article1.Title);
                        sms = sms.Replace($"[{Enums.RefereeArticleMessageKey.CongressTitle.ToString()}]", homa1.CongressTitle);
                        sms = sms.Replace($"[{Enums.RefereeArticleMessageKey.CongressAddress.ToString()}]", homaCompleteUrl);
                    }
                }


                var inform = new Message.Tools.ModelView.MessageModel()
                {
                    Email      = referee.EnterpriseNode.Email,
                    Mobile     = referee.EnterpriseNode.Cellphone,
                    EmailTitle = homa1.CongressTitle,
                    EmailBody  = email,
                    SMSBody    = sms
                };
                new HomaBO().SendInform((byte)config.RefereeInformType, inform, config, homa1.CongressTitle);
                MessageComponenet.SentInternalMessageInstance.MailBoxFacade.SendInternalMail(homa1.OwnerId, config.CongressId,
                                                                                             new[] { referee.EnterpriseNode.Id.ToString() }, homa1.CongressTitle, inform.SMSBody);
            }
        }
示例#8
0
        public void InformRefereeRegister(IConnectionHandler connectionHandler, Guid congressId, ModelView.InFormEntitiyList <Referee> valuePairs)
        {
            if (!valuePairs.Any())
            {
                return;
            }

            var config = new ConfigurationBO().Get(connectionHandler, congressId);

            if (config.RefereeInformType == null)
            {
                return;
            }
            var           homa1         = new HomaBO().Get(connectionHandler, config.CongressId);
            CustomMessage custommessage = new CustomMessageBO().FirstOrDefault(connectionHandler, x => x.CongressId == congressId && x.Type == Enums.MessageInformType.Referee);
            var           @where        = this.Where(connectionHandler, x => x.Id.In(valuePairs.Select(i => i.obj.Id)));

            foreach (var valuePair in valuePairs)
            {
                var referee = @where.FirstOrDefault(x => x.Id == valuePair.obj.Id);
                if (referee == null)
                {
                    continue;
                }
                var name = referee.EnterpriseNode.DescriptionFieldWithGender;
                var homaRefereePanelUrl = homa1.GetHomaRefereePanelUrl();
                var homaCompleteUrl     = homa1.GetHomaCompleteUrl();
                var email = string.Format(valuePair.EmailBody, homa1.CongressTitle, name, homaCompleteUrl, homaRefereePanelUrl, valuePair.obj.Username, valuePair.obj.PasswordWithoutHash);
                var sms   = string.Format(valuePair.SmsBody, homa1.CongressTitle, name, homaRefereePanelUrl, valuePair.obj.Username, valuePair.obj.PasswordWithoutHash);

                if (custommessage != null)
                {
                    if (!string.IsNullOrEmpty(custommessage.EmailText))
                    {
                        email = custommessage.EmailText.Replace($"[{Enums.RefereeMessageKey.FullName.ToString()}]", name);
                        email = email.Replace($"[{Enums.RefereeMessageKey.Username.ToString()}]", referee.Username);
                        email = email.Replace($"[{Enums.RefereeMessageKey.Email.ToString()}]", referee.EnterpriseNode.Email);
                        email = email.Replace($"[{Enums.RefereeMessageKey.CongressTitle.ToString()}]", homa1.CongressTitle);
                        email = email.Replace($"[{Enums.RefereeMessageKey.Password.ToString()}]", valuePair.obj.PasswordWithoutHash);
                        email = email.Replace($"[{Enums.RefereeMessageKey.CongressAddress.ToString()}]", homaCompleteUrl);
                    }
                    if (!string.IsNullOrEmpty(custommessage.SmsText))
                    {
                        sms = custommessage.SmsText.Replace($"[{Enums.RefereeMessageKey.FullName.ToString()}]", name);
                        sms = sms.Replace($"[{Enums.RefereeMessageKey.Username.ToString()}]", referee.Username);
                        sms = sms.Replace($"[{Enums.RefereeMessageKey.Email.ToString()}]", referee.EnterpriseNode.Email);
                        sms = sms.Replace($"[{Enums.RefereeMessageKey.CongressTitle.ToString()}]", homa1.CongressTitle);
                        sms = sms.Replace($"[{Enums.RefereeMessageKey.Password.ToString()}]", valuePair.obj.PasswordWithoutHash);
                        sms = sms.Replace($"[{Enums.RefereeMessageKey.CongressAddress.ToString()}]", homaCompleteUrl);
                    }
                }


                var inform = new Message.Tools.ModelView.MessageModel()
                {
                    Email      = referee.EnterpriseNode.Email,
                    Mobile     = referee.EnterpriseNode.Cellphone,
                    EmailTitle = homa1.DescriptionField,
                    EmailBody  = email,
                    SMSBody    = sms
                };
                new HomaBO().SendInform((byte)config.RefereeInformType, inform, config, homa1.CongressTitle);
                MessageComponenet.SentInternalMessageInstance.MailBoxFacade.SendInternalMail(homa1.OwnerId, config.CongressId,
                                                                                             new[] { referee.Id.ToString() }, homa1.CongressTitle, inform.SMSBody);
            }
        }