public DataSet ToDataSet() { //Return a dataset containing values for this object SortProfileDS ds = null; try { ds = new SortProfileDS(); SortProfileDS.SortProfileTableRow profile = ds.SortProfileTable.NewSortProfileTableRow(); profile.FreightType = this.mFreightType; profile.SortTypeID = this.mSortTypeID; profile.SortType = this.mSortType; profile.ClientNumber = this.mClientNumber; profile.ClientDivision = this.mClientDivision; if (this.mVendorNumber.Length > 0) { profile.VendorNumber = this.mVendorNumber; } profile.Status = this.mStatus; if (this.mExceptionDeliveryLocation > 0) { profile.ExceptionLocation = this.mExceptionDeliveryLocation; } if (this.mLabelID > 0) { profile.LabelID = this.mLabelID; } ds.SortProfileTable.AddSortProfileTableRow(profile); ds.Merge(this.mInboundLabel.ToDataSet()); ds.AcceptChanges(); } catch (Exception) { } return(ds); }
public static SortProfile CreateSortProfile(InboundFreight shipment, int sortTypeID, string sortType, int labelID, int excLocation) { //Create a sort profile for the specified freight based upon its' type (i.e. Tsort, Returns), //the client/shipper relationship, and how it was scheduled by Freight Assign to be sorted (i.e. San, Regular, SKU, etc) SortProfile sortProfile = null; try { //The freight type of the shipment determines whether a regular or returns profile is needed //Create a sort profile that specifies freight type, sort type, and inbound label SortProfileDS sortProfileDS = new SortProfileDS(); SortProfileDS.SortProfileTableRow profile = sortProfileDS.SortProfileTable.NewSortProfileTableRow(); sortProfileDS.EnforceConstraints = false; profile.FreightType = shipment.FreightType; profile.SortTypeID = sortTypeID; profile.SortType = sortType; profile.ClientNumber = shipment.Client.Number; profile.ClientDivision = shipment.Client.Division; profile.VendorNumber = shipment.Shipper.NUMBER; profile.Status = ""; profile.LabelID = labelID; profile.ExceptionLocation = excLocation; sortProfileDS.EnforceConstraints = true; sortProfile = new SortProfile(profile); } catch (ApplicationException ex) { throw ex; } catch (Exception ex) { throw new ApplicationException("Unexpected exception creating sort profile.", ex); } return(sortProfile); }
private InboundLabel mInboundLabel = null; //Expected inbound label //Constants //Events //Interface public SortProfile(SortProfileDS.SortProfileTableRow profile) { //Constructor try { if (profile != null) { this.mFreightType = profile.FreightType; this.mSortTypeID = profile.SortTypeID; this.mSortType = profile.SortType; this.mClientNumber = profile.ClientNumber; this.mClientDivision = profile.ClientDivision; if (!profile.IsVendorNumberNull()) { this.mVendorNumber = profile.VendorNumber; } this.mStatus = profile.Status; if (!profile.IsExceptionLocationNull()) { this.mExceptionDeliveryLocation = profile.ExceptionLocation; } if (!profile.IsLabelIDNull()) { this.mLabelID = profile.LabelID; } //Create the inbound label for this profile; this.mInboundLabel = FreightFactory.CreateInboundLabel(this.mLabelID); } } catch (ApplicationException ex) { throw ex; } catch (Exception ex) { throw new ApplicationException("Unexpected error while creating new Sort Profile instance.", ex); } }