public WorkerDataInputForm(UpdateForm uf, string s, MainMenu m)
        {
            InitializeComponent();
            myCaller = uf;
            mainMenu = m;
            WorkerPasswordBox.PasswordChar = '*';

            Object[] status = new Object[2];
            status[0] = "Active";
            status[1] = "Inactive";
            StatusComboBox.Items.AddRange(status);

            Object[] credential = new Object[2];
            credential[0] = "Administrator";
            credential[1] = "Ordinary";
            CredentialComboBox.Items.AddRange(credential);

            Worker existingWorker = new Worker();

            existingWorker.populateBannerID(s);
            WorkerDataLabel.Text             = "Modify Worker Data";
            BannerIDBox.Text                 = existingWorker.BannerID;
            FirstNameBox.Text                = existingWorker.FirstName;
            LastNameBox.Text                 = existingWorker.LastName;
            PhoneNumberBox.Text              = existingWorker.PhoneNumber;
            EmailBox.Text                    = existingWorker.EmailAddress;
            CredentialComboBox.SelectedIndex = CredentialComboBox.FindStringExact(existingWorker.Credential);
            WorkerPasswordBox.Text           = existingWorker.WorkerPassword;
            NotesBox.Text                    = existingWorker.Notes;
            StatusComboBox.SelectedIndex     = StatusComboBox.FindStringExact(existingWorker.Status);

            FormAction = "update";
            id         = s;
        }
        private void SubmitButton_Click(object sender, RoutedEventArgs e)
        {
            string bannerId = BannerIDTextBox.Text;
            Worker worker   = new Worker();

            worker.populateBannerID(bannerId);
            modifyWorker2 mu2 = new modifyWorker2(myCaller, worker);
        }
        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();
            }
        }
Ejemplo n.º 4
0
        private void SubmitButton_Click(object sender, RoutedEventArgs e)
        {
            string workerID      = BannerIdTextBox.Text;
            string pwd           = PasswordTextBox.Password;
            Worker currentWorker = new Worker();

            currentWorker.populateBannerID(workerID);

            if (!(pwd.Equals(currentWorker.WorkerPassword)))
            {
                System.Windows.Forms.MessageBox.Show("Incorrect Password or BannerID");
            }
            else
            {
                this.Hide();
                MainMenu mmf = new MainMenu(this, currentWorker);
                mmf.Show();
            }
        }