Пример #1
0
        public LTLQuote CreateQuote(LTLQuote quote)
        {
            //Create a new LTL Quote
            LTLClientServiceClient client = new LTLClientServiceClient();

            try {
                quote = client.CreateQuote(quote);
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <LTLFault> cfe) { client.Abort(); throw new ApplicationException(cfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(quote);
        }
Пример #2
0
 public void CreateQuoteLogEntry(LTLQuote quote)
 {
     //Log a quote
     try {
         new DataService().ExecuteNonQuery(SQL_CONNID, USP_QUOTELOG_INSERT,
                                           new object[] {
             quote.Created, quote.ShipDate, quote.OriginZip, quote.DestinationZip,
             quote.Pallet1Weight, quote.Pallet1Class, quote.Pallet1InsuranceValue,
             quote.Pallet2Weight, quote.Pallet2Class, quote.Pallet2InsuranceValue,
             quote.Pallet3Weight, quote.Pallet3Class, quote.Pallet3InsuranceValue,
             quote.Pallet4Weight, quote.Pallet4Class, quote.Pallet4InsuranceValue,
             quote.Pallet5Weight, quote.Pallet5Class, quote.Pallet5InsuranceValue,
             quote.InsidePickup, quote.LiftGateOrigin, quote.AppointmentOrigin,
             quote.InsideDelivery, quote.LiftGateDestination, quote.AppointmentDestination,
             quote.Pallets, quote.Weight, quote.PalletRate, quote.FuelSurcharge, quote.AccessorialCharge, quote.InsuranceCharge, quote.TollCharge, quote.TotalCharge
         });
     }
     catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
 }
Пример #3
0
        public DataSet GetQuote(LTLQuote quote)
        {
            //
            DataSet ltlQuote = null;

            try {
                ltlQuote = new DataService().FillDataset(SQL_CONNID, USP_QUOTE_GET, TBL_QUOTE,
                                                         new object[] {
                    quote.ShipDate, quote.OriginZip, quote.DestinationZip,
                    quote.InsidePickup, quote.InsideDelivery,
                    quote.AppointmentOrigin, quote.AppointmentDestination,
                    quote.LiftGateOrigin, quote.LiftGateDestination,
                    quote.Pallet1InsuranceValue, quote.Pallet2InsuranceValue, quote.Pallet3InsuranceValue, quote.Pallet4InsuranceValue, quote.Pallet5InsuranceValue,
                    quote.Pallets
                });
            }
            catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
            return(ltlQuote);
        }
Пример #4
0
        public LTLQuote CreateQuote(LTLQuote quote)
        {
            //Create and log the quote
            try {
                //For existing clients: determne zip codes from shipper/consignee
                if (quote.ShipperID > 0)
                {
                    quote.OriginZip = ReadLTLShipper(quote.ShipperID).Zip;
                }
                if (quote.ConsigneeID > 0)
                {
                    quote.DestinationZip = ReadLTLConsignee(quote.ConsigneeID).Zip;
                }

                //Create the quote
                quote.Pallets++;
                quote.Weight += quote.Pallet1Weight;
                if (quote.Pallet2Weight > 0)
                {
                    quote.Pallets++; quote.Weight += quote.Pallet2Weight;
                }
                if (quote.Pallet3Weight > 0)
                {
                    quote.Pallets++; quote.Weight += quote.Pallet3Weight;
                }
                if (quote.Pallet4Weight > 0)
                {
                    quote.Pallets++; quote.Weight += quote.Pallet4Weight;
                }
                if (quote.Pallet5Weight > 0)
                {
                    quote.Pallets++; quote.Weight += quote.Pallet5Weight;
                }
                quote.PalletRate        = 0.0M;
                quote.FuelSurcharge     = 0.0M;
                quote.AccessorialCharge = 0.0M;
                quote.InsuranceCharge   = 0.0M;
                quote.TollCharge        = 0.0M;
                quote.TotalCharge       = 0.0M;

                //Get quote
                DataSet ds = new LTLGateway().GetQuote(quote);

                quote.PalletRate         = decimal.Parse(ds.Tables["LTLQuoteTable"].Rows[0]["PalletDeliveryCharge"].ToString());
                quote.TransitMin         = 0;
                quote.TransitMax         = 0;
                quote.FuelSurcharge      = decimal.Parse(ds.Tables["LTLQuoteTable"].Rows[0]["FuelSurcharge"].ToString());
                quote.AccessorialCharge += decimal.Parse(ds.Tables["LTLQuoteTable"].Rows[0]["InsidePickupCharge"].ToString());
                quote.AccessorialCharge += decimal.Parse(ds.Tables["LTLQuoteTable"].Rows[0]["InsideDeliveryCharge"].ToString());
                quote.AccessorialCharge += decimal.Parse(ds.Tables["LTLQuoteTable"].Rows[0]["AppointmentOriginCharge"].ToString());
                quote.AccessorialCharge += decimal.Parse(ds.Tables["LTLQuoteTable"].Rows[0]["AppointmentDestinationCharge"].ToString());
                quote.AccessorialCharge += decimal.Parse(ds.Tables["LTLQuoteTable"].Rows[0]["LiftGateChargeOrigin"].ToString());
                quote.AccessorialCharge += decimal.Parse(ds.Tables["LTLQuoteTable"].Rows[0]["LiftGateChargeDestination"].ToString());
                quote.InsuranceCharge    = decimal.Parse(ds.Tables["LTLQuoteTable"].Rows[0]["ShipmentInsuranceCharge"].ToString());
                quote.TollCharge         = decimal.Parse(ds.Tables["LTLQuoteTable"].Rows[0]["TollCharge"].ToString());
                quote.TotalCharge        = decimal.Parse(ds.Tables["LTLQuoteTable"].Rows[0]["TotalCharge"].ToString());

                //Log the quote
                new LTLGateway().CreateQuoteLogEntry(quote);
            }
            catch (Exception ex) { throw new FaultException <LTLFault>(new LTLFault(ex.Message), "Service Error"); }
            return(quote);
        }