public void InitView(PreviewMode pMode, dtoMailMessagePreview dtoContent, String recipients = "", List <dtoBaseGenericFile> attachments = null) { View.DisplayOptions = (pMode == PreviewMode.MailSent); Person person = CurrentManager.GetPerson(UserContext.CurrentUserID); if (!UserContext.isAnonymous && person != null) { View.isInitialized = true; LoadDisplayItems(pMode, attachments != null && attachments.Any()); switch (pMode) { case PreviewMode.MailToSend: if (String.IsNullOrEmpty("recipients")) { recipients = person.Mail; } View.AllowSendMail = View.AllowSendMail && (View.EditAddressTo || !String.IsNullOrEmpty(recipients)); View.LoadPreviewMessage(pMode, dtoContent, recipients, attachments); break; } //View.AllowSendMail = (pMode == PreviewMode.MailToSend && (View.EditAddressTo || !String.IsNullOrEmpty(addressTo))); //View.LoadMail(dtoContent.Settings. } else { View.HideContent(); } }
public void InitView(PreviewMode pMode, String languageCode, lm.Comol.Core.DomainModel.Languages.ItemObjectTranslation content, SmtpServiceConfig smtpConfig, String recipients = "", List <String> modules = null, MessageSettings settings = null, Int32 idCommunity = -1, ModuleObject obj = null) { View.DisplayOptions = (pMode == PreviewMode.MailSent); Person person = CurrentManager.GetPerson(UserContext.CurrentUserID); if (!UserContext.isAnonymous && person != null) { View.isInitialized = true; switch (pMode) { case PreviewMode.TemplateDisplay: case PreviewMode.MailToSend: if (String.IsNullOrEmpty("recipients")) { recipients = person.Mail; } View.AllowSendMail = settings != null && View.AllowSendMail && (View.EditAddressTo || !String.IsNullOrEmpty(recipients)); Language dLanguage = CurrentManager.GetDefaultLanguage(); Language language = CurrentManager.GetLanguageByCodeOrDefault(languageCode, true); if (modules != null) { String organizationName = ""; Community community = null; if (idCommunity > 0) { community = CurrentManager.GetCommunity(idCommunity); if (community != null) { organizationName = CurrentManager.GetOrganizationName(community.Id); } } if (community != null && idCommunity > 0) { content = View.ParseContent((language == null) ? 0 : language.Id, languageCode, content, modules, community, person, organizationName, obj); } else { content = View.ParseContent((language == null) ? 0 : language.Id, languageCode, content, modules, idCommunity, (community == null || idCommunity < 1) ? View.GetPortalName((language != null) ? language.Id : 0) : community.Name, person, organizationName, obj); } } if (settings != null) { dtoMailMessagePreview dtoContent = new dtoMailMessagePreview((language != null) ? language.Id : 0, dLanguage, new dtoMailMessage() { UserSubject = content.Subject, Body = content.Body }, settings, smtpConfig); View.LoadPreviewTemplateMessage(pMode, dtoContent, recipients); } else { View.LoadPreviewTemplateMessage(pMode, content); } break; } } else { View.HideContent(); } }