public List <Document> GetDocuments(int packageSize, int lastId) { var documentTypeIds = _dictionaryTypesService.GetDocumentTypeIds(); var oldDocuments = _context.DDDocuments .AsNoTracking() .Where(d => d.Id != 0 && d.Id > lastId && documentTypeIds.Contains(d.DocTypeId)) .OrderBy(d => d.Id) .Take(packageSize) .ToList(); var documents = oldDocuments.Select(d => new Document { Id = d.Id, ExternalId = d.Id, Barcode = d.Id, TypeId = d.DocTypeId, DateCreate = d.DateCreate ?? DateTimeOffset.Now, DateUpdate = d.DateUpdate ?? DateTimeOffset.Now, AddresseeId = d.CustomerId, DepartmentId = d.DepartmentId, DocumentNum = d.DocNum, OutgoingNumber = d.OutNum, IncomingNumber = d.InOutNum, NameRu = d.DescMlRu, NameEn = d.DescMlEn, NameKz = d.DescMlKz, DivisionId = d.DivisionId, ReceiveTypeId = d.SendType, IncomingNumberFilial = d.InNumAdd, IsFinished = CustomConverter.StringToNullableBool(d.IsComplete), IsDeleted = false, }).ToList(); return(documents); }
public List <ProtectionDocDocument> GetProtectionDocDocumentRelations(int packageSize, int lastId) { var documentTypeIds = _dictionaryTypesHelper.GetDocumentTypeIds(); var documentProtectionDocRelations = _context.DDDocuments .AsNoTracking() .Where(d => d.Id > lastId && documentTypeIds.Contains(d.DocTypeId) && d.DocId > 0) .OrderBy(d => d.Id) .Take(packageSize) .ToList(); return(documentProtectionDocRelations.Select(d => new ProtectionDocDocument { ExternalId = d.Id, DateCreate = d.DateCreate ?? DateTimeOffset.Now, DateUpdate = d.DateUpdate ?? DateTimeOffset.Now, DocumentId = d.Id, ProtectionDocId = d.DocId.Value }).ToList()); }
public List <AvailabilityCorrespondence> GetAvailabilityCorrespondences() { var documentTypeIds = _dictionaryTypesHelper.GetDocumentTypeIds(); var availabilityCorrespondences = _context.AvailabilityCorrespondences .Where(a => documentTypeIds.Contains(a.CorId)) .AsNoTracking() .ToList(); return(availabilityCorrespondences.Select(a => new AvailabilityCorrespondence { Id = a.Id, DateCreate = DateTimeOffset.Now, DateUpdate = DateTimeOffset.Now, DocumentTypeId = a.CorId, ProtectionDocTypeId = a.PatentType, RouteStageId = a.StageId, Status = a.Status }).ToList()); }