コード例 #1
0
        private void BackBtn_Click(object sender, EventArgs e)
        {
            this.Visible = false;
            DepartmentOptionForm dep = new DepartmentOptionForm();

            dep.Visible = true;
        }
コード例 #2
0
        private void DepartmentBtn_Click(object sender, EventArgs e)
        {
            DepartmentOptionForm departmentOptions = new DepartmentOptionForm();

            departmentOptions.ShowDialog();
            this.Visible = false;
        }
コード例 #3
0
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            try
            {
                if (!depController.DepartmentSalaryDataValidation(double.Parse(DepartBaseSalaryBox.Text)))
                {
                    throw new NullReferenceException("Salary is too low!");
                }
                else if (currentDepName == "TemporaryDepartment" && DepartmentNameBox.Text != "TemporaryDepartment")
                {
                    throw new Exception("You can not change the name of this department!");
                }
                depController.ReworkDepartmentName(currentDepartment, DepartmentNameBox.Text);
                //else if (currentDepartment.BaseSalary!=double.Parse(DepartBaseSalaryBox.Text))
                // {

                depController.ReworkDepartmentSalary(currentDepartment, double.Parse(DepartBaseSalaryBox.Text));

                //}
                MessageBox.Show("Operation is successful!", "Successful operation", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Visible = false;
                DepartmentOptionForm dep = new DepartmentOptionForm();
                dep.Visible = true;
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Invalid operation",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
コード例 #4
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            depController.RemoveDepartment(currentDepName);
            MessageBox.Show("Operation is successful!", "Successful operation", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.Visible = false;
            DepartmentOptionForm depOpt = new DepartmentOptionForm();

            depOpt.Visible = true;
        }
コード例 #5
0
 private void DeleteButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (currentDepName == "TemporaryDepartment")
         {
             throw new Exception("You can not delete this department!");
         }
         depController.RemoveDepartment(currentDepName);
         MessageBox.Show("Operation is successful!", "Successful operation", MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.Visible = false;
         DepartmentOptionForm depOpt = new DepartmentOptionForm();
         depOpt.Visible = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Invalid Operation",
                         MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }