public bool UpdateShipScheduleTripStop(int terminalID, ShipScheduleStop stop)
        {
            //Update the specified ship schedule stop
            bool updated = false;

            try {
                updated = new TsortGateway(terminalID).UpdateShipScheduleTripStop(stop);
            }
            catch (Exception ex) { throw new FaultException <ShipScheduleFault>(new ShipScheduleFault(ex.Message), "Service Error"); }
            return(updated);
        }
Exemple #2
0
        public bool UpdateShipScheduleTripStop(ShipScheduleStop stop)
        {
            //
            bool updated = false;

            try {
                updated = new DataService().ExecuteNonQuery(SQL_CONNID, USP_SS_STOP_UPDATE,
                                                            new object[] { stop.StopID, stop.Notes,
                                                                           (stop.ScheduledArrival != DateTime.MinValue ? stop.ScheduledArrival : null as object),
                                                                           (stop.ScheduledOFD1 != DateTime.MinValue ? stop.ScheduledOFD1 : null as object),
                                                                           stop.LastUpdated, stop.UserID, stop.RowVersion });
            }
            catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
            return(updated);
        }
        public bool UpdateShipSchedule(int terminalID, ShipScheduleTrip trip, ShipScheduleStop stop1, ShipScheduleStop stop2)
        {
            //Update the specified ship schedule including the trip and 2 stops
            bool updated = false;

            try {
                //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()) {
                    //UPdate trip and stop1; update stop2 if not null
                    new TsortGateway(terminalID).UpdateShipScheduleTrip(trip);
                    new TsortGateway(terminalID).UpdateShipScheduleTripStop(stop1);
                    if (stop2 != null)
                    {
                        new TsortGateway(terminalID).UpdateShipScheduleTripStop(stop2);
                    }
                    updated = true;

                    //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 <ShipScheduleFault>(new ShipScheduleFault(ex.Message), "Service Error"); }
            return(updated);
        }
Exemple #4
0
        public static bool UpdateShipScheduleTripStop(ShipScheduleDataset.ShipScheduleStopTableRow stop)
        {
            //
            bool updated = false;
            ShipScheduleServiceClient client = new ShipScheduleServiceClient();

            try {
                //Map datarow to data transfer object
                ShipScheduleStop ssstop = new ShipScheduleStop();
                ssstop.StopID          = stop.StopID;
                ssstop.TripID          = stop.TripID;
                ssstop.StopNumber      = !stop.IsStopNumberNull() ? stop.StopNumber : "";
                ssstop.AgentTerminalID = !stop.IsAgentTerminalIDNull() ? stop.AgentTerminalID : 0;
                ssstop.Tag             = !stop.IsTagNull() ? stop.Tag : "";
                ssstop.Notes           = !stop.IsNotesNull() ? stop.Notes : "";
                if (!stop.IsScheduledArrivalNull())
                {
                    ssstop.ScheduledArrival = stop.ScheduledArrival;
                }
                if (!stop.IsScheduledOFD1Null())
                {
                    ssstop.ScheduledOFD1 = stop.ScheduledOFD1;
                }
                ssstop.LastUpdated = DateTime.Now;
                ssstop.UserID      = Environment.UserName;
                ssstop.RowVersion  = stop.RowVersion;

                updated = client.UpdateShipScheduleTripStop(int.Parse(Program.TerminalCode), ssstop);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <ShipScheduleFault> ssf) { client.Abort(); throw new ApplicationException(ssf.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(updated);
        }
Exemple #5
0
        public static bool UpdateShipSchedule(ShipScheduleDataset.ShipScheduleViewTableRow viewItem)
        {
            //
            bool updated = false;
            ShipScheduleServiceClient client = new ShipScheduleServiceClient();

            try {
                //Map datarows to data transfer objects
                ShipScheduleTrip sstrip = new ShipScheduleTrip();
                sstrip.TripID           = viewItem.TripID;
                sstrip.ScheduleID       = viewItem.ScheduleID;
                sstrip.TemplateID       = viewItem.TemplateID;
                sstrip.BolNumber        = !viewItem.IsBolNumberNull() ? viewItem.BolNumber : 0;
                sstrip.CarrierServiceID = !viewItem.IsCarrierServiceIDNull() ? viewItem.CarrierServiceID : 0;
                sstrip.LoadNumber       = !viewItem.IsLoadNumberNull() ? viewItem.LoadNumber : "";
                sstrip.TrailerNumber    = !viewItem.IsTrailerNumberNull() ? viewItem.TrailerNumber : "";
                sstrip.TractorNumber    = !viewItem.IsTractorNumberNull() ? viewItem.TractorNumber : "";
                sstrip.DriverName       = !viewItem.IsDriverNameNull() ? viewItem.DriverName : "";
                if (!viewItem.IsScheduledCloseNull())
                {
                    sstrip.ScheduledClose = viewItem.ScheduledClose;
                }
                if (!viewItem.IsScheduledDepartureNull())
                {
                    sstrip.ScheduledDeparture = viewItem.ScheduledDeparture;
                }
                sstrip.IsMandatory = !viewItem.IsIsMandatoryNull() ? viewItem.IsMandatory : (byte)0;
                if (!viewItem.IsFreightAssignedNull())
                {
                    sstrip.FreightAssigned = viewItem.FreightAssigned;
                }
                if (!viewItem.IsTrailerCompleteNull())
                {
                    sstrip.TrailerComplete = viewItem.TrailerComplete;
                }
                if (!viewItem.IsPaperworkCompleteNull())
                {
                    sstrip.PaperworkComplete = viewItem.PaperworkComplete;
                }
                if (!viewItem.IsTrailerDispatchedNull())
                {
                    sstrip.TrailerDispatched = viewItem.TrailerDispatched;
                }
                if (!viewItem.IsCanceledNull())
                {
                    sstrip.Canceled = viewItem.Canceled;
                }
                sstrip.LastUpdated = DateTime.Now;
                sstrip.UserID      = Environment.UserName;
                sstrip.RowVersion  = viewItem.SCDERowVersion;

                ShipScheduleStop ssstop1 = new ShipScheduleStop();
                ssstop1.StopID          = viewItem.StopID;
                ssstop1.TripID          = viewItem.TripID;
                ssstop1.StopNumber      = !viewItem.IsStopNumberNull() ? viewItem.StopNumber : "";
                ssstop1.AgentTerminalID = !viewItem.IsAgentTerminalIDNull() ? viewItem.AgentTerminalID : 0;
                ssstop1.Tag             = !viewItem.IsTagNull() ? viewItem.Tag : "";
                ssstop1.Notes           = !viewItem.IsNotesNull() ? viewItem.Notes : "";
                if (!viewItem.IsScheduledArrivalNull())
                {
                    ssstop1.ScheduledArrival = viewItem.ScheduledArrival;
                }
                if (!viewItem.IsScheduledOFD1Null())
                {
                    ssstop1.ScheduledOFD1 = viewItem.ScheduledOFD1;
                }
                ssstop1.LastUpdated = DateTime.Now;
                ssstop1.UserID      = Environment.UserName;
                ssstop1.RowVersion  = viewItem.S1RowVersion;

                ShipScheduleStop ssstop2 = null;
                if (!viewItem.IsS2MainZoneNull() && viewItem.S2MainZone.Trim().Length > 0)
                {
                    ssstop2                 = new ShipScheduleStop();
                    ssstop2.StopID          = viewItem.S2StopID;
                    ssstop2.TripID          = viewItem.TripID;
                    ssstop2.StopNumber      = !viewItem.IsS2StopNumberNull() ? viewItem.S2StopNumber : "";
                    ssstop2.AgentTerminalID = !viewItem.IsS2AgentTerminalIDNull() ? viewItem.S2AgentTerminalID : 0;
                    ssstop2.Tag             = !viewItem.IsS2TagNull() ? viewItem.S2Tag : "";
                    ssstop2.Notes           = !viewItem.IsS2NotesNull() ? viewItem.S2Notes : "";
                    if (!viewItem.IsS2ScheduledArrivalNull())
                    {
                        ssstop2.ScheduledArrival = viewItem.S2ScheduledArrival;
                    }
                    if (!viewItem.IsS2ScheduledOFD1Null())
                    {
                        ssstop2.ScheduledOFD1 = viewItem.S2ScheduledOFD1;
                    }
                    ssstop2.LastUpdated = DateTime.Now;
                    ssstop2.UserID      = Environment.UserName;
                    ssstop2.RowVersion  = viewItem.S2RowVersion;
                }

                updated = client.UpdateShipSchedule(int.Parse(Program.TerminalCode), sstrip, ssstop1, ssstop2);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <ShipScheduleFault> ssf) { client.Abort(); throw new ApplicationException(ssf.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(updated);
        }