Exemplo n.º 1
0
        public bool ChangeBBBScheduleTrip(BBBTrip trip)
        {
            //Change an existing inbound freight
            bool changed = 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()) {
                    //
                    changed = new DispatchGateway().UpdateBBBTrip(trip);

                    //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 <DispatchFault>(new DispatchFault(ex.Message), "Service Error"); }
            return(changed);
        }
Exemplo n.º 2
0
        public int AddBBBScheduleTrip(BBBTrip trip)
        {
            //Add a new inbound freight
            int id = 0;

            try {
                //Apply simple business rules

                //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()) {
                    //
                    id = new DispatchGateway().CreateBBBTrip(trip);

                    //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 <DispatchFault>(new DispatchFault(ex.Message), "Service Error"); }
            return(id);
        }
Exemplo n.º 3
0
        public int CreateBBBTrip(BBBTrip trip)
        {
            //
            int id = 0;

            try {
                object o = new DataService().ExecuteNonQueryWithReturn(SQL_CONNID, USP_BBBSCHEDULE_INSERT,
                                                                       new object[] {
                    null, trip.Created, trip.CreateUserID, trip.ScheduleDate,
                    (trip.OriginLocationID > 0 ? trip.OriginLocationID : null as object), trip.Origin, trip.OriginLocation,
                    (trip.DestinationLocationID > 0 ? trip.DestinationLocationID : null as object), trip.Destination, trip.DestinationLocation,
                    trip.CarrierName, trip.DriverName, trip.TrailerNumber, trip.DropEmptyTrailerNumber, trip.IsLiveUnload,
                    (trip.ScheduledDeparture != DateTime.MinValue ? trip.ScheduledDeparture : null as object),
                    (trip.ScheduledArrival != DateTime.MinValue ? trip.ScheduledArrival : null as object),
                    trip.Confirmed,
                    trip.Amount, trip.AmountType, trip.FreightType,
                    trip.Comments, trip.IsTemplate, trip.LastUpdated, trip.UserID
                });
                id = Convert.ToInt32(o);
            }
            catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
            return(id);
        }
Exemplo n.º 4
0
        public bool ScheduleLoadTenderEntry(int entryID, BBBTrip trip)
        {
            //Schedule a pickup (record pickup number) for the load tender
            bool result = false;

            try {
                //Apply simple business rules (if applicable)


                //Execute the business transcation
                using (TransactionScope scope = new TransactionScope()) {
                    //Create the pickup appointment
                    int pickupNumber = new DispatchGateway().CreateBBBTrip(trip);

                    //Update the load tender as scheduled for pickup
                    result = new DispatchGateway().ScheduleLoadTenderEntry(entryID, pickupNumber);

                    //Commit the transaction
                    scope.Complete();
                }
            }
            catch (Exception ex) { throw new FaultException <DispatchFault>(new DispatchFault(ex.Message), "Service Error"); }
            return(result);
        }
Exemplo n.º 5
0
        public bool UpdateBBBTrip(BBBTrip trip)
        {
            //
            bool updated = false;

            try {
                updated = new DataService().ExecuteNonQuery(SQL_CONNID, USP_BBBSCHEDULE_UPDATE,
                                                            new object[] {
                    trip.ID, trip.ScheduleDate,
                    (trip.OriginLocationID > 0 ? trip.OriginLocationID : null as object), trip.Origin, trip.OriginLocation,
                    (trip.DestinationLocationID > 0 ? trip.DestinationLocationID : null as object), trip.Destination, trip.DestinationLocation,
                    trip.CarrierName, trip.DriverName, trip.TrailerNumber, trip.DropEmptyTrailerNumber, trip.IsLiveUnload,
                    (trip.ScheduledDeparture != DateTime.MinValue ? trip.ScheduledDeparture : null as object),
                    (trip.ActualDeparture != DateTime.MinValue ? trip.ActualDeparture : null as object),
                    (trip.ScheduledArrival != DateTime.MinValue ? trip.ScheduledArrival : null as object),
                    (trip.ActualArrival != DateTime.MinValue ? trip.ActualArrival : null as object),
                    trip.Confirmed,
                    trip.Amount, trip.AmountType, trip.FreightType, trip.TDSNumber,
                    trip.Comments, trip.LastUpdated, trip.UserID
                });
            }
            catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
            return(updated);
        }