//Interface public dlgAssignmentDetail(DialogActionEnum eDialogAction, InboundShipment shipment, string workstationID) { //Constructor try { InitializeComponent(); this.cmdCancel.Text = CMD_CANCEL; this.cmdBack.Text = CMD_BACK; this.cmdNext.Text = CMD_NEXT; this.mShipment = shipment; switch (this.mDialogAction = eDialogAction) { case DialogActionEnum.DialogActionAssign: this.Text = "Assign Freight To Sort Stations"; this.mAssignmentsDS.Clear(); break; case DialogActionEnum.DialogActionUnassignAny: this.Text = "Unassign Freight From Sort Stations"; this.mAssignmentsDS.Merge(TsortGateway.GetStationAssignments(this.mShipment, "")); break; case DialogActionEnum.DialogActionUnassign: this.Text = "Remove Freight Assignment"; this.mAssignmentsDS.Merge(TsortGateway.GetStationAssignments(this.mShipment, workstationID)); break; } } catch (Exception ex) { throw new ApplicationException("Could not crate new Assignment Detail dialog.", ex); } }
private bool assignFreight() { bool bOK = true; this.Cursor = Cursors.WaitCursor; try { //Create station freight assignments foreach (TsortDataset.StationFreightAssignmentTableRow row in this.mAssignmentsDS.StationFreightAssignmentTable.Rows) { Workstation station = new Workstation(); station.WorkStationID = row.WorkStationID; station.Number = row.StationNumber; bool created = false; try { created = TsortGateway.CreateStationAssignment(station, this.mShipment, row.SortTypeID, "Assigned"); } catch (ApplicationException ex) { App.ReportError(ex, true, LogLevel.Error); } if (!created) { bOK = false; } row.Result = (!created) ? EX_RESULT_FAILED : EX_RESULT_OK; this.grdAssignments.Refresh(); Application.DoEvents(); } } catch (Exception ex) { App.ReportError(ex, true, LogLevel.Error); } return(bOK); }
private bool freightStarted() { //Set freight status to started if applicable DialogResult res = DialogResult.None; bool sorting = true; try { if (this.mShipment.Status.ToLower() == "unsorted") { //Before we can make assignment we need to make sure we can set the freight status to //sorting (sort started); no exception is thrown if the status cannot be changed sorting = false; res = MessageBox.Show(this, "The selected freight must be 'sorting' prior to assignment. Would you like to start sort for this freight?", App.Product, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (res == DialogResult.Yes) { //Update a shipment as sorting //Double check result on exception: freight can be assigned if status is sorting try { sorting = TsortGateway.StartSort(this.mShipment); } catch (Exception) { sorting = TsortGateway.IsSortStarted(this.mShipment); } if (!sorting) { App.ReportError(new ApplicationException("Sorting could not be started for freight " + this.mShipment.FreightID + "(VendorKey=" + this.mShipment.VendorKey + "; Status=" + this.mShipment.Status + "). Please refresh and try again."), true, LogLevel.Error); } } } } catch (Exception ex) { App.ReportError(ex, true, LogLevel.Error); } return(sorting); }
protected void OnAssignment(object sender, CommandEventArgs e) { // try { switch (e.CommandName) { case "Add": if (this.cboSortType.SelectedValue.Trim().Length > 0 && this.cboStation.SelectedValue.Trim().Length > 0) { Argix.Freight.Workstation station = new Argix.Freight.Workstation(); station.WorkStationID = this.cboStation.SelectedValue; Argix.Freight.InboundShipment shipment = new Argix.Freight.InboundShipment(); shipment.TerminalID = int.Parse(this.cboTerminal.SelectedValue); shipment.FreightID = this.odsStations.SelectParameters["freightID"].DefaultValue; int sortTypeID = int.Parse(this.cboSortType.SelectedValue); bool added = new Argix.Freight.TsortGateway().CreateStationAssignment(station, shipment, sortTypeID); this.lsvAssignments.DataBind(); } break; case "Unassign": Argix.Freight.StationAssignment assignment = new Argix.Freight.StationAssignment(); assignment.SortStation = new Argix.Freight.Workstation(); assignment.SortStation.WorkStationID = e.CommandArgument.ToString().Split(new char[] { ',' })[0]; assignment.InboundFreight = new Argix.Freight.InboundShipment(); assignment.InboundFreight.TerminalID = int.Parse(this.cboTerminal.SelectedValue); assignment.InboundFreight.FreightID = e.CommandArgument.ToString().Split(new char[] { ',' })[1]; assignment.SortTypeID = int.Parse(e.CommandArgument.ToString().Split(new char[] { ',' })[2]); bool removed = new Argix.Freight.TsortGateway().DeleteStationAssignment(assignment); this.lsvAssignments.DataBind(); break; } } catch (Exception ex) { Master.ReportError(ex); } }
protected void OnCommand(object sender, CommandEventArgs e) { // try { switch (e.CommandName) { case "Assign": if (this.cboSortType.SelectedValue.Trim().Length > 0 && this.cboStation.SelectedValue.Trim().Length > 0) { Argix.Freight.Workstation station = new Argix.Freight.Workstation(); station.WorkStationID = this.cboStation.SelectedValue; Argix.Freight.InboundShipment shipment = new Argix.Freight.InboundShipment(); shipment.TerminalID = int.Parse(Request.QueryString["terminalID"]); shipment.FreightID = Request.QueryString["freightID"]; int sortTypeID = int.Parse(this.cboSortType.SelectedValue); bool added = new Argix.Freight.TsortGateway().CreateStationAssignment(station, shipment, sortTypeID); if (added) { Response.Redirect("~/Stations.aspx"); } } break; case "Cancel": Response.Redirect("~/Default.aspx"); break; } } catch (Exception ex) { Master.ReportError(ex); } }
protected void OnCommand(object sender, CommandEventArgs e) { // try { switch (e.CommandName) { case "Unassign": if (this.grdStations.SelectedRow != null) { DataKey dataKey = (DataKey)this.grdStations.DataKeys[this.grdStations.SelectedRow.RowIndex]; Argix.Freight.StationAssignment assignment = new Argix.Freight.StationAssignment(); assignment.SortStation = new Argix.Freight.Workstation(); assignment.SortStation.WorkStationID = dataKey["WorkStationID"].ToString(); assignment.InboundFreight = new Argix.Freight.InboundShipment(); assignment.InboundFreight.TerminalID = int.Parse(this.cboTerminal.SelectedValue); assignment.InboundFreight.FreightID = dataKey["FreightID"].ToString(); assignment.SortTypeID = int.Parse(dataKey["SortTypeID"].ToString()); bool removed = new Argix.Freight.TsortGateway().DeleteStationAssignment(assignment); this.grdStations.DataBind(); } else { Master.ShowMessageBox("Please select an assignment."); } break; } } catch (Exception ex) { Master.ReportError(ex); } }
private void OnFormLoad(object sender, System.EventArgs e) { //Event handler for form load event this.Cursor = Cursors.WaitCursor; try { //Initialize controls Splash.Close(); this.Visible = true; Application.DoEvents(); #region Set user preferences try { this.WindowState = global::Argix.Properties.Settings.Default.WindowState; switch (this.WindowState) { case FormWindowState.Maximized: break; case FormWindowState.Minimized: break; case FormWindowState.Normal: this.Location = global::Argix.Properties.Settings.Default.Location; this.Size = global::Argix.Properties.Settings.Default.Size; break; } this.msViewToolbar.Checked = this.tsMain.Visible = Convert.ToBoolean(global::Argix.Properties.Settings.Default.Toolbar); this.msViewStatusbar.Checked = this.ssMain.Visible = Convert.ToBoolean(global::Argix.Properties.Settings.Default.StatusBar); App.CheckVersion(); } catch (Exception ex) { App.ReportError(ex, true, LogLevel.Error); } #endregion #region Set tooltips this.mToolTip.InitialDelay = 500; this.mToolTip.AutoPopDelay = 3000; this.mToolTip.ReshowDelay = 1000; this.mToolTip.ShowAlways = true; //Even when form is inactve #endregion //Set control defaults #region Grid Initialization this.grdMain.DisplayLayout.Bands[0].Columns["Load"].SortIndicator = SortIndicator.Ascending; #endregion ServiceInfo si = TsortGateway.GetServiceInfo(); this.ssMain.SetTerminalPanel(si.TerminalID.ToString(), si.Description); this.ssMain.User1Panel.Width = 144; this.mClientDS.Merge(TsortGateway.GetClients()); if (this.cboClient.Items.Count > 0) { this.cboClient.SelectedIndex = 0; } this.dtpFrom.Value = DateTime.Today.AddDays(-7); this.dtpTo.Value = DateTime.Today; this.grdMain.Focus(); } catch (Exception ex) { App.ReportError(ex, true, LogLevel.Error); } finally { setUserServices(); this.Cursor = Cursors.Default; } }
public bool CreateStationAssignment(int terminalID, string workStationID, string freightID, int sortTypeID) { // bool created = false; try { //Verify shipment exists at this terminal InboundShipment _shipment = GetInboundShipment(terminalID, freightID); if (_shipment == null) { throw new ApplicationException("Inbound shipment " + freightID + " could not be found at terminal " + terminalID.ToString() + "."); } //Verify shipment is sortable if (!_shipment.IsSortable) { throw new ApplicationException("Freight cannot be assigned because all TDS arrival information has not been entered."); } //Verify freight is assignable to the specified station at this terminals FreightDataset stations = new FreightDataset(); stations.Merge(GetAssignableSortStations(terminalID, freightID, sortTypeID)); if (stations.WorkstationTable.Select("WorkstationID ='" + workStationID + "'", "").Length == 0) { throw new ApplicationException("WorkstationID " + workStationID + " is not assignable for freight " + freightID + " at terminal " + terminalID.ToString() + "."); } //Create the TransactionScope to execute the commands, guaranteeing that both commands can commit or roll back as a single unit of work using (TransactionScope scope = new TransactionScope()) { // if (terminalID > 0) { bool unsorted = _shipment.Status.ToLower() == "unsorted"; bool sorting = _shipment.Status.ToLower() == "sorting"; bool sorted = _shipment.Status.ToLower() == "sorted"; if (unsorted) { sorting = new TsortGateway(terminalID).StartSort(freightID, DateTime.Now); } if (sorting || sorted) { created = new TsortGateway(terminalID).CreateStationAssignment(workStationID, freightID, sortTypeID); } } //Commits the transaction; if an exception is thrown, Complete is not called and the transaction is rolled back scope.Complete(); } } catch (Exception ex) { throw new FaultException <TsortFault>(new TsortFault(ex.Message), "Service Error"); } return(created); }
private void OnFormLoad(object sender, System.EventArgs e) { //Event handler for form load event this.Cursor = Cursors.WaitCursor; try { //Set initial conditions this.grdFreightTypes.DisplayLayout.Bands[0].Columns["ID"].SortIndicator = SortIndicator.Ascending; this.grdSortStations.DisplayLayout.Bands[0].Columns["Number"].SortIndicator = SortIndicator.Ascending; this.grdAssignments.DisplayLayout.Bands[0].Columns["StationNumber"].SortIndicator = SortIndicator.Ascending; switch (this.mDialogAction) { case DialogActionEnum.DialogActionAssign: //Assignment- show freight sort types for selection. //Note: If only 1 sort type, select for user and go to next screen this.mScreenID = 0; this.mFreightSortTypesDS.Merge(TsortGateway.GetFreightSortTypes(this.mShipment)); if (this.grdFreightTypes.Rows.Count > 0) { this.grdFreightTypes.Rows[0].Selected = true; this.grdFreightTypes.Rows[0].Activate(); } if (this.grdFreightTypes.Rows.Count == 1) { this.mScreenID = 1; } break; case DialogActionEnum.DialogActionUnassignAny: //Delete one or more assignments (as selected by user) //Transfer assignments into sort stations for user selection this.mScreenID = 1; for (int i = 0; i < this.mAssignmentsDS.StationFreightAssignmentTable.Rows.Count; i++) { TsortDataset.WorkstationTableRow row = this.mSortStationsDS.WorkstationTable.NewWorkstationTableRow(); row.WorkStationID = this.mAssignmentsDS.StationFreightAssignmentTable[i].WorkStationID; row.TerminalID = this.mAssignmentsDS.StationFreightAssignmentTable[i].TerminalID; row.Number = (!this.mAssignmentsDS.StationFreightAssignmentTable[i].IsStationNumberNull()) ? this.mAssignmentsDS.StationFreightAssignmentTable[i].StationNumber : "?"; row.Description = ""; this.mSortStationsDS.WorkstationTable.AddWorkstationTableRow(row); } break; case DialogActionEnum.DialogActionUnassign: //Delete a single assignment this.mScreenID = 2; break; } setDialogLayout(); } catch (Exception ex) { App.ReportError(ex, true, LogLevel.Error); } finally { this.Cursor = Cursors.Default; } }
public bool ChangeLanes(int terminalID, Zone zone) { //Update the lane assignments for this zone bool changed = false; try { if (terminalID > 0) { changed = new TsortGateway(terminalID).UpdateZoneLanes(zone); } } catch (Exception ex) { throw new FaultException <TsortFault>(new TsortFault(ex.Message), "Service Error"); } return(changed); }
public bool DeleteStationAssignment(StationAssignment assignment) { // bool deleted = false; try { if (assignment.InboundFreight.TerminalID > 0) { deleted = new TsortGateway(assignment.InboundFreight.TerminalID).DeleteStationAssignment(assignment.SortStation.WorkStationID, assignment.InboundFreight.FreightID); } } catch (Exception ex) { throw new FaultException <TsortFault>(new TsortFault(ex.Message), "Service Error"); } return(deleted); }
public bool StartSort(InboundShipment shipment) { // bool started = false; try { if (shipment.TerminalID > 0) { started = new TsortGateway(shipment.TerminalID).StartSort(shipment.FreightID, DateTime.Now); } } catch (Exception ex) { throw new FaultException <TsortFault>(new TsortFault(ex.Message), "Service Error"); } return(started); }
public bool CloseZone(int terminalID, Zone zone) { //Close this zone and update the lane assignments bool closed = false; try { if (terminalID > 0) { closed = new TsortGateway(terminalID).CloseZonesTL(zone); } } catch (Exception ex) { throw new FaultException <TsortFault>(new TsortFault(ex.Message), "Service Error"); } return(closed); }
public DataSet GetStationAssignments(int terminalID) { //Get a list of station-freight assignments for the specified terminal DataSet assignments = new DataSet(); try { if (terminalID > 0) { DataSet ds = new TsortGateway(terminalID).GetStationAssignments(); if (ds != null) { assignments.Merge(ds); } } } catch (Exception ex) { throw new FaultException <TsortFault>(new TsortFault(ex.Message), "Service Error"); } return(assignments); }
public DataSet GetAssignableSortStations(int terminalID, string freightID, int sortTypeID) { // DataSet sortStations = new DataSet(); try { if (terminalID > 0) { DataSet ds = new TsortGateway(terminalID).GetAssignableSortStations(terminalID, freightID, sortTypeID); if (ds != null) { sortStations.Merge(ds); } } } catch (Exception ex) { throw new FaultException <TsortFault>(new TsortFault(ex.Message), "Service Error"); } return(sortStations); }
public DataSet GetInboundFreight(int terminalID, DateTime fromDate) { //Get a list of inbound shipments for the specified terminal DataSet shipments = new DataSet(); try { if (terminalID > 0) { DataSet ds = new TsortGateway(terminalID).GetInboundFreight(terminalID, fromDate); if (ds != null) { shipments.Merge(ds); } } } catch (Exception ex) { throw new FaultException <TsortFault>(new TsortFault(ex.Message), "Service Error"); } return(shipments); }
public DataSet GetUnassignedClosedTLs(int terminalID, int closedDays) { // DataSet tls = new DataSet(); try { if (terminalID > 0) { DataSet ds = new TsortGateway(terminalID).GetUnassignedClosedTLs(closedDays); FreightDataset _tls = new FreightDataset(); _tls.Merge(ds); if (_tls.ZoneTable.Rows.Count > 0) { tls.Merge(_tls); } } } catch (Exception ex) { throw new FaultException <TsortFault>(new TsortFault(ex.Message), "Service Error"); } return(tls); }
public DataSet GetLanes(int terminalID) { //Get lists of all sort/small sort lanes for this terminal DataSet lanes = new DataSet(); try { if (terminalID > 0) { DataSet ds = new TsortGateway(terminalID).GetLanes(); FreightDataset _lanes = new FreightDataset(); _lanes.Merge(ds); if (_lanes.LaneTable.Rows.Count > 0) { lanes.Merge(_lanes); } } } catch (Exception ex) { throw new FaultException <TsortFault>(new TsortFault(ex.Message), "Service Error"); } return(lanes); }
public InboundShipment GetInboundShipment(int terminalID, string freightID) { //Return the inbound shipment for the specified terminal and freightID InboundShipment shipment = null; try { if (terminalID > 0) { DataSet ds = new TsortGateway(terminalID).GetInboundShipment(freightID); if (ds != null) { FreightDataset freight = new FreightDataset(); freight.Merge(ds, false, MissingSchemaAction.Ignore); shipment = new InboundShipment(freight.InboundFreightTable[0]); } } } catch (Exception ex) { throw new FaultException <TsortFault>(new TsortFault(ex.Message), "Service Error"); } return(shipment); }
public bool StopSort(InboundShipment shipment) { // bool stopped = false; try { //Shipment status = 'sorting' and no station assignments InboundShipment _shipment = GetInboundShipment(shipment.TerminalID, shipment.FreightID); if (_shipment == null) { throw new ApplicationException("Inbound shipment " + shipment.FreightID + " could not be found."); } if (_shipment.Status.ToLower() != "sorting") { throw new ApplicationException("Inbound shipment " + shipment.FreightID + " is currently not sorting."); } FreightDataset _assignments = new FreightDataset(); _assignments.Merge(GetStationAssignments(shipment.TerminalID)); if (_assignments.StationFreightAssignmentTable.Rows.Count > 0) { if (_assignments.StationFreightAssignmentTable.Select("FreightID = '" + shipment.FreightID + "'").Length > 0) { throw new ApplicationException("Inbound shipment " + shipment.FreightID + " currently has station assignments."); } } //Create the TransactionScope to execute the commands, guaranteeing that both commands can commit or roll back as a single unit of work using (TransactionScope scope = new TransactionScope()) { // if (shipment.TerminalID > 0) { stopped = new TsortGateway(shipment.TerminalID).StopSort(shipment.FreightID, DateTime.Now); } //Commits the transaction; if an exception is thrown, Complete is not called and the transaction is rolled back scope.Complete(); } } catch (Exception ex) { throw new FaultException <TsortFault>(new TsortFault(ex.Message), "Service Error"); } return(stopped); }
protected void OnAssignment(object sender, CommandEventArgs e) { // try { switch (e.CommandName) { case "Unassign": Argix.Freight.StationAssignment assignment = new Argix.Freight.StationAssignment(); assignment.SortStation = new Argix.Freight.Workstation(); assignment.SortStation.WorkStationID = e.CommandArgument.ToString().Split(new char[] { ',' })[0]; assignment.InboundFreight = new Argix.Freight.InboundShipment(); assignment.InboundFreight.TerminalID = int.Parse(this.cboTerminal.SelectedValue); assignment.InboundFreight.FreightID = e.CommandArgument.ToString().Split(new char[] { ',' })[1]; assignment.SortTypeID = int.Parse(e.CommandArgument.ToString().Split(new char[] { ',' })[2]); bool removed = new Argix.Freight.TsortGateway().DeleteStationAssignment(assignment); this.lsvAssignments.DataBind(); break; } } catch (Exception ex) { Master.ReportError(ex); } }
private bool unassignFreight() { //Unassign one or more station assignments bool bOK = true; this.Cursor = Cursors.WaitCursor; try { foreach (TsortDataset.StationFreightAssignmentTableRow row in this.mAssignmentsDS.StationFreightAssignmentTable.Rows) { Workstation station = new Workstation(); station.TerminalID = row.TerminalID; station.WorkStationID = row.WorkStationID; station.Number = row.StationNumber; InboundShipment shipment = new InboundShipment(); shipment.TerminalID = row.TerminalID; shipment.FreightID = row.FreightID; shipment.TDSNumber = row.TDSNumber; shipment.ClientNumber = shipment.ClientName = row.Client; StationAssignment assignment = new StationAssignment(); assignment.SortStation = station; assignment.InboundFreight = shipment; assignment.SortTypeID = row.SortTypeID; bool deleted = false; try { deleted = TsortGateway.DeleteStationAssignment(assignment, "Unassigned"); } catch (ApplicationException ex) { App.ReportError(ex, true, LogLevel.Error); } catch (Exception ex) { App.ReportError(new ApplicationException("Failed to unassign freight " + row.FreightID + " from station " + row.WorkStationID + " (sorttypeID= " + row.SortTypeID.ToString() + ").", ex), true, LogLevel.Error); } if (!deleted) { bOK = false; } row.Result = (!deleted) ? EX_RESULT_FAILED : EX_RESULT_OK; this.grdAssignments.Refresh(); Application.DoEvents(); } } catch (Exception ex) { App.ReportError(ex, true, LogLevel.Error); } return(bOK); }
private void OnItemClick(object sender, System.EventArgs e) { //Menu services try { ToolStripItem item = (ToolStripItem)sender; switch (item.Name) { case "msFileNew": case "tsNew": break; case "msFileOpen": case "tsOpen": if (this.grdMain.Selected.Rows.Count > 0) { string loadNumber = this.grdMain.Selected.Rows[0].Cells["Load"].Value.ToString(); LoadTenderDS.LoadTenderTableRow loadTender = (LoadTenderDS.LoadTenderTableRow) this.mLoadTenderDS.LoadTenderTable.Select("Load='" + loadNumber + "'")[0]; new frmLoadTender(loadTender).Show(); } break; case "msFileSave": case "tsSave": break; case "msFileSaveAs": SaveFileDialog dlgSave = new SaveFileDialog(); dlgSave.AddExtension = true; dlgSave.Filter = "Export Files (*.xml) | *.xml"; dlgSave.FilterIndex = 0; dlgSave.Title = "Save Freight As..."; dlgSave.FileName = this.cboClient.Text + ", " + DateTime.Today.ToLongDateString(); dlgSave.OverwritePrompt = true; if (dlgSave.ShowDialog(this) == DialogResult.OK) { this.Cursor = Cursors.WaitCursor; this.mMessageMgr.AddMessage("Saving to " + dlgSave.FileName + "..."); Application.DoEvents(); this.mLoadTenderDS.WriteXml(dlgSave.FileName, XmlWriteMode.WriteSchema); } break; case "msFilePageSetup": UltraGridPrinter.PageSettings(); break; case "msFilePrint": UltraGridPrinter.Print(this.grdMain, this.cboClient.Text.Trim().ToUpper() + " LOAD TENDERS , " + DateTime.Today.ToLongDateString(), true); break; case "tsPrint": UltraGridPrinter.Print(this.grdMain, this.cboClient.Text.Trim().ToUpper() + " LOAD TENDERS , " + DateTime.Today.ToLongDateString(), false); break; case "msFilePrintPreview": case "tsPrintPreview": UltraGridPrinter.PrintPreview(this.grdMain, this.cboClient.Text.Trim().ToUpper() + " LOAD TENDERS , " + DateTime.Today.ToLongDateString()); break; case "msFileExit": this.Close(); Application.Exit(); break; case "msEditCut": case "tsCut": break; case "msEditCopy": case "tsCopy": break; case "msEditPaste": case "tsPaste": break; case "msViewRefresh": case "tsRefresh": this.Cursor = Cursors.WaitCursor; this.mLoadTenderDS.Clear(); this.mLoadTenderDS.Merge(TsortGateway.GetLoadTenders(this.cboClient.SelectedValue.ToString(), this.dtpFrom.Value, this.dtpTo.Value)); break; case "msViewToolbar": this.tsMain.Visible = (this.msViewToolbar.Checked = (!this.msViewToolbar.Checked)); break; case "msViewStatusbar": this.ssMain.Visible = (this.msViewStatusbar.Checked = (!this.msViewStatusbar.Checked)); break; case "msToolsConfig": App.ShowConfig(); break; case "msHelpAbout": new dlgAbout(App.Product + " Application", App.Version, App.Copyright, App.Configuration).ShowDialog(this); break; } } catch (Exception ex) { App.ReportError(ex, true, LogLevel.Warning); } finally { setUserServices(); this.Cursor = Cursors.Default; } }
private void setDialogLayout() { try { this.grdFreightTypes.Visible = (this.mScreenID == 0); this.grdSortStations.Visible = (this.mScreenID == 1); this.grdAssignments.Visible = (this.mScreenID == 2); switch (this.mScreenID) { case 0: //Setup for sort type selection this.lblInstructions.Text = INSTR_0; this.cmdBack.Enabled = false; this.cmdNext.Text = CMD_NEXT; this.cmdNext.Enabled = (this.grdFreightTypes.Selected.Rows.Count > 0); break; case 1: //Setup for sort station selection this.lblInstructions.Text = INSTR_1; this.cmdBack.Enabled = ((this.mDialogAction == DialogActionEnum.DialogActionAssign) && (this.grdFreightTypes.Rows.Count > 1)); this.cmdNext.Text = CMD_NEXT; this.cmdNext.Enabled = (this.grdSortStations.Selected.Rows.Count > 0); if (this.mSortStationsDS.WorkstationTable.Rows.Count == 0) { int iSortTypeID = Convert.ToInt32(this.grdFreightTypes.Selected.Rows[0].Cells["ID"].Value); this.mSortStationsDS.Merge(TsortGateway.GetAssignableSortStations(this.mShipment, iSortTypeID)); if (this.grdSortStations.Rows.Count > 0) { this.grdSortStations.Rows[0].Activate(); } } this.grdSortStations.ActiveRow = null; this.grdSortStations.Focus(); break; case 2: //Setup for assignments view switch (this.mDialogAction) { case DialogActionEnum.DialogActionAssign: this.lblInstructions.Text = INSTR_21; break; case DialogActionEnum.DialogActionUnassignAny: this.lblInstructions.Text = INSTR_22; break; case DialogActionEnum.DialogActionUnassign: this.lblInstructions.Text = INSTR_23; break; } this.cmdBack.Enabled = (this.mDialogAction != DialogActionEnum.DialogActionUnassign); this.cmdNext.Text = CMD_FINISH; this.cmdNext.Enabled = true; //Create station freight assignments dataset for last grid view //Note: The single unassign assignment was merged into mAssignmentsDS in the constructor (DO NOT SET HERE) if (this.mDialogAction != DialogActionEnum.DialogActionUnassign) { this.mAssignmentsDS.Clear(); for (int i = 0; i < this.grdSortStations.Selected.Rows.Count; i++) { TsortDataset.StationFreightAssignmentTableRow row = this.mAssignmentsDS.StationFreightAssignmentTable.NewStationFreightAssignmentTableRow(); row.WorkStationID = this.grdSortStations.Selected.Rows[i].Cells["WorkstationID"].Value.ToString(); row.StationNumber = this.grdSortStations.Selected.Rows[i].Cells["Number"].Value.ToString(); row.FreightID = this.mShipment.FreightID; row.FreightType = this.mShipment.FreightType; row.TDSNumber = this.mShipment.TDSNumber; row.Client = this.mShipment.ClientNumber; row.TerminalID = this.mShipment.TerminalID; row.SortTypeID = (this.mDialogAction == DialogActionEnum.DialogActionAssign) ? Convert.ToInt32(this.grdFreightTypes.Selected.Rows[0].Cells["ID"].Value) : 0; row.SortType = (this.mDialogAction == DialogActionEnum.DialogActionAssign) ? this.grdFreightTypes.Selected.Rows[0].Cells["Description"].Value.ToString() : ""; this.mAssignmentsDS.StationFreightAssignmentTable.AddStationFreightAssignmentTableRow(row); } this.mAssignmentsDS.AcceptChanges(); } break; } } catch (Exception ex) { App.ReportError(ex, false, LogLevel.Warning); } }