private void GetResultObjectFromConWayFreight(ref GCMRateQuote gcmRateQuote) { Logins.Login_info login_info; Logins logins = new Logins(); logins.Get_login_info(46, out login_info); String userId = login_info.username; String passWd = login_info.password; try { if (quoteData.AccessorialsObj.TRADEPU.Equals(true) || quoteData.AccessorialsObj.TRADEDEL.Equals(true)) { throw new Exception("Tradeshow not supported"); } double totalCharges = 0; int standardDays = -1, overlengthFee = 0; string multPieces = "", accessorials = ""; CookieContainer container = new CookieContainer(); for (int i = 0; i < quoteData.m_lPiece.Length; i++) { multPieces += string.Concat("<Item>", "<CmdtyClass>", quoteData.m_lPiece[i].FreightClass.Replace(".", ""), "</CmdtyClass>", "<Weight unit=\"lbs\">", quoteData.m_lPiece[i].Weight, "</Weight>", "</Item>"); } // Get Overlenth Fee HelperFuncs.GetOverlengthFee(ref quoteData.m_lPiece, ref overlengthFee, 168, 168, 168, 89, 89, 89); // $88.25 per shipment #region Accessorials if (quoteData.AccessorialsObj.INSDEL) { accessorials += "<Accessorial>DID</Accessorial>"; } if (quoteData.AccessorialsObj.RESDEL) { accessorials += "<Accessorial>RSD</Accessorial>"; } if (quoteData.AccessorialsObj.RESPU) { accessorials += "<Accessorial>RSO</Accessorial>"; } if (quoteData.AccessorialsObj.CONDEL) { accessorials += "<Accessorial>CSD</Accessorial>"; } if (quoteData.AccessorialsObj.CONPU) { accessorials += "<Accessorial>OCS</Accessorial>"; } /*if (AccessorialsObj.TRADEDEL) * { * request.Append("<AccessorialItem>"); * request.Append("<Code>InsideDelivery</Code>"); * request.Append("</AccessorialItem>"); * } * if (AccessorialsObj.TRADEPU) * { * request.Append("<AccessorialItem>"); * request.Append("<Code>InsideDelivery</Code>"); * request.Append("</AccessorialItem>"); * }*/ if (quoteData.AccessorialsObj.LGPU) { accessorials += "<Accessorial>OLG</Accessorial>"; } if (quoteData.AccessorialsObj.LGDEL) { accessorials += "<Accessorial>DLG</Accessorial>"; } if (quoteData.AccessorialsObj.APTDEL) { accessorials += "<Accessorial>DNC</Accessorial>"; } if (quoteData.isHazmat) { accessorials += "<Accessorial>ZHM</Accessorial>"; } #endregion // Format Today's Date into mm/dd/yy format string today = DateTime.Today.Month.ToString() + "/" + DateTime.Today.Day.ToString() + "/" + DateTime.Today.Year.ToString().Remove(0, 2); #region Not used //string ChargeCode = "C"; //if (acctInfo.acctNum.Equals("561452031")) //{ // ChargeCode = "P"; //} //else if (quoteData.origZip.Equals("08854") || quoteData.origZip.Equals("08901") || quoteData.origZip.Equals("40109") || // quoteData.origZip.Equals("77029") || quoteData.origZip.Equals("91708")) //{ // ChargeCode = "P"; //} #endregion string ChargeCode = acctInfo.chargeType; if (quoteData.origZip.Equals("08854") || quoteData.origZip.Equals("08901") || quoteData.origZip.Equals("40109") || quoteData.origZip.Equals("77029") || quoteData.origZip.Equals("91708")) { ChargeCode = "P"; } string rateRequest = string.Concat("<RateRequest>", "<OriginZip country=\"us\">", quoteData.origZip, "</OriginZip>", "<DestinationZip country=\"us\">", quoteData.destZip, "</DestinationZip>", "<CustNmbr shipcode=\"", acctInfo.terms, "\">", acctInfo.acctNum, "</CustNmbr>", // make dynamic "<ChargeCode>", ChargeCode, "</ChargeCode>", "<EffectiveDate>", today, "</EffectiveDate>", multPieces, accessorials, //"<Item>" + "<CmdtyClass>775</CmdtyClass>" + "<Weight unit=\"lbs\">667</Weight>" + "</Item>" + //"<Item>" + //"<CmdtyClass>100</CmdtyClass>" + "<Weight unit=\"lbs\">555</Weight>" + "</Item>" + //"<Accessorial>SSC</Accessorial>" + "<Accessorial>DNC</Accessorial>" + "<Accessorial>GUR</Accessorial>" + "</RateRequest>"); //DB.Log("Con Way (Live)", rateRequest, ""); string[] res = getConWayFreightRate(ref userId, ref passWd, ref rateRequest); totalCharges = Convert.ToDouble(res[3]); //DB.Log("Con Way (Live)", totalCharges.ToString()); if (!int.TryParse(res[2], out standardDays)) { standardDays = -3; } if (totalCharges > 0) { gcmRateQuote.TotalPrice = totalCharges + overlengthFee; gcmRateQuote.DisplayName = acctInfo.displayName; gcmRateQuote.Documentation = ""; gcmRateQuote.DeliveryDays = standardDays; gcmRateQuote.BookingKey = "#1#"; gcmRateQuote.CarrierKey = "Con-way"; //CarsOnTime carOnTime; //if (Session["onTimeDict"] != null && ((Dictionary<string, CarsOnTime>)Session["onTimeDict"]).TryGetValue("Frontline", out carOnTime)) //{ // objQuote.OnTimePercent = carOnTime.onTimePercent + '%'; // objQuote.ShipsBetweenStates = carOnTime.delivOnTime + carOnTime.delivLate; //} } else { } } catch (Exception exp) { DB.Log("Con Way (Live)", exp.ToString()); } }
public GCMRateQuote GetResultObjectFromDaytonFreight() { //DB.Log("GetResultObjectFromDaytonFreight", ""); try { if (quoteData.AccessorialsObj.TRADEPU.Equals(true) || quoteData.AccessorialsObj.TRADEDEL.Equals(true)) { throw new Exception("Tradeshow not supported"); } LoadFreightArray(); Logins.Login_info login_info; Logins logins = new Logins(); logins.Get_login_info(69, out login_info); string strCustomerNumber = login_info.account; gcmAPI.com.daytonfreight.www.RateResult objDFResult; //gcmAPI.com.daytonfreight.www.RateResult objGRResultAM; //gcmAPI.com.daytonfreight.www.RateResult objGRResultPM; gcmAPI.com.daytonfreight.www.Credentials objCredentials = new gcmAPI.com.daytonfreight.www.Credentials(); objCredentials.UserName = login_info.username; objCredentials.Password = login_info.password; gcmAPI.com.daytonfreight.www.ShippingService objSS = new gcmAPI.com.daytonfreight.www.ShippingService(); objSS.CredentialsValue = objCredentials; ///////////////////////// string[] arrAccCode = GetAccessorialCodesForDaytonFreight(); objDFResult = objSS.Rate(strCustomerNumber, com.daytonfreight.www.Terms.ThirdParty, quoteData.origZip, quoteData.destZip, "", objRSIArray, arrAccCode); //SC //objGRResultAM = objSS.Rate(strCustomerNumber, com.daytonfreight.www.Terms.ThirdParty, midOrigZip, midDestZip, "AM", objRSIArray, arrAccCode); //objGRResultPM = objSS.Rate(strCustomerNumber, com.daytonfreight.www.Terms.ThirdParty, midOrigZip, midDestZip, "PM", objRSIArray, arrAccCode); //objDFResult. //objGUResult = objSS.GetGuaranteedServiceInformation(midOrigZip, midDestZip, Convert.ToDateTime("2008-04-17 13:58:06.000")); //SC /////////////////////// if (objDFResult != null) { double dblAdditionalAccessorialCharge = 0; foreach (gcmAPI.com.daytonfreight.www.AccessorialDetailInformation objAccessDetail in objDFResult.Accessorials) { if ( objAccessDetail.Code.Trim().ToUpper().Equals("LIFT") && quoteData.AccessorialsObj.LGDEL && quoteData.AccessorialsObj.LGPU ) { dblAdditionalAccessorialCharge += objAccessDetail.Amount; } else if ( objAccessDetail.Code.Trim().ToUpper().Equals("HMF") && quoteData.AccessorialsObj.APTPU && quoteData.AccessorialsObj.APTDEL ) { dblAdditionalAccessorialCharge += objAccessDetail.Amount; } else if (objAccessDetail.Code.Trim().ToUpper().Equals("RESID")) { int intCount = 0; if (quoteData.AccessorialsObj.RESDEL) { intCount += 1; } if (quoteData.AccessorialsObj.RESPU) { intCount += 1; } if (quoteData.AccessorialsObj.CONDEL) { intCount += 1; } if (quoteData.AccessorialsObj.CONPU) { intCount += 1; } ///////////// dblAdditionalAccessorialCharge += objAccessDetail.Amount * (intCount - 1); } } dblAdditionalAccessorialCharge += GetInsidePickupDeliveryCharge(); double totalCharges = objDFResult.Total + dblAdditionalAccessorialCharge; #region Overlength if (totalCharges > 0) { int overlengthFee = 0; // Get Overlenth Fee HelperFuncs.GetOverlengthFee(ref quoteData.m_lPiece, ref overlengthFee, 180, 180, 180, 110, 110, 110); totalCharges += overlengthFee; } #endregion #region Cost Additions //if (quoteData.subdomain.Equals("spc") || isCostPlus) //{ // totalCharges = HelperFuncs.addSPC_Addition(totalCharges); //} //if (quoteData.subdomain.Equals(HelperFuncs.Subdomains.clipper)) //{ // totalCharges = HelperFuncs.addClipperSubdomain_Addition(totalCharges); //} #endregion gcmAPI.com.daytonfreight.www.TransitTimeResult objTransitTime; objTransitTime = objSS.GetTransitTime(quoteData.origZip, quoteData.destZip); Int16 transitTime; if (objTransitTime != null) { transitTime = Convert.ToInt16(objTransitTime.TotalServiceDays); } else { transitTime = -1; } //objDaytonFreightResult = SetInfoToObjectQuote(ref totalCharges, "Dayton Freight", "#1#", "Dayton", //"http://www.globalcargomanager.com/Documents/DaytonFreight_Guaranteed.pdf", transitTime, "Dayton"); GCMRateQuote gcmRateQuote = new GCMRateQuote { TotalPrice = totalCharges, DisplayName = "Dayton Freight", Documentation = "http://www.globalcargomanager.com/Documents/DaytonFreight_Guaranteed.pdf", DeliveryDays = transitTime, BookingKey = "#1#", CarrierKey = "Dayton" }; return(gcmRateQuote); } else { return(null); } } catch (System.Web.Services.Protocols.SoapException ex) { #region Catch //gcmRateQuote = null; WebServiceException[] webServiceExceptions = ParseSoapException(ex); StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < webServiceExceptions.Length; i++) { stringBuilder.Append(webServiceExceptions[i].Message + "\r\n"); } //throw new Exception(stringBuilder.ToString()); DB.Log("Dayton (Live) Soap Exception", stringBuilder.ToString()); return(null); #endregion //DB.Log("Dayton (Live) Soap Exception", ex.ToString()); } catch (Exception ex) { #region Catch //gcmRateQuote = null; DB.Log("Dayton (Live)", ex.ToString()); return(null); #endregion } }