Example #1
0
        private void CalculateSalary_Click(object sender, EventArgs e)
        {
            try
            {
                Bussiness bs = new Bussiness();

                if (type.Text == "Internal")
                {
                    InternalEmployee emp       = new InternalEmployee();
                    float            otPayment = emp.CalcOverTimePayment(Convert.ToInt32(noOfHours.Text), float.Parse(otHourRate.Text));

                    salary.Text = (emp.CalcNetSalary(float.Parse(basicSal.Text), otPayment)).ToString();
                }
                else if (type.Text == "External")
                {
                    ExternalEmployee exEmp = new ExternalEmployee();
                    salary.Text = (exEmp.CalcNetSalary(float.Parse(otHourRate.Text), Convert.ToInt32(noOfHours.Text))).ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("invalid calculation");
            }
        }