private void ConfigureEmailContent()
        {
            var emailType = EmailProfileInformation.FirstOrDefault(p => p.EmailType.Name == "OrderConfirmation");

            if (emailType.EmailProfile.EmailContents.All(x => x.CultureCode != "en-US"))
            {
                EmailContent newEmailContent = new EmailContent();
                newEmailContent.EmailProfile = emailType.EmailProfile;
                newEmailContent.CultureCode  = "en-US";
                newEmailContent.EmailType    = emailType.EmailType;
                newEmailContent.Subject      = "Order Confirmation";

                emailType.EmailProfile.EmailContents.Add(newEmailContent);
            }
            if (emailType.EmailProfile.EmailContents.All(x => x.CultureCode != "en-GB"))
            {
                EmailContent newEmailContent = new EmailContent();
                newEmailContent.EmailProfile = emailType.EmailProfile;
                newEmailContent.CultureCode  = "en-GB";
                newEmailContent.EmailType    = emailType.EmailType;
                newEmailContent.Subject      = "Order Confirmation";

                emailType.EmailProfile.EmailContents.Add(newEmailContent);
            }
        }
        private void ConfigureEmailContent()
        {
            var docType = ContentTypeService.Get("Email");

            if (docType == null)
            {
                return;
            }

            var emails       = ContentService.GetPagedOfType(docType.Id, 0, int.MaxValue, out var b, null);
            var emailContent = emails.FirstOrDefault(e => e.Name == "Order Confirmation Email");

            if (emailContent == null)
            {
                return;
            }

            var emailType = EmailProfileInformation.FirstOrDefault(p => p.EmailType.Name == "OrderConfirmation");

            if (emailType.EmailProfile.EmailContents.All(x => x.CultureCode != "en-US"))
            {
                EmailContent newEmailContent = new EmailContent();
                newEmailContent.EmailProfile = emailType.EmailProfile;
                newEmailContent.CultureCode  = "en-US";
                newEmailContent.EmailType    = emailType.EmailType;
                newEmailContent.Subject      = "Order Confirmation";

                emailType.EmailProfile.EmailContents.Add(newEmailContent);
            }

            if (emailType.EmailProfile.EmailContents.All(x => x.CultureCode != "en-GB"))
            {
                EmailContent newEmailContent = new EmailContent();
                newEmailContent.EmailProfile = emailType.EmailProfile;
                newEmailContent.CultureCode  = "en-GB";
                newEmailContent.EmailType    = emailType.EmailType;
                newEmailContent.Subject      = "Order Confirmation";

                emailType.EmailProfile.EmailContents.Add(newEmailContent);
            }

            foreach (var content in emailType.EmailProfile.EmailContents)
            {
                content.ContentId = emailContent.GetUdi().Guid.ToString();
                content.Save();
            }
        }
예제 #3
0
        private void ConfigureEmailContent()
        {
            var docType = DocumentType.GetAllAsList().FirstOrDefault(t => t.Alias == "uCommerceEmail");

            if (docType == null)
            {
                return;
            }

            var emails       = Document.GetDocumentsOfDocumentType(docType.Id);
            var emailContent = emails.FirstOrDefault(e => e.Text == "Order Confirmation Email");

            if (emailContent == null)
            {
                return;
            }

            var emailType = EmailProfileInformation.FirstOrDefault(p => p.EmailType.Name == "OrderConfirmation");

            if (emailType.EmailProfile.EmailContents.All(x => x.CultureCode != "en-US"))
            {
                EmailContent newEmailContent = new EmailContent();
                newEmailContent.EmailProfile = emailType.EmailProfile;
                newEmailContent.CultureCode  = "en-US";
                newEmailContent.EmailType    = emailType.EmailType;
                newEmailContent.Subject      = "Order Confirmation";

                emailType.EmailProfile.EmailContents.Add(newEmailContent);
            }
            if (emailType.EmailProfile.EmailContents.All(x => x.CultureCode != "en-GB"))
            {
                EmailContent newEmailContent = new EmailContent();
                newEmailContent.EmailProfile = emailType.EmailProfile;
                newEmailContent.CultureCode  = "en-GB";
                newEmailContent.EmailType    = emailType.EmailType;
                newEmailContent.Subject      = "Order Confirmation";

                emailType.EmailProfile.EmailContents.Add(newEmailContent);
            }

            foreach (var content in emailType.EmailProfile.EmailContents)
            {
                content.ContentId = emailContent.Id.ToString();
                content.Save();
            }
        }