private void butSave_Click(object sender, EventArgs e) { Custom_Message_Box message; if (tbxUserName.Text == "") { message = new Custom_Message_Box("Please enter user name ", "Error", "Error"); message.ShowDialog(); tbxUserName.Focus(); } else if (tbxPassword.Text == "") { message = new Custom_Message_Box("Please enter password ", "Error", "Error"); message.ShowDialog(); tbxPassword.Focus(); } else { Properties.Settings.Default.UserName = tbxUserName.Text; Properties.Settings.Default.Password = tbxPassword.Text; Properties.Settings.Default.Default_Settings = true; Properties.Settings.Default.Save(); message = new Custom_Message_Box("User Name and password is stored for your software", "Setting Complete", "Information"); message.ShowDialog(); this.Hide(); LogIn_Form form = new LogIn_Form(); form.Show(); } }
private void butAddform_Click(object sender, EventArgs e) { if (butSave.ButtonText == "Add") { add(); Custom_Message_Box message = new Custom_Message_Box("Role has added into the record.", "Record Added", "Information"); message.ShowDialog(); } else if (butSave.ButtonText == "Update") { update(); Custom_Message_Box message = new Custom_Message_Box("Role has updated into the record", "Record Updated", "Information"); message.ShowDialog(); } else if (butSave.ButtonText == "Delete") { delete(); Custom_Message_Box message = new Custom_Message_Box("Role has deleted from the record", "Record Deleted", "Information"); message.ShowDialog(); } else { search(); } }
private void butLogin_Click(object sender, EventArgs e) { if (tbxUserName.Text != Properties.Settings.Default.UserName) { Custom_Message_Box messagebox = new Custom_Message_Box("Please enter correct user name", "Invalid User Name", "Error"); messagebox.ShowDialog(); tbxUserName.Focus(); } else if (tbxPassword.Text != Properties.Settings.Default.Password) { Custom_Message_Box messagebox = new Custom_Message_Box("Please enter correct password", "Invalid Password", "Error"); messagebox.ShowDialog(); tbxPassword.Focus(); } else { Main_Form form = new Main_Form(); this.Hide(); form.Show(); } }