public DateTime DateReminder(Guid ID, string type) { DateTime datereminder = DateTime.MinValue; try { List <RegistrationEmailSent> registrationEmailSentList = RegistrationEmailSentList.GetRegistrationEmailSentList() .Where(x => x.EntryType == type) .OrderByDescending(y => y.DateCreated).ToList(); List <Registration> registrationList = RegistrationList.GetRegistrationList("", "", "").Where(x => x.Id == ID).ToList(); List <Entry> entryList = EntryList.GetEntryList(Guid.Empty, ID, "").ToList(); RegistrationEmailSent registrationEmailSent = (from entry in entryList join res in registrationEmailSentList on entry.Id equals res.EntryId orderby res.DateCreated descending select res).FirstOrDefault(); if (!(registrationEmailSent.DateCreated == DateTime.MaxValue) && !(registrationEmailSent.DateCreated == DateTime.MinValue)) { datereminder = registrationEmailSent.DateCreated; } } catch { datereminder = GeneralFunctionEffie2017App.GetDateReminder(ID, type); } return(datereminder); }
protected void btnSendPassword_Click(object sender, EventArgs e) { lblMsg.Text = ""; if (!txtLoginId.Text.Trim().Equals("")) { Effie2017.App.RegistrationList registrationList = Effie2017.App.RegistrationList.GetRegistrationList(txtLoginId.Text, "", StatusRegistration.OK); if (registrationList.Count == 1) { //string host = System.Configuration.ConfigurationManager.AppSettings["emailHost"].ToString(); //int port = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["emailport"].ToString()); //string emailFromName = System.Configuration.ConfigurationManager.AppSettings["emailFromName"].ToString(); //string emailFrom = System.Configuration.ConfigurationManager.AppSettings["emailFrom"].ToString(); //string emailFromLogin = System.Configuration.ConfigurationManager.AppSettings["emailFromLogin"].ToString(); //string emailFromPassword = System.Configuration.ConfigurationManager.AppSettings["emailFromPassword"].ToString(); //string emailTo = ""; //string emailCc = System.Configuration.ConfigurationManager.AppSettings["emailCc"].ToString(); //string emailBcc = System.Configuration.ConfigurationManager.AppSettings["emailBcc"].ToString(); //string emailSubject = System.Configuration.ConfigurationManager.AppSettings["emailSubjectForgetPassword"].ToString(); //bool isHTML = true; //string emailMessage = ""; //emailTo = registrationList[0].Email; //emailMessage = GeneralFunction.ReadTxtFile(System.Configuration.ConfigurationManager.AppSettings["storagePhysicalPath"].ToString() + "emailTemplate\\UserPassword.htm"); //emailMessage = emailMessage.Replace("##LoginId##", registrationList[0].Email); //emailMessage = emailMessage.Replace("##Password##", registrationList[0].Password); //GeneralFunction.SendEmail(host, port, emailFromName, emailFrom, emailFromLogin, emailFromPassword, emailTo, emailCc, emailBcc, emailSubject, isHTML, emailMessage); Registration reg = registrationList[0]; string password = GeneralFunction.CreatePassword(8); GeneralFunction.LogPasswordRegistration(ref reg, password); Email.SendForgotPasswordEmail(reg, password, false); lblMsg.Text = "Password Sent.<br>"; } else { lblMsg.Text = "Login is invalid.<br>"; } } else { lblMsg.Text = "login is required"; } }