예제 #1
0
        private void CalculateLevel()
        {
            long totalSpentExp = 0;

            foreach (var attribute in Attributes)
            {
                int attributeExp = 0;
                for (int i = attribute.Start; i < attribute.Base; i++)
                {
                    attributeExp += RaiseCost(attribute, i);
                }
                totalSpentExp += attributeExp;
            }

            foreach (var skill in Skills)
            {
                int skillExp = 0;
                for (int i = skill.Start; i < skill.Base; i++)
                {
                    skillExp += RaiseCost(skill, i);
                }
                totalSpentExp += skillExp;
            }

            CurrentExp   = totalSpentExp;
            CurrentLevel = HelperFuncs.GetLevelFromExp(CurrentExp);
        }
예제 #2
0
        // POST api/getltlrates
        public string Post(FormDataCollection form)
        {
            try
            {
                //ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                HelperFuncs.writeToSiteErrors("get_ltl_rates new ", "get_ltl_rates new ");

                //HelperFuncs.QuoteData quoteData = new HelperFuncs.QuoteData();
                QuoteData quoteData = new QuoteData();

                Models.LTL.Helper helper = new Models.LTL.Helper();
                helper.setParameters(ref form, ref quoteData);

                LTL_Carriers             carriers = new LTL_Carriers(quoteData);
                SharedLTL.CarriersResult result   = carriers.GetRates();
                //string res = carriers.GetRates();
                //HelperFuncs.writeToSiteErrors("get_ltl_rates result", res);
                StringBuilder res = new StringBuilder();

                //res.Append("myObj = {\"carrierRates\": ");
                //res.Append("\"carrierRates\": ");
                res.Append(result.totalQuotes.ToJSON());
                //SharedLTL.getCarriersResultJSON(ref result.totalQuotes, ref res);

                //res.Append("}");
                //res.Append("]");

                return(res.ToString());
            }
            catch (Exception e)
            {
                HelperFuncs.writeToSiteErrors("get_ltl_rates", e.ToString());
                return("0");
            }
        }
예제 #3
0
        // 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");
            }
        }
예제 #4
0
파일: Helper.cs 프로젝트: alefurman40/api_2
        private void Store_one_service_info(ref string requestId, ref string ServiceCode, ref string Type)
        {
            string sql = string.Concat("insert into LTL_RATE_REQUESTS_SERVICE (RequestId,ServiceCode,Type) values ",
                                       "('", requestId, "','", ServiceCode, "','", Type, "')");

            HelperFuncs.ExecuteNonQuery(AppCodeConstants.connStringAesAPI, ref sql, "StoreLTLRequestsSql Genera");
        }
예제 #5
0
    //public static string ToJSON(this object obj, int recursionDepth)
    //{
    //    JavaScriptSerializer serializer = new JavaScriptSerializer();
    //    serializer.RecursionLimit = recursionDepth;
    //    return serializer.Serialize(obj);
    //}

    #endregion

    #region GetDLS_strSQL_ForCompID

    private static string GetDLS_strSQL_ForCompID(string CompName)
    {
        string sql = string.Concat("select CompID from tbl_Company where Carrier = 1 AND CompName='", CompName, "'");

        HelperFuncs.writeToDispatchLogs("carNameTest RRD", sql);
        return(sql);
    }
예제 #6
0
파일: Estes.cs 프로젝트: alefurman40/api_2
        private void Parse_one_estes_result(ref List <Estes_price_res> list, string doc, ref string quoteNumber)
        {
            Estes_price_res res = new Estes_price_res();

            string[] tokens = new string[3];
            tokens[0] = "<rat:standardPrice>";
            tokens[1] = ">";
            tokens[2] = "<";

            double.TryParse(HelperFuncs.scrapeFromPage(tokens, doc), out res.standardPrice);

            tokens[0] = "<rat:guaranteedPrice>";
            double.TryParse(HelperFuncs.scrapeFromPage(tokens, doc), out res.guaranteedPrice);

            tokens[0]        = "<rat:deliveryDate>";
            res.deliveryDate = DateTime.MinValue;
            DateTime.TryParse(HelperFuncs.scrapeFromPage(tokens, doc), out res.deliveryDate);

            tokens[0]        = "<rat:serviceLevel>";
            res.serviceLevel = HelperFuncs.scrapeFromPage(tokens, doc);

            //tokens[0] = "<rat:code>";
            //res.code = HelperFuncs.scrapeFromPage(tokens, doc);

            res.quoteNumber = quoteNumber;

            list.Add(res);
        }
예제 #7
0
        //// POST api/getintermodalrates
        //public void Post([FromBody]string value)
        //{
        //}

        // POST api/getintegrarates
        public string Post(FormDataCollection form)
        {
            //string test2 = form.Get("test2");

            //string myString = "";

            ////GetIntegraRatesModel model = new GetIntegraRatesModel();
            ////model.testFunc(ref myString);

            //Intermodal.testStaticFunc(ref myString);

            //return "value was " + myString;
            HelperFuncs.writeToSiteErrors("test", "test");

            string username = form.Get("username");
            string password = form.Get("password");
            //string pickupDate = form.Get("test2");
            string originZip      = form.Get("originZip");
            string destinationZip = form.Get("destinationZip");

            //string username = form.Get("test2");
            //List<string> additionalServices = new List<string>();
            string[] additionalServices = new string[1];
            DateTime pickupDate         = DateTime.Today;

            IntermodalRater ir      = new IntermodalRater();
            List <string[]> results = new List <string[]>();

            int QuoteID = 0;

            results = ir.GetIntermodalRate(username, password, pickupDate, originZip, destinationZip, additionalServices, ref QuoteID);

            return(QuoteID.ToString());
        }
예제 #8
0
    public static void GetRRD_ScacByCarrierName(string CarrierName, ref string SCAC)
    {
        string sql = string.Empty;

        try
        {
            if (CarrierName.ToLower().Contains("dayton"))
            {
                sql = string.Concat("SELECT SCAC ",

                                    "FROM SQL_LTLCARRIERS ",

                                    "WHERE ID=348");
            }
            else
            {
                sql = string.Concat("SELECT SCAC ",

                                    "FROM SQL_LTLCARRIERS ",

                                    "WHERE CarrierName='", CarrierName, "'");
            }


            using (SqlConnection conn = new SqlConnection(AppCodeConstants.connStringLTLRater))
            {
                #region SQL

                //sql = string.Concat("SELECT SCAC ",

                //    "FROM SQL_LTLCARRIERS ",

                //    "WHERE CarrierName='", CarrierName, "'");

                #endregion

                using (SqlCommand command = new SqlCommand())
                {
                    command.Connection  = conn;
                    command.CommandText = sql;
                    conn.Open();
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        if (reader.Read())
                        {
                            if (reader["SCAC"] != DBNull.Value)
                            {
                                SCAC = reader["SCAC"].ToString();
                            }
                        }
                    }
                }
            }
        }
        catch (Exception e)
        {
            HelperFuncs.writeToSiteErrors("GetRRD_ScacByCarrierName", e.ToString());
        }
    }
예제 #9
0
    private void Update()
    {
        _moveInput = new Vector2(
            Input.GetAxis("Horizontal"),
            Input.GetAxis("Vertical"));

        _mousePosition = HelperFuncs.GetMousePositionWorld();
    }
예제 #10
0
    public static void getClassForRRTS_AAFES(ref decimal rrtsFreightClass, ref decimal totalDensity)
    {
        #region Get rrtsFreightClass by density
        if (totalDensity <= 0)
        {
            //SharedFunctions.writeToAAFES_Logs("AAFES", string.Concat("Density was less than zero po id: ", shipInfo.PO_ID.ToString()));
            //continue;
            HelperFuncs.writeToSiteErrors("rrtsFreightClass", "Density was less than zero");
            rrtsFreightClass = -1;
        }
        else if (totalDensity > 0 && totalDensity < 1)
        {
            rrtsFreightClass = 400;
        }
        else if (totalDensity >= 1 && totalDensity < 2)
        {
            rrtsFreightClass = 300;
        }
        else if (totalDensity >= 2 && totalDensity < 4)
        {
            rrtsFreightClass = 250;
        }
        else if (totalDensity >= 4 && totalDensity < 6)
        {
            rrtsFreightClass = 175;
        }
        else if (totalDensity >= 6 && totalDensity < 8)
        {
            rrtsFreightClass = 125;
        }
        else if (totalDensity >= 8 && totalDensity < 10)
        {
            rrtsFreightClass = 100;
        }
        else if (totalDensity >= 10 && totalDensity < 12)
        {
            rrtsFreightClass = 92.5M;
        }
        else if (totalDensity >= 12 && totalDensity < 15)
        {
            rrtsFreightClass = 85;
        }
        else if (totalDensity >= 15 && totalDensity < 22.5M)
        {
            rrtsFreightClass = 70;
        }
        else if (totalDensity >= 22.5M && totalDensity < 30)
        {
            rrtsFreightClass = 65;
        }
        else
        {
            rrtsFreightClass = 60;
        }


        #endregion
    }
예제 #11
0
파일: Helper.cs 프로젝트: alefurman40/api_2
        //public static string GetSpecialState()
        //{
        //    string originState = "";
        //    string destState = "";

        //    try
        //    {
        //        if (!String.IsNullOrEmpty(requestedValues["oCityState"]))
        //        {
        //            string[] arrPCityState = requestedValues["oCityState"].Split(',');
        //            originState = arrPCityState[1].Trim();
        //        }
        //        else if (Session["oState"] != null)
        //        {
        //            originState = Session["oState"].ToString();
        //        }
        //        else if (!String.IsNullOrEmpty(requestedValues["q_OCity"]))
        //        {
        //            string[] arrPCityState = requestedValues["q_OCity"].Split(',');
        //            originState = arrPCityState[1].Trim();
        //        }

        //        if (!String.IsNullOrEmpty(requestedValues["dCityState"]))
        //        {
        //            string[] arrPCityState = requestedValues["dCityState"].Split(',');
        //            originState = arrPCityState[1].Trim();
        //        }
        //        else if (Session["dState"] != null)
        //        {
        //            destState = Session["dState"].ToString();
        //        }
        //        else if (!String.IsNullOrEmpty(requestedValues["q_DCity"]))
        //        {
        //            string[] arrDCityState = requestedValues["q_DCity"].Split(',');
        //            destState = arrDCityState[1].Trim();
        //        }
        //    }
        //    catch (Exception myException)
        //    {
        //        HelperFuncs.writeToSiteErrors("dispatch getSpecialState", string.Concat("oCityState: ", requestedValues["oCityState"], " q_OCity: ",
        //            requestedValues["q_OCity"], " dCityState: ", requestedValues["dCityState"], " q_DCity: ", requestedValues["q_DCity"]));

        //        throw new Exception(myException.ToString());
        //    }

        //    if (originState.ToUpper().Equals("HI") || originState.ToUpper().Equals("AK"))
        //    {
        //        return originState;
        //    }
        //    if (destState.ToUpper().Equals("HI") || destState.ToUpper().Equals("AK"))
        //    {
        //        return destState;
        //    }
        //    return "";
        //}

        #endregion

        #region GetSpecialState

        public static string GetSpecialState(ref DispatchData dispatch_data)
        {
            string originState = "";
            string destState   = "";

            try
            {
                if (!String.IsNullOrEmpty(dispatch_data.oCityState))
                {
                    string[] arrPCityState = dispatch_data.oCityState.Split(',');
                    originState = arrPCityState[1].Trim();
                }
                else if (dispatch_data.oState != null)
                {
                    originState = dispatch_data.oState;
                }
                else if (!String.IsNullOrEmpty(dispatch_data.q_OCity))
                {
                    string[] arrPCityState = dispatch_data.q_OCity.Split(',');
                    originState = arrPCityState[1].Trim();
                }

                if (!String.IsNullOrEmpty(dispatch_data.dCityState))
                {
                    string[] arrPCityState = dispatch_data.dCityState.Split(',');
                    originState = arrPCityState[1].Trim();
                }
                else if (dispatch_data.dState != null)
                {
                    destState = dispatch_data.dState;
                }
                else if (!String.IsNullOrEmpty(dispatch_data.q_DCity))
                {
                    string[] arrDCityState = dispatch_data.q_DCity.Split(',');
                    destState = arrDCityState[1].Trim();
                }
            }
            catch (Exception myException)
            {
                HelperFuncs.writeToSiteErrors("dispatch getSpecialState",
                                              string.Concat("oCityState: ", dispatch_data.oCityState, " q_OCity: ",
                                                            dispatch_data.q_OCity, " dCityState: ", dispatch_data.dCityState, " q_DCity: ",
                                                            dispatch_data.q_DCity));

                throw new Exception(myException.ToString());
            }

            if (originState.ToUpper().Equals("HI") || originState.ToUpper().Equals("AK"))
            {
                return(originState);
            }
            if (destState.ToUpper().Equals("HI") || destState.ToUpper().Equals("AK"))
            {
                return(destState);
            }
            return("");
        }
예제 #12
0
        public static void GetQuoteInfoByQuoteID(ref int QuoteID, ref string oZip, ref string dZip, ref DateTime Day, ref DateTime Time)
        {
            try
            {
                using (SqlConnection conn = new SqlConnection(AppCodeConstants.connStringRater2009))
                {
                    #region SQL

                    string sql = string.Concat("SELECT Origin, Destination, Day, Time ",

                                               "FROM SQL_STATS_GCM ",

                                               "WHERE ID=", QuoteID);

                    #endregion

                    byte counter = 0;

                    using (SqlCommand command = new SqlCommand())
                    {
                        command.Connection  = conn;
                        command.CommandText = sql;
                        conn.Open();
                        using (SqlDataReader reader = command.ExecuteReader())
                        {
                            if (reader.Read())
                            {
                                if (reader["Origin"] != DBNull.Value)
                                {
                                    oZip = reader["Origin"].ToString();
                                }

                                if (reader["Destination"] != DBNull.Value)
                                {
                                    dZip = reader["Destination"].ToString();
                                }

                                if (reader["Day"] != DBNull.Value)
                                {
                                    Day = (DateTime)reader["Day"];
                                }

                                if (reader["Time"] != DBNull.Value)
                                {
                                    Time = (DateTime)reader["Time"];
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                HelperFuncs.writeToSiteErrors("GetQuoteInfoByQuoteID", e.ToString());
            }
        }
예제 #13
0
    /*
     * function GetClassByDensity(totDensity) {
     * var classDensityBased = "-1";
     *
     * if (totDensity < 1)
     *  classDensityBased = "400";
     * else if (totDensity >= 1 && totDensity < 2)
     *  classDensityBased = "300";
     * else if (totDensity >= 2 && totDensity < 4)
     *  classDensityBased = "250";
     * else if (totDensity >= 4 && totDensity < 6)
     *  classDensityBased = "175";
     * else if (totDensity >= 6 && totDensity < 8)
     *  classDensityBased = "125";
     * else if (totDensity >= 8 && totDensity < 10)
     *  classDensityBased = "100";
     * else if (totDensity >= 10 && totDensity < 12)
     *  classDensityBased = "92.5";
     * else if (totDensity >= 12 && totDensity < 15)
     *  classDensityBased = "85";
     * else if (totDensity >= 15 && totDensity < 22.5)
     *  classDensityBased = "70";
     * else if (totDensity >= 22.5 && totDensity < 30)
     *  classDensityBased = "65";
     * else //greater than 30
     *  classDensityBased = "60";
     *
     * return classDensityBased;
     * }
     */
    public static void Get_class_by_density(ref QuoteData quoteData)
    {
        #region Get quoteData.calculated_freight_class by density
        if (quoteData.totalDensity <= 0)
        {
            HelperFuncs.writeToSiteErrors("quoteData.calculated_freight_class", "Density was less than zero");
            quoteData.calculated_freight_class = -1;
        }
        else if (quoteData.totalDensity > 0 && quoteData.totalDensity < 1)
        {
            quoteData.calculated_freight_class = 400;
        }
        else if (quoteData.totalDensity >= 1 && quoteData.totalDensity < 2)
        {
            quoteData.calculated_freight_class = 300;
        }
        else if (quoteData.totalDensity >= 2 && quoteData.totalDensity < 4)
        {
            quoteData.calculated_freight_class = 250;
        }
        else if (quoteData.totalDensity >= 4 && quoteData.totalDensity < 6)
        {
            quoteData.calculated_freight_class = 175;
        }
        else if (quoteData.totalDensity >= 6 && quoteData.totalDensity < 8)
        {
            quoteData.calculated_freight_class = 125;
        }
        else if (quoteData.totalDensity >= 8 && quoteData.totalDensity < 10)
        {
            quoteData.calculated_freight_class = 100;
        }
        else if (quoteData.totalDensity >= 10 && quoteData.totalDensity < 12)
        {
            quoteData.calculated_freight_class = 92.5;
        }
        else if (quoteData.totalDensity >= 12 && quoteData.totalDensity < 15)
        {
            quoteData.calculated_freight_class = 85;
        }
        else if (quoteData.totalDensity >= 15 && quoteData.totalDensity < 22.5)
        {
            quoteData.calculated_freight_class = 70;
        }
        else if (quoteData.totalDensity >= 22.5 && quoteData.totalDensity < 30)
        {
            quoteData.calculated_freight_class = 65;
        }
        else
        {
            quoteData.calculated_freight_class = 60;
        }


        #endregion
    }
예제 #14
0
        public void Cancel_UPS_Freight_pickup_request(ref string PickupRequestConfirmationNumber)
        {
            string month, day;

            month = DateTime.Today.Month.ToString();
            day   = DateTime.Today.Day.ToString();
            if (month.Length == 1)
            {
                month = "0" + month;
            }
            if (day.Length == 1)
            {
                day = "0" + day;
            }

            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

            Web_client http = new Web_client();

            string username = AppCodeConstants.ups_freight_genera_un, password = AppCodeConstants.ups_freight_genera_pwd,
                   AccessLicenseNumber = AppCodeConstants.ups_freight_genera_license_num;

            //http.url = "https://onlinetools.ups.com/rest/FreightPickup";
            http.url       = "https://wwwcie.ups.com/rest/FreightPickup";
            http.method    = "POST";
            http.post_data = string.Concat(
                "{ \"Security\": { \"UsernameToken\": { \"Username\": \"", username, "\", \"Password\": \"", password, "\" }, ",
                "\"UPSServiceAccessToken\": { \"AccessLicenseNumber\": \"", AccessLicenseNumber, "\" } }, ",
                "\"LumberJack\": \"\", \"pNg911jan06\": \"\", ",
                "\"FreightCancelPickupRequest\": { \"Request\": { \"RequestOption\": \"\", ",
                "\"TransactionReference\": { \"CustomerContext\": \"\" } }, ",
                "\"PickupRequestConfirmationNumber\": \"", PickupRequestConfirmationNumber, "\" } }");

            http.accept       = "application/json";
            http.content_type = "application/json";

            string doc = http.Make_http_request();

            #region Parse result

            string[] tokens = new string[5];
            tokens[0] = "FreightCancelStatus";
            tokens[1] = "Code";
            tokens[2] = ":";
            tokens[3] = "\"";
            tokens[4] = "\"";

            string Code = HelperFuncs.scrapeFromPage(tokens, doc);

            //tokens[0] = "TimeInTransit";
            tokens[1] = "Description";

            string Description = HelperFuncs.scrapeFromPage(tokens, doc);

            #endregion
        }
예제 #15
0
파일: DLS.cs 프로젝트: alefurman40/api_2
        // Imported from WS
        private string getResponseFromDLS(string data)
        {
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;


            #region Variables

            string          url = "", referrer, contentType, accept, method, doc = "";
            CookieContainer container = new CookieContainer();

            url         = "https://dlsworldwideproxy.rrd.com/services/api/v1/RateShop/RateRequest";
            referrer    = "";
            contentType = "application/xml";
            method      = "POST";
            accept      = "text/xml";

            #endregion

            try
            {
                #region Post Data

                DB.Log("getRateFromDLS Alex2015 data", data);

                #endregion

                #region Authentication Headers

                string[] headerNames  = new string[2];
                string[] headerValues = new string[2];

                headerNames[0] = "UserName";
                headerNames[1] = "APIKey";

                headerValues[0] = UserName;
                headerValues[1] = APIKey;

                #endregion

                doc = (string)HelperFuncs.generic_http_request_addHeaders("string", container, url, referrer, contentType, accept, method,
                                                                          data, false, headerNames, headerValues);

                return(doc);

                #region Not used
                //url = "https://dlsworldwideproxy-stage.rrd.com/services/api/v1/RateShop/RateRequest";
                //url = "https://dlsworldwideproxy-stage.rrd.com/services";
                #endregion
            }
            catch (Exception e)
            {
                DB.Log("getRateFromDLS", e.ToString());
                return("error");
            }
        }
예제 #16
0
        public static void InsertAdditionalService(int intSegmentID, int intServiceID)
        {
            string strSQL =
                "insert into tbl_ACCDetail(SEGMENTID,LKUPID_ACC,ACCType)"
                + " values("
                + intSegmentID + "," + intServiceID + DB.GetCommaSingleQuoteValue("SEG")
                + ")";

            HelperFuncs.ExecuteNonQuery(AppCodeConstants.connStringAesData, ref strSQL,
                                        "dispatch InsertAdditionalService");
        }
예제 #17
0
파일: LOUP.cs 프로젝트: alefurman40/api_2
    private static void getLocationInfo(ref SharedRail.Location location, ref string zipCode, ref string city,
                                        ref CookieContainer container, ref string doc,
                                        string referrer, string url, string accept, string contentType)
    {
        referrer    = url;
        accept      = "*/*";
        contentType = "";
        url         = "https://www.shipstreamline.com/pricing-services/secure/jas/api/location/search?term=" + zipCode;
        doc         = (string)HelperFuncs.generic_http_request_3("string", container, url, referrer, contentType, accept, "GET", "", false, false, "", "");

        int ind;

        if (doc.IndexOf(city) != -1)
        {
            ind = doc.IndexOf(city);
            doc = doc.Substring(ind - 50);
        }

        string[] tokens = new string[4];
        tokens[0] = "locationId";
        tokens[1] = "\"";
        tokens[2] = "\"";
        tokens[3] = "\"";

        location.locationId = HelperFuncs.scrapeFromPage(tokens, doc);

        tokens[0]     = "city\"";
        location.city = HelperFuncs.scrapeFromPage(tokens, doc);

        tokens[0]      = "state\"";
        location.state = HelperFuncs.scrapeFromPage(tokens, doc);

        tokens[0]        = "zipcode\"";
        location.zipCode = HelperFuncs.scrapeFromPage(tokens, doc);

        tokens[0]        = "country\"";
        location.country = HelperFuncs.scrapeFromPage(tokens, doc);

        tokens[0]     = "area";
        location.area = HelperFuncs.scrapeFromPage(tokens, doc);

        tokens[0]         = "timeZone";
        location.timeZone = HelperFuncs.scrapeFromPage(tokens, doc);

        tokens[2] = ":";
        tokens[3] = ",";

        tokens[0]         = "latitude";
        location.latitude = HelperFuncs.scrapeFromPage(tokens, doc);

        tokens[0]          = "longitude";
        location.longitude = HelperFuncs.scrapeFromPage(tokens, doc);
    }
예제 #18
0
    public void AddStar()
    {
        HelperFuncs.ASSERT(m_currentActiveStars > m_childrenList.Count, "Can`t activate more stars, than avaliable");

        if (m_currentActiveStars == m_childrenList.Count)
        {
            GameObject newStar = Instantiate(m_starInstance, transform);
            m_childrenList.Add(newStar);
        }

        m_childrenList[m_currentActiveStars].SetActive(true);
        ++m_currentActiveStars;
    }
예제 #19
0
    public void GeneratePercentage(Gases gases)
    {
        float tsum = gases.TotalSum();

        if (tsum == 0)
        {
            return;
        }
        waterVapour   = HelperFuncs.RoundToDecimals((gases.waterVapour / tsum) * 100, 1);
        carbonDioxide = HelperFuncs.RoundToDecimals((gases.carbonDioxide / tsum) * 100, 1);
        methane       = HelperFuncs.RoundToDecimals((gases.methane / tsum) * 100, 1);
        nitrousOxide  = HelperFuncs.RoundToDecimals((gases.nitrousOxide / tsum) * 100, 1);
        CFCs          = HelperFuncs.RoundToDecimals((gases.CFCs / tsum) * 100, 1);
    }
예제 #20
0
    private static void getResult_ModalX(ref string doc, ref HelperFuncs.ModalX_Result res)
    {
        string[] tokens = new string[3];
        tokens[0] = "success";
        tokens[1] = ":";
        tokens[2] = ",";

        bool.TryParse(HelperFuncs.scrapeFromPage(tokens, doc), out res.success);
        if (res.success != true)
        {
            return;
        }

        tokens[0] = "pickupDate";
        string tmp = HelperFuncs.scrapeFromPage(tokens, doc);
        long   jsDateTime;

        long.TryParse(tmp, out jsDateTime);

        if (jsDateTime < 1)
        {
            return;
        }
        else
        {
            res.pickupDate = SharedRail.getDateFromJsGetTimeValue(jsDateTime);
        }

        //--

        tokens[0] = "deliveryDate";
        tmp       = HelperFuncs.scrapeFromPage(tokens, doc);
        long.TryParse(tmp, out jsDateTime);

        if (jsDateTime < 1)
        {
            return;
        }
        else
        {
            res.deliveryDate = SharedRail.getDateFromJsGetTimeValue(jsDateTime);
        }

        //--

        tokens[0] = "totalCharge";
        tmp       = HelperFuncs.scrapeFromPage(tokens, doc);
        decimal.TryParse(tmp, out res.cost);
    }
예제 #21
0
        public static int GetInterimCarrierCompanyID(ref DispatchData dispatch_data)
        {
            object  objTempID;
            int     intInterimCarrierCompID;
            string  strSQL         = "";
            Company interimCompany = Helper.GetInterimCompanyDetails(ref dispatch_data);

            strSQL = "select top 1 CompID from tbl_Company where CompName=" + DB.GetSingleQuoteValue(interimCompany.CompName)
                     + "and Carrier=1 "
                     + "and Addr1=" + DB.GetSingleQuoteValue(interimCompany.Addr1)
                     + "and Addr2=" + DB.GetSingleQuoteValue(interimCompany.Addr2)
                     + "and City=" + DB.GetSingleQuoteValue(interimCompany.City)
                     + "and State=" + DB.GetSingleQuoteValue(interimCompany.State)
                     + "and Zip=" + DB.GetSingleQuoteValue(interimCompany.Zip)
                     + "and Phone=" + DB.GetSingleQuoteValue(interimCompany.Phone)
                     + "and Fax=" + DB.GetSingleQuoteValue("");

            //comm.CommandText = strSQL;
            objTempID = HelperFuncs.ExecuteScalar(AppCodeConstants.connStringAesData, ref strSQL,
                                                  "Dispatch GetInterimCarrierCompanyID");
            //

            //
            if (objTempID != null)
            {
                intInterimCarrierCompID = Convert.ToInt32(objTempID);
            }
            else
            {
                strSQL = "insert into tbl_Company(CompName,Carrier,Addr1,Addr2,City,State,Zip,Phone,Fax)"
                         + " values("
                         + DB.GetSingleQuoteValue(interimCompany.CompName) + ",1"
                         + DB.GetCommaSingleQuoteValue(interimCompany.Addr1) + DB.GetCommaSingleQuoteValue(interimCompany.Addr2)
                         + DB.GetCommaSingleQuoteValue(interimCompany.City) + DB.GetCommaSingleQuoteValue(interimCompany.State)
                         + DB.GetCommaSingleQuoteValue(interimCompany.Zip) + DB.GetCommaSingleQuoteValue(interimCompany.Phone)
                         + DB.GetCommaSingleQuoteValue("")
                         + ")";
                //comm.CommandText = strSQL;
                //comm.ExecuteNonQuery();

                //intInterimCarrierCompID = HelperFuncs.GetLastAutogeneratedID(comm);

                intInterimCarrierCompID = HelperFuncs.ExecuteNonQuery_GetLastAutogeneratedID(
                    AppCodeConstants.connStringAesData, ref strSQL, "Dispatch GetInterimCarrierCompanyID");
            }

            return(intInterimCarrierCompID);
        }
예제 #22
0
    public void Get_XPO_Access_token(out string access_token)
    {
        try
        {
            Logins.Login_info login_info;
            Logins            logins = new Logins();
            logins.Get_login_info(126, out login_info);

            string access_key = login_info.API_Key;

            string data = string.Concat("grant_type=password&username="******"&password="******"https://api.ltl.xpo.com/token",
                content_type = "application/x-www-form-urlencoded",
                accept       = "*/*",
                post_data    = data,
                method       = "POST"
            };

            http.header_names     = new string[1];
            http.header_names[0]  = "Authorization";
            http.header_values    = new string[1];
            http.header_values[0] = string.Concat("Basic ", access_key);

            string doc = http.Make_http_request();

            #region Parse result

            string[] tokens = new string[4];
            tokens[0] = "access_token";
            tokens[1] = ":";
            tokens[2] = "\"";
            tokens[3] = "\"";

            access_token = HelperFuncs.scrapeFromPage(tokens, doc);

            #endregion
        }
        catch (Exception e)
        {
            access_token = "not found";
            //string str = e.ToString();
            DB.Log("Get_XPO_Access_token", e.ToString());
        }
    }
예제 #23
0
    void UpdateUI()
    {
        Gases perc = new Gases(_gasesWeight);

        _waterVapourCount.text     = perc.waterVapour + "%";
        _carbonDioxideCount.text   = perc.carbonDioxide + "%";
        _methaneCount.text         = perc.methane + "%";
        _nitrousOxideCount.text    = perc.nitrousOxide + "%";
        _CFCsCount.text            = perc.CFCs + "%";
        _waterVapourSlider.value   = _gasesWeight.waterVapour;
        _carbonDioxideSlider.value = _gasesWeight.carbonDioxide;
        _methaneSlider.value       = _gasesWeight.methane;
        _nitrousOxideSlider.value  = _gasesWeight.nitrousOxide;
        _CFCsSlider.value          = _gasesWeight.CFCs;
        _dateDisplay.text          = _date.Year + "Y " + _date.Month + "M " + _date.Day + "D";
        _tempSlider.value          = _temp;
        _tempText.text             = HelperFuncs.RoundToDecimals(_temp, 2).ToString() + "°";
    }
예제 #24
0
    private static void getPurchasedInfo_ModalX(ref SharedRail.ModalX_PurchasedBy purchasedBy, ref string doc)
    {
        string[] tokens = new string[4];
        tokens[0]         = "email";
        tokens[1]         = ":";
        tokens[2]         = "\"";
        tokens[3]         = "\"";
        purchasedBy.email = HelperFuncs.scrapeFromPage(tokens, doc);

        tokens[0]           = "company";
        purchasedBy.company = HelperFuncs.scrapeFromPage(tokens, doc);

        tokens[0]         = "telephone";
        purchasedBy.phone = HelperFuncs.scrapeFromPage(tokens, doc);

        tokens[0]        = "fullName";
        purchasedBy.name = HelperFuncs.scrapeFromPage(tokens, doc);
    }
예제 #25
0
        private void getRatesFromPittOhioAPI(ref string multPieces, ref StringBuilder sbAccessorials,
                                             ref string TotalChargesString, ref string daysString)
        {
            string url = string.Concat("http://works.pittohio.com/mypittohio/b2bratecalc.asp?acctnum=",
                                       acctInfo.username, "&password="******"&ShipCity=", quoteData.origCity,
                                       "&ShipState=", quoteData.origState,
                                       "&ShipZIP=", quoteData.origZip,

                                       "&ConsCity=", quoteData.destCity,
                                       "&ConsState=", quoteData.destState,
                                       "&ConsZIP=", quoteData.destZip,

                                       "&Terms=", acctInfo.terms,                          // Options P,I,3 - Prepaid, Inbound Collect, Third Party
                                       "&ShipDate=", quoteData.puDate.ToShortDateString(), //mm/dd/yyyy

                                                                                           // ShipType=PAL // Options P or PAL for Pallets, N for not pallets (default), M for Mixed
                                                                                           //"&TestMode=Y",
                                                                                           //"&Class1=50&Wgt1=1482",
                                       multPieces,
                                       sbAccessorials
                                       //"&Acc_RES=Y&Acc_LGD=Y"
                                       );

            HelperFuncs.writeToSiteErrors("Pitt Ohio API (Live) request", url);
            //string doc = "";
            string doc = (string)HelperFuncs.generic_http_request_3(
                "string", null, url, "", "text/xml", "*/*", "GET", "", false, false, "", "");

            HelperFuncs.writeToSiteErrors("Pitt Ohio API (Live) response", doc);


            string[] tokens = new string[3];
            tokens[0]          = "TotalCharges";
            tokens[1]          = ">";
            tokens[2]          = "<";
            TotalChargesString = HelperFuncs.scrapeFromPage(tokens, doc);

            //DB.Log("Pitt Ohio API (Live) TotalChargesStr", TotalChargesString);

            tokens[0]  = "AdvertisedTransit";
            daysString = HelperFuncs.scrapeFromPage(tokens, doc);
        }
예제 #26
0
    public static void getOTR_RateDLS()
    {
        string[] cityStateCountryOrig = new string[3];
        string[] cityStateCountryDest = new string[3];

        string oState, dState, oCity, dCity, oCountry, dCountry;

        try
        {
            SharedRail.cityStateCountryByZip(ref cityStateCountryOrig, originZipGlobal);
            SharedRail.cityStateCountryByZip(ref cityStateCountryDest, destZipGlobal);

            if (!string.IsNullOrEmpty(cityStateCountryOrig[0]))
            {
                oState   = cityStateCountryOrig[1];
                oCity    = cityStateCountryOrig[0];
                oCountry = cityStateCountryOrig[2];
            }
            else
            {
                return;
            }
            if (!string.IsNullOrEmpty(cityStateCountryDest[0]))
            {
                dState   = cityStateCountryDest[1];
                dCity    = cityStateCountryDest[0];
                dCountry = cityStateCountryDest[2];
            }
            else
            {
                return;
            }

            SharedRail.getOTR_RateDLS(ref originZipGlobal, ref destZipGlobal, ref puDateGlobal, ref oCity, ref oState, ref oCountry,
                                      ref dCity, ref dState, ref dCountry);
        }
        catch (Exception e)
        {
            HelperFuncs.writeToSiteErrors("MG OTR", e.ToString());
        }
    }
예제 #27
0
        public static void InsertInsuranceCost(ref DispatchData dispatch_data, double shipmentValue, int intRQID)
        {
            string strSQL;
            int    intServiceID  = 291;
            double insuranceCost = shipmentValue * AppCodeConstants.InsuranceSellRate;

            if (insuranceCost < dispatch_data.minInsuranceCost)
            {
                insuranceCost = dispatch_data.minInsuranceCost;
            }

            SetInsuranceMinimum(ref dispatch_data, ref insuranceCost, ref shipmentValue);

            strSQL = "insert into tbl_ACCDetail(SEGMENTID,LKUPID_ACC,ACCType,ChargeAmt,RQID)"
                     + " values("
                     + dispatch_data.intSegmentID + "," + intServiceID + DB.GetCommaSingleQuoteValue("SEG") + "," +
                     insuranceCost + "," + intRQID
                     + ")";

            HelperFuncs.ExecuteNonQuery(AppCodeConstants.connStringAesData, ref strSQL,
                                        "dispatch InsertInsuranceCost");
        }
예제 #28
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");
            }
        }
예제 #29
0
    private void Update()
    {
        if (!IsPlacing)
        {
            if (Input.GetButtonUp("TogglePlacing"))
            {
                StartPlacing(ObjectPrefab);
            }
            return;
        }

        // Update preview
        Vector2 position = HelperFuncs.GetMousePositionWorld();

        Vector2Int gridCoord = Grid.GetCoordFromCentre(position);

        position = Grid.GetCellCorner(gridCoord);

        bool isOccupied = GridObjMgr.IsOccupied(gridCoord, ObjectPrefab.OccupiedTiles);

        ObjectPreview.gameObject.SetActive(!isOccupied);
        ObjectPreview.transform.position = position;

        if (Input.GetButton("Place"))
        {
            if (!isOccupied)
            {
                Building building = Instantiate(ObjectPrefab, position, Quaternion.identity, GridObjMgr.transform);

                GridObjMgr.AddObject(building, gridCoord);
            }
        }

        if (Input.GetButtonUp("Cancel") ||
            Input.GetButtonUp("TogglePlacing"))
        {
            StopPlacing();
        }
    }
예제 #30
0
        public void Get_access_token(ref string access_token)
        {
            try
            {
                string data =
                    string.Concat(
                        "client_secret=", AppCodeConstants.DYLT_Genera_client_secret,
                        "&grant_type=client_credentials&client_id=", AppCodeConstants.DYLT_Genera_client_id);

                Web_client http = new Web_client
                {
                    url          = "https://api.dylt.com/oauth/client_credential/accesstoken?grant_type=client_credentials",
                    content_type = "application/x-www-form-urlencoded",
                    accept       = "application/json",
                    post_data    = data,
                    method       = "POST"
                };

                string doc = http.Make_http_request();

                #region Parse result

                string[] tokens = new string[4];
                tokens[0] = "access_token";
                tokens[1] = ":";
                tokens[2] = "\"";
                tokens[3] = "\"";

                access_token = HelperFuncs.scrapeFromPage(tokens, doc);

                #endregion
            }
            catch (Exception e)
            {
                string str = e.ToString();
                HelperFuncs.writeToSiteErrors("Get_access_token", str);
            }
        }