private void AddRow(IEmployee employee) { DataGridViewRow r = new DataGridViewRow(); IEmployee chief = _handler.FindChief(employee); EmployeeInfo chiefInfo = null; if (chief != null) { chiefInfo = chief.GetEmployeeInfo(); } string chiefFullName = chief != null ? chiefInfo.FirstName + " " + chiefInfo.LastName : ""; EmployeeInfo employeeInfo = employee.GetEmployeeInfo(); string[] s = new string[] { employeeInfo.FirstName, employeeInfo.LastName, employee.GetType().Name, employeeInfo.WageRate.ToString(), employee.CalculateWage().ToString(), employeeInfo.EnrollmentDate.ToString(), chiefFullName }; dataGridView1.Rows.Add(s); }
private decimal BonusFromSubordinates(IEmployee employee, decimal bonusTerm, List <EmployeeInfo> processed) { if (processed.Contains(employee.GetEmployeeInfo())) { return(0); } processed.Add(employee.GetEmployeeInfo()); decimal w = employee.CalculateWage() * bonusTerm; var subs = employee.GetSuborinates(); if (subs != null) { foreach (var sub in subs) { w += BonusFromSubordinates(sub, bonusTerm, processed); } } return(w); }