//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); } }
public InboundLabelInputSrc Copy() { //Return a copy of this object InboundLabelInputSrc input = null; try { InboundLabelDS label = (InboundLabelDS)this.ToDataSet(); input = new InboundLabelInputSrc(this.mInputNumber, label, this.mName); } catch (Exception ex) { throw new ApplicationException("Unexpected error while creating a copy of an Inbound Label Input Source.", ex); } return(input); }
public void AddInputSrc(InboundLabelInputSrc inputSrc) { //Add an input src definition to this label. //NOTE : Need to think about calling Validate Definition here to verify // that input number corresponds to the order in the linked array if (this.mInputs[inputSrc.InputNumber - 1] != null) { throw new ApplicationException("There is already an input defined for input position " + inputSrc.InputNumber); } this.mInputs[inputSrc.InputNumber - 1] = inputSrc; inputSrc.DataElementValidated += new LabelDataEventHandler(this.OnDataElementValdated); }
private void adapt() { //Event handler for change in label data InboundLabelInputSrc inputSrc1 = null, inputSrc2 = null, inputSrc3 = null; InboundLabelDataElement element = null; base.mInputs[0] = base.mInputs[1] = base.mInputs[2] = null; //Create input 1 (mandatory) inputSrc1 = new InboundLabelInputSrc(1, this.mFreightInfo.Input1Length, this.mFreightInfo.ValidationString, (short)this.mFreightInfo.ValidationBegin, ""); element = createDataElement(inputSrc1, base.mLabelID, InboundLabelDataElement.DATAELEM_STORE, 1, this.mFreightInfo.StoreBeginPos, (short)(this.mFreightInfo.StoreEndPos - this.mFreightInfo.StoreBeginPos + 1), false, false, false); inputSrc1.AddDataElement(element); if (this.mFreightInfo.CartonInInput1 == "Y") { element = createDataElement(inputSrc1, base.mLabelID, InboundLabelDataElement.DATAELEM_CARTON, 1, this.mFreightInfo.CartonBeginPos, (short)(this.mFreightInfo.CartonEndPos - this.mFreightInfo.CartonBeginPos + 1), (this.mFreightInfo.CartonsNbrReq == "Y"), (this.mFreightInfo.DupCartonsOK == "Y"), (this.mFreightInfo.CartonValidation == "Y")); inputSrc1.AddDataElement(element); } if (this.mFreightInfo.POInputNumber == 1) { element = createDataElement(inputSrc1, base.mLabelID, InboundLabelDataElement.DATAELEM_PO, 1, (short)this.mFreightInfo.POStart, (short)this.mFreightInfo.POLength, false, false, false); inputSrc1.AddDataElement(element); } base.AddInputSrc(inputSrc1); //Create input 2 if (this.mFreightInfo.Input2Length > 0) { inputSrc2 = new InboundLabelInputSrc(2, this.mFreightInfo.Input2Length, "", 0, ""); if (this.mFreightInfo.CartonInInput1 == "N") { element = createDataElement(inputSrc2, base.mLabelID, InboundLabelDataElement.DATAELEM_CARTON, 2, this.mFreightInfo.CartonBeginPos, (short)(this.mFreightInfo.CartonEndPos - this.mFreightInfo.CartonBeginPos + 1), false, false, false); inputSrc2.AddDataElement(element); } if (this.mFreightInfo.POInputNumber == 2) { element = createDataElement(inputSrc2, base.mLabelID, InboundLabelDataElement.DATAELEM_PO, 2, (short)this.mFreightInfo.POStart, (short)this.mFreightInfo.POLength, false, false, false); inputSrc2.AddDataElement(element); } base.AddInputSrc(inputSrc2); } //Create input 3 if (this.mFreightInfo.Input3Length > 0) { inputSrc3 = new InboundLabelInputSrc(3, this.mFreightInfo.Input3Length, "", 0, ""); if (this.mFreightInfo.POInputNumber == 3) { element = createDataElement(inputSrc3, base.mLabelID, InboundLabelDataElement.DATAELEM_PO, 3, (short)this.mFreightInfo.POStart, (short)this.mFreightInfo.POLength, false, false, false); inputSrc3.AddDataElement(element); } base.AddInputSrc(inputSrc3); } }
public InboundLabelInputSrc InputSrcItem(int inputNumber) { //Get the input src with the specified input number from this label InboundLabelInputSrc input = null; for (int i = 0; i < this.mInputs.Length; i++) { if (this.mInputs[i].InputNumber == inputNumber) { input = this.mInputs[i]; break; } } return(input); }
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); }
public void RemoveInputSrc(InboundLabelInputSrc inputSrc) { //Remove an input src definition from this label this.mInputs[inputSrc.InputNumber - 1] = null; }