private void button1_Click(object sender, EventArgs e) { try { string encPassword = ""; string username = txtUsername.Text.Trim(); string password = txtPassword.Text.Trim(); using (MD5 md5Hash = MD5.Create()) { encPassword = GetMd5Hash(md5Hash, password); } DAL.DataClasses1DataContext objdal = new DAL.DataClasses1DataContext(); DAL.User objuser = objdal.Users.FirstOrDefault(x => x.Username.Trim() == username && x.Password.Trim() == encPassword); if (objuser != null) { LoggedInUser.UserID = objuser.ID; LoggedInUser.Username = objuser.Username; Main objmain = new Main(); objmain.Tag = this; objmain.Show(this); this.Hide(); } else { MessageBox.Show("Invalid username or password."); } } catch { } }
partial void DeleteUser(User instance);
partial void UpdateUser(User instance);
partial void InsertUser(User instance);