// POST api/get_loup_rates
        public string Post(FormDataCollection form)
        {
            try
            {
                //return "0"; // LOUP had changed their website, need to rewrite scraper

                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                HelperFuncs.writeToSiteErrors("get_loup_rates new ", "get_loup_rates new ");
                int CarrierCompID = 78573;
                SharedRail.Parameters parameters = new SharedRail.Parameters();
                SharedRail.setParameters(ref form, ref parameters, ref CarrierCompID);

                SharedRail.ICarrier carrier = new LOUP(parameters);

                IntermodalRater.railResult railResult = new IntermodalRater.railResult();
                railResult = carrier.getRate();

                return(SharedRail.getResultString(ref railResult));
            }
            catch (Exception e)
            {
                HelperFuncs.writeToSiteErrors("get_loup_rates", e.ToString());
                return("0");
            }
        }
示例#2
0
        // POST api/get_modalx_rates
        public string Post(FormDataCollection form)
        {
            try
            {
                HelperFuncs.writeToSiteErrors("get_ModalX_rates new ", "get_ModalX_rates new ");
                int CarrierCompID = 78573; // Wrong id
                SharedRail.Parameters parameters = new SharedRail.Parameters();
                SharedRail.setParameters(ref form, ref parameters, ref CarrierCompID);

                SharedRail.ICarrier carrier = new ModalX(parameters);

                IntermodalRater.railResult railResult = new IntermodalRater.railResult();
                railResult = carrier.getRate();

                return(SharedRail.getResultString(ref railResult));
            }
            catch (Exception e)
            {
                HelperFuncs.writeToSiteErrors("get_ModalX_rates", e.ToString());
                return("0");
            }
        }
示例#3
0
        // POST api/getcsxiinfo
        public string Post(FormDataCollection form)
        {
            #region Not used
            //#region Get form data

            ////HelperFuncs.writeToSiteErrors("test", "test1");

            //string username = form.Get("username");
            //string password = form.Get("password");

            //string originZip = form.Get("originZip");
            //string destinationZip = form.Get("destinationZip");

            //string[] additionalServices = new string[1];
            //DateTime pickupDate;

            //if (!DateTime.TryParse(form.Get("pickupDate"), out pickupDate))
            //{
            //    pickupDate = DateTime.Today.AddDays(1);
            //}

            //#endregion

            //List<string[]> accessorials = new List<string[]>();
            //IntermodalRater.railResult railResult = new IntermodalRater.railResult();

            //SharedRail.GetCSXIInfo(ref originZip, ref destinationZip, ref pickupDate, ref accessorials, ref railResult);

            //if (string.IsNullOrEmpty(railResult.success) || !railResult.success.Equals("success"))
            //{
            //    return "0";
            //}
            //else
            //{
            //    return string.Concat("success=", railResult.success, "&rate=", railResult.rate, "&transitTime=", railResult.transitTime,
            //        "&hasCapacity=", railResult.hasCapacity, "&firstCapacityDate=", railResult.firstCapacityDate.ToShortDateString(),
            //        "&eta=", railResult.eta.ToShortDateString(), "&containerSize=", railResult.containerSize);


            //}
            #endregion

            try
            {
                HelperFuncs.writeToSiteErrors("get_CSXI_rates new ", "get_CSXI_rates new ");
                int CarrierCompID = 90199;
                SharedRail.Parameters parameters = new SharedRail.Parameters();
                SharedRail.setParameters(ref form, ref parameters, ref CarrierCompID);

                SharedRail.ICarrier carrier = new CSXI(parameters);

                IntermodalRater.railResult railResult = new IntermodalRater.railResult();
                railResult = carrier.getRate();

                return(SharedRail.getResultString(ref railResult));
            }
            catch (Exception e)
            {
                HelperFuncs.writeToSiteErrors("get_CSXI_rates", e.ToString());
                return("0");
            }
        }