// 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");
            }
        }
Esempio n. 2
0
        public void Get_LOUP_rates()
        {
            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();

                //username=gcm&password=gcm1&originZip=30303&destinationZip=98177&originCity=ATLANTA
                //&destinationCity=SEATTLE&isHazMat=False&pickupDate=6/12/2019

                var data = new List <KeyValuePair <string, string> >()
                {
                    new KeyValuePair <string, string>("username", ""),
                    new KeyValuePair <string, string>("password", ""),
                    new KeyValuePair <string, string>("originZip", "30303"),
                    new KeyValuePair <string, string>("destinationZip", "98177"),
                    new KeyValuePair <string, string>("originCity", "ATLANTA"),
                    new KeyValuePair <string, string>("destinationCity", "SEATTLE"),
                    new KeyValuePair <string, string>("isHazMat", "False"),
                    new KeyValuePair <string, string>("pickupDate", "6/12/2019")
                };


                FormDataCollection form = new FormDataCollection(data);
                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)
            {
                string str = e.ToString();
                //HelperFuncs.writeToSiteErrors("get_loup_rates", e.ToString());
                //return "0";
            }
        }
Esempio n. 3
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");
            }
        }
Esempio n. 4
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");
            }
        }