private void SubmitButton_Click(object sender, EventArgs e) { if (FormAction.Equals("insert")) { string bannerID = BannerIDBox.Text; string firstName = FirstNameBox.Text; string lastName = LastNameBox.Text; string phoneNumber = PhoneNumberBox.Text; string email = EmailBox.Text; string credential = Convert.ToString(CredentialComboBox.SelectedItem); string workerPassword = WorkerPasswordBox.Text; string notes = NotesBox.Text; string status = Convert.ToString(StatusComboBox.SelectedItem); Worker newWorker = new Worker(bannerID, firstName, lastName, phoneNumber, email, credential, workerPassword, notes, status); newWorker.insert(); System.Windows.Forms.MessageBox.Show("Worker insert successful!"); this.Hide(); myCaller.Show(); } else if (FormAction.Equals("update")) { Worker existingWorker = new Worker(); existingWorker.populateBannerID(id); existingWorker.BannerID = BannerIDBox.Text; existingWorker.FirstName = FirstNameBox.Text; existingWorker.LastName = LastNameBox.Text; existingWorker.PhoneNumber = PhoneNumberBox.Text; existingWorker.EmailAddress = EmailBox.Text; existingWorker.Credential = Convert.ToString(CredentialComboBox.SelectedItem); existingWorker.WorkerPassword = WorkerPasswordBox.Text; existingWorker.Notes = NotesBox.Text; existingWorker.Status = Convert.ToString(StatusComboBox.SelectedItem); existingWorker.update(); System.Windows.Forms.MessageBox.Show("Worker update successful!"); this.Hide(); mainMenu.Show(); } else if (FormAction.Equals("delete")) { Worker existingWorker = new Worker(); existingWorker.populateBannerID(id); existingWorker.delete(); System.Windows.Forms.MessageBox.Show("Worker deletion successful!"); this.Hide(); mainMenu.Show(); } }
//Submit button inserts worker private void Button_Click(object sender, RoutedEventArgs e) { String banner = BannerBox.Text; String first = FirstNameBox.Text; String last = LastNameBox.Text; String phone = PhoneNumberBox.Text; String email = EmailBox.Text; credential = CredentialBox.Text; String password = PasswordBox.Password; String notes = NotesBox.Text; Worker w = new Worker(banner, first, last, phone, email, credential, password, notes); w.insert(); MessageBox.Show("Worker inserted successfully."); this.Hide(); myCaller.Show(); }
private void SubmitButton_Click(object sender, RoutedEventArgs e) { string bannerID = BannerIDTextBox.Text; string firstName = FirstNameTextBox.Text; string lastName = LastNameTextBox.Text; string phoneNumber = PhoneNumberTextBox.Text; string email = EmailTextBox.Text; string credential = CredentialTextBox.Text; string notes = NoteTextBox.Text; string status = Convert.ToString(StatusComboBox.SelectedItem); string dateStatusUpdated = DateTime.Now.ToString("yyyy-MM-dd"); Worker newWorker = new Worker(bannerID, firstName, lastName, phoneNumber, email, credential, notes, status, dateStatusUpdated); newWorker.insert(); MessageBox.Show("Worker insert successful!"); this.Close(); myCaller.Show(); }