Пример #1
0
        protected void ChangePassword_Click(object sender, EventArgs e)
        {
            try
            {
                ws.GrantAccess(_strUserName);
                objUserInfo = ws.Password(_strUserName,
                                          txtEmail.ToString(), txtPhone.ToString(),
                                          W2GOWCF.UsersHelperPasswordActionType.Change,
                                          PrePassword.ToString(),
                                          NPassword.ToString()).ToList();
                string x = "test";
            }
            catch (Exception ex)
            {
                lblerror.Text = ex.Message;

                lblerror.Visible = true;
            }
        }
Пример #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);
     }
 }