daily pastebin goal
1%
SHARE
TWEET

Untitled

a guest May 31st, 2017 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private void btnChange_Click(object sender, EventArgs e)
  2.         {
  3.             string sUsername = txtUsername.Text;
  4.             string sOPassword = txtOriginalPassword.Text;
  5.             string sNPasswprd = txtNewPassword.Text;
  6.             string sCPassword = txtConfirmPassword.Text;
  7.  
  8.             DataClasses1DataContext dc = new DataClasses1DataContext();
  9.  
  10.             var loginCheck =
  11.                 dc.GetTable<User>().SingleOrDefault(credentials => credentials.Username == sUsername && credentials.Password == sOPassword);
  12.  
  13.             if (sNPasswprd == sCPassword)
  14.             {
  15.                 Table<User> tUser = dc.GetTable<User>();
  16.  
  17.                 loginCheck.Password = sCPassword;
  18.                 loginCheck.Username = sUsername;
  19.                 dc.SubmitChanges();
  20.                 this.Close();
  21.             }
  22.             else
  23.             {
  24.                 MessageBox.Show("Unfortunately the Password for that User Account does not exist, or you have incorrectly typed your new passwords!", "Password Change Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
  25.  
  26.                 this.Close();
  27.             }
  28.                
  29.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top