public static string GetUserEmail(string username, Int32 PortalID) { MessageManagementController objController = new MessageManagementController(); MessageManagementInfo objInfo = objController.GetUserEmail(username, PortalID); return(objInfo.Email); }
public static string GetUserActivationCode(string username, Int32 PortalID) { MessageManagementController objController = new MessageManagementController(); MessageManagementInfo objInfo = objController.GetUserActivationCode(username, PortalID); return(objInfo.UserId.ToString()); }
/// <summary> /// Replaces all the messagetoken in a messagetemple with their respective values. /// </summary> /// <param name="messageTemplate">Message template.</param> /// <param name="username">User's name.</param> /// <param name="PortalID">portalID.</param> /// <returns>Replaced message template.</returns> public static string ReplaceAllMessageToken(string messageTemplate, string username, Int32 PortalID) { MessageManagementController objController = new MessageManagementController(); MessageManagementInfo objInfo = objController.GetUserDetailsByUserName(username, PortalID); messageTemplate = messageTemplate.Replace("##Username##", username); messageTemplate = messageTemplate.Replace("##UserEmail##", objInfo.Email); messageTemplate = messageTemplate.Replace("##UserFirstName##", objInfo.FirstName); messageTemplate = messageTemplate.Replace("##UserLastName##", objInfo.LastName); messageTemplate = messageTemplate.Replace("##HostUrl##", GetCurrnetHostURL); messageTemplate = messageTemplate.Replace("##UserActivationCode##", EncryptionMD5.Encrypt(objInfo.UserID.ToString())); return(messageTemplate); }
public void SendMailNotificatiion(int storeId, int portalId, string cultureName, BookAnAppointmentInfo objInfo) { DateTime now; StoreSettingConfig ssc = new StoreSettingConfig(); string logosrc = ssc.GetStoreSettingsByKey(StoreSetting.StoreLogoURL, storeId, portalId, cultureName); string name = "Appointment Approval - Email"; List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >() { new KeyValuePair <string, object>("PortalID", (object)portalId), new KeyValuePair <string, object>("CultureName", cultureName), new KeyValuePair <string, object>("MessageTemplateTypeName", name) }; int messageTemplateTypeId = (new OracleHandler()).ExecuteNonQuery("usp_Aspx_GetMessageTemplateTypeID", parameter, "MessageTemplateID"); MessageManagementInfo template = (new MessageManagementController()).GetMessageTemplate(messageTemplateTypeId, portalId); string messageTemplate = template.Body; string src = string.Concat(HttpContext.Current.Request.ServerVariables["SERVER_NAME"], "/"); string receiverEmailID = objInfo.Email; string subject = template.Subject; string senderEmail = template.MailFrom; string headerMsg = string.Empty; string customMessage = ""; if (objInfo.AppointmentID > 0) { headerMsg = "status has been modified as follow."; } else if (objInfo.AppointmentID == 0) { headerMsg = "has been scheduled as following date and time."; } if (template != null) { string[] allToken = this.GetAllToken(messageTemplate); for (int i = 0; i < (int)allToken.Length; i++) { string token = allToken[i]; string str = token; if (str != null) { switch (str) { case "%LogoSource%": { string imgSrc = string.Concat(src, logosrc); messageTemplate = messageTemplate.Replace(token, imgSrc); break; } case "%DateTime%": { now = DateTime.Now; messageTemplate = messageTemplate.Replace(token, now.ToString("MM/dd/yyyy")); break; } case "%PreferredDate%": { now = objInfo.PreferredDate; messageTemplate = messageTemplate.Replace(token, now.ToString("MM/dd/yyyy")); break; } case "%PreferredTime%": { messageTemplate = messageTemplate.Replace(token, objInfo.PreferredTime); break; } case "%PreferredTimeInterval%": { messageTemplate = messageTemplate.Replace(token, objInfo.PreferredTimeInterval); break; } case "%AppointmentStatus%": { messageTemplate = messageTemplate.Replace(token, objInfo.AppointmentStatusName); break; } case "%ServerPath%": { messageTemplate = messageTemplate.Replace(token, src); break; } case "%DateYear%": { int year = DateTime.Now.Year; messageTemplate = messageTemplate.Replace(token, year.ToString()); break; } case "%AppointmentHeadingMessage%": { messageTemplate = messageTemplate.Replace(token, headerMsg); break; } case "%AppointmentCustomMessage%": { messageTemplate = messageTemplate.Replace(token, customMessage); break; } case "%ServiceProductName%": { messageTemplate = messageTemplate.Replace(token, objInfo.ServiceProductName); break; } } } } } SageFrameConfig pagebase = new SageFrameConfig(); string emailSuperAdmin = pagebase.GetSettingsByKey(SageFrameSettingKeys.SuperUserEmail); string emailSiteAdmin = pagebase.GetSettingsByKey(SageFrameSettingKeys.SiteAdminEmailAddress); MailHelper.SendMailNoAttachment(senderEmail, receiverEmailID, subject, messageTemplate, emailSiteAdmin, emailSuperAdmin); }