Example #1
0
 private void MakeEmptyForm()
 {
     OPassword.Focus();
     CmpOPassword.Text = CPassword.Text = OPassword.Text = Password.Text = string.Empty;
     ReportGrid(StrCondition);
 }
Example #2
0
 private void Button3_Click_1(System.Object sender, System.EventArgs e)
 {
     try
     {
         if (string.IsNullOrEmpty(UName.Text.Trim()))
         {
             MessageBox.Show("Plz.. Enter UserName..");
         }
         else if (string.IsNullOrEmpty(OPassword.Text.Trim()))
         {
             MessageBox.Show("Plz.. Enter Old Password..");
         }
         else if (string.IsNullOrEmpty(NPassword.Text.Trim()) | string.IsNullOrEmpty(OPassword.Text.Trim()))
         {
             MessageBox.Show("Plz.. Enter New Password and Confirm it..");
         }
         else if (NPassword.Text != CPassword.Text)
         {
             MessageBox.Show("Plz.. Password You Typed Did Not Match .. Plz Enter New Password Both Boxes..");
         }
         else if (string.IsNullOrEmpty(AK.Text.Trim()))
         {
             MessageBox.Show("Plz.. Enter Access Key..");
         }
         else
         {
             con = new SqlConnection("Data Source=.\\SQLEXPRESS;Initial Catalog=Bus_System;Integrated Security=True");
             con.Open();
             cmd = new SqlCommand("select username,password from Newuser where username='******' and password='******'", con);
             dr  = cmd.ExecuteReader();
             dr.Read();
             if (dr.HasRows)
             {
                 dr.Close();
                 cmd = new SqlCommand("select * from  AKPrivate where KeyIMP='" + AK.Text + "'", con);
                 dr  = cmd.ExecuteReader();
                 dr.Read();
                 if (dr.HasRows)
                 {
                     dr.Close();
                     cmd = new SqlCommand("Update Newuser Set password='******' Where username='******'", con);
                     cmd.ExecuteNonQuery();
                     MessageBox.Show("Password Changed Successfully..!");
                     AK.Clear();
                     NPassword.Clear();
                     CPassword.Clear();
                     OPassword.Clear();
                     UName.Clear();
                 }
                 else
                 {
                     MessageBox.Show("Wrong Access Key..!");
                 }
             }
             else
             {
                 MessageBox.Show("Wrong Username and Password..!");
             }
             dr.Close();
             con.Close();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Sorry.. Something Went Wrong..! Or " + ex.Message);
     }
 }