public static bool ResetPassword(string strEmail) { bool isReset = false; string strTempPass = string.Empty; string HashPassword = string.Empty; string HashSalt = string.Empty; string strReturn = string.Empty; strTempPass = DateTime.Now.Millisecond.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Day.ToString(); HashPassword = SecurityObj.SecurityObj.ComputeHash(strTempPass, "SHA1", null); HashSalt = SecurityObj.SecurityObj.GetSalt("SHA1", HashPassword); List <clsUser> objEmp = new List <clsUser>(); objEmp = UserDAL.SelectDynamicUser("EmailId = '" + strEmail + "'", "AuthorisedUserId"); if (objEmp != null) { if (objEmp.Count > 0) { clsUser objEmpSelect = new clsUser(); objEmpSelect = UserDAL.SelectUserById(Convert.ToInt32(objEmp[0].AuthorisedUserId)); if (objEmpSelect != null) { objEmpSelect.Password = HashPassword; objEmpSelect.TempPassword = strTempPass; objEmpSelect.salt = HashSalt; objEmpSelect.IsActive = 0; if (UserDAL.UpdateUser(objEmpSelect)) { isReset = true; } #region Calling API to rest the Password. try { //#region Generating email message with the TEMP Password for the new ADMIN. //StringBuilder strbEmailMSG = new StringBuilder(); //strbEmailMSG.Append(objEmpSelect.FName + " " + objEmpSelect.LName + "," + System.Environment.NewLine + System.Environment.NewLine); //strbEmailMSG.Append("LRCA Application created a TEMPORARY PASSWORD for your new account." + System.Environment.NewLine + " Please, use " + objEmpSelect.EmailId + " as your USERNAME and " + objEmpSelect.TempPassword + " as a TEMPORARY PASSWORD to login on the LRCA System." + System.Environment.NewLine); //strbEmailMSG.Append("To access LRCA System please visit " + AppConstants.ConstAppURL + "." + System.Environment.NewLine); //strbEmailMSG.Append(System.Environment.NewLine + System.Environment.NewLine); //strbEmailMSG.Append("If you require any further information, feel free to contact " + AppConstants.ConstHelpPhone + System.Environment.NewLine + " or Email us @" + AppConstants.ConstHelpEmail + System.Environment.NewLine + System.Environment.NewLine); //#endregion //GlobalMethods.SendEmail(objEmpSelect.EmailId, "", strbEmailMSG, "LRCA System Account Reset!"); Mailing.SendResetPasswordMail(objEmpSelect.AuthorisedUserId.ToString(), objEmpSelect.EmailId, strTempPass); } catch (Exception ex) { ErrorHandler.ErrorLogging(ex, false); ErrorHandler.ReadError(); } #endregion } } } // var objEmpResetPass = JsonConvert.SerializeObject(objEmp); return(isReset); }