コード例 #1
0
ファイル: Segment.cs プロジェクト: DirektChark/EDIFACT
        internal static Segment SetUNA(string componentDataElementSeparator, string dataElementSeparator, string decimalNotation, string releaseIndicator, string reservedForFutureUse, string segmentTerminator)
        {
            var una = new UNA(componentDataElementSeparator,
                              dataElementSeparator,
                              decimalNotation,
                              releaseIndicator,
                              reservedForFutureUse,
                              segmentTerminator);

            return(una);
        }
コード例 #2
0
ファイル: Separators.cs プロジェクト: zyhong/EdiWeave
        /// <summary>
        /// Creates UNA segment.
        /// </summary>
        /// <returns>The separators.</returns>
        public UNA ToUna()
        {
            var result = new UNA
            {
                ComponentDataElement = ComponentDataElement,
                DataElement          = DataElement,
                DecimalNotation      = '.',
                ReleaseIndicator     = Escape ?? '?',
                Reserved             = ' ',
                Segment = Segment
            };

            return(result);
        }
コード例 #3
0
ファイル: EdifactHelper.cs プロジェクト: zyhong/EdiWeave
        public static string Generate(List <EdiItem> items, Separators separators, string postFix,
                                      Encoding encoding = null, UNA una = null)
        {
            using (var stream = new MemoryStream())
            {
                var writer = new EdifactWriter(stream, encoding, postFix);
                if (una != null)
                {
                    writer.Write(una);
                }
                foreach (var item in items)
                {
                    var message = item as EdiMessage;
                    if (message != null)
                    {
                        writer.Write(message);
                        continue;
                    }

                    var gs = item as UNG;
                    if (gs != null)
                    {
                        writer.Write(gs);
                        continue;
                    }

                    var ge = item as UNE;
                    if (ge != null)
                    {
                        continue;
                    }

                    var unb = item as UNB;
                    if (unb != null)
                    {
                        writer.Write(unb, separators);
                    }
                }
                writer.Flush();

                return(CommonHelper.LoadString(stream));
            }
        }
コード例 #4
0
 /// <summary>
 /// Write UNA to the destination.
 /// </summary>
 /// <param name="ediSegment">The UNA.</param>
 public void Write(UNA ediSegment)
 {
     Write(ediSegment.GenerateSegment());
 }