public static Report Create( List<RawDetail> rawDetails, Dictionary<ulong, Document> documents, Dictionary<ulong, List<Document>> duplicates, Dictionary<ulong, List<Document>> both) { int itemId = 1; var reportItems = new Report(rawDetails.Count); DocumentGroupType group = DocumentGroupType.Unknown; for (int index = 0; index < rawDetails.Count; index++) { AssignGroup(ref itemId, ref group, rawDetails[index].Col3); ulong documentId; if(ulong.TryParse(rawDetails[index].Col14, out documentId)) { if (documents.ContainsKey(documentId)) { if (!documents[documentId].Type.ExcludeFromGroup(group, rawDetails[index].Col20)) { reportItems.Items[group].Add( ItemFactory.Create( rawDetails[index], documents[documentId], itemId++)); } else { reportItems.SkippedItems[group].Add( ItemFactory.Create( rawDetails[index], documents[documentId], itemId++)); } } else if (duplicates.ContainsKey(documentId)) { itemId++; foreach (var dup in duplicates[documentId]) { reportItems.Duplicates.Add( ItemFactory.Create( rawDetails[index], dup, itemId)); } } else if (both.ContainsKey(documentId)) { itemId++; foreach (var multi in both[documentId]) { reportItems.Both.Add( ItemFactory.Create( rawDetails[index], multi, itemId)); } } else { reportItems.UnmatchedItems[group].Add(ItemFactory.Create( rawDetails[index], documentId, itemId++)); } } } return reportItems; }
public void Write(Report report) { reportView.Write(Mapper.Map<Data.Model.Report>(report)); }