public static StationAssignments GetStationAssignments(Workstation workstation) { //Return a collection of current freight assignments for the specified workstation StationAssignments assignments = null; try { if (workstation == null) { throw new ApplicationException("Workstation is null."); } assignments = new StationAssignments(); StationAssignmentDS dsAssignments = new StationAssignmentDS(); dsAssignments.Merge(Mediator.FillDataset(USP_FREIGHTCLIENTSHIPPER, TBL_FREIGHTCLIENTSHIPPER, new object[] { workstation.WorkStationID })); foreach (StationAssignmentDS.FreightClientShipperTableRow row in dsAssignments.FreightClientShipperTable) { Client client = EnterpriseFactory.CreateClient(row.ClientNumber, row.ClientDivision, row.Client, row.ClientAddressLine1, row.ClientAddressLine2, row.ClientAddressCity, row.ClientAddressState, row.ClientAddressZip); Shipper shipper = EnterpriseFactory.CreateShipper(row.FreightType, row.ShipperNumber, row.Shipper, row.ShipperAddressLine1, row.ShipperAddressLine2, row.ShipperAddressCity, row.ShipperAddressState, row.ShipperAddressZip, row.ShipperUserData); InboundFreight shipment = FreightFactory.CreateInboundFreight(row.TerminalID, row.FreightID, row.FreightType, row.TDSNumber, row.VendorKey, row.TrailerNumber, row.PickupDate, row.PickupNumber, row.CubeRatio, client, shipper); SortProfile profile = CreateSortProfile(shipment, row.SortTypeID, row.SortType, row.LabelID, row.ExcLocation); assignments.Add(new StationAssignment("", workstation, shipment, profile)); } } catch (ApplicationException ex) { throw ex; } catch (Exception ex) { throw new ApplicationException("Unexpected error while getting station assignments (freight-client-shipper).", ex); } return(assignments); }
public void RefreshIndirectAssignments() { //Load trip assignments try { this.mIndirectAssignments.Clear(); StationAssignmentDS assignments = new StationAssignmentDS(); assignments.Merge(this.mMediator.FillDataset(App.USP_INDIRECTASSIGNMENTS, App.TBL_INDIRECTASSIGNMENTS, null)); foreach (StationAssignmentDS.IndirectAssignmentTableRow row in assignments.IndirectAssignmentTable) { SortStation station = EnterpriseFactory.GetStation(row.StationNumber); InboundFreight freight = FreightFactory.CreateInboundFreight(0, row.TripNumber, "", "", 0); this.mIndirectAssignments.Add(station.Number + freight.FreightID, new StationFreightAssignment(station, freight, "")); } } catch (Exception ex) { throw ex; } finally { if (IndirectAssignmentsChanged != null) { IndirectAssignmentsChanged(this, EventArgs.Empty); } } }
public void RefreshDirectAssignments() { //Load direct freight assignments try { this.mDirectAssignments.Clear(); StationAssignmentDS assignments = new StationAssignmentDS(); assignments.Merge(this.mMediator.FillDataset(App.USP_DIRECTASSIGNMENTS, App.TBL_DIRECTASSIGNMENTS, null)); foreach (StationAssignmentDS.DirectAssignmentTableRow row in assignments.DirectAssignmentTable) { SortStation station = EnterpriseFactory.GetStation(row.StationNumber); Client client = EnterpriseFactory.CreateClient(row.ClientNumber, row.ClientDivision, row.Client, "", "", "", "", ""); Shipper shipper = EnterpriseFactory.CreateShipper(row.FreightType, row.ShipperNumber, row.Shipper, "", "", "", "", "", ""); InboundFreight freight = FreightFactory.CreateInboundFreight(row.TerminalID, row.FreightID, row.FreightType, row.TDSNumber, "", row.TrailerNumber, row.Pickup, row.Pickup, 0, client, shipper); this.mDirectAssignments.Add(station.Number + freight.FreightID, new StationFreightAssignment(station, freight, row.SortType)); } } catch (Exception ex) { throw ex; } finally { if (DirectAssignmentsChanged != null) { DirectAssignmentsChanged(this, EventArgs.Empty); } } }