public Get_SimpleSmResult WTB_Get_PIDSimpleSmInfoEC(string midSiteId, string ISOwebsite, List <string> productId) { Get_SimpleSmResult result = new Get_SimpleSmResult(); var requestData = new List <Get_PIDSimpleSmObjRequest>(); requestData.Add(new Get_PIDSimpleSmObjRequest() { websiteid = midSiteId, ISOwebsite = ISOwebsite, pid = productId }); string responseJsonStr = ""; string responseXML = ""; try { string strPostData = JsonConvert.SerializeObject(requestData); var header = new WtbHeader() { apiId = this.WhereToBuySystem_apiid, apikey = WhereToBuySystem_apikey }; var body = new WtbBody_Get_WTB() { Data = strPostData }; string strHeader = AOCC_ApiHelper.SetXMLString(header); string strBody = AOCC_ApiHelper.SetXMLString(body, true, "Get_PIDSimpleSmInfoEC"); DateTime requestStartTime = DateTime.Now; responseXML = AOCC_ApiHelper.ToPostSoapRequestWithXML(WTB_Host, strHeader, strBody); responseJsonStr = AOCC_ApiHelper.GetXmlStringData(responseXML, "Get_PIDSimpleSmInfoECResult"); var tmpResult = JsonConvert.DeserializeObject <Get_SimpleSmResponseResult>(responseJsonStr); oLogService.InsertExternalAPILog(MethodBase.GetCurrentMethod().Name, requestStartTime, DateTime.Now, Get_WTB_Url, "", $"strHeader : {strHeader}; strBody : {strBody}", responseJsonStr); if (tmpResult != null && tmpResult.Status == "1") { throw new Exception("WTB System Error : " + tmpResult.Message); } if (tmpResult != null && tmpResult.Status == "0") { result = tmpResult.lists; } } catch (Exception ex) { oLogService.InsertExternalApiErrorLog(MethodBase.GetCurrentMethod().Name, Get_WTB_Url, responseXML, responseJsonStr, ex.Message); } return(result); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public GetAwardListResponseRoot Award_GetAwardList(string productId, string area = "", string productLineId = "", string awardDateS = "", string awardDateE = "") { DateTime requestStartTime = DateTime.Now; GetAwardListResponseRoot result = new GetAwardListResponseRoot(); string xmlResponseString = ""; string responseString = ""; try { string strPostData = ""; strPostData += "apiid=" + AwardSystem_apiid; strPostData += "&apikey=" + AwardSystem_apikey; strPostData += "&productId=" + productId; if (!string.IsNullOrWhiteSpace(productLineId)) { strPostData += "&productLineId=" + productLineId; } if (!string.IsNullOrWhiteSpace(awardDateS)) { strPostData += "&awardDateS=" + HttpUtility.UrlEncode(awardDateS); } if (!string.IsNullOrWhiteSpace(awardDateE)) { strPostData += "&awardDateE=" + HttpUtility.UrlEncode(awardDateE); } if (!string.IsNullOrWhiteSpace(area)) { strPostData += "&area=" + area; } xmlResponseString = AOCC_ApiHelper.SendRequest($"{GetAwardList_Url}?{strPostData}"); responseString = AOCC_ApiHelper.GetXmlStringData(xmlResponseString); result = JsonConvert.DeserializeObject <GetAwardListResponseRoot>(responseString); if (result.Status == "1") { throw new Exception("Award System Error : " + result.Message); } oLogService.InsertExternalAPILog(MethodBase.GetCurrentMethod().Name, requestStartTime, DateTime.Now, GetAwardList_Url, "", strPostData, responseString); } catch (Exception ex) { oLogService.InsertExternalApiErrorLog(MethodBase.GetCurrentMethod().Name, GetAwardList_Url, strPostData, responseString, ex.Message); } return(result); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public List <Get_WtbResponseObj> WTB_Get_WTB(string website, string type, List <string> partNo) { DateTime requestStartTime = DateTime.Now; Get_WtbRootResponseResult result = new Get_WtbRootResponseResult(); var requestData = new List <Get_WtbObjRequest>(); requestData.Add(new Get_WtbObjRequest() { website = website, type = type, sku_member = partNo }); string responseJsonStr = ""; string responseXML = ""; try { string strPostData = JsonConvert.SerializeObject(requestData); var header = new WtbHeader() { apiId = this.WhereToBuySystem_apiid, apikey = WhereToBuySystem_apikey }; var body = new WtbBody_Get_WTB() { Data = strPostData }; string strHeader = AOCC_ApiHelper.SetXMLString(header); string strBody = AOCC_ApiHelper.SetXMLString(body, true, "Get_WTB"); responseXML = AOCC_ApiHelper.ToPostSoapRequestWithXML(WTB_Host, strHeader, strBody); responseJsonStr = AOCC_ApiHelper.GetXmlStringData(responseXML, "Get_WTBResult"); result = JsonConvert.DeserializeObject <List <Get_WtbRootResponseResult> >(responseJsonStr)?.FirstOrDefault(); if (result != null) { if (result.Status == "1") { throw new Exception("WTB System Error : " + result.Message); } oLogService.InsertExternalAPILog(MethodBase.GetCurrentMethod().Name, requestStartTime, DateTime.Now, Get_WTB_Url, "", $"strHeader : {strHeader}; strBody : {strBody}", responseJsonStr); } } catch (Exception ex) { oLogService.InsertExternalApiErrorLog(MethodBase.GetCurrentMethod().Name, Get_WTB_Url, responseXML, responseJsonStr, ex.Message); } return(result.lists); }