public static List<DocumentBeo> ToDocumentList(this List<DocumentDetail> documents) { var documentBeoList = new List<DocumentBeo>(); documents.ForEach(d => { if (d.document == null) return; var document = new DocumentBeo { Id = d.document.DocumentId, Path = d.document.NativeFilePath, Dcn = d.document.DocumentControlNumber, }; if (d.document.FieldList != null && d.document.FieldList.Any()) { foreach (var field in d.document.FieldList) { if (document.Fields.ContainsKey(field.FieldName)) { document.Fields.Remove(field.FieldName); } document.Fields.Add(new KeyValuePair<string, string>(field.FieldName, field.FieldValue)); } } if (document.Fields.ContainsKey(EVSystemFields.MatterId)) { document.Fields.Remove(EVSystemFields.MatterId); } if (document.Fields.ContainsKey(EVSystemFields.DatasetId)) { document.Fields.Remove(EVSystemFields.DatasetId); } document.Fields.Add(new KeyValuePair<string, string>(EVSystemFields.MatterId, d.document.MatterId.ToString())); document.Fields.Add(new KeyValuePair<string, string>(EVSystemFields.DatasetId, d.document.CollectionId)); if (string.IsNullOrEmpty(d.document.CustomFieldToPopulateText)) { var txtUrl = GetTextFilePath(d.document); document.Text = (d.document.DocumentBinary != null && !StringUtility.IsNullOrWhiteSpace(d.document.DocumentBinary.Content)) ? d.document.DocumentBinary.Content : (!string.IsNullOrEmpty(txtUrl) ? GetContent(txtUrl) : string.Empty); } if (d.document.Tags != null && d.document.Tags.Any()) { var tagStr = new StringBuilder(); foreach (var tag in d.document.Tags) { if (!string.IsNullOrEmpty(tagStr.ToString())) { tagStr.Append(","); } tagStr.Append(tag.TagName); } if (document.Fields.ContainsKey(EVSystemFields.Tag)) { document.Fields.Remove(EVSystemFields.Tag); } document.Fields.Add(new KeyValuePair<string, string>(EVSystemFields.Tag, tagStr.ToString())); } documentBeoList.Add(document); }); return documentBeoList; }
public static List <DocumentBeo> ToDocumentList(this List <DocumentDetail> documents) { var documentBeoList = new List <DocumentBeo>(); documents.ForEach(d => { if (d.document == null) { return; } var document = new DocumentBeo { Id = d.document.DocumentId, Path = d.document.NativeFilePath, Dcn = d.document.DocumentControlNumber, }; if (d.document.FieldList != null && d.document.FieldList.Any()) { foreach (var field in d.document.FieldList) { if (document.Fields.ContainsKey(field.FieldName)) { document.Fields.Remove(field.FieldName); } document.Fields.Add(new KeyValuePair <string, string>(field.FieldName, field.FieldValue)); } } if (document.Fields.ContainsKey(EVSystemFields.MatterId)) { document.Fields.Remove(EVSystemFields.MatterId); } if (document.Fields.ContainsKey(EVSystemFields.DatasetId)) { document.Fields.Remove(EVSystemFields.DatasetId); } document.Fields.Add(new KeyValuePair <string, string>(EVSystemFields.MatterId, d.document.MatterId.ToString())); document.Fields.Add(new KeyValuePair <string, string>(EVSystemFields.DatasetId, d.document.CollectionId)); if (string.IsNullOrEmpty(d.document.CustomFieldToPopulateText)) { var txtUrl = GetTextFilePath(d.document); document.Text = (d.document.DocumentBinary != null && !StringUtility.IsNullOrWhiteSpace(d.document.DocumentBinary.Content)) ? d.document.DocumentBinary.Content : (!string.IsNullOrEmpty(txtUrl) ? GetContent(txtUrl) : string.Empty); } if (d.document.Tags != null && d.document.Tags.Any()) { var tagStr = new StringBuilder(); foreach (var tag in d.document.Tags) { if (!string.IsNullOrEmpty(tagStr.ToString())) { tagStr.Append(","); } tagStr.Append(tag.TagName); } if (document.Fields.ContainsKey(EVSystemFields.Tag)) { document.Fields.Remove(EVSystemFields.Tag); } document.Fields.Add(new KeyValuePair <string, string>(EVSystemFields.Tag, tagStr.ToString())); } documentBeoList.Add(document); }); return(documentBeoList); }