private void SendToSalesforce(AgenciaPnr agenciaPnr, string token, string crmServer) { try { var agenciaPnrSf = ToSalesforceEntity(agenciaPnr); var responsePnr = RestBase.ExecuteByKeyWithServer(crmServer, SalesforceKeys.PnrMethod, Method.POST, agenciaPnrSf, true, token); if (responsePnr.StatusCode.Equals(HttpStatusCode.OK)) { dynamic jsonResponse = new JavaScriptSerializer().DeserializeObject(responsePnr.Content); try { agenciaPnr.CodigoError = jsonResponse[OutParameter.SF_CodigoError]; agenciaPnr.MensajeError = jsonResponse[OutParameter.SF_MensajeError]; agenciaPnr.IdOportunidad = jsonResponse[OutParameter.SF_IdOportunidad]; agenciaPnr.LastMethod = ConfigAccess.GetValueInAppSettings(SalesforceKeys.PnrMethod); } catch { } } } catch { } }
private object ToSalesforceEntity(AgenciaPnr agenciaPnr) { try { return(new { info = new { DkAgencia = agenciaPnr.DkAgencia.ToString(), Pnr = agenciaPnr.PNR } }); } catch (Exception ex) { throw ex; } }