private void SaveDocumentToDatabase(ExtractedDocument extractedDocument, int docTypeId, int subDocTypeId, int manCoId, int gridRunId) { _documentService.AddDocument( extractedDocument.DocumentId, docTypeId, subDocTypeId, manCoId, gridRunId, extractedDocument.MailPrintFlag); NexdoxMessaging.SendMessage(string.Format("Document {0} saved to database", extractedDocument.DocumentId), true, this); }
public List <ExtractedDocument> GetDocument(string dataFile) { List <ExtractedDocument> extractedDocs = new List <ExtractedDocument>(); XElement application; string applicationName = string.Empty; try { ExtractedDocument extractedDoc; // Load Xml file XDocument xml = XDocument.Load(dataFile); // Read xml file application data application = (from a in xml.Descendants("Application") select a).FirstOrDefault(); // Read xml file document data into document class var documents = xml.Descendants("Documents");// select new { DocumentChildren = c.Descendants("Document") }); applicationName = application.Attribute("application").Value; foreach (var document in documents.Descendants("Document")) { extractedDoc = new ExtractedDocument { DocumentId = document.Attribute("DocumentIdGUID").Value, ManCoCode = document.Attribute("MANAGEMENT_COMPANY").Value, DocType = document.Attribute("DOCUMENT_TYPE").Value, SubDocType = document.Attribute("DOCUMENT_SUB_TYPE").Value, Application = applicationName, MailPrintFlag = document.Attribute("MAIL_PRINT_FLAG").Value }; extractedDocs.Add(extractedDoc); } } catch (Exception e) { throw new UnityException(string.Format("Unable to retrieve application information from the trigger file for application {0}.", applicationName), e); } return(extractedDocs); }