Example #1
0
    // Most paid Employee
    protected string mostPaidEmployee()
    {
        string resEmployee = null;
        double resSalary   = 0;

        foreach (SalariedEmployee SE in listSE)
        {
            if (resSalary < SE.getSalary())
            {
                resSalary   = SE.getSalary();
                resEmployee = string.Format("{0}, {1}, {2:C}",
                                            SE.employeeID, SE.firstName + " " + SE.lastName, SE.getSalary().ToString());
            }
        }
        foreach (HourlyEmployee HE in listHE)
        {
            if (resSalary < HE.getSalary())
            {
                resSalary   = HE.getSalary();
                resEmployee = string.Format("{0}, {1}, {2:C}",
                                            HE.employeeID, HE.firstName + " " + HE.lastName, HE.getSalary().ToString());
            }
        }
        foreach (CommissionEmployee CE in listCE)
        {
            if (resSalary < CE.getSalary())
            {
                resSalary   = CE.getSalary();
                resEmployee = string.Format("{0}, {1}, {2:C}",
                                            CE.employeeID, CE.firstName + " " + CE.lastName, CE.getSalary().ToString());
            }
        }
        return(resEmployee);
    }
Example #2
0
    // Print raw data from object lists
    protected string printReport()
    {
        string printRes = null;

        foreach (SalariedEmployee SE in listSE)
        {
            //printRes += SE.ToString() + "<br/>";
            listEmployee.Add(Convert.ToInt32(SE.getSalary()), SE.ToString() + "<br/>");
        }
        foreach (HourlyEmployee HE in listHE)
        {
            //printRes += HE.ToString() + "<br/>";
            listEmployee.Add(Convert.ToInt32(HE.getSalary()), HE.ToString() + "<br/>");
        }
        foreach (CommissionEmployee CE in listCE)
        {
            //printRes += CE.ToString() + "<br/>";
            listEmployee.Add(Convert.ToInt32(CE.getSalary()), CE.ToString() + "<br/>");
        }

        // Sorting employees
        foreach (var employ in listEmployee.OrderByDescending(key => key.Key))
        {
            printRes += employ.Value;
        }
        // Sorting consultants
        listCons = listCons.OrderByDescending(o => o.payment).ToList();
        foreach (Consultant Cons in listCons)
        {
            printRes += Cons.ToString() + "<br/>";
        }

        return(printRes);
    }
Example #3
0
    // Total Commissioned Employees
    protected double totalCEPay()
    {
        double printRes = 0;

        foreach (CommissionEmployee CE in listCE)
        {
            printRes += CE.getSalary();
        }

        return(printRes);
    }