Beispiel #1
0
        private void AddBtn_Click(object sender, EventArgs e)
        {
            employeeAddModifyForm addEmployee = new employeeAddModifyForm();

            addEmployee.addEmployee = true;
            DialogResult result = addEmployee.ShowDialog();

            if (result == DialogResult.OK)
            {
                employee = addEmployee.employee;
                employeeIDTextBox.Text = employee.employeeID.ToString();
                this.DisplayEmployee();
            }
        }
Beispiel #2
0
        private void EditBtn_Click(object sender, EventArgs e)
        {
            if (employeeIDTextBox.Text.Length == 0)
            {
                MessageBox.Show("Please select an employee first.");
                return;
            }


            int employeeID = Convert.ToInt32(employeeIDTextBox.Text);

            this.GetEmployee(employeeID);

            employeeAddModifyForm modifyEmployee = new employeeAddModifyForm();

            modifyEmployee.addEmployee = false;
            modifyEmployee.employee    = this.employee;
            DialogResult result = modifyEmployee.ShowDialog();

            if (result == DialogResult.OK)
            {
                employee = modifyEmployee.employee;
                this.DisplayEmployee();
            }
            else if (result == DialogResult.Retry)
            {
                this.GetEmployee(employee.employeeID);
                if (employee != null)
                {
                    this.DisplayEmployee();
                }
                else
                {
                    this.ClearControls();
                }
            }
        }