예제 #1
0
        public static bool DeleteStationAssignment(StationAssignment assignment, string initials)
        {
            //
            bool deleted = false;
            FreightAssignServiceClient client = new FreightAssignServiceClient();

            try {
                deleted = client.DeleteStationAssignment(assignment);
                client.Close();

                //Add to station unassignment history
                _AssignmentHistory.FreightAssignmentHistoryTable.AddFreightAssignmentHistoryTableRow(DateTime.Today, assignment.InboundFreight.TDSNumber, assignment.InboundFreight.ClientName, assignment.SortStation.Number, DateTime.Now, initials);
                if (AssignmentHistoryChanged != null)
                {
                    AssignmentHistoryChanged(null, EventArgs.Empty);
                }

                RefreshStationAssignments();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <TsortFault> dfe) { client.Abort(); throw new ApplicationException(dfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(deleted);
        }
예제 #2
0
        public static StationAssignment GetAssignment(string stationNumber, string tripNumber)
        {
            //Get a station assignment
            StationAssignment assignment = null;
            int    cartonCount = 0;
            string carrier = "", trailerNumber = "";

            try {
                //Merge from collection (dataset)
                DataRow[] rows = _Assignments.BwareStationTripTable.Select("StationNumber='" + stationNumber + "' AND TripNumber='" + tripNumber + "'");
                if (rows.Length > 0)
                {
                    //Existing assignment
                    BearwareDS.BwareStationTripTableRow row = (BearwareDS.BwareStationTripTableRow)rows[0];
                    cartonCount   = row.CartonCount;
                    carrier       = row.Carrier;
                    trailerNumber = row.TrailerNumber;
                }
                else
                {
                    //New assignment
                    cartonCount = 0;
                    carrier     = trailerNumber = "";
                }
                Workstation  station = new Workstation(stationNumber);
                BearwareTrip trip    = new BearwareTrip(tripNumber, cartonCount, carrier, trailerNumber);
                assignment          = new StationAssignment("", station, trip);
                assignment.Changed += new EventHandler(OnAssignmentChanged);
            }
            catch (Exception ex) { throw ex; }
            return(assignment);
        }
예제 #3
0
    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); }
    }
예제 #4
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;
		}
예제 #5
0
    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); }
    }
예제 #6
0
        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);
        }
예제 #7
0
        public bool DeleteStationAssignment(StationAssignment assignment)
        {
            //
            bool deleted = false;
            FreightAssignServiceClient client = new FreightAssignServiceClient();

            try {
                deleted = client.DeleteStationAssignment(assignment);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <TsortFault> dfe) { client.Abort(); throw new ApplicationException(dfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(deleted);
        }
예제 #8
0
 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); }
 }
예제 #9
0
        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);
        }
예제 #10
0
        public static bool DeleteAssignment(StationAssignment assignment, string initials)
        {
            //Delete the specified freight assignment
            bool ret = false;

            try {
                //Update local LAN database
                ret = App.Mediator.ExecuteNonQuery(USP_ASSIGNMENTDELETE, new object[] { assignment.SortStation.WorkStationID, assignment.InboundFreight.FreightID });

                //Add to station unassignment history
                _AssignmentHistory.FreightAssignmentHistoryTable.AddFreightAssignmentHistoryTableRow(DateTime.Today, assignment.InboundFreight.TDSNumber, assignment.InboundFreight.ClientName, assignment.SortStation.Number, DateTime.Now, initials);
                if (AssignmentHistoryChanged != null)
                {
                    AssignmentHistoryChanged(null, EventArgs.Empty);
                }

                try { RefreshStationAssignments(); }
                catch { }
            }
            catch (Exception ex) { throw new ApplicationException("Failed to unassign freight " + assignment.InboundFreight.FreightID + " from station " + assignment.SortStation.WorkStationID + " (sorttypeID= " + assignment.SortTypeID.ToString() + ").", ex); }
            return(ret);
        }
예제 #11
0
        public static StationAssignment CreateAssignment(Workstation workstation, IBShipment freight, int sortTypeID, string initials)
        {
            //Assign this freight to the specified sort station
            StationAssignment assignment = null;

            try {
                //Create the station assignment
                App.Mediator.ExecuteNonQuery(USP_ASSIGNMENTCREATE, new object[] { workstation.WorkStationID, freight.FreightID, sortTypeID });
                assignment = new StationAssignment(workstation, freight, sortTypeID);
                try { RefreshStationAssignments(); }
                catch { }

                //Add to station assignment history
                _AssignmentHistory.FreightAssignmentHistoryTable.AddFreightAssignmentHistoryTableRow(DateTime.Today, freight.TDSNumber, freight.ClientNumber + "-" + freight.ClientName, workstation.Number, DateTime.Now, initials);
                if (AssignmentHistoryChanged != null)
                {
                    AssignmentHistoryChanged(null, EventArgs.Empty);
                }
            }
            catch (Exception ex) { throw new ApplicationException("Failed to assign freight TDS#" + freight.TDSNumber + " to station " + workstation.Number + " (sorttypeID= " + sortTypeID.ToString() + ").", ex); }
            return(assignment);
        }