Пример #1
0
 //Constants
 //Events
 //Interface
 public InboundLabelDataElement(InboundLabelInputSrc parent, InboundLabelDS.InboundLabelDataElementTableRow element, int priority)
 {
     //Constructor: used for Returns freight label construction
     try {
         if (parent == null)
         {
             throw new ApplicationException("Input Src cannot be null.");
         }
         if (element == null)
         {
             throw new ApplicationException("Data Element cannot be null.");
         }
         if (parent.InputNumber != element.InputNumber)
         {
             throw new ApplicationException("Input number of Input Src must match input number of Data Element.");
         }
         this.mParent                 = parent;
         this.mLabelID                = element.LabelID;
         this.mElementType            = element.ElementType.Trim();
         this.mInputNumber            = element.InputNumber;
         this.mStart                  = element.Start;
         this.mLength                 = element.Length;
         this.mIsValueRequired        = element.IsValueRequired;
         this.mIsDuplicateAllowed     = element.IsDuplicateAllowed;
         this.mIsCheckDigitValidation = element.IsCheckDigitValidation;
         this.mConstantValue          = element.ConstantValue.Trim();
         this.mValidationExp          = element.ValidationExp.Trim();
         this.mCheckDigitType         = element.CheckDigitType.Trim();
         this.mPriority               = priority;
     }
     catch (ApplicationException ex) { throw ex; }
     catch (Exception ex) { throw new ApplicationException("Unexpected error while creating Inbound Label Data Element instance.", ex); }
 }
Пример #2
0
        public InboundLabelDataElement Copy()
        {
            //Return a copy of this object
            InboundLabelDataElement element = null;

            try {
                InboundLabelDS.InboundLabelDataElementTableRow elem = ((InboundLabelDS)this.ToDataSet()).InboundLabelDataElementTable[0];
                element = new InboundLabelDataElement(this.mParent, elem, this.mPriority);
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while creating a copy of an Inbound Label Data Element.", ex); }
            return(element);
        }
Пример #3
0
        private InboundLabelDataElement createDataElement(InboundLabelInputSrc parent, int labelID, string type, short inputNumber, short start, short len, bool isValueRequired, bool isDuplicateAllowed, bool isCheckDigitValidation)
        {
            //
            InboundLabelDataElement element = null;

            try {
                InboundLabelDS label = new InboundLabelDS();
                InboundLabelDS.InboundLabelDataElementTableRow elem = label.InboundLabelDataElementTable.NewInboundLabelDataElementTableRow();
                elem.LabelID                = labelID;
                elem.ElementType            = type;
                elem.InputNumber            = inputNumber;
                elem.Start                  = start;
                elem.Length                 = len;
                elem.IsValueRequired        = (isValueRequired ? (byte)1 : (byte)0);
                elem.IsDuplicateAllowed     = (isDuplicateAllowed ? (byte)1 : (byte)0);
                elem.IsCheckDigitValidation = (isCheckDigitValidation ? (byte)1 : (byte)0);
                elem.ConstantValue          = "";
                label.InboundLabelDataElementTable.AddInboundLabelDataElementTableRow(elem);
                element = new InboundLabelDataElement(parent, label.InboundLabelDataElementTable[0], 0);
            }
            catch (Exception ex) { throw ex; }
            return(element);
        }
Пример #4
0
        public DataSet ToDataSet()
        {
            //Return a dataset containing values for this object
            InboundLabelDS ds = null;

            try {
                ds = new InboundLabelDS();
                InboundLabelDS.InboundLabelDataElementTableRow element = ds.InboundLabelDataElementTable.NewInboundLabelDataElementTableRow();
                element.LabelID                = this.mLabelID;
                element.ElementType            = this.mElementType;
                element.InputNumber            = this.mInputNumber;
                element.Start                  = this.mStart;
                element.Length                 = this.mLength;
                element.IsValueRequired        = this.mIsValueRequired;
                element.IsDuplicateAllowed     = this.mIsDuplicateAllowed;
                element.IsCheckDigitValidation = this.mIsCheckDigitValidation;
                element.ConstantValue          = this.mConstantValue.Trim();
                element.ValidationExp          = this.mValidationExp.Trim();
                element.CheckDigitType         = this.mCheckDigitType.Trim();
                ds.InboundLabelDataElementTable.AddInboundLabelDataElementTableRow(element);
            }
            catch (Exception ex) { Debug.Write(ex.ToString() + "\n"); }
            return(ds);
        }