/// <summary> /// Method to perform warranty check for creating "WARRANTY" type work order using old BOM query. /// </summary> public void WarrantyCheck(IIncident incidentRecord) { _rnConnectService = RightNowConnectService.GetService(); _rnConnectService._incidentVINObjects.Clear();//Clear the _incidentVINObjects variable that holds all incident_vin record to be updated with response _incidentRecord = incidentRecord; //Get basic field that need to be pass in webservce call, //Null validation of these fields are handle by workspace rules _odometer = RightNowConnectService.GetService().getFieldFromIncidentRecord("CO", "odometer_reading", _incidentRecord); _causalPart = RightNowConnectService.GetService().getFieldFromIncidentRecord("CO", "causal_part_nmbr", _incidentRecord); string failureDateInSTring = RightNowConnectService.GetService().getFieldFromIncidentRecord("CO", "failure_date", _incidentRecord); _failureDate = Convert.ToDateTime(failureDateInSTring).ToString("dd-MMM-yyyy"); string[] busInfo = _rnConnectService.getBusInfo(_incidentRecord.ID); if (busInfo != null && busInfo.Length > 0) { if (busInfo.Length > 1) { WorkspaceAddIn.InfoLog("It seems multi VIN are mapped with Reporting Incident, warrant type work order" + " works only for individual VIN"); return; } else { _vin = busInfo[0].Split('~')[0]; _srNum = busInfo[0].Split('~')[1]; _incVinID = Convert.ToInt32(busInfo[0].Split('~')[2]); //If all required info is valid then form jSon request parameter var content = GetWarrantyReqParam(); var jsonContent = WebServiceRequest.JsonSerialize(content); jsonContent = jsonContent.Replace("xmlns", "@xmlns"); //Call webservice string jsonResponse = WebServiceRequest.Get(_curlURL, jsonContent, "POST"); if (jsonResponse == "") { WorkspaceAddIn.InfoLog("Server didn't returned any info"); return; } else { ExtractResponse(jsonResponse); _rnConnectService.updateIncidentVinRecords(); } } } else { WorkspaceAddIn.InfoLog("No Bus info found, please map a bus to reporting Incident and then click check warranty button"); return; } return; }