public JsonResult changePasswordAjax(string currentPassword, string newPassword) { try { StaffDetails staff = Fingerprints.Common.FactoryInstance.Instance.CreateInstance <StaffDetails>(); string result = LoginData.ChangePassword(currentPassword.Trim(), newPassword.Trim(), staff.UserId.ToString()); if (result == "1") { string imagepath = UrlExtensions.LinkToRegistrationProcess("Content/img/logo_email.png"); Thread thread = new Thread(delegate() { SendMail.Sendchangepassword(staff.EmailID, newPassword.Trim(), string.Empty, Server.MapPath("~/MailTemplate"), imagepath); }); thread.Start(); } return(Json(result)); } catch (Exception Ex) { return(Json(Ex.Message)); } }
public ActionResult ForgetPasswordagency(string EmailId) { try { string RandomPassword = GenerateRandomPassword.GenerateRandomCode(10); if (!LoginData.CheckEmailIdExist(EmailId, RandomPassword)) { ViewBag.message = "If the entered email id exists then new password has been sent to the entered email id."; return(View()); } string imagepath = UrlExtensions.LinkToRegistrationProcess("Content/img/logo_email.png"); bool isResult = SendMail.Sendchangepassword(EmailId, RandomPassword, string.Empty, Server.MapPath("~/MailTemplate"), imagepath); if (isResult) { ViewBag.message = "If the entered email id exists then new password has been sent to the entered email id."; } else { ViewBag.message = "Error occurred. Please, try again later."; } return(View()); } catch (Exception Ex) { ViewBag.message = Ex.Message; return(View()); } }
public void GetRegisteredParentAndMail(Events events) { try { int CheckMode = events.CheckMode; string DefaultStatus = events.DefaultStatus; string ChangeStatus = events.ChangeStatus; string DefaultDate = events.DefaultDate; string ChangeDate = events.ChangeDate; string DefaultTime = events.DefaultTime; string ChangeTime = events.ChangeTime; string Enc_EventId = EncryptDecrypt.Encrypt64(events.Eventid.ToString()); events = new EventsData().GetRegisteredParentEmailData(events); string path; using (var sr = new StreamReader(Server.MapPath("~/MailTemplate/EmailCancel.html"))) { path = sr.ReadToEnd(); } string link = UrlExtensions.LinkToRegistrationProcess("/Login/loginagency"); string imagepath = UrlExtensions.LinkToRegistrationProcess("Content/img/logo_email.png"); string yesPath = UrlExtensions.LinkToRegistrationProcess("/Events/MailMessage"); string noPath = UrlExtensions.LinkToRegistrationProcess("/Events/ConfirmMail"); string mode = "3"; string[] array = { events.EventStatusDescription, events.EventDateDescription, events.EventTimeDescription }; string FromEmail = Session["EmailID"].ToString(); string reason = string.Join(",", array.Where(s => !string.IsNullOrEmpty(s))); if (events.RegisteredMembers != null) { if (events.RegisteredMembers.Count() > 0) { foreach (var item in events.RegisteredMembers) { System.Threading.Thread thread = new System.Threading.Thread(delegate() { StringBuilder stringBuilder = new StringBuilder(); if (CheckMode == 1)//status { path = path.Replace("{Name}", item.Text).Replace("{WorkShopName}", events.Workshopname). Replace("{EventDate}", events.EventDate). Replace("{EventTime}", events.EventTime). Replace("{CenterName}", events.CenterName) .Replace("{url}", link). Replace("{Path}", imagepath). Replace("{ChangeReason}", reason). Replace("{YesPath}", yesPath). Replace("{NoPath}", noPath). Replace("{Email}", item.Value). Replace("{EventId}", Enc_EventId). Replace("{DefaultStatus}", DefaultStatus). Replace("{ChangeStatus}", ChangeStatus). Replace("{StatusContent}", "changed to"). Replace("{DefaultDate}", "").Replace("{ChangeDate}", ""). Replace("{DefaultTime}", "").Replace("{ChangeTime}", ""). Replace("{DateContent}", "").Replace("{TimeContent}", ""); path = path.Replace("{Name}", item.Text). Replace("{WorkShopName}", events.Workshopname). Replace("{EventDate}", events.EventDate). Replace("{EventTime}", events.EventTime). Replace("{CenterName}", events.CenterName). Replace("{url}", link).Replace("{Path}", imagepath). Replace("{ChangeReason}", reason).Replace("{YesPath}", yesPath). Replace("{NoPath}", noPath).Replace("{Email}", item.Value). Replace("{EventId}", Enc_EventId).Replace("{DefaultStatus}", DefaultStatus). Replace("{ChangeStatus}", ChangeStatus).Replace("{StatusContent}", "changed to"). Replace("{DefaultDate}", DefaultDate).Replace("{ChangeDate}", "").Replace("{DefaultTime}", DefaultTime). Replace("{ChangeTime}", "").Replace("{DateContent}", "").Replace("{TimeContent}", ""); } else if (CheckMode == 2)//date { path = path.Replace("{Name}", item.Text). Replace("{WorkShopName}", events.Workshopname). Replace("{EventDate}", events.EventDate). Replace("{EventTime}", events.EventTime). Replace("{CenterName}", events.CenterName). Replace("{url}", link). Replace("{Path}", imagepath). Replace("{ChangeReason}", reason). Replace("{YesPath}", yesPath). Replace("{NoPath}", noPath). Replace("{Email}", item.Value). Replace("{EventId}", Enc_EventId). Replace("{DefaultDate}", DefaultDate). Replace("{ChangeDate}", ChangeDate). Replace("{DateContent}", "changed to"). Replace("{DefaultStatus}", DefaultStatus). Replace("{ChangeStatus}", ""). Replace("{DefaultTime}", DefaultTime). Replace("{ChangeTime}", ""). Replace("{StatusContent}", ""). Replace("{TimeContent}", ""); } else if (CheckMode == 3)//time { path = path.Replace("{Name}", item.Text). Replace("{WorkShopName}", events.Workshopname). Replace("{EventDate}", events.EventDate). Replace("{EventTime}", events.EventTime). Replace("{CenterName}", events.CenterName). Replace("{url}", link). Replace("{Path}", imagepath). Replace("{ChangeReason}", reason). Replace("{YesPath}", yesPath). Replace("{NoPath}", noPath). Replace("{Email}", item.Value). Replace("{EventId}", Enc_EventId). Replace("{DefaultTime}", DefaultTime). Replace("{ChangeTime}", ChangeTime). Replace("{TimeContent}", "changed to"). Replace("{DefaultStatus}", DefaultStatus). Replace("{ChangeStatus}", ""). Replace("{DefaultDate}", DefaultDate). Replace("{ChangeDate}", ""). Replace("{StatusContent}", ""). Replace("{DateContent}", ""); } SendMail.SendEventChangedEmail(item.Value, path, FromEmail); }); thread.Start(); } } } } catch (Exception ex) { clsError.WriteException(ex); } }