예제 #1
0
        /// <summary>
        /// purpose: to add an employee to the array
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_AddEmployee_Click(object sender, EventArgs e)
        {
            ETYPE newEmp;

            if (dbox_empType.Text == null | dbox_empType.Text == "")
            {
                MessageBox.Show(_error);
                newEmp = ETYPE.None;
            }

            if (busRule.isInDic(Convert.ToUInt32(txt_empID.Text)))
            {
                MessageBox.Show(_empIDError);
            }
            else
            {
                newEmp = (ETYPE)Enum.Parse(typeof(ETYPE), dbox_empType.Text);



                // add employee switch case
                switch (newEmp)
                {
                case ETYPE.Hourly:

                    Business_Rules.Rules.addEmpHourly(Convert.ToUInt32(txt_empID.Text), ETYPE.Hourly, txt_empFName.Text, txt_empLName.Text, Convert.ToDecimal(txt_info2.Text), Convert.ToDouble(txt_info1.Text), true, false, false, true);
                    _message = _success;

                    MessageBox.Show(_message);
                    break;

                case ETYPE.Salary:


                    Business_Rules.Rules.addEmpSalary(Convert.ToUInt32(txt_empID.Text), ETYPE.Salary, txt_empFName.Text, txt_empLName.Text, Convert.ToDecimal(txt_info1.Text), false, true, false, true);
                    _message = _success;
                    MessageBox.Show(_message);

                    break;

                case ETYPE.Contract:


                    Business_Rules.Rules.addEmpContract(Convert.ToUInt32(txt_empID.Text), ETYPE.Contract, txt_empFName.Text, txt_empLName.Text, Convert.ToDecimal(txt_info1.Text), false, false, false, false);
                    _message = _success;
                    MessageBox.Show(_message);

                    break;

                case ETYPE.Sales:

                    Business_Rules.Rules.addEmpSales(Convert.ToUInt32(txt_empID.Text), ETYPE.Sales, txt_empFName.Text, txt_empLName.Text, Convert.ToDecimal(txt_info2.Text), Convert.ToDecimal(txt_info1.Text), Convert.ToDecimal(txt_info3.Text), false, true, true, true);
                    _message = _success;
                    MessageBox.Show(_message);
                    break;


                default:

                    MessageBox.Show(_error);

                    break;
                }
            }
        }