Exemplo n.º 1
0
		private bool unassignFreight() {
			//Unassign one or more station assignments
			bool bOK=true;
			this.Cursor = Cursors.WaitCursor;
			try {
				foreach(FreightAssignDS.StationFreightAssignmentTableRow row in this.mAssignmentsDS.StationFreightAssignmentTable.Rows) {
                    WorkstationDS.WorkstationTableRow ws = new WorkstationDS().WorkstationTable.NewWorkstationTableRow();
					ws.WorkStationID = row.WorkStationID;
					ws.Number = row.StationNumber;
                    Workstation station = new Workstation(ws);
                    InboundFreightDS.InboundFreightTableRow ibf = new InboundFreightDS().InboundFreightTable.NewInboundFreightTableRow();
                    ibf.FreightID = row.FreightID;
                    ibf.TDSNumber = row.TDSNumber;
                    ibf.ClientNumber = ibf.ClientName = row.Client;
                    IBShipment shipment = new IBShipment(ibf);
                    StationAssignment assignment = new StationAssignment(station,shipment,row.SortTypeID);
					bool deleted=false;
					try {
						deleted = FreightFactory.DeleteAssignment(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;
		}
Exemplo n.º 2
0
 //Interface
 static FreightFactory()
 {
     _InboundFreight    = new InboundFreightDS();
     _Assignments       = new FreightAssignDS();
     _AssignmentHistory = new FreightAssignDS();
 }