private List <INotification> GetListWithoutFile() { DriverList driverList = DriverList.getInstance(); List <Driver> listDriver = driverList.ToList().Where(item => (!item.Fired && !item.Decret && !item.NotificationStop && item.IsDriver)).ToList(); List <INotification> list = _list.ToList(); List <INotification> listExist = (from itemMC in list join itemDriver in listDriver on itemMC.Driver.ID equals itemDriver.ID into table1 from itemRes in table1.DefaultIfEmpty() where itemRes != null select itemMC).ToList(); List <INotification> listNotification = new List <INotification>(); foreach (IActual item in listExist) { if (item.IsDateActual() && !item.IsHaveFile()) { if (list.First() is MedicalCert) { listNotification.Add(item as MedicalCert); } else if (list.First() is DriverLicense) { listNotification.Add(item as DriverLicense); } } } return(listNotification); }
private List <INotification> GetListNotExist() { DriverList driverList = DriverList.getInstance(); List <Driver> listDriver = driverList.ToList().Where(item => (!item.Fired && !item.Decret && !item.NotificationStop && item.IsDriver)).ToList(); List <INotification> list = _list.ToList(); List <Driver> listNotExist = (from itemDriver in listDriver join itemMC in list on itemDriver.ID equals itemMC.Driver.ID into table1 from itemRes in table1.DefaultIfEmpty() where itemRes == null select itemDriver).ToList(); List <INotification> listNotification = new List <INotification>(); foreach (Driver item in listNotExist) { if (list.First() is MedicalCert) { listNotification.Add(new MedicalCert(item)); } else if (list.First() is DriverLicense) { listNotification.Add(new DriverLicense(item)); } } return(listNotification); }
public void ClearStopIfNeed() { DriverList driverList = DriverList.getInstance(); List <Driver> listDriver = driverList.ToList().Where(item => (item.NotificationStop && item.DateStopNotification == DateTime.Today)).ToList(); foreach (Driver driver in listDriver) { driver.DateStopNotification = new DateTime(1, 1, 1); } }