public DataSet ToDataSet() { //Return a dataset containing values for this terminal InboundFreightDS ds = null; try { ds = new InboundFreightDS(); InboundFreightDS.InboundFreightTableRow shipment = ds.InboundFreightTable.NewInboundFreightTableRow(); shipment.FreightID = this.mFreightID; shipment.FreightType = this.mFreightType; shipment.CurrentLocation = this.mCurrentLocation; shipment.TDSNumber = this.mTDSNumber; shipment.TrailerNumber = this.mTrailerNumber; shipment.StorageTrailerNumber = this.mStorageTrailerNumber; if (this.mClient != null) { shipment.ClientNumber = this.mClient.Number; } if (this.mClient != null) { shipment.ClientName = this.mClient.Name; } if (this.mShipper != null) { shipment.ShipperNumber = this.mShipper.NUMBER; } if (this.mShipper != null) { shipment.ShipperName = this.mShipper.NAME; } shipment.PickupDate = this.mPickupDate; shipment.PickupNumber = this.mPickupNumber; shipment.Status = this.mStatus; shipment.Cartons = this.mCartons; shipment.Pallets = this.mPallets; shipment.CarrierNumber = this.mCarrierNumber; shipment.DriverNumber = this.mDriverNumber; shipment.FloorStatus = this.mFloorStatus; shipment.SealNumber = this.mSealNumber; shipment.UnloadedStatus = this.mUnloadedStatus; shipment.VendorKey = this.mVendorKey; shipment.ReceiveDate = this.mReceiveDate; shipment.TerminalID = this.mTerminalID; shipment.CubeRatio = this.mCubeRatio; ds.InboundFreightTable.AddInboundFreightTableRow(shipment); if (this.mClient != null) { ds.Merge(this.mClient.ToDataSet()); } if (this.mShipper != null) { ds.Merge(this.mShipper.ToDataSet()); } ds.AcceptChanges(); } catch (Exception) { } return(ds); }
public static InboundFreight CreateInboundFreight(int terminalID, string freightID, string freightType, int TDSNumber, string vendorKey, string trailerNumber, string pickupDate, string pickupNumber, decimal cubeRatio, Client client, Shipper shipper) { // InboundFreight shipment = null; try { InboundFreightDS freight = new InboundFreightDS(); InboundFreightDS.InboundFreightTableRow row = freight.InboundFreightTable.NewInboundFreightTableRow(); row.TerminalID = terminalID; row.FreightID = freightID; row.FreightType = freightType; row.TDSNumber = TDSNumber; row.VendorKey = vendorKey; row.TrailerNumber = trailerNumber; row.PickupDate = pickupDate; row.PickupNumber = pickupNumber; row.CubeRatio = cubeRatio; freight.InboundFreightTable.AddInboundFreightTableRow(row); shipment = new InboundFreight(freight.InboundFreightTable[0], client, shipper); } catch (ApplicationException ex) { throw ex; } catch (Exception ex) { throw new ApplicationException("Unexpected exception creating inbound freight.", ex); } return(shipment); }
//Interface public InboundFreight(InboundFreightDS.InboundFreightTableRow shipment, Client client, Shipper shipper) { //Constructor try { if (shipment != null) { if (!shipment.IsFreightIDNull()) { this.mFreightID = shipment.FreightID; } if (!shipment.IsFreightTypeNull()) { this.mFreightType = shipment.FreightType; } if (!shipment.IsCurrentLocationNull()) { this.mCurrentLocation = shipment.CurrentLocation; } if (!shipment.IsTDSNumberNull()) { this.mTDSNumber = shipment.TDSNumber; } if (!shipment.IsTrailerNumberNull()) { this.mTrailerNumber = shipment.TrailerNumber; } if (!shipment.IsStorageTrailerNumberNull()) { this.mStorageTrailerNumber = shipment.StorageTrailerNumber; } if (!shipment.IsPickupDateNull()) { this.mPickupDate = shipment.PickupDate; } if (!shipment.IsPickupNumberNull()) { this.mPickupNumber = shipment.PickupNumber; } if (!shipment.IsStatusNull()) { this.mStatus = shipment.Status; } if (!shipment.IsCartonsNull()) { this.mCartons = shipment.Cartons; } if (!shipment.IsPalletsNull()) { this.mPallets = shipment.Pallets; } if (!shipment.IsCarrierNumberNull()) { this.mCarrierNumber = shipment.CarrierNumber; } if (!shipment.IsDriverNumberNull()) { this.mDriverNumber = shipment.DriverNumber; } if (!shipment.IsFloorStatusNull()) { this.mFloorStatus = shipment.FloorStatus; } if (!shipment.IsSealNumberNull()) { this.mSealNumber = shipment.SealNumber; } if (!shipment.IsUnloadedStatusNull()) { this.mUnloadedStatus = shipment.UnloadedStatus; } if (!shipment.IsVendorKeyNull()) { this.mVendorKey = shipment.VendorKey; } if (!shipment.IsReceiveDateNull()) { this.mReceiveDate = shipment.ReceiveDate; } if (!shipment.IsTerminalIDNull()) { this.mTerminalID = shipment.TerminalID; } if (!shipment.IsCubeRatioNull()) { this.mCubeRatio = shipment.CubeRatio; } } this.mClient = client; this.mShipper = shipper; } catch (Exception ex) { throw new ApplicationException("Unexpected error while creating new inbound shipment instance.", ex); } }