public string GetSMSTemplate(ENotice eNotice, dynamic model) { string header = string.Empty; string footer = string.Empty; switch (eNotice) { case ENotice.Error: case ENotice.Info: { string body = System.Web.HttpUtility.HtmlDecode(RenderViewToString(BasePath + "\\SMS\\Info.cshtml", model)); return(header + body + footer); } case ENotice.Contact: { string body = System.Web.HttpUtility.HtmlDecode(RenderViewToString(BasePath + "\\SMS\\Info.cshtml", model)); return(header + body + footer); } case ENotice.SubscriptionActive: { string body = System.Web.HttpUtility.HtmlDecode(RenderViewToString(BasePath + "\\SMS\\Info.cshtml", model)); return(header + body + footer); } case ENotice.SubscriptionExpired: { string body = System.Web.HttpUtility.HtmlDecode(RenderViewToString(BasePath + "\\SMS\\Info.cshtml", model)); return(header + body + footer); } case ENotice.SubscriptionFinished: { string body = System.Web.HttpUtility.HtmlDecode(RenderViewToString(BasePath + "\\SMS\\Info.cshtml", model)); return(header + body + footer); } default: { string body = System.Web.HttpUtility.HtmlDecode(RenderViewToString(BasePath + "\\SMS\\Info.cshtml", model)); return(header + body + footer); } } }
public string GetMailTemplate(ENotice eNotice, dynamic model, string locale = "es") { string basepath = BasePath + "\\Shared\\Emails\\_" + locale; string headertemplate = basepath + "\\_EmailHeader.cshtml"; string footertemplate = basepath + "\\_EmailFooter.cshtml"; string bodytemplate = string.Empty; switch (eNotice) { case ENotice.CrewNotice: { footertemplate = basepath + "\\_EmailFooterCrew.cshtml"; bodytemplate = basepath + "\\CrewNotice.cshtml"; } break; case ENotice.Error: case ENotice.Info: { bodytemplate = basepath + "\\Info.cshtml"; } break; case ENotice.Contact: { bodytemplate = basepath + "\\Contact.cshtml"; } break; case ENotice.NewRegistration: { bodytemplate = basepath + "\\NewRegistration.cshtml"; } break; case ENotice.SubscriptionActive: { bodytemplate = basepath + "\\SubscriptionActivation.cshtml"; } break; case ENotice.SubscriptionExpired: { bodytemplate = basepath + "\\SubscriptionExpiration.cshtml"; } break; case ENotice.SubscriptionFinished: { bodytemplate = basepath + "\\SubscriptionFinish.cshtml"; } break; case ENotice.Monitor: { headertemplate = string.Empty; bodytemplate = basepath + "\\Monitor.cshtml"; footertemplate = string.Empty; } break; } string template = string.Empty; string result = string.Empty; try { //Header template = headertemplate; result = !string.IsNullOrEmpty(template) ? RenderViewToString(template, model) : string.Empty; //Body template = bodytemplate; result += !string.IsNullOrEmpty(template) ? RenderViewToString(template, model) : string.Empty; //Footer template = footertemplate; result += !string.IsNullOrEmpty(template) ? RenderViewToString(template, model) : string.Empty; return(result); } catch (Exception ex) { molLogger.LogError(ex); throw new iQException(string.Format(Resources.Errors.VIEW_TEMPLATE_NOT_FOUND, template), iQExceptionCode.RESOURCE_NOT_FOUND); } }