private IEnumerable<IEdiMessage> buildMessagesFromFileInfo(EdiFileInfo fileInfo, BusinessPartner partner) { var docs = fileInfo.Documents; var msgs = new List<IEdiMessage>(); docs.ForEach(d => msgs.Add(getMessageFrom(d, partner))); return msgs; }
private BusinessPartner get_partner(EdiSegmentCollection doc) { var seg = doc.SegmentList.First(); var els = seg.GetElements(seg.Contents.Substring(3, 1)); return(BusinessPartner.FromReceiverId(els[6])); }
public ISegmentFactory GetSegmentFactoryFor(BusinessPartner partner) { var segFactory = ServiceLocator.Current.GetInstance<ISegmentFactory>(); segFactory.SetBuildValues(partner); return segFactory; }
private IEnumerable<IEdiMessage> buildMessagesFromFileInfo(EdiFileInfo fileInfo, BusinessPartner partner) { var docs = fileInfo.Documents; if (docs == null) throw new InvalidOperationException("File for partner " + partner.Text + " has no documents."); var msgs = new List<IEdiMessage>(); docs.ForEach(d => msgs.Add(getMessageFrom(d, partner))); return msgs; }
private IEdiMessage getMessageFrom(DocContainer docContainer, BusinessPartner partner) { var parser = docContainer.ParserFor(partner); var package = parser.ProcessSegmentList(docContainer.InnerSegments.ToList()); var docDto = create_document_entity(docContainer); add_value(docDto, package.ResponseValues); add_lines(docDto, package.Lines); _docsRepo.Save(docDto); return package.Message; }
private IEdiMessage getMessageFrom(DocContainer docContainer, BusinessPartner partner) { var parser = docContainer.ParserFor(partner); var package = parser.ProcessSegmentList(docContainer.InnerSegments.ToList()); var docDto = create_document_entity(docContainer); add_value(docDto, package.ResponseValues); add_lines(docDto, package.Lines); _docsRepo.Save(docDto); return(package.Message); }
private DocumentInDTO create_document_entity(DocContainer document, BusinessPartner partner) { var group = document.ParentGroup; return new DocumentInDTO() { DocumentID = document.DocType.CastToInt(), ControlNumber = document.ControlNumber, ISAControlNumber = group.ControlNumber.CastToInt(), DateSent = group.DateSent, GroupID = group.GroupId, PartnerNumber = partner.Number }; }
public IEnumerable<Segment> MemorizeOuterReferences(List<Segment> segList, string controlNumber, string elDelimiter, BusinessPartner partner) { segList.SetContexts(); var returnList = new List<Segment>(); IEnumerable<Segment> refs = segList.Where(s => s.Context == "root"); foreach (Segment rf in refs.ToList()) { process_outer_ref(rf, controlNumber, elDelimiter, partner); returnList.Add(rf); } return returnList; }
private void assign_outer_reference(string qualifier, string identification, string controlNumber, BusinessPartner partner) { _responseValues.Add(new ResponseElementEntity { DocumentInDTO = new DocumentInDTO { ControlNumber = controlNumber.CastToInt(), PartnerNumber = partner.Number }, ElementName = "REF02", Value = identification, Qualifier = qualifier }); }
public IEnumerable<IEdiMessage> GenerateMessages(EdiFileInfo fileInfo, BusinessPartner partner) { return buildMessagesFromFileInfo(fileInfo, partner); }
public bool For(BusinessPartner partner) { return partner == BusinessPartner.Initech; }
// private static void add_line_response_element(Segment seg, ICollection<LineResponseElementEntity> responseEls) // { // var elDelim = seg.Contents.Substring(3, 1); // var arr = seg.GetElements(elDelim); // responseEls.Add(new LineResponseElementEntity // { // ElementName = "REF02", // Qualifier = arr[1], // Value = arr[2] // }); // } private void process_outer_ref(Segment rf, string controlNumber, string elDelimiter, BusinessPartner partner) { var arr = rf.GetElements(elDelimiter); assign_outer_reference(arr[1], arr[2], controlNumber, partner); }
public IEnumerable <IEdiMessage> GenerateMessages(EdiFileInfo fileInfo, BusinessPartner partner) { return(buildMessagesFromFileInfo(fileInfo, partner)); }
public IFileParser GetFileParserFor(BusinessPartner partner) { return ServiceLocator.Current.GetInstance<IFileParser>(string.Format("{0}FILEPARSER", partner.Code)); }
public IBuildValueFactory GetBuildValueFactoryFor(BusinessPartner partner) { var factories = ServiceLocator.Current.GetAllInstances<IBuildValueFactory>(); return factories.Find(f => f.For(partner)); }
public void MemorizeInnerReferences(IList<DocumentLineItemEntity> refs, string controlNumber, BusinessPartner partner) { if (refs == null || refs.Count() == 0) return; refs.ForEach(s => save_line(s, controlNumber, partner)); }
private void save_line(DocumentLineItemEntity line, string controlNo, BusinessPartner partner) { line.DocumentInDTO = new DocumentInDTO { ControlNumber = controlNo.CastToInt(), PartnerNumber = partner.Number }; _lines.Add(line); }
public IDocumentParser GetDocumentParserFor(BusinessPartner partner, string docType) { return ServiceLocator.Current.GetInstance<IDocumentParser>(string.Format("{0}{1}DOCPARSER", partner.Code, docType.Trim())); }
public DocumentAssignments(BusinessPartner partner) { Partner = partner; Documents = new List<DocumentFile>(); }
public static string GetSenderIdFor(BusinessPartner partner) { ensureInitialized(); return(_config.GetSettingBasedOnTestMode(string.Format("{0}InterchangeReceiverID", partner.Code))); }
public bool CanParseFor(BusinessPartner partner) { return partner.Value == BusinessPartner.Initech.Value; }
private IEnumerable <IEdiMessage> buildMessagesFromFileInfo(EdiFileInfo fileInfo, BusinessPartner partner) { var docs = fileInfo.Documents; var msgs = new List <IEdiMessage>(); docs.ForEach(d => msgs.Add(getMessageFrom(d, partner))); return(msgs); }
public void SetBuildValues(BusinessPartner partner) { _buildFactory = _serviceResolver.GetBuildValueFactoryFor(partner); if (_buildFactory == null) throw new ApplicationException("There was no build factory for partner " + partner.Code); }
public DocumentAssignments(BusinessPartner partner) { Partner = partner; Documents = new List <DocumentFile>(); }
public static string GetSenderIdFor(BusinessPartner partner) { ensureInitialized(); return _config.GetSettingBasedOnTestMode(string.Format("{0}InterchangeReceiverID", partner.Code)); }
public bool CanProcess(BusinessPartner partner, string docType) { return partner.Value == BusinessPartner.Initech.Value && docType == "850"; }
public bool CanProcess(BusinessPartner partner, string docType) { return partner == BusinessPartner.Initech && docType == "997"; }