Beispiel #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");
            }
        }
Beispiel #2
0
        public static Employee GetEmployee(ExternalEmployee externalEmployee)
        {
            Employee employee = null;

            if (externalEmployee != null)
            {
                if (externalEmployee.ContractTypeName == "HourlySalaryEmployee")
                {
                    employee = new EmployeeHourly()
                    {
                        ContractTypeName = externalEmployee.ContractTypeName,
                        Id              = externalEmployee.Id,
                        Name            = externalEmployee.Name,
                        RoleDescription = externalEmployee.RoleDescription,
                        RoleId          = externalEmployee.RoleId,
                        RoleName        = externalEmployee.RoleName,
                        HourlySalary    = externalEmployee.HourlySalary
                    };
                }
                else if (externalEmployee.ContractTypeName == "MonthlySalaryEmployee")
                {
                    employee = new EmployeeMontly()
                    {
                        ContractTypeName = externalEmployee.ContractTypeName,
                        Id              = externalEmployee.Id,
                        Name            = externalEmployee.Name,
                        RoleDescription = externalEmployee.RoleDescription,
                        RoleId          = externalEmployee.RoleId,
                        RoleName        = externalEmployee.RoleName,
                        MonthlySalary   = externalEmployee.MonthlySalary
                    };
                }
            }

            return(employee);
        }