Beispiel #1
0
 protected void lbtnforgetpass_Click(object sender, EventArgs e)
 {
     if (txtforgrtid.Text == "")
     {
         ScriptManager.RegisterStartupScript(this, this.GetType(), "popup",
                                             "alert('Please Enter The User_ID.');", true);
         return;
     }
     else
     {
         a = txtforgrtid.Text;
     }
     try
     {
         dr = cls.FillDataReader("select R_password , R_EmailId from Registerlist where R_logid='" + a + "'");
         if (dr.Read())
         {
             if (!dr.IsDBNull(0))
             {
                 pass = dr.GetValue(0).ToString();
             }
             if (!dr.IsDBNull(1))
             {
                 emal = dr.GetValue(1).ToString();
             }
         }
         dr.Close();
         if (pass == null && emal == null)
         {
             ScriptManager.RegisterStartupScript(this, this.GetType(), "popup",
                                                 "alert('Not a valid User_ID.');", true);
             txtforgrtid.Text = "";
             return;
         }
         else
         {
             bool var = MailHelper.CheckForInternetConnection();
             if (var == true)
             {
                 MailHelper.SendMailMessage("*****@*****.**", emal, "Password", "Your Password:'******'");
                 ScriptManager.RegisterStartupScript(this, this.GetType(), "popup",
                                                     "alert('Password have been sent to your registered email_ID.');", true);
                 txtforgrtid.Text = "";
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this, this.GetType(), "popup",
                                                     "alert('Please Check Your Internet Connection.');", true);
                 txtforgrtid.Text = "";
             }
         }
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, this.GetType(), "popup",
                                             "alert(" + ex + ");", true);
     }
 }