///<summary> /// Method Name: SendSignUpConfirmationMail. /// Method Purpose: This method used to send signup confirmation mail. /// Author: Mena Armanyous. /// Modification Date: May 08, 2011. /// </summary> /// <param name="pCard">Card</param> /// <param name="pContact">Contact</param> public bool SendCardRegistrationConfirmationMail(bool pIsSecureConnection = false) { try { Contact pContact = _NavigationState.Contact; //forming the notification mail then sent EDM.PrimitivePOCO.PrimitiveCard lCard = new EDM.PrimitivePOCO.PrimitiveCard(this._NavigationState.RegisteredCard); EDM.PrimitivePOCO.SNDCommonMailParameters lCommonMail = new EDM.PrimitivePOCO.SNDCommonMailParameters(); // fix defect # 1346 //set aspnet_users for account string lUserName = SessionManager.Get <string>(enumSessionKeys.UserName) ?? string.Empty; if (string.IsNullOrEmpty(lUserName) && pContact != null && pContact.Account != null) { if (pContact.Account.aspnet_Users == null) { pContact.Account.aspnet_Users = new AccountAdministrationManager().GetAspNetUser(pContact.Account.aspnet_User_ID); } if (pContact.Account.aspnet_Users != null) { lUserName = (pContact.Account.aspnet_Users.UserName); } } lCommonMail.Username = lUserName; // end defect # 1346 string strhttp = "http"; if (HttpContext.Current.Request.IsSecureConnection == true) { strhttp += "s"; } string strSNDURL = System.Configuration.ConfigurationManager.AppSettings["SNDSiteUrl"]; string lFAQPath = "some url"; lCommonMail.FAQLink = string.Format("{0}://{1}{2}{3}", strhttp, strSNDURL, HttpContext.Current.Request.ApplicationPath, lFAQPath); EDM.PrimitivePOCO.PrimitiveContact lContact = new EDM.PrimitivePOCO.PrimitiveContact(pContact); NotificationManager notificationManager = new NotificationManager(enumNotificationType.Card_Registration, enumNotificationCategory.Account_Service, lContact, lCommonMail, lCard); //#Shady 14-5-2012 to get the email of the logged in user and to send the email to him Contact emailContact = AccountAdministrationManager.GetContactByUserName(lUserName); return(notificationManager.SendNotification(emailContact.Email)); //if (notificationManager.SendNotification(HttpUtility.HtmlEncode(pContact.Email))) //{ // if (pDiscardNavigationToConfirmationPage == false) // { DisplayConfirmationMessage(Resources.EmailNotification.SentEmailSuccess); } //} //else //{ // if (pDiscardNavigationToConfirmationPage == false) // { DisplayConfirmationMessage(Resources.EmailNotification.SentEmailFailed); } //} } catch (Exception ex) { if (!ExceptionHandler.IsUserFriendly(ex)) { ex.Data.Add("ClassName", "NavBase"); ex.Data.Add("MethodName", "SendCardRegistrationConfirmationMail"); ExceptionHandler.handle(ex); } else { throw ex; } return(false); } }
///<summary> /// Method Name: SendSignUpConfirmationMail. /// Method Purpose: This method used to send signup confirmation mail. /// Author: Mena Armanyous. /// Modification Date: May 08, 2011. /// </summary> /// <param name="pCard">Card</param> /// <param name="pContact">Contact</param> public bool SendCardRegistrationConfirmationMail(bool pIsSecureConnection = false) { try { Contact pContact = _NavigationState.Contact; //forming the notification mail then sent EDM.PrimitivePOCO.PrimitiveCard lCard = new EDM.PrimitivePOCO.PrimitiveCard(this._NavigationState.RegisteredCard); EDM.PrimitivePOCO.SNDCommonMailParameters lCommonMail = new EDM.PrimitivePOCO.SNDCommonMailParameters(); // fix defect # 1346 //set aspnet_users for account string lUserName = SessionManager.Get<string>(enumSessionKeys.UserName) ?? string.Empty; if (string.IsNullOrEmpty(lUserName) && pContact != null && pContact.Account != null) { if (pContact.Account.aspnet_Users == null) { pContact.Account.aspnet_Users = new AccountAdministrationManager().GetAspNetUser(pContact.Account.aspnet_User_ID); } if (pContact.Account.aspnet_Users != null) { lUserName = (pContact.Account.aspnet_Users.UserName); } } lCommonMail.Username = lUserName; // end defect # 1346 string strhttp = "http"; if (HttpContext.Current.Request.IsSecureConnection == true) { strhttp += "s"; } string strSNDURL = System.Configuration.ConfigurationManager.AppSettings["SNDSiteUrl"]; string lFAQPath = "some url"; lCommonMail.FAQLink = string.Format("{0}://{1}{2}{3}", strhttp, strSNDURL, HttpContext.Current.Request.ApplicationPath, lFAQPath); EDM.PrimitivePOCO.PrimitiveContact lContact = new EDM.PrimitivePOCO.PrimitiveContact(pContact); NotificationManager notificationManager = new NotificationManager(enumNotificationType.Card_Registration, enumNotificationCategory.Account_Service, lContact, lCommonMail, lCard); //#Shady 14-5-2012 to get the email of the logged in user and to send the email to him Contact emailContact = AccountAdministrationManager.GetContactByUserName(lUserName); return notificationManager.SendNotification(emailContact.Email); //if (notificationManager.SendNotification(HttpUtility.HtmlEncode(pContact.Email))) //{ // if (pDiscardNavigationToConfirmationPage == false) // { DisplayConfirmationMessage(Resources.EmailNotification.SentEmailSuccess); } //} //else //{ // if (pDiscardNavigationToConfirmationPage == false) // { DisplayConfirmationMessage(Resources.EmailNotification.SentEmailFailed); } //} } catch (Exception ex) { if (!ExceptionHandler.IsUserFriendly(ex)) { ex.Data.Add("ClassName", "NavBase"); ex.Data.Add("MethodName", "SendCardRegistrationConfirmationMail"); ExceptionHandler.handle(ex); } else { throw ex; } return false; } }