Ejemplo n.º 1
0
        public LTLRateShipmentSimpleResponse CalculateLTLSimpleRate(LTLRateShipmentSimpleRequest request)
        {
            //
            LTLRateShipmentSimpleResponse response = null;

            try {
                response = new RateWareGateway().CalculateLTLRate(request);
            }
            catch (Exception ex) { throw new FaultException <RateQuoteFault>(new RateQuoteFault(ex.Message), "Service Error"); }
            return(response);
        }
Ejemplo n.º 2
0
        public static LTLRateShipmentSimpleResponse CalculateLTLSimpleRate(LTLRateShipmentSimpleRequest request)
        {
            //
            LTLRateShipmentSimpleResponse response = null;
            RateQuoteServiceClient        client   = new RateQuoteServiceClient();

            try {
                response = client.CalculateLTLSimpleRate(request);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <RateQuoteFault> rfe) { client.Abort(); throw new ApplicationException(rfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(response);
        }
Ejemplo n.º 3
0
        public LTLRateShipmentSimpleResponse CalculateLTLRate(LTLRateShipmentSimpleRequest request)
        {
            //
            LTLRateShipmentSimpleResponse response = null;
            RateWareXLPortTypeClient      client   = new RateWareXLPortTypeClient();

            try {
                AuthenticationToken authToken = getAuthenticationToken();
                if (client.isReady(authToken))
                {
                    //LTL rate shipment request
                    response = client.LTLRateShipmentSimple(authToken, request);
                }
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(response);
        }
Ejemplo n.º 4
0
        private void OnFormLoad(object sender, EventArgs e)
        {
            //Event handler for form load event
            try {
                //Set control defaults
                #region Grid customizations from normal layout (to support cell editing)
                this.grdRates.DisplayLayout.Bands[0].Override.RowFilterMode = RowFilterMode.AllRowsInBand;
                #endregion

                //Get all tariffs and create dataset schema
                this.mRates = new DataSet();
                this.mRates.Tables.Add("LTLRatesTable");
                this.mRates.Tables["LTLRatesTable"].Columns.Add("Origin");
                this.mRates.Tables["LTLRatesTable"].Columns.Add("Destination");
                this.mRates.Tables["LTLRatesTable"].Columns.Add("NMFC");
                this.mRates.Tables["LTLRatesTable"].Columns.Add("Weight");
                DataModule[] tariffs = FinanceGateway.GetAvailableTariffs();
                for (int k = 0; k < tariffs.Length; k++)
                {
                    this.mRates.Tables["LTLRatesTable"].Columns.Add(tariffs[k].effectiveDateField);
                }
                this.mRates.Tables["LTLRatesTable"].Columns.Add("PSP");
                this.mRates.AcceptChanges();

                //Loop thru all delivery locations
                DataSet destinations = FinanceGateway.ViewDeliveryZips();
                DataRow row          = null;
                //for(int j = 0; j < destinations.Tables["DeliveryZipTable"].Rows.Count; j=j+100) {
                for (int j = 0; j < 5; j++)
                {
                    //Get an LTL rate for each tariff for this destination
                    row                = this.mRates.Tables["LTLRatesTable"].NewRow();
                    row["Origin"]      = "07657";
                    row["Destination"] = destinations.Tables["DeliveryZipTable"].Rows[j]["Zip"].ToString();
                    row["NMFC"]        = "50";
                    row["Weight"]      = "1500";
                    for (int i = 0; i < tariffs.Length; i++)
                    {
                        //Setup the request for NMFC=50, weight=100lbs, Origin=Ridgefield
                        DataModule tariff = tariffs[i];

                        LTLRateShipmentSimpleRequest request = new LTLRateShipmentSimpleRequest();
                        request.tariffNameField            = tariff != null ? tariff.tariffNameField : "";
                        request.shipmentDateCCYYMMDDField  = tariff != null ? tariff.effectiveDateField : "";
                        request.destinationCountryField    = request.originCountryField = "USA";
                        request.originPostalCodeField      = "07657";
                        request.destinationPostalCodeField = destinations.Tables["DeliveryZipTable"].Rows[j]["Zip"].ToString();
                        LTLRequestDetail detail = new LTLRequestDetail();
                        detail.nmfcClassField = "50";
                        detail.weightField    = "1500";
                        request.detailsField  = new LTLRequestDetail[] { detail };

                        //Get the LTL rate and add a datarow
                        LTLRateShipmentSimpleResponse response = FinanceGateway.CalculateLTLSimpleRate(request);
                        row[tariff.effectiveDateField] = response.totalChargeField;
                    }

                    //Get the PSP rate for this destination
                    LTLQuote2 quote = new LTLQuote2();
                    quote.ShipDate       = DateTime.Today;
                    quote.OriginZip      = "07657";
                    quote.DestinationZip = destinations.Tables["DeliveryZipTable"].Rows[j]["Zip"].ToString();
                    quote.Pallet1Weight  = 100;
                    quote      = FreightGateway.CreateQuote(quote);
                    row["PSP"] = quote.TotalCharge.ToString();

                    //Ad the results for this destination
                    this.mRates.Tables["LTLRatesTable"].Rows.Add(row);
                }
                this.grdRates.DataSource = this.mRates;
                this.grdRates.DataMember = "LTLRatesTable";
            }
            catch (Exception ex) { App.ReportError(ex, true, LogLevel.Error); }
        }