public XtraUserControlDepInfo(RendezvousInfo rendezvousInfo) { InitializeComponent(); DepartmentName = rendezvousInfo.DepartmentName; Info = rendezvousInfo.DoctorRenInfos; Max = rendezvousInfo.Max; Value = rendezvousInfo.Value; }
public List <RendezvousInfo> RendezvousInfos() { List <RendezvousInfo> rendezvous = new List <RendezvousInfo>(); RendezvousTimeManager timeManager = new RendezvousTimeManager(); int times = timeManager.RendezvousTimes().Count; RendezvousManager rendezvousManager = new RendezvousManager(); List <Rendezvous> savedRendezvous = rendezvousManager.Rendezvouses(DateTime.Today, null, null); DepartmentManager departmentManager = new DepartmentManager(); List <Department> departments = departmentManager.Departments(); foreach (Department department in departments) { RendezvousInfo info = new RendezvousInfo { DepartmentName = department.Name, Max = times * department.Doctors.Count }; foreach (Doctor doctor in department.Doctors) { DoctorRenInfo doctorRenInfo = new DoctorRenInfo { DoctorName = String.Format("{0} {1}", doctor.Name, doctor.Surname) }; int count = savedRendezvous.Count(r => r.DoctorId == doctor.Id); doctorRenInfo.Limit = times - count; info.Value += count; info.DoctorRenInfos.Add(doctorRenInfo); } rendezvous.Add(info); } return(rendezvous); }