public void Get_accessorials_by_RequestID(ref HelperFuncs.AccessorialsObj AccessorialsObj, ref AES_API_info api_info) { List <Acc> list = new List <Acc>(); try { using (SqlConnection conn = new SqlConnection(AppCodeConstants.connStringAesAPI)) { #region SQL string sql = string.Concat("SELECT ServiceCode,Type ", "FROM LTL_RATE_REQUESTS_SERVICE ", "WHERE RequestId='", api_info.RequestId, "'"); #endregion using (SqlCommand command = new SqlCommand()) { command.Connection = conn; command.CommandText = sql; conn.Open(); using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { DB.LogGenera("Get_accessorials_by_RequestID", "found accessorial", "found accessorial"); Acc a = new Acc(); if (reader["ServiceCode"] != DBNull.Value) { a.ServiceCode = reader["ServiceCode"].ToString(); DB.LogGenera(iam, "Get_accessorials_by_RequestID ServiceCode", a.ServiceCode); } if (reader["Type"] != DBNull.Value) { a.Type = reader["Type"].ToString(); DB.LogGenera(iam, "Get_accessorials_by_RequestID Type", a.Type); } list.Add(a); } } } } } catch (Exception e) { DB.LogGenera(iam, "Get_accessorials_by_RequestID", e.ToString()); } // for (byte i = 0; i < list.Count; i++) { if (list[i].ServiceCode == "RSD") { AccessorialsObj.RESDEL = true; } else if (list[i].ServiceCode == "RSP") { AccessorialsObj.RESPU = true; } else if (list[i].ServiceCode == "CSD") { AccessorialsObj.CONDEL = true; } else if (list[i].ServiceCode == "CSP") { AccessorialsObj.CONPU = true; } else if (list[i].ServiceCode == "TGD") { DB.LogGenera("Get_accessorials_by_RequestID", "found LGDEL", "found LGDEL"); AccessorialsObj.LGDEL = true; } else if (list[i].ServiceCode == "TGP") { AccessorialsObj.LGPU = true; } else if (list[i].ServiceCode == "TSD") { AccessorialsObj.TRADEDEL = true; } else if (list[i].ServiceCode == "TSP") { AccessorialsObj.TRADEPU = true; } else if (list[i].ServiceCode == "AMD") { AccessorialsObj.APTDEL = true; } else if (list[i].ServiceCode == "AMP") { AccessorialsObj.APTPU = true; } else if (list[i].ServiceCode == "ISD") { AccessorialsObj.INSDEL = true; } } }
public static void getAAACooperRate(ref double totalCharges, ref byte transitDays, ref QuoteData quoteData, ref LTLPiece[] m_lPiece, ref HelperFuncs.AccessorialsObj AccessorialsObj) { #region Bill date string day = DateTime.Today.Day.ToString(); string month = DateTime.Today.Month.ToString(); string year = DateTime.Today.Year.ToString().Substring(2); if (day.Length.Equals(1)) { day = '0' + day; } if (month.Length.Equals(1)) { month = '0' + month; } #endregion // Define the web service object gcmAPI.AAACooperRateService.wsGenRateEstimate ws = new gcmAPI.AAACooperRateService.wsGenRateEstimate(); #region Accessorials // For Additional Services var acclinelist = new List <gcmAPI.AAACooperRateService.RateEstimateRequestVOAccLine>(); #region Liftgate if (AccessorialsObj.LGPU) { var accline = new gcmAPI.AAACooperRateService.RateEstimateRequestVOAccLine() { AccCode = "LGP" }; acclinelist.Add(accline); } if (AccessorialsObj.LGDEL) { var accline = new gcmAPI.AAACooperRateService.RateEstimateRequestVOAccLine() { AccCode = "LGD" }; acclinelist.Add(accline); } #endregion #region Appointment if (AccessorialsObj.APTPU || AccessorialsObj.APTDEL) { var accline = new gcmAPI.AAACooperRateService.RateEstimateRequestVOAccLine() { AccCode = "NCM" }; acclinelist.Add(accline); } #endregion #region Inside Delivery if (AccessorialsObj.INSDEL) { var accline = new gcmAPI.AAACooperRateService.RateEstimateRequestVOAccLine() { AccCode = "ISD" }; acclinelist.Add(accline); } #endregion #region Residential if (AccessorialsObj.RESPU) { var accline = new gcmAPI.AAACooperRateService.RateEstimateRequestVOAccLine() { AccCode = "RSP" }; acclinelist.Add(accline); } if (AccessorialsObj.RESDEL) { var accline = new gcmAPI.AAACooperRateService.RateEstimateRequestVOAccLine() { AccCode = "RSD" }; acclinelist.Add(accline); } #endregion #region Construction if (AccessorialsObj.CONPU) { var accline = new gcmAPI.AAACooperRateService.RateEstimateRequestVOAccLine() { AccCode = "CSP" }; acclinelist.Add(accline); } if (AccessorialsObj.CONDEL) { var accline = new gcmAPI.AAACooperRateService.RateEstimateRequestVOAccLine() { AccCode = "CSD" }; acclinelist.Add(accline); } #endregion #region Not used /*if (AccessorialsObj.TRADEPU) * { * var accline = new gcmAPI.AAACooperRateService.RateEstimateRequestVOAccLine() * { * AccCode = "LGD" * }; * acclinelist.Add(accline); * } * if (AccessorialsObj.TRADEDEL) * { * var accline = new gcmAPI.AAACooperRateService.RateEstimateRequestVOAccLine() * { * AccCode = "LGD" * }; * acclinelist.Add(accline); * }*/ #endregion #endregion #region Items var lineitemslist = new List <gcmAPI.AAACooperRateService.RateEstimateRequestVORateEstimateRequestLine>(); string hazMatStr = ""; for (byte i = 0; i < m_lPiece.Length; i++) { #region Hazmat if (m_lPiece[i].HazMat.Equals(true)) { hazMatStr = "X"; } else { hazMatStr = ""; } #endregion var lineitems = new gcmAPI.AAACooperRateService.RateEstimateRequestVORateEstimateRequestLine() { Class = m_lPiece[i].FreightClass, Weight = Convert.ToInt16(m_lPiece[i].Weight).ToString(), //HandlingUnitType = "Drums", HandlingUnitType = "Pallets", HandlingUnits = Convert.ToInt16(m_lPiece[i].Quantity).ToString(), Length = Convert.ToInt16(m_lPiece[i].Length).ToString(), Width = Convert.ToInt16(m_lPiece[i].Width).ToString(), Height = Convert.ToInt16(m_lPiece[i].Height).ToString(), Hazmat = hazMatStr }; lineitemslist.Add(lineitems); } #endregion #region Set request info var request = new gcmAPI.AAACooperRateService.RateEstimateRequestVO { Token = AppCodeConstants.aaa_cooper_token, CustomerNumber = AppCodeConstants.aaa_cooper_customer_number, OriginCity = quoteData.origCity, OriginState = quoteData.origState, OriginZip = quoteData.origZip, OriginCountryCode = "USA", DestinationCity = quoteData.destCity, DestinationState = quoteData.destState, DestinationZip = quoteData.destZip, DestinCountryCode = "USA", WhoAmI = "T", BillDate = string.Concat(month, day, year), //BillDate = "050415", PrePaidCollect = "P", AccLine = acclinelist.ToArray(), RateEstimateRequestLine = lineitemslist.ToArray() }; #endregion // CallwsGenRateEstimate var responseMatches = ws.CallwsGenRateEstimate(request); if (!double.TryParse(responseMatches.TotalCharges, out totalCharges) || totalCharges.Equals(0)) { // No rate found throw new Exception(responseMatches.ErrorMessage); } byte.TryParse(responseMatches.TotalTransit, out transitDays); //HelperFuncs.writeToSiteErrors("aaa", responseMatches.TotalTransit); }
//RateServiceNotification res; #endregion #region Constructors public Validator(ref QuoteData quoteData) { this.quoteData = quoteData; this.m_lPiece = quoteData.m_lPiece; this.AccessorialsObj = quoteData.AccessorialsObj; }
public string MakeBookingViaSOAP(ref LTLBookRequest ltl_book_request, ref string username, ref string password) { //gcmAPI.gcmWebService.LTLBookingReply lbr; try { //return "{ \"Notification\" : \"temporily stopped service\" }"; #region Testing StringBuilder logger = new StringBuilder(); //ltl_book_request.lineItems.Length; logger.Append(string.Concat("lineItems.Length: ", ltl_book_request.items.Count, ", ")); logger.Append(string.Concat("shipmentDate: ", ltl_book_request.pickupDate, ", ")); logger.Append(string.Concat("bookingKey: ", ltl_book_request.bookingKey, ", ")); logger.Append(string.Concat("customerType: ", ltl_book_request.customerType, ", ")); logger.Append(string.Concat("origName: ", ltl_book_request.originName, ", ")); logger.Append(string.Concat("origEmail: ", ltl_book_request.originEmail, ", ")); logger.Append(string.Concat("origCompany: ", ltl_book_request.originCompany, ", ")); logger.Append(string.Concat("origPhone: ", ltl_book_request.originPhone, ", ")); logger.Append(string.Concat("origFax: ", ltl_book_request.originFax, ", ")); logger.Append(string.Concat("origAddress1: ", ltl_book_request.originAddress1, ", ")); logger.Append(string.Concat("origAddress2: ", ltl_book_request.originAddress2, ", ")); logger.Append(string.Concat("origCity: ", ltl_book_request.originCity, ", ")); logger.Append(string.Concat("origState: ", ltl_book_request.originState, ", ")); logger.Append(string.Concat("origZip: ", ltl_book_request.originZip, ", ")); logger.Append(string.Concat("destName: ", ltl_book_request.destinationName, ", ")); logger.Append(string.Concat("destEmail: ", ltl_book_request.destinationEmail, ", ")); logger.Append(string.Concat("destCompany: ", ltl_book_request.destinationCompany, ", ")); logger.Append(string.Concat("destPhone: ", ltl_book_request.destinationPhone, ", ")); logger.Append(string.Concat("destFax: ", ltl_book_request.destinationFax, ", ")); logger.Append(string.Concat("destAddress1: ", ltl_book_request.destinationAddress1, ", ")); logger.Append(string.Concat("destAddress2: ", ltl_book_request.destinationAddress2, ", ")); logger.Append(string.Concat("destCity: ", ltl_book_request.destinationCity, ", ")); logger.Append(string.Concat("destState: ", ltl_book_request.destinationState, ", ")); logger.Append(string.Concat("destZip: ", ltl_book_request.destinationZip, ", ")); HelperFuncs.writeToSiteErrors("LTL Booking Restful", logger.ToString()); #endregion #region Not used //logger.Append(string.Concat("shipmentDate: ", ltl_book_request.shipmentDate, ", ")); //if(j //if (!DateTime.TryParse(ltl_book_request.shipmentDate, out shipmentDate)) //{ // shipmentDate = DateTime.Today.AddDays(1); //} // Authenticate to the web service/API //string sessionId = rs.Authenticate(apiUserName, apiKey); //// Initialize SOAP header for authentication //rs.AuthHeaderValue = new MyWebReference.AuthHeader(); //// Set session id to the SOAP header //rs.AuthHeaderValue.SessionID = sessionId; #endregion DateTime shipmentDate = ltl_book_request.pickupDate; // Initialize web service/API object gcmAPI.gcmWebService.RateService2 rs = new gcmAPI.gcmWebService.RateService2(); string bookingKey = ltl_book_request.bookingKey; string customerType = ltl_book_request.customerType; //Set customer type gcmAPI.gcmWebService.BookingThirdPartyBilling thirdPartyBilling = null; //DateTime shipmentDate = DateTime.Now.Date; //Set shipment date string readyTime = "02:15 PM"; //Set ready time of the shipment string closeTime = "06:15 PM"; //Set close time of the shipment //string readyTime = "10"; //Set ready time of the shipment //string closeTime = "3"; //Set close time of the shipment string bolSendTo = "EML"; //Set BOL sending option //string poNumber = "45455"; //Set PO Number string poNumber = null; //Set PO Number #region Origin and Destination // Set pickup location gcmAPI.gcmWebService.BookingPickupLocation pickupLocation = new gcmAPI.gcmWebService.BookingPickupLocation(); pickupLocation.Name = ltl_book_request.originName; pickupLocation.Email = ltl_book_request.originEmail; pickupLocation.Company = ltl_book_request.originCompany; pickupLocation.Phone = ltl_book_request.originPhone; pickupLocation.Fax = ltl_book_request.originFax; pickupLocation.Address1 = ltl_book_request.originAddress1; pickupLocation.Address2 = ltl_book_request.originAddress2; pickupLocation.City = ltl_book_request.originCity; pickupLocation.State = ltl_book_request.originState; pickupLocation.Zip = ltl_book_request.originZip; pickupLocation.DispatchAddressesId = 1; // Set destination location gcmAPI.gcmWebService.BookingDestinationLocation destinationLocation = new gcmAPI.gcmWebService.BookingDestinationLocation(); destinationLocation.Name = ltl_book_request.destinationName; destinationLocation.Email = ltl_book_request.destinationEmail; destinationLocation.Company = ltl_book_request.destinationCompany; destinationLocation.Phone = ltl_book_request.destinationPhone; destinationLocation.Fax = ltl_book_request.destinationFax; destinationLocation.Address1 = ltl_book_request.destinationAddress1; destinationLocation.Address2 = ltl_book_request.destinationAddress2; destinationLocation.City = ltl_book_request.destinationCity; destinationLocation.State = ltl_book_request.destinationState; destinationLocation.Zip = ltl_book_request.destinationZip; #endregion //string SessionID = ltl_book_request.SessionID; //logger.Append(string.Concat("SessionID: ", ltl_book_request.SessionID, ", ")); //int testInt; List <gcmAPI.gcmWebService.LTLBookingPiece> bookingLineItems = new List <gcmAPI.gcmWebService.LTLBookingPiece>(); for (byte i = 0; i < ltl_book_request.items.Count; i++) { gcmAPI.gcmWebService.LTLBookingPiece lineItem = new gcmAPI.gcmWebService.LTLBookingPiece(); lineItem.Tag = ltl_book_request.items[i].tag; lineItem.Description = ltl_book_request.items[i].description; if (ltl_book_request.items[i].units > 0) { lineItem.NumberOfPallet = ltl_book_request.items[i].units; } else if (ltl_book_request.items[i].pieces > 0) { lineItem.NumberOfPallet = ltl_book_request.items[i].pieces; } else { lineItem.NumberOfPallet = 1; } // Testing logger.Append(string.Concat("Tag", i.ToString(), ": ", lineItem.Tag, ", ")); logger.Append(string.Concat("Description", i.ToString(), ": ", lineItem.Description, ", ")); logger.Append(string.Concat("NumberOfPallet", i.ToString(), ": ", lineItem.NumberOfPallet, ", ")); bookingLineItems.Add(lineItem); } HelperFuncs.writeToSiteErrors("LTL Booking Restful", logger.ToString()); #region Not used //Set other line items //gcmWebService.LTLBookingPiece[] bookingLineItems = new gcmWebService.LTLBookingPiece[1]; //Set first line item for booking //bookingLineItems[0] = new gcmWebService.LTLBookingPiece(); //// This tag is related to the object(LTLPiece) in lineItems array which is used in GetLTLBookingRate function call //bookingLineItems[0].Tag = form.Get("Tag"); ////bookingLineItems[0].NMFC = 50; //bookingLineItems[0].NumberOfPallet = 1; //bookingLineItems[0].Description = form.Get("Description"); //Set second line item for booking //bookingLineItems[1] = new MyWebReference.LTLBookingPiece(); ////// This tag is related to the object(LTLPiece) in lineItems array which is used in GetLTLBookingRate function call //bookingLineItems[1].Tag = "2"; //bookingLineItems[1].NMFC = 60; //bookingLineItems[1].NumberOfPallet = 10; //bookingLineItems[1].Description = "TEST"; #endregion string comments = "TEST"; //string comments = null; //bool insuranceRequired = true; bool insuranceRequired = false; double declaredValue = 100; // //Book an LTL rate and getting the BOL and insurance certificate PDF url gcmAPI.gcmWebService.LTLBookingReply lbr = rs.CreateLTLBooking_3(username, password, bookingKey, customerType, thirdPartyBilling, shipmentDate, readyTime, closeTime, bolSendTo, poNumber, pickupLocation, destinationLocation, bookingLineItems.ToArray(), comments, insuranceRequired, declaredValue); HelperFuncs.writeToSiteErrors("LTL Booking Restful result", string.Concat("notification=", lbr.Notification, "&shipmentID=", lbr.ShipmentId, "&=BOLURL", lbr.BOLURL)); // DB.Log("before DLS Shipment Import", "before DLS Shipment Import"); #region DLS Shipment Import try { var repo = new gcmAPI.Models.Public.LTL.Repository(); AES_API_info api_info; repo.Get_booking_info_by_booking_key(ltl_book_request.bookingKey, out api_info); HelperFuncs.dlsShipInfo dlsInfo = new HelperFuncs.dlsShipInfo(); HelperFuncs.DispatchInfo dispatchInfo = new HelperFuncs.DispatchInfo(); HelperFuncs.AccessorialsObj AccessorialsObj = new HelperFuncs.AccessorialsObj(); DLS_ShipmentImport shipment_import = new DLS_ShipmentImport(ref dlsInfo, ref dispatchInfo, ref api_info, ref AccessorialsObj, ref username, lbr.ShipmentId); shipment_import.Set_DLS_ShipmentImport_objects(ref ltl_book_request, ref api_info); //DB.Log("dispatchInfo.username", dispatchInfo.username); string DLS_PrimaryReferencePNW = ""; DB.Log("before ShipmentImportDLS", "before ShipmentImportDLS"); //shipment_import.ShipmentImportDLS(ref DLS_PrimaryReferencePNW); DB.Log("after ShipmentImportDLS", "after ShipmentImportDLS"); } catch (Exception e) { DB.Log("MakeBookingViaSOAP DLS Shipment Import", e.ToString()); } DB.Log("after DLS Shipment Import", "after DLS Shipment Import"); #endregion // Insert DLS_PrimaryReferencePNW into DB return(lbr.ToJSON()); //return string.Concat("{ \"notification\" : \"", lbr.Notification, "\", \"shipmentID\" : ", lbr.ShipmentId, ", \"BOLURL", lbr.BOLURL, " }"); //return "test test"; } catch (Exception e) { HelperFuncs.writeToSiteErrors("LTL Booking Restful", e.ToString()); Json_helper json_helper = new Json_helper(); return(json_helper.Build_error_response("1", "An error occurred while processing the request")); //return "{ \"Notification\" : \"error\" }"; //return lbr.ToJSON; } }
public HttpResponseMessage Post() { string data = "", DLS_PrimaryReferencePNW = "", response_string = ""; try { #region Authentication var re = Request; var headers = re.Headers; string username = "", password = ""; if (headers.Contains("username")) { username = headers.GetValues("username").First(); DB.LogGenera(iam, "username", username); } else { DB.LogGenera(iam, "username", "none found"); } if (headers.Contains("password")) { password = headers.GetValues("password").First(); DB.LogGenera(iam, "password", password); } else { DB.LogGenera(iam, "password", "none found"); } #endregion data = this.Request.Content.ReadAsStringAsync().Result; DB.LogGenera(iam, "Public API booking data", data); string request_format = "", error_response = "", content_type = "application/json"; LTLBookRequest ltl_book_request = new LTLBookRequest(); QuoteData quoteData = new QuoteData(); // Validator vld = new Validator(); DB.LogGenera(iam, "before", "Validate_booking_request_xml_json"); // Validate_booking_request_json vld.Validate_booking_request_json(ref data, ref error_response, ref request_format, ref ltl_book_request); DB.LogGenera(iam, "after", "Validate_booking_request_xml_json"); Models.Public.LTL.Helper public_helper = new Models.Public.LTL.Helper(); #region If got an error response from Validator - return error message DB.LogGenera(iam, "Public API error_response", error_response); if (error_response == "") { // Do nothing } else { response_string = error_response; return(public_helper.Get_response_message(ref response_string, ref content_type)); } #endregion #region Not used, MakeBookingViaSOAP //return new HttpResponseMessage() //{ // Content = new StringContent(response_string, Encoding.UTF8, "application/json") //}; //Models.Public.LTL.Helper public_helper = new Models.Public.LTL.Helper(); // If got to here, request is valid JSON or XML // Make booking via SOAP //LTLBooking booking = new LTLBooking(); //response_string = booking.MakeBookingViaSOAP(ref ltl_book_request, ref username, ref password); #endregion // Get Calculated freight_class, carrier Mode var repo = new gcmAPI.Models.Public.LTL.Repository(); AES_API_info api_info; repo.Get_booking_info_by_booking_key(ltl_book_request.bookingKey, out api_info); // Get_carriers_by_QuoteID List <AES_API_info> quote_carriers; // Get_carriers_by_QuoteID repo.Get_carriers_by_QuoteID(api_info.QuoteId, out quote_carriers); // // Build email text StringBuilder sb = new StringBuilder(); public_helper.getEmailText(ref sb, ref quote_carriers); DB.LogGenera("create ltl booking", "sb carriers count", quote_carriers.Count.ToString()); DB.LogGenera("create ltl booking", "sb carriers", sb.ToString()); // Get_items_by_QuoteID repo.Get_items_by_QuoteID(api_info.QuoteId, ref api_info); // Get_total_cube_by_QuoteID repo.Get_total_cube_by_QuoteID(api_info.QuoteId, ref api_info); #region Calculate density if (api_info.total_cube > 0 && api_info.total_weight > 0) { api_info.total_density = api_info.total_weight / api_info.total_cube; DB.LogGenera(iam, "api_info.total_density", api_info.total_density.ToString()); } else { DB.LogGenera(iam, "could not set density", "total cube or total weight 0"); } #endregion string sql = ""; #region Check for Genera carrier, if true return before getting PNW DB.LogGenera(iam, "before DLS Shipment Import", "before DLS Shipment Import"); DB.LogGenera(iam, "api_info.CarrierDisplayName", api_info.CarrierDisplayName); if (api_info.CarrierDisplayName.Contains("Genera")) { response_string = "Genera carrier, could not get PNW"; // Return error return(public_helper.Get_response_message(ref response_string, ref content_type)); } else { // Do nothing } #endregion // // Book_request_vs_BookingKey vld.Book_request_vs_BookingKey(ref error_response, ref ltl_book_request, ref api_info); // #region DLS Shipment Import HelperFuncs.dlsShipInfo dlsInfo = new HelperFuncs.dlsShipInfo(); HelperFuncs.DispatchInfo dispatchInfo = new HelperFuncs.DispatchInfo(); HelperFuncs.AccessorialsObj AccessorialsObj = new HelperFuncs.AccessorialsObj(); // Get_accessorials_by_RequestID repo.Get_accessorials_by_RequestID(ref AccessorialsObj, ref api_info); DLS_ShipmentImport shipment_import = new DLS_ShipmentImport(ref dlsInfo, ref dispatchInfo, ref api_info, ref AccessorialsObj, ref username, "0"); shipment_import.Set_DLS_ShipmentImport_objects(ref ltl_book_request, ref api_info); //DB.LogGenera("dispatchInfo.username", dispatchInfo.username); DB.LogGenera(iam, "before ShipmentImportDLS, mode:", AppCodeConstants.mode); if (AppCodeConstants.mode == AppCodeConstants.prod) { DB.LogGenera(iam, "ShipmentImportDLS, mode:", "is prod"); // Prod ShipmentImportDLS shipment_import.ShipmentImportDLS(ref DLS_PrimaryReferencePNW, ref quote_carriers, ref sb); } else if (AppCodeConstants.mode == AppCodeConstants.demo) { DB.LogGenera(iam, "ShipmentImportDLS, mode:", "is demo"); // Demo ShipmentImportDLS shipment_import.test_email(ref DLS_PrimaryReferencePNW, ref quote_carriers, ref sb); Random rnd = new Random(); int rand = rnd.Next(); DLS_PrimaryReferencePNW = string.Concat("PNW", rand); } else { DB.LogGenera(iam, "ShipmentImportDLS, mode:", "is different"); // A different mode } // DB.LogGenera(iam, "after ShipmentImportDLS", "after ShipmentImportDLS"); #endregion if (DLS_PrimaryReferencePNW == "") { throw new Exception("Did not get PNW"); } #region INSERT INTO Segments.CarrierQuoteNum // Only for Live GCM bookings string[] tokens = new string[4]; tokens[0] = "shipmentID"; tokens[1] = ":"; tokens[2] = "\""; tokens[3] = "\""; int shipmentID = 0; // Scrape the shipment id from the request string string shipment_id = HelperFuncs.scrapeFromPage(tokens, data); DB.LogGenera(iam, "shipment_id", shipment_id); if (int.TryParse(shipment_id, out shipmentID) && shipmentID > 0) { // This happens only when Genera user booked in Live GCM // Update CarrierQuoteNum HelperFuncs.updateCarrierQuoteNum(ref shipmentID, ref DLS_PrimaryReferencePNW); } else { // Regular booking, from the API // Do nothing } //dynamic dyn = JsonConvert.DeserializeObject(doc); #endregion //response_string = DLS_PrimaryReferencePNW; DB.LogGenera(iam, "get_ltl_book_test", DLS_PrimaryReferencePNW); // repo.UpdateStatsQuoteWasBooked(api_info.QuoteId, DLS_PrimaryReferencePNW, ltl_book_request.destinationCompany.Replace("'", "''")); // Json_helper json_helper = new Json_helper(); response_string = json_helper.Build_booking_response("0", "success", ref DLS_PrimaryReferencePNW, ref api_info); #region INSERT INTO Genera_Booking // string PO = ""; if (!string.IsNullOrEmpty(ltl_book_request.poNumber)) { PO = ltl_book_request.poNumber; } // data = data.Replace("'", "''"); sql = string.Concat("INSERT INTO Genera_Booking_2(Booking_request,Booking_request_escaped,Booking_response,PNW,PO) VALUES(", "'", data, "','", data.Replace("\"", "\\\""), "','", response_string.Replace("'", "''"), "','", DLS_PrimaryReferencePNW, "','", PO.Replace("'", "''"), "')"); HelperFuncs.ExecuteNonQuery(AppCodeConstants.connStringAesAPI, ref sql, "Get_LTL_ratesController"); #endregion return(public_helper.Get_response_message(ref response_string, ref content_type)); } catch (Exception e) { #region Unknown error DB.LogGenera(iam, "get_ltl_book_test", e.ToString()); Json_helper json_helper = new Json_helper(); response_string = json_helper.Build_booking_error_response("2", string.Concat("Could not create booking. Please try again.")); Models.Public.LTL.Helper public_helper = new Models.Public.LTL.Helper(); string content_type = "application/json"; string sql = string.Concat("INSERT INTO Genera_Booking_2(Booking_request,Booking_request_escaped,Booking_Response,PNW) VALUES(", "'", data, "','", data.Replace("\"", "\\\""), "','", response_string, "','", DLS_PrimaryReferencePNW, "')"); HelperFuncs.ExecuteNonQuery(AppCodeConstants.connStringAesAPI, ref sql, "Get_LTL_ratesController"); return(public_helper.Get_response_message(ref response_string, ref content_type)); #endregion } }