Exemple #1
0
        public bool UpdatePickup(PickupRequest pickup)
        {
            //Update an existing pickup requesst
            bool updated = false;

            try {
                //Apply simple business rules
                //Cannot cancel if arrived or if day of pickup
                PickupRequest _pickup = ReadPickup(pickup.RequestID);
                if (_pickup.ScheduleDate.CompareTo(DateTime.Today) <= 0)
                {
                    throw new ApplicationException("Pickups must be updated at least one day before the scheduled pickup date.");
                }
                if (_pickup.ActualPickup > DateTime.MinValue)
                {
                    throw new ApplicationException("This pickup has already been arrived.");
                }

                //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()) {
                    //
                    updated = new DispatchGateway().UpdatePickupRequest(pickup);

                    //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(updated);
        }
Exemple #2
0
        public bool ChangePickupRequest(PickupRequest request)
        {
            //Change an existing pickup request
            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()) {
                    //
                    //Get the pickups current state
                    PickupRequest pickup = ReadPickup(request.RequestID);

                    //Update the pickup
                    changed = new DispatchGateway().UpdatePickupRequest(request);

                    //Arrive/unarrive LTL shipment (if applicable); see if the actual pickup date is now being changed
                    if (pickup != null && pickup.CreateUserID == "PSP" && (pickup.ActualPickup == null || pickup.ActualPickup == DateTime.MinValue) && (request.ActualPickup != null && request.ActualPickup > DateTime.MinValue))
                    {
                        //This is an LTL pickup being arrived
                        new LTLGateway2().ArriveLTLShipment(request.RequestID, request.ActualPickup);
                    }
                    else if (pickup != null && pickup.CreateUserID == "PSP" && (pickup.ActualPickup != null && pickup.ActualPickup > DateTime.MinValue) && (request.ActualPickup == null || request.ActualPickup == DateTime.MinValue))
                    {
                        //This is an LTL pickup being unarrived
                        new LTLGateway2().ArriveLTLShipment(request.RequestID, DateTime.MinValue);
                    }
                    scope.Complete();
                }
            }
            catch (Exception ex) { throw new FaultException <DispatchFault>(new DispatchFault(ex.Message), "Service Error"); }
            return(changed);
        }
Exemple #3
0
        public int RequestPickup(PickupRequest pickup)
        {
            //Add a new pickup request
            int pickupID = 0;

            try {
                //Apply simple business rules
                //Validate schedule date > today
                if (pickup.ScheduleDate.CompareTo(DateTime.Today) <= 0)
                {
                    throw new ApplicationException("Schedule date must be next day or later.");
                }

                //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()) {
                    //Enforce identification of LTL pickups (needed for BizTalk integration)
                    pickup.CreateUserID = "PSP";
                    pickupID            = new DispatchGateway().InsertPickupRequest3(pickup);

                    //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(pickupID);
        }
Exemple #4
0
        public bool ChangeClientInboundFreight(ClientInboundFreight freight)
        {
            //Change an existing client 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()) {
                    //Update appointment
                    changed = new DispatchGateway().UpdateClientInboundFreight(freight);

                    //Blog a notification when appointments arrive
                    if (freight.ActualArrival > DateTime.MinValue)
                    {
                        BlogEntry entry = new BlogEntry();
                        entry.Date    = DateTime.Now;
                        entry.Comment = freight.VendorName + " appt# " + freight.ID.ToString() + " arrived " + freight.ActualArrival.ToString("HH:mm tt") + ", TDS# " + freight.TDSNumber;
                        entry.UserID  = "Dispatch";
                        AddBlogEntry(entry);
                    }

                    //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);
        }
Exemple #5
0
        public bool CancelLoadTenderEntry(int entryID, DateTime cancelled, string cancelledBy)
        {
            //
            bool result = false;

            try {
                //Apply simple business rules
                LoadTenderEntry entry = ReadLoadTenderEntry(entryID);
                if (entry.PickupNumber > 0)
                {
                    //Get the pickup appointment or request and check if picked up
                    if (entry.PickupNumber.ToString().Substring(0, 1) == "1")
                    {
                        ClientInboundFreight appt = null;
                        if (appt != null && appt.ActualArrival != DateTime.MinValue)
                        {
                            throw new ApplicationException("This load tender has already been picked up.");
                        }
                    }
                    else
                    {
                        PickupRequest pickup = null;
                        if (pickup != null && pickup.ActualPickup != DateTime.MinValue)
                        {
                            throw new ApplicationException("This load tender has already been picked up.");
                        }
                    }
                }

                //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 (entry.PickupNumber > 0)
                    {
                        //Get the pickup appointment or request and check if picked up
                        if (entry.PickupNumber.ToString().Substring(0, 1) == "1")
                        {
                            //Cancel the pickup appointment
                            new DispatchGateway().CancelClientInboundFreight(entry.PickupNumber, cancelled, cancelledBy);
                        }
                        else
                        {
                            //Cancel the pickup request
                            new DispatchGateway().CancelPickupRequest(entry.PickupNumber, cancelled, cancelledBy);
                        }
                    }

                    //Cancel the load tender entry
                    result = new DispatchGateway().CancelLoadTenderEntry(entryID, cancelled, cancelledBy);

                    //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(result);
        }
Exemple #6
0
        public DataSet ViewBlog()
        {
            DataSet ds = null;

            try {
                ds = new DispatchGateway().ReadBlog();
            }
            catch (Exception ex) { throw new FaultException <DispatchFault>(new DispatchFault(ex.Message), "Service Error"); }
            return(ds);
        }
Exemple #7
0
        public DataSet SearchTrailerLog(string trailerNumber)
        {
            DataSet ds = null;

            try {
                ds = new DispatchGateway().SearchTrailerLog(trailerNumber);
            }
            catch (Exception ex) { throw new FaultException <DispatchFault>(new DispatchFault(ex.Message), "Service Error"); }
            return(ds);
        }
Exemple #8
0
        public DataSet ViewBBBSchedule(DateTime start, DateTime end)
        {
            DataSet ds = null;

            try {
                ds = new DispatchGateway().ViewBBBSchedule(start, end);
            }
            catch (Exception ex) { throw new FaultException <DispatchFault>(new DispatchFault(ex.Message), "Service Error"); }
            return(ds);
        }
Exemple #9
0
        public DataSet ViewOutboundScheduleTemplates()
        {
            DataSet ds = null;

            try {
                ds = new DispatchGateway().ReadOutboundScheduleTemplates();
            }
            catch (Exception ex) { throw new FaultException <DispatchFault>(new DispatchFault(ex.Message), "Service Error"); }
            return(ds);
        }
Exemple #10
0
        //Dispatch services
        public int SchedulePickupRequest(PickupRequest request)
        {
            //Add a new pickup request
            int id = 0;

            try {
                id = new DispatchGateway().InsertPickupRequest3(request);
            }
            catch (Exception ex) { throw new FaultException <DispatchFault>(new DispatchFault(ex.Message), "Service Error"); }
            return(id);
        }
Exemple #11
0
        public bool UpdateLoadTenderEntry(LoadTenderEntry entry)
        {
            //UPdate an existing load tender
            bool updated = false;

            try {
                updated = new DispatchGateway().UpdateLoadTenderEntry(entry);
            }
            catch (Exception ex) { throw new FaultException <DispatchFault>(new DispatchFault(ex.Message), "Service Error"); }
            return(updated);
        }
Exemple #12
0
        public DataSet GetFreghtDesginationTypes()
        {
            //
            DataSet types = new DataSet();

            try {
                types = new DispatchGateway().GetFreghtDesginationTypes();
            }
            catch (Exception ex) { throw new FaultException <EnterpriseFault>(new EnterpriseFault(ex.Message), "Service Error"); }
            return(types);
        }
Exemple #13
0
        public DataSet ViewLoadTenderLog(DateTime start, DateTime end)
        {
            //View the load tender log
            DataSet log = null;

            try {
                log = new DispatchGateway().ViewLoadTenderLog(start, end);
            }
            catch (Exception ex) { throw new FaultException <DispatchFault>(new DispatchFault(ex.Message), "Service Error"); }
            return(log);
        }
Exemple #14
0
        public LoadTenderEntry ReadLoadTenderEntry(int id)
        {
            //Read an existing load tender
            LoadTenderEntry entry = new LoadTenderEntry();

            try {
                DataSet ds = new DispatchGateway().ReadLoadTenderEntry(id);
                if (ds != null && ds.Tables["LoadTenderLogTable"] != null && ds.Tables["LoadTenderLogTable"].Rows.Count > 0)
                {
                    DataRow _entry = ds.Tables["LoadTenderLogTable"].Rows[0];
                    #region Set fields
                    entry.ID                 = int.Parse(_entry["ID"].ToString());
                    entry.Created            = DateTime.Parse(_entry["Created"].ToString());
                    entry.CreateUserID       = _entry["CreateUserID"].ToString();
                    entry.ScheduleDate       = DateTime.Parse(_entry["ScheduleDate"].ToString());
                    entry.ClientNumber       = _entry["ClientNumber"].ToString();
                    entry.Client             = _entry["Client"].ToString();
                    entry.VendorNumber       = _entry["VendorNumber"].ToString();
                    entry.VendorName         = _entry["VendorName"].ToString();
                    entry.VendorAddressLine1 = _entry["VendorAddressLine1"].ToString();
                    entry.VendorAddressLine2 = !_entry.IsNull("VendorAddressLine2") ? _entry["VendorAddressLine2"].ToString() : "";
                    entry.VendorCity         = _entry["VendorCity"].ToString();
                    entry.VendorState        = _entry["VendorState"].ToString();
                    entry.VendorZip          = _entry["VendorZip"].ToString();
                    entry.VendorZip4         = !_entry.IsNull("VendorZip4") ? _entry["VendorZip4"].ToString() : "";
                    entry.ContactName        = !_entry.IsNull("ContactName") ? _entry["ContactName"].ToString() : "";
                    entry.ContactPhone       = !_entry.IsNull("ContactPhone") ? _entry["ContactPhone"].ToString() : "";
                    entry.ContactEmail       = !_entry.IsNull("ContactEmail") ? _entry["ContactEmail"].ToString() : "";
                    entry.WindowOpen         = !_entry.IsNull("WindowOpen") ? int.Parse(_entry["WindowOpen"].ToString()) : 0;
                    entry.WindowClose        = !_entry.IsNull("WindowClose") ? int.Parse(_entry["WindowClose"].ToString()) : 0;
                    entry.Description        = !_entry.IsNull("Description") ? _entry["Description"].ToString() : "";
                    entry.Amount             = !_entry.IsNull("Amount") ? int.Parse(_entry["Amount"].ToString()) : 0;
                    entry.AmountType         = !_entry.IsNull("AmountType") ? _entry["AmountType"].ToString() : "";
                    entry.Weight             = !_entry.IsNull("Weight") ? int.Parse(_entry["Weight"].ToString()) : 0;
                    entry.IsFullTrailer      = !_entry.IsNull("IsFullTrailer") ? bool.Parse(_entry["IsFullTrailer"].ToString()) : false;
                    entry.LoadTenderNumber   = !_entry.IsNull("LoadTenderNumber") ? int.Parse(_entry["LoadTenderNumber"].ToString()) : 0;
                    entry.PickupNumber       = !_entry.IsNull("PickupNumber") ? int.Parse(_entry["PickupNumber"].ToString()) : 0;
                    entry.Cancelled          = !_entry.IsNull("Cancelled") ? DateTime.Parse(_entry["Cancelled"].ToString()) : DateTime.MinValue;
                    entry.CancelledUserID    = !_entry.IsNull("CancelledBy") ? _entry["CancelledBy"].ToString() : "";
                    entry.Comments           = !_entry.IsNull("Comments") ? _entry["Comments"].ToString() : "";
                    entry.LastUpdated        = !_entry.IsNull("LastUpdated") ? DateTime.Parse(_entry["LastUpdated"].ToString()) : DateTime.MinValue;
                    entry.UserID             = !_entry.IsNull("UserID") ? _entry["UserID"].ToString() : "";
                    #endregion
                }
            }
            catch (Exception ex) { throw new FaultException <DispatchFault>(new DispatchFault(ex.Message), "Service Error"); }
            return(entry);
        }
Exemple #15
0
        public DataSet ViewPickupLog(string clientNumber)
        {
            DataSet pickups = new DataSet();

            try {
                int     back    = int.Parse(WebConfigurationManager.AppSettings["ClientPickupsViewDaysBack"].ToString());
                int     forward = int.Parse(WebConfigurationManager.AppSettings["ClientPickupsViewDaysForward"].ToString());
                DataSet ds      = new DispatchGateway().ReadPickupLogByClient(DateTime.Today.AddDays(-back), DateTime.Today.AddDays(forward), clientNumber);
                if (ds != null)
                {
                    pickups.Merge(ds);
                }
            }
            catch (Exception ex) { throw new FaultException <DispatchFault>(new DispatchFault(ex.Message), "Service Error"); }
            return(pickups);
        }
Exemple #16
0
        public LoadTender GetLoadTender(int number)
        {
            //Get an existing file attachment from database
            LoadTender loadTender = null;

            try {
                DataSet ds = new DispatchGateway().GetLoadTender(number);
                if (ds != null && ds.Tables["LoadTenderTable"] != null && ds.Tables["LoadTenderTable"].Rows.Count > 0)
                {
                    loadTender          = new LoadTender();
                    loadTender.Number   = number;
                    loadTender.Filename = (string)ds.Tables["LoadTenderTable"].Rows[0]["FileName"];
                    loadTender.File     = (byte[])ds.Tables["LoadTenderTable"].Rows[0]["File"];
                }
            }
            catch (Exception ex) { throw new FaultException <LTLFault>(new LTLFault(ex.Message), "Service Error"); }
            return(loadTender);
        }
Exemple #17
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);
        }
Exemple #18
0
        public bool CancelBBBScheduleTrip(int id, DateTime cancelled, string cancelledUserID)
        {
            //Delete an existing inbound freight
            bool removed = 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()) {
                    //
                    removed = new DispatchGateway().CancelBBBTrip(id, cancelled, cancelledUserID);

                    //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(removed);
        }
Exemple #19
0
        public bool ArrivePickupRequest(int requestID, string driverName, DateTime actual, string orderType, DateTime lastUpdated, string userID)
        {
            //Change an existing order detail item
            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().UpdatePickupRequest(requestID, driverName, actual, orderType, lastUpdated, userID);

                    //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);
        }
Exemple #20
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);
        }
Exemple #21
0
        public bool AddBlogEntry(BlogEntry entry)
        {
            //Add a new blog entry
            bool added = false;

            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()) {
                    //
                    added = new DispatchGateway().InsertBlogEntry(entry);

                    //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(added);
        }
Exemple #22
0
        public PickupRequest ReadPickup(int requestID)
        {
            //Read an existing pickup request
            PickupRequest request = null;

            try {
                //
                DataSet ds = new DispatchGateway().GetPickupRequest(requestID);
                if (ds != null)
                {
                    DispatchDataset _request = new DispatchDataset();
                    _request.Merge(ds);
                    if (_request.PickupLogTable.Rows.Count > 0)
                    {
                        request = new PickupRequest(_request.PickupLogTable[0]);
                    }
                }
            }
            catch (Exception ex) { throw new FaultException <DispatchFault>(new DispatchFault(ex.Message), "Service Error"); }
            return(request);
        }
Exemple #23
0
        public int CreateLoadTenderEntry(LoadTenderEntry entry)
        {
            //Create a new load tender
            int id = 0;

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


                //Execute the business transcation
                using (TransactionScope scope = new TransactionScope()) {
                    //Create the LoadTenderQuote
                    id = new DispatchGateway().CreateLoadTenderEntry(entry);

                    //Commit the transaction
                    scope.Complete();
                }
            }
            catch (Exception ex) { throw new FaultException <DispatchFault>(new DispatchFault(ex.Message), "Service Error"); }
            return(id);
        }
Exemple #24
0
        public bool CancelPickup(int requestID, DateTime cancelled, string cancelledUserID)
        {
            //Cancel an existing pickup requesst
            bool removed = false;

            try {
                //Apply simple business rules
                //Cannot cancel if arrived or if day of pickup
                PickupRequest pickup = ReadPickup(requestID);
                if (pickup.ScheduleDate.CompareTo(DateTime.Today) <= 0)
                {
                    throw new ApplicationException("Pickups must be cancelled at least one day before the scheduled pickup date.");
                }
                if (pickup.ActualPickup > DateTime.MinValue)
                {
                    throw new ApplicationException("This pickup has already been arrived.");
                }

                removed = new DispatchGateway().CancelPickupRequest(requestID, cancelled, cancelledUserID);
            }
            catch (Exception ex) { throw new FaultException <DispatchFault>(new DispatchFault(ex.Message), "Service Error"); }
            return(removed);
        }
Exemple #25
0
        public bool TenderLoadTenderEntry(int entryID, LoadTender loadTender)
        {
            //Attach the load tender file to the load tender
            bool result = false;

            try {
                //Apply simple business rules

                //Execute the business transcation
                using (TransactionScope scope = new TransactionScope()) {
                    //Create the load tender
                    int loadTenderNumber = new DispatchGateway().CreateLoadTender(loadTender.Filename, loadTender.File);

                    //Update the load tender entry with the load tender file number
                    result = new DispatchGateway().TenderLoadTenderEntry(entryID, loadTenderNumber);

                    //Commit the transaction
                    scope.Complete();
                }
            }
            catch (Exception ex) { throw new FaultException <DispatchFault>(new DispatchFault(ex.Message), "Service Error"); }
            return(result);
        }
Exemple #26
0
        public bool ScheduleLoadTenderEntry(int entryID, PickupRequest request)
        {
            //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 request
                    int pickupNumber = new DispatchGateway().InsertPickupRequest3(request);

                    //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);
        }
Exemple #27
0
        public int CreateLTLShipment(LTLShipment shipment)
        {
            //Add a new LTL shipment
            int shipmentID = 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()) {
                    //Create the shipment
                    LTLGateway gateway = new LTLGateway();
                    shipmentID  = gateway.CreateLTLShipment(shipment);
                    shipment.ID = shipmentID;

                    //Create the pallets
                    LTLPallet pallet = new LTLPallet();
                    pallet.ShipmentID = shipmentID;
                    if (shipment.Pallet1Weight > 0)
                    {
                        pallet.Weight = shipment.Pallet1Weight; pallet.InsuranceValue = shipment.Pallet1InsuranceValue; gateway.CreateLTLPallet(pallet);
                    }
                    if (shipment.Pallet2Weight > 0)
                    {
                        pallet.Weight = shipment.Pallet2Weight; pallet.InsuranceValue = shipment.Pallet2InsuranceValue; gateway.CreateLTLPallet(pallet);
                    }
                    if (shipment.Pallet3Weight > 0)
                    {
                        pallet.Weight = shipment.Pallet3Weight; pallet.InsuranceValue = shipment.Pallet3InsuranceValue; gateway.CreateLTLPallet(pallet);
                    }
                    if (shipment.Pallet4Weight > 0)
                    {
                        pallet.Weight = shipment.Pallet4Weight; pallet.InsuranceValue = shipment.Pallet4InsuranceValue; gateway.CreateLTLPallet(pallet);
                    }
                    if (shipment.Pallet5Weight > 0)
                    {
                        pallet.Weight = shipment.Pallet5Weight; pallet.InsuranceValue = shipment.Pallet5InsuranceValue; gateway.CreateLTLPallet(pallet);
                    }

                    //Schedule pickup request
                    LTLClient    client    = ReadLTLClient(shipment.ClientID);
                    LTLShipper   shipper   = ReadLTLShipper(shipment.ShipperID);
                    LTLConsignee consignee = ReadLTLConsignee(shipment.ConsigneeID);
                    //bool useBizTalk = bool.Parse(WebConfigurationManager.AppSettings["UseBizTalk"].ToString());
                    //if (useBizTalk) {
                    //    Argix.BizTalk.LTLShipment _shipment = new BizTalk.LTLShipment();
                    //    _shipment.ID = shipmentID;
                    //    _shipment.Created = shipment.Created;
                    //    _shipment.ShipDate = shipment.ShipDate;
                    //    _shipment.ShipmentNumber = shipment.ShipmentNumber;
                    //    _shipment.ClientID = shipment.ClientID;
                    //    _shipment.ClientNumber = client.Number;
                    //    _shipment.ClientName = client.Name;
                    //    _shipment.ShipperNumber = "";
                    //    _shipment.ShipperName = shipper.Name;
                    //    _shipment.ShipperAddress = shipper.AddressLine1 + "\n" + shipper.City + ", " + shipper.State + " " + shipper.Zip;
                    //    _shipment.ShipperContactName = shipper.ContactName;
                    //    _shipment.ShipperContactPhone = shipper.ContactPhone;
                    //    _shipment.ShipperWindowStartTime = shipper.WindowStartTime;
                    //    _shipment.ShipperWindowEndTime = shipper.WindowEndTime;
                    //    _shipment.ConsigneeID = shipment.ConsigneeID;
                    //    _shipment.Pallets = shipment.Pallets;
                    //    _shipment.Weight = int.Parse(shipment.Weight.ToString());
                    //    _shipment.PalletRate = shipment.PalletRate;
                    //    _shipment.FuelSurcharge = shipment.FuelSurcharge;
                    //    _shipment.AccessorialCharge = shipment.AccessorialCharge;
                    //    _shipment.InsuranceCharge = shipment.InsuranceCharge;
                    //    _shipment.TollCharge = shipment.TollCharge;
                    //    _shipment.TotalCharge = shipment.TotalCharge;
                    //    _shipment.LastUpdated = shipment.LastUpdated;
                    //    _shipment.UserID = shipment.UserID;
                    //    new Argix.BizTalk.BizTalkGateway().ScheduleLTLPickup(_shipment);
                    //}
                    //else {
                    //Direct to Pickup Log
                    PickupRequest request = new PickupRequest();
                    request.RequestID      = 0;
                    request.ScheduleDate   = shipment.ShipDate;
                    request.CallerName     = "Online";
                    request.ClientNumber   = client.Number;
                    request.Client         = client.Name;
                    request.ShipperNumber  = "";
                    request.Shipper        = shipper.Name;
                    request.ShipperAddress = shipper.AddressLine1 + "\n" + shipper.City + ", " + shipper.State + " " + shipper.Zip;
                    request.ShipperPhone   = shipper.ContactPhone;
                    request.WindowOpen     = shipper.WindowStartTime.CompareTo(DateTime.MinValue) > 0 ? int.Parse(shipper.WindowStartTime.ToString("HHmm")) : 0;
                    request.WindowClose    = shipper.WindowEndTime.CompareTo(DateTime.MinValue) > 0 ? int.Parse(shipper.WindowEndTime.ToString("HHmm")) : 0;
                    request.Amount         = shipment.Pallets;
                    request.AmountType     = "Pallets";
                    request.FreightType    = "Tsort";
                    request.OrderType      = "B";
                    request.Weight         = int.Parse(shipment.Weight.ToString());
                    request.Comments       = "";
                    request.IsTemplate     = false;
                    request.Created        = DateTime.Now;
                    request.CreateUserID   = "PSP";
                    request.TerminalNumber = "";
                    request.Terminal       = "";
                    request.LastUpdated    = shipment.LastUpdated;
                    request.UserID         = shipment.UserID;
                    int pickupID = new DispatchGateway().InsertPickupRequest3(request);

                    //Update shipment with PickupID
                    shipment.PickupID = pickupID;
                    new LTLGateway().DispatchLTLShipment(shipment);
                    //}

                    //Send email notification to customer
                    ServiceLocation location = ReadPickupLocation(shipper.Zip);
                    LTLClient       salesRep = null;
                    if (client.SalesRepClientID > 0)
                    {
                        salesRep = ReadLTLClient(client.SalesRepClientID);
                    }
                    new NotifyService().NotifyShipmentCreated(client, shipper, consignee, shipment, shipmentID, salesRep);

                    //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 <LTLFault>(new LTLFault(ex.Message), "Service Error"); }
            return(shipmentID);
        }