/// <summary> /// Funtion to handle ebs webservice response /// </summary> /// <param name="respJson">response in jSON string</param> public void ExtractResponse(string jsonResp) { Dictionary <string, object> data = (Dictionary <string, object>)WebServiceRequest.JsonDeSerialize(jsonResp); Dictionary <string, object> outputParam = (Dictionary <string, object>)data["OutputParameters"]; Dictionary <string, object> returnTbl = (Dictionary <string, object>)outputParam["P_RETURN_TBL"]; Dictionary <string, object> returnTblItem = (Dictionary <string, object>)returnTbl["P_RETURN_TBL_ITEM"]; if (returnTblItem["HASERROR"].ToString() == "1") { WorkspaceAddIn.InfoLog(returnTblItem["DESCRIPTION"].ToString()); return; } else { _rnConnectService.UpdatePartsRecord(_partsInfo, returnTblItem["SALES_ORDER_NO"].ToString()); //WorkspaceAddIn.InfoLog("Order sent successfully"); } }
/// <summary> /// Funtion to handle ebs webservice response /// </summary> /// <param name="respJson">response in jSON string</param> public void ExtractResponse(string jsonResp) { int _internalIncidentID = 0; string[] internalIncident = RightNowConnectService.GetService().GetAllInternalIncident(_incidentRecord.ID); if (internalIncident != null) { _internalIncidentID = Convert.ToInt32(internalIncident[0]); } //Extract response Dictionary <string, object> data = (Dictionary <string, object>)WebServiceRequest.JsonDeSerialize(jsonResp); Dictionary <String, object> outputParameters = (Dictionary <String, object>)data["OutputParameters"]; Dictionary <String, object> output = (Dictionary <String, object>)outputParameters["CIN_SUPPLIER_WARRANTY_PKG-24ISP"]; if (output["ISCOVERED"].ToString() == "1") { //autogenerate sClaim //_rnConnectService.CreatesClaim(_incidentRecord.ID); RightNowConnectService.GetService().UpdateInternalIncidentForSupplier(_internalIncidentID, true, output["DESCRIPTION"].ToString()); //Create a child object to store Supplier recoverable limit _rnConnectService.CreateSupplierInfo(_incidentRecord.ID, output["DESCRIPTION"].ToString(), output["TEMPLATE_NAME"].ToString(), output["PARTS_REIMB_PERC"].ToString(), output["PARTS_MAX_AMOUNT"].ToString(), output["LABOUR_REIMB_PERC"].ToString(), output["LABOUR_MAX_AMOUNT"].ToString(), output["OTHER_REIMB_PERC"].ToString(), output["OTHER_MAX_AMOUNT"].ToString() ); } else { RightNowConnectService.GetService().UpdateInternalIncidentForSupplier(_internalIncidentID, false, output["DESCRIPTION"].ToString()); } }
/// <summary> /// Funtion to handle ebs webservice response /// </summary> /// <param name="respJson">response in jSON string</param> public void ExtractResponse(string jsonResp, string[] vinsOfInternalInc) { //Extract response Dictionary <string, object> data = (Dictionary <string, object>)WebServiceRequest.JsonDeSerialize(jsonResp); Dictionary <String, object> outputParameters = (Dictionary <String, object>)data["OutputParameters"]; Dictionary <String, object> output = (Dictionary <String, object>)outputParameters["CIN_BOM_QUERY_PKG_V2-24GETVINWA"]; //loop over each vin response if (IsArray(output["CIN_BOM_QUERY_PKG_V2-24GETVINWA_ITEM"])) { foreach (object vinItem in (object[])output["CIN_BOM_QUERY_PKG_V2-24GETVINWA_ITEM"]) { ExtractIncidentVinInfo(vinItem, vinsOfInternalInc); } } else { ExtractIncidentVinInfo(output["CIN_BOM_QUERY_PKG_V2-24GETVINWA_ITEM"], vinsOfInternalInc); } }
/// <summary> /// Funtion to handle ebs webservice response /// </summary> /// <param name="respJson">response in jSON string</param> public void ExtractResponse(string jsonResp) { //save webservice response // RightNowConnectService.GetService().setIncidentField("CO", "WebServiceResponse", jsonResp, _incidentRecord); Dictionary <string, string> incidentVinInfo = new Dictionary <string, string>(); Dictionary <string, object> singleOptionGroup; jsonResp = jsonResp.Replace("@xmlns:xsi", "@xmlns_xsi"); //formating json string jsonResp = jsonResp.Replace("@xsi:nil", "@xsi_nil"); //formating json string jsonResp = jsonResp.Replace("PKG_V2-24", "PKG_V2_24"); //formating json string //converting json string to Dictionary<string, object> Dictionary <string, object> data = (Dictionary <string, object>)WebServiceRequest.JsonDeSerialize(jsonResp); Dictionary <string, object> output = (Dictionary <string, object>)data["OutputParameters"]; Dictionary <string, object> param = (Dictionary <string, object>)output["CIN_BOM_QUERY_PKG_V2_24ISPARTWA"]; string combo = ""; string busModel = ""; string vin = ""; string[] ewrInfo; string[] busInfo = _rnConnectService.getBusInfoIV(_incVinID); //Check if multi option group is retured, if so then save jSon response if (IsArray(param["CIN_BOM_QUERY_PKG_V2_24ISPARTWA_ITEM"])) { object[] optionItems = (object[])param["CIN_BOM_QUERY_PKG_V2_24ISPARTWA_ITEM"]; if (optionItems.Length == 1)//if one elemnet in an array that mean too single option group { singleOptionGroup = (Dictionary <string, object>)optionItems[0]; } else { //Get part desc from first item, as it will same across all item of multioption grp Dictionary <string, object> firstItem = (Dictionary <string, object>)optionItems[0]; RightNowConnectService.GetService().setIncidentField("CO", "causal_part_desc", firstItem["PART_DESC"].ToString(), _incidentRecord); //Include the vendor id (org) and EWR_Xref_Id in multi option grp object[], so it can be used in other add-in logic foreach (object option in optionItems) { Dictionary <string, object> response = (Dictionary <string, object>)option; if (busInfo != null && busInfo.Length > 0) { vin = busInfo[0].Split('~')[0]; busModel = vin.Substring(4, 1); combo = busModel + "-" + response["OPTIONGROUP_SEQNO"].ToString().Trim(); ewrInfo = _rnConnectService.getEWRID(combo); if (ewrInfo != null && ewrInfo.Length > 0) { response.Add("EWR_Xref_Id", ewrInfo[0].Split('~')[0]);// add EWR_Xref_Id in response list for multi option grp } } } string optionGrpJson = WebServiceRequest.JsonSerialize(output["CIN_BOM_QUERY_PKG_V2_24ISPARTWA"]); _rnConnectService.addIncidentVINRecord(_incVinID, null, optionGrpJson); return; } } //If 1 item is retured then set individual field of incident_vin record else { singleOptionGroup = (Dictionary <string, object>)param["CIN_BOM_QUERY_PKG_V2_24ISPARTWA_ITEM"]; } if (singleOptionGroup != null) { RightNowConnectService.GetService().setIncidentField("CO", "causal_part_desc", singleOptionGroup["PART_DESC"].ToString(), _incidentRecord); if (singleOptionGroup["VENDOR_ID"].ToString().Trim() != "") { //Get OOTB ORG ID from EBS ORG ID string orgID = _rnConnectService.GetOrgID(Convert.ToInt32(singleOptionGroup["VENDOR_ID"].ToString())); //RightNowConnectService.GetService().setIncidentField("CO", "supplier_from_webservice", orgID, _incidentRecord); incidentVinInfo.Add("supplier_from_webservice", orgID); } if (singleOptionGroup["DESCRIPTION"].ToString().Trim() == "Warranty Start Date and Date From Plant are blank for the VIN") { WorkspaceAddIn.InfoLog(singleOptionGroup["DESCRIPTION"].ToString()); } incidentVinInfo.Add("under_warranty", singleOptionGroup["ISCOVERED"].ToString().Trim()); incidentVinInfo.Add("causal_part_nmbr_bom_pn", singleOptionGroup["PART_NUMBER"].ToString().Trim()); incidentVinInfo.Add("causal_part_desc_bom_pn", singleOptionGroup["DESCRIPTION"].ToString().Trim()); incidentVinInfo.Add("coverage_name", singleOptionGroup["COVERAGE_NAME"].ToString().Trim()); incidentVinInfo.Add("coverage_desc", singleOptionGroup["COVERAGE_DESC"].ToString().Trim()); incidentVinInfo.Add("optiongroup_seqno", singleOptionGroup["OPTIONGROUP_SEQNO"].ToString().Trim()); incidentVinInfo.Add("s_policy_name", singleOptionGroup["SPOLICY_NAME"].ToString().Trim()); incidentVinInfo.Add("s_policy_desc", singleOptionGroup["SPOLICY_DESC"].ToString().Trim()); //_rnConnectService.addIncidentVINRecord(_incVinID, "", "", singleOptionGroup["ISCOVERED"].ToString(), "", // singleOptionGroup["OPTIONGROUP_SEQNO"].ToString()); //Logic to update EWR_Xref_Id field if (busInfo != null && busInfo.Length > 0) { vin = busInfo[0].Split('~')[0]; if (vin != "") { busModel = vin.Substring(4, 1); combo = busModel + "-" + singleOptionGroup["OPTIONGROUP_SEQNO"].ToString().Trim(); ewrInfo = _rnConnectService.getEWRID(combo); if (ewrInfo != null && ewrInfo.Length > 0) { incidentVinInfo.Add("EWR_Xref_Id", ewrInfo[0].Split('~')[0]); } } } _rnConnectService.addIncidentVINRecord(_incVinID, incidentVinInfo, ""); } }