Esempio n. 1
0
        // Genera
        public void setParameters(ref FormDataCollection form, ref QuoteData quoteData)
        {
            if (string.IsNullOrEmpty(form.Get("linealFeet")))
            {
                // Do nothing
            }
            else
            {
                double.TryParse(form.Get("linealFeet"), out quoteData.linealFeet);
            }

            #region pickup date

            DateTime pickupDate;
            if (!DateTime.TryParse(form.Get("pickupDate"), out pickupDate))
            {
                pickupDate = DateTime.Today;
            }
            quoteData.puDate = pickupDate;

            #endregion

            #region Boolean flags

            try
            {
                if (!bool.TryParse(form.Get("is_AAFES_quote"), out quoteData.is_AAFES_quote))
                {
                    quoteData.is_AAFES_quote = false;
                }
            }
            catch (Exception e)
            {
                DB.LogException("bool.TryParse(form.Get(is_AAFES_quote", e.ToString());
            }
            if (!bool.TryParse(form.Get("is_Genera_quote"), out quoteData.is_Genera_quote))
            {
                quoteData.is_Genera_quote = false;
            }
            if (!bool.TryParse(form.Get("isHazMat"), out quoteData.isHazmat))
            {
                quoteData.isHazmat = false;
            }
            if (!bool.TryParse(form.Get("hasDimensions"), out quoteData.hasDimensions))
            {
                quoteData.hasDimensions = false;
            }
            if (!bool.TryParse(form.Get("hasFreightClass"), out quoteData.hasFreightClass))
            {
                quoteData.hasFreightClass = false;
            }
            if (!bool.TryParse(form.Get("showDLSRates"), out quoteData.showDLSRates))
            {
                quoteData.showDLSRates = false;
            }
            if (!bool.TryParse(form.Get("isDUR"), out quoteData.isDUR))
            {
                quoteData.isDUR = false;
            }
            if (!bool.TryParse(form.Get("isAssociationID_5"), out quoteData.isAssociationID_5))
            {
                quoteData.isAssociationID_5 = false;
            }
            if (!bool.TryParse(form.Get("isCommodity"), out quoteData.isCommodity))
            {
                quoteData.isCommodity = false;
            }
            if (!bool.TryParse(form.Get("isCommodityLkupHHG"), out quoteData.isCommodityLkupHHG))
            {
                if (form.Get("isCommodityLkupHHG") != null && form.Get("isCommodityLkupHHG").Equals("1"))
                {
                    quoteData.isCommodityLkupHHG = true;
                }
                else
                {
                    quoteData.isCommodityLkupHHG = false;
                }
            }
            if (!bool.TryParse(form.Get("isHHG"), out quoteData.isHHG))
            {
                quoteData.isHHG = false;
            }
            if (!bool.TryParse(form.Get("isUSED"), out quoteData.isUSED))
            {
                quoteData.isUSED = false;
            }
            if (!bool.TryParse(form.Get("q_isHHG_AndUnder500"), out quoteData.isHHG_AndUnder500))
            {
                quoteData.isHHG_AndUnder500 = false;
            }
            if (!bool.TryParse(form.Get("isUserVanguard"), out quoteData.isUserVanguard))
            {
                quoteData.isUserVanguard = false;
            }

            #endregion

            quoteData.username = form.Get("username").ToLower();

            DB.Log("username", quoteData.username.ToString());

            if (string.IsNullOrEmpty(form.Get("api_username")))
            {
                quoteData.api_username = "";
            }
            else
            {
                quoteData.api_username = form.Get("api_username").ToLower();
                DB.Log("quoteData.api_username", quoteData.api_username.ToString());
            }

            quoteData.is_like_NetNet = Is_login_like_NetNet(quoteData.username);

            quoteData.is_good_USF_Holland_orig_state = Is_good_USF_Holland_orig_state(ref quoteData);

            if (quoteData.username.Equals("durachem") || quoteData.username.Equals("jcma512h"))
            {
                quoteData.is_dura_logic = true;
            }

            DB.Log("is_dura_logic", quoteData.is_dura_logic.ToString());

            quoteData.txtCommodityCubicFeet = form.Get("txtCommodityCubicFeet");
            quoteData.txtAAFES_Quote_PO     = form.Get("txtAAFES_Quote_PO");

            #region Origin and Destination

            quoteData.origZip   = form.Get("q_OPCode");
            quoteData.destZip   = form.Get("q_DPCode");
            quoteData.origCity  = form.Get("origCity");
            quoteData.destCity  = form.Get("destCity");
            quoteData.origState = form.Get("origState");
            quoteData.destState = form.Get("destState");

            #endregion

            quoteData.totalCube = 0.0;
            double.TryParse(form.Get("q_CubicFeet"), out quoteData.totalCube);
            DB.Log("quoteData.totalCube", quoteData.totalCube.ToString());

            if (string.IsNullOrEmpty(form.Get("totalCube")))
            {
                // Do nothing
                DB.Log("total cube", "null or empty");
            }
            else
            {
                double.TryParse(form.Get("totalCube"), out quoteData.totalCube);
                DB.Log("total cube", quoteData.totalCube.ToString());
            }

            quoteData.subdomain = form.Get("subdomain");

            quoteData.mode = form.Get("mode");

            quoteData.hasFreightClass = Convert.ToBoolean(form.Get("hasFreightClass"));

            DB.Log("quoteData.hasFreightClass", quoteData.hasFreightClass.ToString());

            int numOfUnits;

            SetLTLPiecesObject(out quoteData.numOfUnitsPieces, out numOfUnits, ref form, ref quoteData);

            quoteData.totalUnits = numOfUnits;

            #region Accessorials

            quoteData.AccessorialsObj = new HelperFuncs.AccessorialsObj();

            HelperFuncs.setAccessorialsObject(ref quoteData, ref quoteData.AccessorialsObj,
                                              Convert.ToBoolean(form.Get("q_ResPick")),
                                              Convert.ToBoolean(form.Get("q_ResDel")),
                                              Convert.ToBoolean(form.Get("q_ConstPick")),
                                              Convert.ToBoolean(form.Get("q_ConstDel")),
                                              Convert.ToBoolean(form.Get("q_InsDel")),
                                              Convert.ToBoolean(form.Get("q_AppPick")),
                                              Convert.ToBoolean(form.Get("q_AppDel")),
                                              Convert.ToBoolean(form.Get("q_TradePick")),
                                              Convert.ToBoolean(form.Get("q_TradeDel")),
                                              Convert.ToBoolean(form.Get("q_TailPick")),
                                              Convert.ToBoolean(form.Get("q_TailDel")),
                                              Convert.ToBoolean(form.Get("q_MiliPick")),
                                              Convert.ToBoolean(form.Get("q_MiliDel")),
                                              Convert.ToBoolean(form.Get("q_GovPick")),
                                              Convert.ToBoolean(form.Get("q_GovDel"))
                                              );

            #endregion
        }
Esempio n. 2
0
        // Genera
        public void Set_parameters(ref LTLQuoteRequest ltl_quote_request, ref QuoteData quoteData)
        {
            if (ltl_quote_request.totalCube == null)
            {
                // Do nothing
            }
            else
            {
                quoteData.totalCube = (double)ltl_quote_request.totalCube;
            }

            if (ltl_quote_request.linealFeet == null)
            {
                // Do nothing
            }
            else
            {
                quoteData.linealFeet = (double)ltl_quote_request.linealFeet;
            }


            #region pickup date

            quoteData.puDate = ltl_quote_request.pickupDate;

            #endregion

            #region Boolean flags

            for (byte i = 0; i < ltl_quote_request.items.Count; i++)
            {
                if (ltl_quote_request.items[i].hazmat == true)
                {
                    quoteData.isHazmat = true;
                    break;
                }
                else
                {
                    // Do nothing
                }
            }

            if (ltl_quote_request.items[0].length > 0)
            {
                quoteData.hasDimensions = true;
            }

            if (ltl_quote_request.items[0].freightClass > 0)
            {
                quoteData.hasFreightClass = true;
            }

            for (byte i = 0; i < ltl_quote_request.items.Count; i++)
            {
                if (ltl_quote_request.items[i].commodity == "HHG")
                {
                    quoteData.isHHG = true;
                    break;
                }
                else
                {
                    // Do nothing
                }
            }

            for (byte i = 0; i < ltl_quote_request.items.Count; i++)
            {
                if (ltl_quote_request.items[i].commodity == "USED")
                {
                    quoteData.isUSED = true;
                    break;
                }
                else
                {
                    // Do nothing
                }
            }

            double total_weight = 0.0;
            for (byte i = 0; i < ltl_quote_request.items.Count; i++)
            {
                if (ltl_quote_request.items[i].weight > 0)
                {
                    total_weight += (double)ltl_quote_request.items[i].weight;
                }
                else
                {
                    // Do nothing
                }
            }

            if (total_weight < 500 && quoteData.isHHG == true)
            {
                quoteData.isHHG_AndUnder500 = true;
            }

            #endregion

            //quoteData.username = username;

            //DB.Log("username", quoteData.username.ToString());

            quoteData.is_like_NetNet = Is_login_like_NetNet(quoteData.username);

            quoteData.is_good_USF_Holland_orig_state = Is_good_USF_Holland_orig_state(ref quoteData);

            #region Origin and Destination

            string[] split_arr;

            split_arr = ltl_quote_request.originZip.Trim().Split(' ');

            if (split_arr.Length == 2)
            {
                quoteData.origZip = split_arr[0] + split_arr[1];
            }
            else
            {
                quoteData.origZip = ltl_quote_request.originZip;
            }

            //if (ltl_quote_request.originZip)

            split_arr = ltl_quote_request.destinationZip.Trim().Split(' ');

            if (split_arr.Length == 2)
            {
                quoteData.destZip = split_arr[0] + split_arr[1];
            }
            else
            {
                quoteData.destZip = ltl_quote_request.destinationZip;
            }


            //quoteData.destZip = ltl_quote_request.destinationZip;
            quoteData.origCity  = ltl_quote_request.originCity;
            quoteData.destCity  = ltl_quote_request.destinationCity;
            quoteData.origState = ltl_quote_request.originState;
            quoteData.destState = ltl_quote_request.destinationState;

            #endregion

            quoteData.mode = "ws";

            int numOfUnits;

            SetLTLPiecesObject(out quoteData.numOfUnitsPieces, out numOfUnits, ref ltl_quote_request, ref quoteData);

            quoteData.totalUnits = numOfUnits;

            #region Accessorials

            quoteData.AccessorialsObj = new HelperFuncs.AccessorialsObj();

            HelperFuncs.setAccessorialsObject(ref quoteData, ref quoteData.AccessorialsObj,
                                              ltl_quote_request.additionalServices.RSP,
                                              ltl_quote_request.additionalServices.RSD,
                                              ltl_quote_request.additionalServices.CSP,
                                              ltl_quote_request.additionalServices.CSD,
                                              ltl_quote_request.additionalServices.ISD,
                                              ltl_quote_request.additionalServices.AMP,
                                              ltl_quote_request.additionalServices.AMD,
                                              ltl_quote_request.additionalServices.TSP,
                                              ltl_quote_request.additionalServices.TSD,
                                              ltl_quote_request.additionalServices.TGP,
                                              ltl_quote_request.additionalServices.TGD,
                                              false,
                                              false,
                                              false,
                                              false
                                              );

            #endregion
        }