private void LogoutIcon_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure to logout?", "Cofirm Logout", MessageBoxButtons.YesNo) == DialogResult.Yes) { using (DBEntity db = new DBEntity()) { this.Hide(); Login login = new Login(); login.Show(); MessageBox.Show("You have successfully Logged out. Thanks for using PassLocker"); } } }
private void dataGridView1_DoubleClick(object sender, EventArgs e) { if (dataGridView1.CurrentRow.Index != -1) { lockerTable.AccountID = Convert.ToInt32(dataGridView1.CurrentRow.Cells["AccountID"].Value); } using (DBEntity db = new DBEntity()) { lockerTable = db.UserLockers.Where(x => x.AccountID == lockerTable.AccountID).FirstOrDefault(); AccountTB.Text = lockerTable.AccountName; UsernameTB.Text = lockerTable.Username; PasswordTB.Text = lockerTable.Password; } }
private void AddBtn_Click(object sender, EventArgs e) { if (AccountTB.Text.Length == 0 || UsernameTB.Text.Length == 0 || PasswordTB.Text.Length == 0) { MessageBox.Show("Please fill up all the field in Locker"); } else { lockerTable.UserID = Int32.Parse(userID); lockerTable.AccountName = AccountTB.Text.Trim(); lockerTable.Username = UsernameTB.Text.Trim(); lockerTable.Password = PasswordTB.Text.Trim(); using (DBEntity db = new DBEntity()) { db.UserLockers.Add(lockerTable); db.SaveChanges(); } clear(); DataPopulate(); MessageBox.Show("Record Successfully added"); } }