Пример #1
0
 public void SendInform(Homa homa, byte type, Message.Tools.ModelView.MessageModel inform)
 {
     try
     {
         new HomaBO().SendInform(type, inform, homa.Configuration, homa.CongressTitle);
     }
     catch (Exception ex)
     {
         throw new KnownException(ex.Message, ex);
     }
 }
Пример #2
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);
            }
        }
Пример #3
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);
            }
        }
Пример #4
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);
            }
        }
Пример #5
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);
            }
        }