public static IQueryable <IContractualDocument> GetFilteredRegisteredDocuments( string number, DateTime?dateFrom, DateTime?dateTo, IDocumentRegister documentRegister, ICaseFile caseFile, IEmployee responsibleEmployee) { if (dateTo != null) { dateTo = dateTo.Value.AddDays(1); } return(ContractualDocuments.GetAll() .Where(l => number == null || l.RegistrationNumber.Contains(number)) .Where(l => dateFrom == null || l.RegistrationDate >= dateFrom) .Where(l => dateTo == null || l.RegistrationDate < dateTo) .Where(l => documentRegister == null || l.DocumentRegister.Equals(documentRegister)) .Where(l => caseFile == null || l.CaseFile.Equals(caseFile)) .Where(l => responsibleEmployee == null || l.ResponsibleEmployee.Equals(responsibleEmployee))); }
public static IQueryable <IOfficialDocument> GetFilteredRegisteredDocuments( string registrationNumber, DateTime?registrationDateFrom, DateTime?registrationDateTo, IDocumentRegister documentRegister, ICaseFile caseFile, Company.IEmployee registeredBy) { var documents = OfficialDocuments.GetAll(); if (registrationNumber != null) { documents = documents.Where(l => l.RegistrationNumber.Contains(registrationNumber)); } if (registrationDateFrom != null) { documents = documents.Where(l => l.RegistrationDate >= registrationDateFrom); } if (registrationDateTo != null) { registrationDateTo = registrationDateTo.Value.Date.EndOfDay(); documents = documents.Where(l => l.RegistrationDate <= registrationDateTo); } if (documentRegister != null) { documents = documents.Where(l => Equals(l.DocumentRegister, documentRegister)); } if (caseFile != null) { documents = documents.Where(l => Equals(l.CaseFile, caseFile)); } if (registeredBy != null) { // TODO Zamerov: ересь с операциями. var regitrationOperation = new Enumeration(Docflow.PublicFunctions.OfficialDocument.GetRegistrationOperation()); documents = documents.WhereDocumentHistory(h => Equals(h.User, registeredBy) && h.Operation == regitrationOperation); } return(documents); }