コード例 #1
0
        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();
            }
        }
コード例 #2
0
 //Submit button deletes worker
 private void SubmitButton_Click(object sender, RoutedEventArgs e)
 {
     w.delete();
     MessageBox.Show("Worker deleted successfully.");
 }