Exemple #1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (txtUsername.Text == "" && txtEmail.Text == "")
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "AlertBox('User ID or Email ID is Required')", true);
                return;
            }
            BusinessObjects bo     = new BusinessObjects();
            string          strPwd = bo.ForgotPwd(txtUsername.Text, txtEmail.Text);
            //EncryptionDecryption crypt = new EncryptionDecryption();
            string strDecryptedPwd = EncryptDecrypt.Decrypt(strPwd);

            if (strDecryptedPwd == "" || strDecryptedPwd == null)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "AlertBox('Invalid User ID or Email ID')", true);
                return;
            }

            string strEmail = "";

            if (txtUsername.Text != "")
            {
                strEmail = bo.GetEmailByUser(txtUsername.Text);
                if (strEmail == "" || strEmail == null)
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "AlertBox('Invalid User ID')", true);
                    return;
                }
            }
            if (txtEmail.Text != "")
            {
                int retVal = bo.ChkEmailID(txtEmail.Text);
                if (retVal == 1)
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "AlertBox('Invalid Email ID')", true);
                    return;
                }
                strEmail = txtEmail.Text;
            }
            //SendMail(strEmail, strDecryptedPwd);Uncomment123
            Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "ReAlertBox()", true);
        }