Beispiel #1
0
        protected void btnValidate_Click(object sender, EventArgs e)
        {
            try
            {
                string validationLink = string.Empty;

                Business.HR.EmployeeMaster objEmployeeMaster = new Business.HR.EmployeeMaster();
                DataTable dtValidate = objEmployeeMaster.ValidateForgotPassword(txtUserName.Text.Trim(), txtEmailId.Text.Trim());

                if (dtValidate != null && dtValidate.Rows.Count > 0)
                {
                    validationLink = string.Concat("EmployeeId=", dtValidate.Rows[0]["EmployeeMasterId"].ToString(), "&Email=", txtEmailId.Text.Trim(), "&UserName="******"&Timestamp=", DateTime.Now.ToFileTime(), "&Source=ForgotPassword");

                    validationLink = "http://" + HttpContext.Current.Request.Url.Authority + "/ValidateLinks.aspx?enc=" + validationLink.EncryptQueryString();

                    SendEmailValidationLink(txtEmailId.Text.Trim(), dtValidate.Rows[0]["EmployeeName"].ToString(), validationLink);
                    lblUserMessage.InnerText = "Validation link is sent to your office email id.";
                }
                else
                {
                    lblUserMessage.InnerText = "Username and Email Id not found!";
                }
            }
            catch (Exception ex)
            {
                lblUserMessage.InnerText = ex.Message;
                ex.WriteException();
            }
        }