private void buttonBack_Click(object sender, EventArgs e) { this.Hide(); var formTemp = new AdminMain(); formTemp.Show(); }
private void buttonBack_Click(object sender, EventArgs e) { MessageBox.Show("Changes will not be saved"); this.Hide(); var formTemp = new AdminMain(); formTemp.Show(); }
private void buttonLogin_Click_1(object sender, EventArgs e) { // Check userid text box if (String.IsNullOrEmpty(textboxUsername.Text)) { MessageBox.Show("Please enter the user id", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Check password text box if (String.IsNullOrEmpty(textboxmaskedPassword.Text)) { MessageBox.Show("Please enter the password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Login if (CheckUserIDAndPassword()) { if (GetAccessLevel() == 1) { this.Hide(); var formTemp = new ManagementItemView(); formTemp.Show(); } else if (GetAccessLevel() == 2) { this.Hide(); var formTemp = new AdminMain(); formTemp.Show(); } else { MessageBox.Show("Access level is invalid", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("User ID or password are invalid", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void buttonSaveAndExit_Click(object sender, EventArgs e) { int tempVal = 0; // Check first name text box if (String.IsNullOrEmpty(textboxFirstName.Text)) { MessageBox.Show("Please enter the first name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Check last name text box if (String.IsNullOrEmpty(textboxLastName.Text)) { MessageBox.Show("Please enter the last name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Check user name text box if (String.IsNullOrEmpty(textboxUsername.Text)) { MessageBox.Show("Please enter the user name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Check password text box if (String.IsNullOrEmpty(textboxPassword.Text)) { MessageBox.Show("Please enter the password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Check access level combo box if (String.IsNullOrEmpty(comboBoxAccessLevel.Text)) { MessageBox.Show("Please enter the access level", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Check if combo box is integer if (!Int32.TryParse(comboBoxAccessLevel.Text, out tempVal)) { MessageBox.Show("Access level must be a number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } aManager.managerUsername = textboxUsername.Text; aManager.managerPassword = textboxPassword.Text; aManager.managerFName = textboxFirstName.Text; aManager.managerLName = textboxLastName.Text; aManager.managerAccessLvl = Convert.ToInt32(comboBoxAccessLevel.Text); bool wasSucessful = aManager.UpdateDatabaseManager(aManager); if (wasSucessful) { MessageBox.Show("Update Successful"); } else { MessageBox.Show("Update Not Successful"); } this.Hide(); var formTemp = new AdminMain(); formTemp.Show(); }
private void buttonSaveAndExit_Click(object sender, EventArgs e) { int tempVal = 0; DateTime dt = new DateTime(); if (String.IsNullOrEmpty(textboxFirstName.Text)) { MessageBox.Show("Error: Please enter a first name"); return; } else if (String.IsNullOrEmpty(textboxLastName.Text)) { MessageBox.Show("Error: Please enter a last name"); return; } else if (String.IsNullOrEmpty(textboxUsername.Text)) { MessageBox.Show("Error: Please enter a user name"); return; } else if (String.IsNullOrEmpty(textboxPassword.Text)) { MessageBox.Show("Error: Please enter a password"); return; } else if (String.IsNullOrEmpty(textboxDOB.Text)) { MessageBox.Show("Error: Please enter a date of birth"); return; } else if (String.IsNullOrEmpty(textboxAccessLVL.Text)) { MessageBox.Show("Error: Please enter an access level"); return; } if (!Int32.TryParse(textboxAccessLVL.Text, out tempVal)) { MessageBox.Show("Error: access level must be a number"); return; } if (!DateTime.TryParseExact(textboxDOB.Text, "MM/dd/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.NoCurrentDateDefault, out dt)) { MessageBox.Show("Error: Date of birth not in the right format (mm/dd/yyyy)"); return; } aManager.managerUsername = textboxUsername.Text; aManager.managerPassword = textboxPassword.Text; aManager.managerFName = textboxFirstName.Text; aManager.managerLName = textboxLastName.Text; aManager.managerDOB = textboxDOB.Text; aManager.managerAccessLvl = Convert.ToInt32(textboxAccessLVL.Text); bool wasSuccessful = aManager.InsertToDatabase(aManager); if (wasSuccessful) { MessageBox.Show("Successful"); } this.Hide(); var formTemp = new AdminMain(); formTemp.Show(); }