public ShowMyDutiesWindow(int employeeID) { InitializeComponent(); Employee = EmployeeRepository.GetEmployee(employeeID); List <Duty> duties = DutyRepository.GetDuties(Employee.FirstName); List <DutyListView> dutyListViews = new List <DutyListView>(); foreach (Duty duty in duties) { dutyListViews.Add(new DutyListView { Duty = duty, EmployeeName = EmployeeRepository.GetEmployeeName(duty.EmployeeID) }); } DutyListView.ItemsSource = dutyListViews; this.Closing += WindowClosed; }
public void UpdateDutyList() { List <Duty> duties = DutyRepository.GetDuties(EmployeeCB.SelectedItem.ToString()); List <string> dutiesS = new List <string>(); if (duties.Count > 0) { foreach (Duty duty in duties) { string dutyS = DateRepository.GetDate(DutyRepository.GetDuty(duty.DutyID).DateID).Date.ToString().Substring(0, 10) + " <--> " + EmployeeRepository.GetEmployee(duty.EmployeeID).FirstName; dutiesS.Add(dutyS); } DutyList.ItemsSource = dutiesS; } else { DutyList.ItemsSource = null; } }
public void UpdateDutyList() { List <Duty> duties = DutyRepository.GetDuties(EmployeeCB.SelectedItem.ToString()); List <DutyListView> dutyListViews = new List <DutyListView>(); foreach (Duty duty in duties) { int dateCompare = DateTime.Compare(duty.StartTime, DateTime.Now); if (dateCompare > 0) { dutyListViews.Add(new DutyListView { Duty = duty, EmployeeName = EmployeeRepository.GetEmployeeName(duty.EmployeeID) }); } } DutyListView.ItemsSource = dutyListViews; DutyListView.SelectedIndex = -1; }