Beispiel #1
0
        public ActionResult EmailTemplateEdit(int id)
        {
            TempData["page_title"] = "Edit Email Template";
            GRINGlobalService          grinGlobalService          = new GRINGlobalService(this.AuthenticatedUserSession.Environment);
            EmailTemplateEditViewModel emailTemplateEditViewModel = new EmailTemplateEditViewModel();
            EmailTemplate emailTemplate = new EmailTemplate();

            try
            {
                emailTemplate = grinGlobalService.GetEmailTemplate(id);
                if (emailTemplate == null)
                {
                    throw new NullReferenceException(String.Format("No email template found for id {0}", id));
                }
                emailTemplateEditViewModel.ID                       = emailTemplate.ID;
                emailTemplateEditViewModel.Title                    = emailTemplate.Title;
                emailTemplateEditViewModel.SenderAddress            = emailTemplate.From;
                emailTemplateEditViewModel.Subject                  = emailTemplate.Subject;
                emailTemplateEditViewModel.Body                     = emailTemplate.Body;
                emailTemplateEditViewModel.CreatedDate              = emailTemplate.CreatedDate;
                emailTemplateEditViewModel.CreatedByCooperatorID    = emailTemplate.CreatedByCooperatorID;
                emailTemplateEditViewModel.CreatedByCooperatorName  = emailTemplate.CreatedByCooperatorName;
                emailTemplateEditViewModel.ModifiedDate             = emailTemplate.ModifiedDate;
                emailTemplateEditViewModel.ModifiedByCooperatorID   = emailTemplate.ModifiedByCooperatorID;
                emailTemplateEditViewModel.ModifiedByCooperatorName = emailTemplate.ModifiedByCooperatorName;
                return(View("~/Views/GRINGlobal/WebOrder/Email/Edit.cshtml", emailTemplateEditViewModel));
            }
            catch (Exception ex)
            {
                Log.Error(ex, ex.Message);
                return(RedirectToAction("InternalServerError", "Error"));
            }
        }
Beispiel #2
0
        public PartialViewResult _EmailTemplateView(int id)
        {
            TempData["page_title"] = "View Email Template";
            GRINGlobalService          grinGlobalService          = new GRINGlobalService(this.AuthenticatedUserSession.Environment);
            EmailTemplateEditViewModel emailTemplateEditViewModel = new EmailTemplateEditViewModel();
            EmailTemplate emailTemplate = new EmailTemplate();

            try
            {
                emailTemplate = grinGlobalService.GetEmailTemplate(id);
                if (emailTemplate == null)
                {
                    throw new NullReferenceException(String.Format("No email template found for id {0}", id));
                }
                emailTemplateEditViewModel.ID            = emailTemplate.ID;
                emailTemplateEditViewModel.Title         = emailTemplate.Title;
                emailTemplateEditViewModel.SenderAddress = emailTemplate.From;
                emailTemplateEditViewModel.Subject       = emailTemplate.Subject;
                emailTemplateEditViewModel.Body          = emailTemplate.Body;
                return(PartialView("~/Views/GRINGlobal/WebOrder/Email/_Detail.cshtml", emailTemplateEditViewModel));
            }
            catch (Exception ex)
            {
                Log.Error(ex, ex.Message);
                return(PartialView("~/Views/Error/_Error.cshtml"));
            }
        }