Exemple #1
0
        /// <summary>
        /// Converts the interchange to edi message.
        /// </summary>
        /// <param name="context">
        /// The interchange context.
        /// This sets the non format default separators.
        /// </param>
        /// <returns>
        /// The edi message.
        /// </returns>
        public override List <string> ToEdi(InterchangeContext context = null)
        {
            var x12Lexer = new ToEdiLexer(EdiHelper.Serialize(this), context);

            x12Lexer.Analyze();

            return(x12Lexer.Result);
        }
Exemple #2
0
        /// <summary>
        /// Converts the interchange to edi message.
        /// </summary>
        /// <param name="context">
        /// The interchange context.
        /// This sets the non format default separators.
        /// </param>
        /// <returns>
        /// The edi message.
        /// </returns>
        public List <string> ToEdi(InterchangeContext context = null)
        {
            var edifactLexer = new ToEdiLexer(EdiHelper.Serialize(this), context);

            edifactLexer.Analyze();

            return(edifactLexer.Result);
        }
Exemple #3
0
 /// <summary>
 /// Serialize the interchange into xml
 /// </summary>
 /// <returns>
 /// The serialized xml.
 /// </returns>
 public XElement Serialize()
 {
     return(EdiHelper.Serialize(this));
 }
Exemple #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Message"/> class.
 /// </summary>
 /// <param name="instance">
 /// Edi object.
 /// </param>
 /// <example>
 /// Set UNT segments count.
 /// <code lang="C#">
 /// var mInvoic = new M_INVOIC();
 /// // ... build the message
 ///
 /// var msg = new Message(mInvoic);
 /// var segCount = msg.Item.Descendants().Count(d => d.Name.LocalName.StartsWith("S_"));
 ///
 /// var nmn = new XmlNamespaceManager(new NameTable());
 /// nmn.AddNamespace("p", "www.edifabric.com/edifact");
 ///
 /// var untSegCount = msg.Item.XPathSelectElement("./p:S_UNT/p:D_0074_1", nmn);
 /// untSegCount.SetValue(segCount);
 /// </code>
 /// </example>
 public Message(object instance)
 {
     Context = new MessageContext(instance.GetType());
     Item    = EdiHelper.Serialize(instance);
 }