Ejemplo n.º 1
0
        /// <summary>
        /// Adds a new <see cref="FunctionGroup"/> to the interchange
        /// </summary>
        /// <param name="functionIdCode">Id code of new FunctionGroup</param>
        /// <param name="date">DateTime for function group</param>
        /// <param name="controlNumber">FunctionGroup control number</param>
        /// <param name="version">Version for FunctionGroup</param>
        /// <returns>New FunctionGroup object</returns>
        /// <exception cref="ElementValidationException">Thrown if the control number is not within acceptable range</exception>
        public FunctionGroup AddFunctionGroup(string functionIdCode, DateTime date, int controlNumber, string version)
        {
            if (controlNumber > 999999999 || controlNumber < 1)
            {
                throw new ElementValidationException(
                          Resources.ElementValueOutOfRange,
                          "GS06",
                          controlNumber.ToString());
            }

            var fg = new FunctionGroup(
                this.SpecFinder,
                this,
                this.DelimiterSet,
                string.Format("GS{0}{0}{0}{0}{0}{0}{0}X{0}{2}{1}", this.DelimiterSet.ElementSeparator, this.DelimiterSet.SegmentTerminator, version))
            {
                FunctionalIdentifierCode = functionIdCode,
                Date          = date,
                ControlNumber = controlNumber
            };

            fg.SetTerminatingTrailerSegment(string.Format("GE{0}0{0}{2}{1}", this.DelimiterSet.ElementSeparator, this.DelimiterSet.SegmentTerminator, controlNumber));
            this.functionGroups.Add(fg);
            return(fg);
        }
Ejemplo n.º 2
0
        public FunctionGroup AddFunctionGroup(string segmentString)
        {
            var fg = new FunctionGroup(this.SpecFinder, this, this.DelimiterSet, segmentString);

            this.functionGroups.Add(fg);
            return(fg);
        }