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); }
private void OnGridBeforeRowUpdate(object sender, Infragistics.Win.UltraWinGrid.CancelableRowEventArgs e) { //Event handler for data entry row updated try { //There is no selected row when updating- at a cell level string clid = e.Row.Cells["CLID"].Value.ToString(); string format = e.Row.Cells["ExportFormat"].Value.ToString(); string path = e.Row.Cells["ExportPath"].Value.ToString(); string key = e.Row.Cells["CounterKey"].Value.ToString(); string client = e.Row.Cells["Client"].Value.ToString(); string scanner = e.Row.Cells["Scanner"].Value.ToString(); string userid = e.Row.Cells["UserID"].Value.ToString(); if (clid != "" && format != "" && path != "" && key != "" && client != "") { if (e.Row.IsAddRow) { //Add new entry bool created = EnterpriseFactory.CreateClient(clid, format, path, key, client, scanner, userid); OnRefresh(this.btnRefresh, EventArgs.Empty); } else { //Update existing bool updated = EnterpriseFactory.UpdateClient(clid, format, path, key, client, scanner, userid); OnRefresh(this.btnRefresh, EventArgs.Empty); } } else { e.Cancel = true; } } catch (Exception ex) { App.ReportError(ex); } }