internal static List <FrecuenciaCredito> TraeFrecuenciaCalcu() { string xClase = string.Format("{0}|{1}", MethodBase.GetCurrentMethod().Module.Name, MethodBase.GetCurrentMethod().DeclaringType.Name); string xProceso = MethodBase.GetCurrentMethod().Name; var dto = new DynamicDto(); dto.ParameterList = new List <SpParameter>(); FrecuenciaCredito frec = new FrecuenciaCredito(); dto.Result = null; dto.SPName = "usp_TraeFrecuenciaCredito"; var dto_excepcion = new UTL_TRA_EXCEPCION { STR_CLASE = xClase, STR_EVENTO = xProceso, STR_PARAMETROS = JsonConvert.SerializeObject(frec), STR_APLICATIVO = ConfigurationManager.AppSettings["Aplicativo"], STR_SERVIDOR = System.Net.Dns.GetHostName() }; var dto_obj = new List <FrecuenciaCredito>(); try { var obj = DynamicSqlDAO.ExecuterSp <FrecuenciaCredito>(dto, GlobalClass.connectionString.Where(a => a.Key == infDto.STR_COD_PAIS).FirstOrDefault().Value); dto_obj = obj.ToList(); } catch (Exception ex) { dto_excepcion.STR_MENSAJE = ex.Message; dto_excepcion.STR_DETALLE = ex.StackTrace; TwoFunTwoMe_DataAccess.Utility.guardaExcepcion(dto_excepcion, GlobalClass.connectionString.Where(a => a.Key == infDto.STR_COD_PAIS).FirstOrDefault().Value); } return(dto_obj); }
public List <TipoMoneda> TraeTipoMoneda() { string xClase = string.Format("{0}|{1}", MethodBase.GetCurrentMethod().Module.Name, MethodBase.GetCurrentMethod().DeclaringType.Name); string xProceso = MethodBase.GetCurrentMethod().Name; var dto_excepcion = new UTL_TRA_EXCEPCION { STR_CLASE = xClase, STR_EVENTO = xProceso, STR_APLICATIVO = ConfigurationManager.AppSettings["APLICATIVO"].ToString(), STR_SERVIDOR = System.Net.Dns.GetHostName(), FEC_CREACION = DateTime.Now }; var dto = new DynamicDto(); dto.ParameterList = new List <SpParameter>(); dto.Result = null; dto.SPName = "usp_TraeTipoMoneda"; try { DynamicDto ds = DynamicSqlDAO.ExecuterSp(dto, GlobalClass.connectionString.Where(a => a.Key == infDto.STR_COD_PAIS).FirstOrDefault().Value); return(JsonConvert.DeserializeObject <List <TipoMoneda> >(JsonConvert.SerializeObject(ds.Result.Tables[0]))); } catch (Exception ex) { dto_excepcion.STR_MENSAJE = ex.Message; dto_excepcion.STR_DETALLE = ex.StackTrace; TwoFunTwoMe_DataAccess.Utility.guardaExcepcion(dto_excepcion, GlobalClass.connectionString.Where(a => a.Key == infDto.STR_COD_PAIS).FirstOrDefault().Value); throw; } }
public List <DTO_GiniMachineConfig> ObtenerConfigGiniMachine(DTO_GiniMachineConfig objConfig) { var dto = new DynamicDto(); dto.ParameterList = new List <SpParameter>(); dto.ParameterList.AddRange(from nodo in objConfig.GetType().GetProperties() where nodo.GetValue(objConfig) != null select new SpParameter { Name = nodo.Name, Value = nodo.GetValue(objConfig).ToString() } ); dto.Result = null; dto.SPName = "usp_ObtenerConfiguracionGiniMachine"; var dto_result = new List <DTO_GiniMachineConfig>(); try { var objRet = DynamicSqlDAO.ExecuterSp(dto, GlobalClass.connectionString.Where(a => a.Key == infDto.STR_COD_PAIS).FirstOrDefault().Value); if (objRet.HasResult) { dto_result = JsonConvert.DeserializeObject <List <DTO_GiniMachineConfig> >(JsonConvert.SerializeObject(objRet.Result.Tables[0])); } } catch (Exception ex) { //dto_result.Mensaje = "Ocurrio un Error"; throw; } return(dto_result); }
static void Main(string[] args) { //var dto = new DynamicDto //{ new SpParameter // { // Name = "INT_SUB_ORIGEN", // Value = xInfoClass.INT_SUB_ORIGEN.ToString() // }, // SPName = "usp_ConsultarAgentes" //}; var dto = new DynamicDto { ParameterList = new List <SpParameter> { }, Result = null, SPName = "usp_ConsultarAgentes" }; dto.Result = null; DynamicDto ds = DynamicSqlDAO.ExecuterSp(dto, "Data Source=192.168.110.15 ;Initial Catalog=FinTech_DEV;Persist Security Info=True;User ID=icortes;Password=Ics5355.;"); var res = ds.Result.Tables[0]; foreach (DataRow row in res.Rows) { var data = row[0]; } }
internal static void ApiSolicitudEndConsul(InsertPersonasWeb insertPersonasWeb, ref DTO_SOLICITUD_VENTAS persona) { string xClase = string.Format("{0}|{1}", MethodBase.GetCurrentMethod().Module.Name, MethodBase.GetCurrentMethod().DeclaringType.Name); string xProceso = MethodBase.GetCurrentMethod().Name; var dto = new DynamicDto(); dto.ParameterList = new List <SpParameter>(); dto.ParameterList.AddRange(from nodo in insertPersonasWeb.GetType().GetProperties() where nodo.GetValue(insertPersonasWeb) != null select new SpParameter { Name = nodo.Name, Value = nodo.GetValue(insertPersonasWeb).ToString() } ); dto.Result = null; dto.SPName = "usp_ValidarPIN"; var dto_excepcion = new UTL_TRA_EXCEPCION { STR_CLASE = xClase, STR_EVENTO = xProceso, STR_PARAMETROS = JsonConvert.SerializeObject(insertPersonasWeb), STR_APLICATIVO = ConfigurationManager.AppSettings["Aplicativo"], STR_SERVIDOR = System.Net.Dns.GetHostName() }; try { var obj = DynamicSqlDAO.ExecuterSp(dto, GlobalClass.connectionString.Where(a => a.Key == infDto.STR_COD_PAIS).FirstOrDefault().Value); var dto_result = new List <DTO_SOLICITUD_VENTAS>(); if (obj.HasResult) { dto_result = JsonConvert.DeserializeObject <List <DTO_SOLICITUD_VENTAS> >(JsonConvert.SerializeObject(obj.Result.Tables[0])); } persona = dto_result.ToList().FirstOrDefault(); if (persona != null) { persona.Status = dto_result.Any() ? dto_result.ToList().FirstOrDefault().Status : null; } else { persona = new DTO_SOLICITUD_VENTAS(); } } catch (Exception ex) { dto_excepcion.STR_MENSAJE = ex.Message; dto_excepcion.STR_DETALLE = ex.StackTrace; TwoFunTwoMe_DataAccess.Utility.guardaExcepcion(dto_excepcion, GlobalClass.connectionString.Where(a => a.Key == infDto.STR_COD_PAIS).FirstOrDefault().Value); } }
public bool ValidarCuentaSinpe(CuentaBancaria cuentabancaria) { string xClase = string.Format("{0}|{1}", MethodBase.GetCurrentMethod().Module.Name, MethodBase.GetCurrentMethod().DeclaringType.Name); string xProceso = MethodBase.GetCurrentMethod().Name; var dto_excepcion = new UTL_TRA_EXCEPCION { STR_CLASE = xClase, STR_EVENTO = xProceso, STR_APLICATIVO = ConfigurationManager.AppSettings["APLICATIVO"].ToString(), STR_SERVIDOR = System.Net.Dns.GetHostName(), FEC_CREACION = DateTime.Now }; var dto = new DynamicDto(); dto.ParameterList = new List <SpParameter>(); dto.ParameterList.AddRange(from nodo in cuentabancaria.GetType().GetProperties() where nodo.GetValue(cuentabancaria) != null select new SpParameter { Name = nodo.Name, Value = nodo.GetValue(cuentabancaria).ToString() } ); dto.Result = null; dto.SPName = "usp_ValidaSinpe"; var dto_result = new List <CuentaBancaria>(); try { var objRet = DynamicSqlDAO.ExecuterSp(dto, GlobalClass.connectionString.Where(a => a.Key == infDto.STR_COD_PAIS).FirstOrDefault().Value); if (objRet.HasResult) { dto_result = JsonConvert.DeserializeObject <List <CuentaBancaria> >(JsonConvert.SerializeObject(objRet.Result.Tables[0])); //dto_result.FirstOrDefault().Mensaje = string.Concat("Se creo Buckets N#: ", dto_result.FirstOrDefault().Id); } } catch (Exception ex) { dto_excepcion.STR_MENSAJE = ex.Message; dto_excepcion.STR_DETALLE = ex.StackTrace; TwoFunTwoMe_DataAccess.Utility.guardaExcepcion(dto_excepcion, GlobalClass.connectionString.Where(a => a.Key == infDto.STR_COD_PAIS).FirstOrDefault().Value); cuentabancaria.Respuesta = "ERR"; dto_result.Add(cuentabancaria); //throw; } return(dto_result.Any()? dto_result.FirstOrDefault().result:false); }
private List <Tab_ConfigSys> GetConfigRabbit(Tab_ConfigSys config) { manage = new Manager(); string xClase = string.Format("{0}|{1}", MethodBase.GetCurrentMethod().Module.Name, MethodBase.GetCurrentMethod().DeclaringType.Name); string xProceso = MethodBase.GetCurrentMethod().Name; string strHostName = System.Net.Dns.GetHostName(); //IPHostEntry ipHostInfo = Dns.Resolve(Dns.GetHostName()); <-- Obsolete IPHostEntry ipHostInfo = Dns.GetHostEntry(strHostName); IPAddress ipAddress = ipHostInfo.AddressList[0]; var dto_excepcion = new UTL_TRA_EXCEPCION { STR_CLASE = xClase, STR_EVENTO = xProceso, STR_APLICATIVO = ConfigurationManager.AppSettings["APLICATIVO"].ToString(), STR_SERVIDOR = ipAddress.ToString(), STR_PARAMETROS = JsonConvert.SerializeObject(config) }; var dto = new DynamicDto(); dto.ParameterList = new List <SpParameter>(); dto.ParameterList.AddRange(from nodo in config.GetType().GetProperties() where nodo.GetValue(config) != null select new SpParameter { Name = nodo.Name, Value = nodo.GetValue(config).ToString() } ); dto.Result = null; dto.SPName = "usp_consulta_configuracion_general"; var dto_result = new List <Tab_ConfigSys>(); try { var objRet = DynamicSqlDAO.ExecuterSp(dto, GlobalClass.connectionString.Where(a => a.Key == infDto.STR_COD_PAIS).FirstOrDefault().Value); if (objRet.HasResult) { dto_result = JsonConvert.DeserializeObject <List <Tab_ConfigSys> >(JsonConvert.SerializeObject(objRet.Result.Tables[0])); } } catch (Exception ex) { dto_excepcion.STR_MENSAJE = ex.Message; DynamicSqlDAO.guardaExcepcion(dto_excepcion, GlobalClass.connectionString.Where(a => a.Key == infDto.STR_COD_PAIS).FirstOrDefault().Value); } return(dto_result); }
public List <DTO_GiniMachine> ObtenerJSON(DTO_GiniMachine dto_Entrada) { string xClase = string.Format("{0}|{1}", MethodBase.GetCurrentMethod().Module.Name, MethodBase.GetCurrentMethod().DeclaringType.Name); string xProceso = MethodBase.GetCurrentMethod().Name; var dto_excepcion = new UTL_TRA_EXCEPCION { STR_CLASE = xClase, STR_EVENTO = xProceso }; var dto = new DynamicDto(); dto.ParameterList = new List <SpParameter>(); dto.ParameterList.AddRange(from nodo in dto_Entrada.GetType().GetProperties() where nodo.GetValue(dto_Entrada) != null select new SpParameter { Name = nodo.Name, Value = nodo.GetValue(dto_Entrada).ToString() } ); dto.Result = null; dto.SPName = "usp_GeneraProspectoModeloGini"; var dto_result = new List <DTO_GiniMachine>(); try { var objRet = DynamicSqlDAO.ExecuterSp(dto, GlobalClass.connectionString.Where(a => a.Key == infDto.STR_COD_PAIS).FirstOrDefault().Value); if (objRet.HasResult) { dto_result = JsonConvert.DeserializeObject <List <DTO_GiniMachine> >(JsonConvert.SerializeObject(objRet.Result.Tables[0])); dto_result.FirstOrDefault().Mensaje = string.Concat("", dto_result.FirstOrDefault().Mensaje); } } catch (Exception ex) { dto_excepcion.STR_MENSAJE = ex.Message; DynamicSqlDAO.guardaExcepcion(dto_excepcion, ConfigurationManager.ConnectionStrings["TwoFunTwoMeConnection"].ConnectionString); dto_Entrada.Mensaje = "ERR"; } return(dto_result); }
public PagareContrato TraeDatosContratoPagare(PagareContrato pagareContrato) { Guid x = Guid.NewGuid(); manager = new Manager.Manager(); Solicitudes solicitudes = new Solicitudes(); var pagareCon = new List <PagareContrato>(); var datosContrato = new List <PagareContrato>(); string xClase = string.Format("{0}|{1}", MethodBase.GetCurrentMethod().Module.Name, MethodBase.GetCurrentMethod().DeclaringType.Name); string xProceso = MethodBase.GetCurrentMethod().Name; var dto_excepcion = new UTL_TRA_EXCEPCION { STR_CLASE = xClase, STR_EVENTO = xProceso, STR_APLICATIVO = ConfigurationManager.AppSettings["APLICATIVO"].ToString(), STR_SERVIDOR = System.Net.Dns.GetHostName(), STR_PARAMETROS = JsonConvert.SerializeObject(pagareContrato), FEC_CREACION = DateTime.Now }; try { solicitudes.IdTipoIdentificacion = pagareContrato.IdTipoIdentificacion; solicitudes.Identificacion = pagareContrato.Identificacion; var dto_DatosCredito = manager.CargarDatosCredito(solicitudes); if (dto_DatosCredito.Any()) { //pagareCon = manager.TraeDocumentoPagare(); pagareContrato.IdSolicitud = dto_DatosCredito.FirstOrDefault().IdSolicitud; pagareContrato.fechagenerapagare = DateTime.Today; datosContrato = manager.PagareContrato(pagareContrato); return(pagareContrato = datosContrato[0]); } } catch (Exception ex) { dto_excepcion.STR_MENSAJE = ex.Message; DynamicSqlDAO.guardaExcepcion(dto_excepcion, GlobalClass.connectionString.Where(a => a.Key == infDto.STR_COD_PAIS).FirstOrDefault().Value); } return(null); }
public List <ConsultaRules> consultaRules(ConsultaRules rules) { string xClase = string.Format("{0}|{1}", MethodBase.GetCurrentMethod().Module.Name, MethodBase.GetCurrentMethod().DeclaringType.Name); string xProceso = MethodBase.GetCurrentMethod().Name; var dto_excepcion = new UTL_TRA_EXCEPCION { STR_CLASE = xClase, STR_EVENTO = xProceso, STR_APLICATIVO = ConfigurationManager.AppSettings["Aplicativo"], STR_PARAMETROS = JsonConvert.SerializeObject(rules), STR_SERVIDOR = System.Net.Dns.GetHostName() }; var dto = new DynamicDto(); dto.ParameterList = new List <SpParameter>(); var dto_result = new List <ConsultaRules>(); try { dto.ParameterList.AddRange(from nodo in rules.GetType().GetProperties() where nodo.GetValue(rules) != null select new SpParameter { Name = nodo.Name, Value = nodo.GetValue(rules).ToString() } ); dto.Result = null; dto.SPName = "usp_consultaAnalisisRules"; var objRet = DynamicSqlDAO.ExecuterSp(dto, GlobalClass.connectionString.Where(a => a.Key == infDto.STR_COD_PAIS).FirstOrDefault().Value); if (objRet.HasResult) { dto_result = JsonConvert.DeserializeObject <List <ConsultaRules> >(JsonConvert.SerializeObject(objRet.Result.Tables[0])); } } catch (Exception ex) { dto_excepcion.STR_MENSAJE = ex.Message; dto_excepcion.STR_DETALLE = ex.StackTrace; } return(dto_result); }
private static bool ConsultaUltimoIngresoSolicitud(InsertPersonasWeb persona) { string xClase = string.Format("{0}|{1}", MethodBase.GetCurrentMethod().Module.Name, MethodBase.GetCurrentMethod().DeclaringType.Name); string xProceso = MethodBase.GetCurrentMethod().Name; var dto_excepcion = new UTL_TRA_EXCEPCION { STR_CLASE = xClase, STR_EVENTO = xProceso, STR_PARAMETROS = JsonConvert.SerializeObject(persona), STR_APLICATIVO = ConfigurationManager.AppSettings["Aplicativo"], STR_SERVIDOR = System.Net.Dns.GetHostName() }; var dto = new DynamicDto(); dto.ParameterList = new List <SpParameter>(); dto.ParameterList.AddRange(from nodo in persona.GetType().GetProperties() where nodo.GetValue(persona) != null select new SpParameter { Name = nodo.Name, Value = nodo.GetValue(persona).ToString() } ); dto.Result = null; dto.SPName = "usp_consulta_ultimo_ingreso_solicitud"; try { var obj = DynamicSqlDAO.ExecuterSp <InsertPersonasWeb>(dto, GlobalClass.connectionString.Where(a => a.Key == infDto.STR_COD_PAIS).FirstOrDefault().Value); return(obj.Any()); } catch (Exception ex) { dto_excepcion.STR_MENSAJE = ex.Message; dto_excepcion.STR_DETALLE = ex.StackTrace; TwoFunTwoMe_DataAccess.Utility.guardaExcepcion(dto_excepcion, GlobalClass.connectionString.Where(a => a.Key == infDto.STR_COD_PAIS).FirstOrDefault().Value); } return(false); }
internal static List <DTO_SOLICITUD_VENTAS> GuardaProducto(DTO_SOLICITUD_VENTAS solicitudes) { string xClase = string.Format("{0}|{1}", MethodBase.GetCurrentMethod().Module.Name, MethodBase.GetCurrentMethod().DeclaringType.Name); string xProceso = MethodBase.GetCurrentMethod().Name; var dto = new DynamicDto(); dto.ParameterList = new List <SpParameter>(); dto.ParameterList.AddRange(from nodo in solicitudes.GetType().GetProperties() where nodo.GetValue(solicitudes) != null select new SpParameter { Name = nodo.Name, Value = nodo.GetValue(solicitudes).ToString() } ); dto.Result = null; dto.SPName = "usp_GuardarProducto"; var dto_excepcion = new UTL_TRA_EXCEPCION { STR_CLASE = xClase, STR_EVENTO = xProceso, STR_PARAMETROS = JsonConvert.SerializeObject(solicitudes), STR_APLICATIVO = ConfigurationManager.AppSettings["Aplicativo"], STR_SERVIDOR = System.Net.Dns.GetHostName() }; var dto_obj = new List <DTO_SOLICITUD_VENTAS>(); try { var obj = DynamicSqlDAO.ExecuterSp <DTO_SOLICITUD_VENTAS>(dto, GlobalClass.connectionString.Where(a => a.Key == infDto.STR_COD_PAIS).FirstOrDefault().Value); dto_obj = obj.ToList(); } catch (Exception ex) { dto_excepcion.STR_MENSAJE = ex.Message; dto_excepcion.STR_DETALLE = ex.StackTrace; TwoFunTwoMe_DataAccess.Utility.guardaExcepcion(dto_excepcion, GlobalClass.connectionString.Where(a => a.Key == infDto.STR_COD_PAIS).FirstOrDefault().Value); } return(dto_obj); }
public List <CuentaBancaria> uspConsultaEditCuentaBancaria(CuentaBancaria cuentaBancaria) { string xClase = string.Format("{0}|{1}", MethodBase.GetCurrentMethod().Module.Name, MethodBase.GetCurrentMethod().DeclaringType.Name); string xProceso = MethodBase.GetCurrentMethod().Name; var dto_excepcion = new UTL_TRA_EXCEPCION { STR_CLASE = xClase, STR_EVENTO = xProceso, STR_APLICATIVO = ConfigurationManager.AppSettings["Aplicativo"], STR_PARAMETROS = JsonConvert.SerializeObject(cuentaBancaria), STR_SERVIDOR = System.Net.Dns.GetHostName() }; var dto = new DynamicDto(); dto.ParameterList = new List <SpParameter>(); try { dto.ParameterList.AddRange(from nodo in cuentaBancaria.GetType().GetProperties() where nodo.GetValue(cuentaBancaria) != null select new SpParameter { Name = nodo.Name, Value = nodo.GetValue(cuentaBancaria).ToString() } ); dto.Result = null; dto.SPName = "usp_ConsultarPersonasCuenta_Edit_Ventas_Fenix"; return(DynamicSqlDAO.ExecuterSp <CuentaBancaria>(dto, GlobalClass.connectionString.Where(a => a.Key == infDto.STR_COD_PAIS).FirstOrDefault().Value).ToList()); } catch (Exception ex) { dto_excepcion.STR_MENSAJE = ex.Message; dto_excepcion.STR_DETALLE = ex.StackTrace; Utility.guardaExcepcion(dto_excepcion, GlobalClass.connectionString.Where(a => a.Key == infDto.STR_COD_PAIS).FirstOrDefault().Value); } return(new List <CuentaBancaria>()); }
public bool guardarAsignacionAgenciaExterna(DtoAsignacionAgenciaExterna row) { string xClase = string.Format("{0}|{1}", MethodBase.GetCurrentMethod().Module.Name, MethodBase.GetCurrentMethod().DeclaringType.Name); string xProceso = MethodBase.GetCurrentMethod().Name; var dto_excepcion = new UTL_TRA_EXCEPCION { STR_CLASE = xClase, STR_EVENTO = xProceso, STR_APLICATIVO = ConfigurationManager.AppSettings["Aplicativo"], STR_PARAMETROS = JsonConvert.SerializeObject(row), STR_SERVIDOR = System.Net.Dns.GetHostName() }; var dto = new DynamicDto(); dto.ParameterList = new List <SpParameter>(); dto.ParameterList.AddRange(from nodo in row.GetType().GetProperties() where nodo.GetValue(row) != null select new SpParameter { Name = nodo.Name, Value = nodo.GetValue(row).ToString() } ); dto.Result = null; dto.SPName = "usp_asignar_agencia_externa"; try { var objRet = DynamicSqlDAO.ExecuterSp(dto, GlobalClass.connectionString.Where(a => a.Key == infDto.STR_COD_PAIS).FirstOrDefault().Value); return(true); } catch (Exception ex) { dto_excepcion.STR_MENSAJE = ex.Message; dto_excepcion.STR_DETALLE = ex.StackTrace; Utility.guardaExcepcion(dto_excepcion, GlobalClass.connectionString.Where(a => a.Key == infDto.STR_COD_PAIS).FirstOrDefault().Value); throw ex; } }
public string CrearPdf(PagareContrato pagareContrato) { Guid x = Guid.NewGuid(); manager = new Manager.Manager(); Utilitario Util = new Utilitario(); Solicitudes solicitudes = new Solicitudes(); var pagareCon = new List <PagareContrato>(); var datosContrato = new List <PagareContrato>(); string xClase = string.Format("{0}|{1}", MethodBase.GetCurrentMethod().Module.Name, MethodBase.GetCurrentMethod().DeclaringType.Name); string xProceso = MethodBase.GetCurrentMethod().Name; string strHostName = System.Net.Dns.GetHostName(); //IPHostEntry ipHostInfo = Dns.Resolve(Dns.GetHostName()); <-- Obsolete IPHostEntry ipHostInfo = Dns.GetHostEntry(strHostName); IPAddress ipAddress = ipHostInfo.AddressList[0]; Tab_ConfigSys dto_Config = new Tab_ConfigSys(); dto_Config.llave_Config1 = "SERVICIO"; dto_Config.llave_Config2 = "CONFIGURACION"; dto_Config.llave_Config3 = "SERVIDOR"; dto_Config.llave_Config4 = "DIRECTORIO"; dto_Config.llave_Config5 = "CONTRATOPAGARE"; solicitudes.IdTipoIdentificacion = pagareContrato.IdTipoIdentificacion; solicitudes.Identificacion = pagareContrato.Identificacion; var dto_DatosCredito = manager.CargarDatosCredito(solicitudes); var dto_interval = manager.ConsultaConfiUrlImagen(dto_Config); string URL = dto_interval.Where(y => y.llave_Config5 == "CONTRATOPAGARE").Select(y => y.Dato_Char1).FirstOrDefault(); var dto_excepcion = new UTL_TRA_EXCEPCION { STR_CLASE = xClase, STR_EVENTO = xProceso, STR_APLICATIVO = ConfigurationManager.AppSettings["APLICATIVO"].ToString(), STR_SERVIDOR = ipAddress.ToString(), STR_PARAMETROS = JsonConvert.SerializeObject(pagareContrato), FEC_CREACION = DateTime.Now }; try { if (dto_DatosCredito.Any()) { pagareCon = manager.TraeDocumentoPagare(); pagareContrato.IdSolicitud = dto_DatosCredito.FirstOrDefault().IdSolicitud; pagareContrato.fechagenerapagare = DateTime.Today; datosContrato = manager.PagareContrato(pagareContrato); pagareContrato.Pagare = pagareCon.FirstOrDefault().Pagare; pagareContrato.Contrato = pagareCon.FirstOrDefault().Contrato; string Contrato = pagareContrato.Contrato; string Pagare = pagareContrato.Pagare; string fileName = @"Pagare y contrato_" + datosContrato[0].Nombre + ".docx"; //Remplazo en la cadena los datos para generar el contrato Contrato = Contrato.Replace("<Nombre>", datosContrato[0].Nombre); Contrato = Contrato.Replace("<Identificacion>", datosContrato[0].Identificacion); Contrato = Contrato.Replace("<MontoProductoLetras>", datosContrato[0].MontoProductoLetras); Contrato = Contrato.Replace("<Moneda>", datosContrato[0].Moneda); Contrato = Contrato.Replace("<MontoProducto>", Convert.ToString(datosContrato[0].MontoProducto)); Contrato = Contrato.Replace("<CantidadCuotas>", Convert.ToString(datosContrato[0].CantidadCuotas)); Contrato = Contrato.Replace("<Frecuencia>", datosContrato[0].Frecuencia); Contrato = Contrato.Replace("<Cuota>", Convert.ToString(datosContrato[0].Cuota)); Contrato = Contrato.Replace("<FechaPrimerPagoLetras>", datosContrato[0].FechaPrimerPagoLetras); Contrato = Contrato.Replace("<FechaUltimoPagoLetras>", datosContrato[0].FechaUltimoPagoLetras); Contrato = Contrato.Replace("<Interes>", Convert.ToString(datosContrato[0].Interes)); Contrato = Contrato.Replace("<InteresLetras>", datosContrato[0].InteresLetras); Contrato = Contrato.Replace("<CtaCliente>", datosContrato[0].CtaCliente); Contrato = Contrato.Replace("<FechaHoy>", datosContrato[0].FechaHoy); Contrato = Contrato.Replace("<CuotaenLetras>", datosContrato[0].CuotaenLetras); Contrato = Contrato.Replace("<Frecuencia2>", datosContrato[0].Frecuencia2); Contrato = Contrato.Replace("<Frecuencia3>", datosContrato[0].Frecuencia3); Contrato = Contrato.Replace("<CantidadCuotasLetras>", datosContrato[0].CantidadCuotasLetras); //Reemplazo los datos para generar el Pagaré Pagare = Pagare.Replace("<Nombre>", datosContrato[0].Nombre); Pagare = Pagare.Replace("<Identificacion>", datosContrato[0].Identificacion); Pagare = Pagare.Replace("<MontoProductoLetras>", datosContrato[0].MontoProductoLetras); Pagare = Pagare.Replace("<Moneda>", datosContrato[0].Moneda); Pagare = Pagare.Replace("<MontoProductoPagare>", Convert.ToString(datosContrato[0].MontoProductoPagare)); Pagare = Pagare.Replace("<MontoProductoLetrasPagare>", Convert.ToString(datosContrato[0].MontoProductoLetrasPagare)); Pagare = Pagare.Replace("<CantidadCuotas>", Convert.ToString(datosContrato[0].CantidadCuotas)); Pagare = Pagare.Replace("<Frecuencia>", datosContrato[0].Frecuencia); Pagare = Pagare.Replace("<Cuota>", Convert.ToString(datosContrato[0].Cuota)); Pagare = Pagare.Replace("<FechaPrimerPagoLetras>", datosContrato[0].FechaPrimerPagoLetras); Pagare = Pagare.Replace("<FechaUltimoPagoLetras>", datosContrato[0].FechaUltimoPagoLetras); Pagare = Pagare.Replace("<Interes>", Convert.ToString(datosContrato[0].Interes)); Pagare = Pagare.Replace("<InteresLetras>", datosContrato[0].InteresLetras); Pagare = Pagare.Replace("<CtaCliente>", datosContrato[0].CtaCliente); Pagare = Pagare.Replace("<FechaHoy>", datosContrato[0].FechaHoy); Pagare = Pagare.Replace("<CuotaenLetras>", datosContrato[0].CuotaenLetras); Pagare = Pagare.Replace("<CantidadCuotasLetras>", datosContrato[0].CantidadCuotasLetras); Pagare = Pagare.Replace("<Frecuencia2>", datosContrato[0].Frecuencia2); Pagare = Pagare.Replace("<pagoProximasCuotas>", datosContrato[0].PagoProximasCuotas); //creamos la imagen editada de la firma para agregarla luego al documento if (datosContrato[0].FotoFirma != "") { editarImagen(datosContrato[0].FotoFirma); } //Doy formato al archivo PDF iTextSharp.text.Font fontHeader_1 = FontFactory.GetFont("Calibri", 9, iTextSharp.text.Font.NORMAL, new iTextSharp.text.BaseColor(0, 0, 0)); //Genero el documento PDF con la libreria iTextSharp using (Document pdfDoc = new Document(PageSize.LETTER, 25f, 25f, 25f, 25f)) { iTextSharp.text.Document oDoc = new iTextSharp.text.Document(iTextSharp.text.PageSize.LETTER); //Escribo el documento en el archivo PDF generado //PdfWriter.GetInstance(pdfDoc, HttpContext.Current.Response.OutputStream); var OutputPathDocumento = AppDomain.CurrentDomain.BaseDirectory + "/Machote/archivos/Documento-" + datosContrato.FirstOrDefault().Nombre.ToString() + x + ".pdf"; using (PdfWriter wri = PdfWriter.GetInstance(pdfDoc, new FileStream(OutputPathDocumento, FileMode.Create))) { pdfDoc.Open(); var espacio = new Paragraph(" "); //Ingreso el texto que corresponde al Contrato var tituloContrato = new Paragraph("Solicitud N°: " + datosContrato.FirstOrDefault().Id.ToString(), FontFactory.GetFont("Calibri", 14, BaseColor.BLACK)); tituloContrato.Alignment = Element.ALIGN_CENTER; tituloContrato.Font.Size = 14; pdfDoc.Add(tituloContrato); pdfDoc.Add(espacio); var Contratopdf = new Paragraph(Contrato, fontHeader_1); Contratopdf.Alignment = Element.ALIGN_JUSTIFIED; Contratopdf.Font.Size = 8; pdfDoc.Add(Contratopdf); //si existe foto de la firma lo agregamos al contrato if (datosContrato[0].FotoFirma != "") { //creamos la imagen de la firma para el PDF iTextSharp.text.Image imagen = iTextSharp.text.Image.GetInstance(@AppDomain.CurrentDomain.BaseDirectory + @"\Machote\FotoFirma-Copia-Editada.png"); imagen.BorderWidth = 0; imagen.Alignment = Element.ALIGN_LEFT; float percentage = 0.0f; percentage = 70 / imagen.Width; imagen.ScalePercent(percentage * 100); //creamos una tabla para agregar la imagen PdfPTable tablaImagen = new PdfPTable(1);; PdfPCell c1 = new PdfPCell(); PdfPCell c2 = new PdfPCell(imagen); c1.Border = 0; c2.Border = 0; c2.VerticalAlignment = Element.ALIGN_MIDDLE; c2.HorizontalAlignment = Element.ALIGN_LEFT; tablaImagen.AddCell(c1); //celda con espacio a la derecha tablaImagen.AddCell(c2); //celda con la imagen de la firma // Insertamos la tabla con la imagen de la firma en el contrato pdfDoc.Add(tablaImagen); } else { pdfDoc.Add(espacio); pdfDoc.Add(espacio); } //Agregamos la info final del contrato string textoFinal = " …………………………………………… ……………………………………………\n El DEUDOR LA ACREEDORA\n\n\n " + datosContrato.FirstOrDefault().Identificacion.ToString() + "\n ………………………………………… \n CÉDULA "; var parrafoFinal = new Paragraph(textoFinal, fontHeader_1); pdfDoc.Add(parrafoFinal); //Ingreso el titulo del Pagaré pdfDoc.NewPage(); var SubtituloPdf = new Paragraph("Pagaré N°: " + datosContrato.FirstOrDefault().Id.ToString(), FontFactory.GetFont("Calibri", 14, BaseColor.BLACK)); SubtituloPdf.Alignment = Element.ALIGN_CENTER; SubtituloPdf.Font.Size = 14; pdfDoc.Add(SubtituloPdf); pdfDoc.Add(espacio); //Ingreso Texto de Pagare var PagarePdf = new Paragraph(Pagare, FontFactory.GetFont("Calibri", 10, BaseColor.BLACK)); PagarePdf.Alignment = Element.ALIGN_JUSTIFIED; PagarePdf.Font.Size = 10; pdfDoc.Add(PagarePdf); if (datosContrato[0].FotoFirma != "") { iTextSharp.text.Image imagen = iTextSharp.text.Image.GetInstance(@AppDomain.CurrentDomain.BaseDirectory + @"\Machote\FotoFirma-Copia-Editada.png"); imagen.BorderWidth = 0; imagen.Alignment = Element.ALIGN_LEFT; float percentage = 0.0f; percentage = 70 / imagen.Width; imagen.ScalePercent(percentage * 100); // Insertamos la imagen de la firma en el Pagare PdfPTable tablaImagenPagare = new PdfPTable(5);; iTextSharp.text.Phrase fraseFirma = new iTextSharp.text.Phrase("Firma Deudor:"); fraseFirma.Font.Size = 10; PdfPCell espacioCelda = new PdfPCell(); PdfPCell celdaTexto = new PdfPCell(fraseFirma); PdfPCell celdaFirma = new PdfPCell(imagen); espacioCelda.Border = 0; celdaTexto.Border = 0; celdaTexto.VerticalAlignment = Element.ALIGN_MIDDLE; celdaTexto.HorizontalAlignment = Element.ALIGN_LEFT; celdaFirma.Border = 0; celdaFirma.VerticalAlignment = Element.ALIGN_MIDDLE; celdaFirma.HorizontalAlignment = Element.ALIGN_LEFT; tablaImagenPagare.AddCell(celdaTexto); //celda con el texto de la firma tablaImagenPagare.AddCell(celdaFirma); //celda con la imagen de la firma tablaImagenPagare.AddCell(espacioCelda); //celda con espacio en blanco tablaImagenPagare.AddCell(espacioCelda); //celda con espacio en blanco tablaImagenPagare.AddCell(espacioCelda); //celda con espacio en blanco pdfDoc.Add(tablaImagenPagare); } else { var parrafoFirma = new Paragraph("\n\n Firma Deudor: \n\n\n", fontHeader_1); parrafoFirma.Font.Size = 10; pdfDoc.Add(parrafoFirma); } //Agregamos la info final del contrato string textoFinalPagare = " Nombre Completo: " + datosContrato[0].Nombre + "\n\n\n Número de Cédula: " + datosContrato[0].Identificacion; var parrafoFinalPagare = new Paragraph(textoFinalPagare, fontHeader_1); parrafoFinalPagare.Font.Size = 10; pdfDoc.Add(parrafoFinalPagare); //Cierro el archivo PDF pdfDoc.Close(); wri.Close(); } oDoc.Close(); } //Proceso para crear y agregar el formulario BCCR a el pdf final var path = @AppDomain.CurrentDomain.BaseDirectory + @"\Machote\formulario-bac.html"; var pathOriginal = @AppDomain.CurrentDomain.BaseDirectory + @"\Machote\formulario-bac-sin-remplazo.html"; string html = File.ReadAllText(pathOriginal); string EncodedString = ""; string ret = ""; string DecodedStringFormulario; string htmlOriginal = html; //este sera el html orinal sin hacer los remplazas para luego de todo el proceso volver a guaradr el archivo html con los valores originales using (StringWriter writer = new StringWriter()) { HttpUtility.HtmlEncode(html, writer); //Server.HtmlEncode(html, writer); EncodedString = html.ToString(); ret = completarFormularioDomiciliacion(EncodedString, datosContrato[0]); // replazamos el html con la info dinamica DecodedStringFormulario = HttpUtility.HtmlDecode(ret); //Server.HtmlDecode(ret); writer.Close(); } using (StreamWriter sw = new StreamWriter(path)) //sobrescribimos el html con la nueva info { sw.WriteLine(DecodedStringFormulario); sw.Close(); } //Generamos el pdf del formulario caon base en el archivo html NReco.PdfGenerator.HtmlToPdfConverter pdfFormulario = new NReco.PdfGenerator.HtmlToPdfConverter(); pdfFormulario.PageHeight = 279; pdfFormulario.PageWidth = 216; pdfFormulario.GeneratePdfFromFile(path, null, @AppDomain.CurrentDomain.BaseDirectory + @"\Machote\archivos\Formulario-" + datosContrato.FirstOrDefault().Nombre + x + ".pdf"); //llamamos al metodo interno mergePdfs para unir los pdfs del contrato, el pagare y el formulario string rutaDocumentoFinal = URL + "/" + pagareContrato.Identificacion + "/" + "Contrato_Pagare_" + pagareContrato.Identificacion + ".pdf"; if (Util.ValidarFichero(rutaDocumentoFinal) == true) { rutaDocumentoFinal = Util.Renamefile(rutaDocumentoFinal, pagareContrato.Identificacion, ".pdf"); string[] archivos = { AppDomain.CurrentDomain.BaseDirectory + "/Machote/archivos/Documento-" + datosContrato.FirstOrDefault().Nombre + x + ".pdf", @AppDomain.CurrentDomain.BaseDirectory + @"\Machote\archivos\Formulario-" + datosContrato.FirstOrDefault().Nombre + x + ".pdf" }; mergePdfs(rutaDocumentoFinal, archivos); } //volvemos a guaradar el archivo html Original(sin los valores remplazados) using (StreamWriter sw = new StreamWriter(path)) { sw.WriteLine(htmlOriginal); sw.Close(); } File.Delete(AppDomain.CurrentDomain.BaseDirectory + "/Machote/archivos/Documento-" + datosContrato.FirstOrDefault().Nombre + x + ".pdf"); File.Delete(@AppDomain.CurrentDomain.BaseDirectory + @"\Machote\archivos\Formulario-" + datosContrato.FirstOrDefault().Nombre + x + ".pdf"); File.Delete(@AppDomain.CurrentDomain.BaseDirectory + @"\Machote\FotoFirma-Copia-Editada.png"); return(rutaDocumentoFinal); } } catch (Exception ex) { dto_excepcion.STR_MENSAJE = ex.Message; DynamicSqlDAO.guardaExcepcion(dto_excepcion, GlobalClass.connectionString.Where(a => a.Key == infDto.STR_COD_PAIS).FirstOrDefault().Value); pagareContrato.Mensaje = "ERR"; } return(null); }
public Solicitudes GetTestAsync(List <ConfigSys> configSys, List <Solicitudes> sol) { string xClase = string.Format("{0}|{1}", MethodBase.GetCurrentMethod().Module.Name, MethodBase.GetCurrentMethod().DeclaringType.Name); string xProceso = MethodBase.GetCurrentMethod().Name; var dto_excepcion = new UTL_TRA_EXCEPCION { STR_CLASE = xClase, STR_EVENTO = xProceso, STR_PARAMETROS = JsonConvert.SerializeObject(sol), STR_APLICATIVO = ConfigurationManager.AppSettings["APLICATIVO"].ToString(), STR_SERVIDOR = System.Net.Dns.GetHostName(), FEC_CREACION = DateTime.Now }; Solicitudes _Solicitudes = new Solicitudes(); var options = new CredentialProfileOptions { AccessKey = configSys[0].llave_Config1, SecretKey = configSys[0].llave_Config2 }; try { var profile = new Amazon.Runtime.CredentialManagement.CredentialProfile("AWSProfileName", options); profile.Region = RegionEndpoint.USWest1; var netSDKFile = new NetSDKCredentialsFile(); netSDKFile.RegisterProfile(profile); float similarityThreshold = 70F; String sourceImage = sol[0].UrlFotoSelfie; String targetImage = sol[0].UrlFotoCedula; using (AmazonRekognitionClient rekognitionClient = new AmazonRekognitionClient(configSys[0].llave_Config1, configSys[0].llave_Config2)) { Amazon.Rekognition.Model.Image imageSource = new Amazon.Rekognition.Model.Image(); using (FileStream fs = new FileStream(sourceImage, FileMode.Open, FileAccess.Read)) { byte[] data = new byte[fs.Length]; fs.Read(data, 0, (int)fs.Length); imageSource.Bytes = new MemoryStream(data); } Amazon.Rekognition.Model.Image imageTarget = new Amazon.Rekognition.Model.Image(); using (FileStream fs = new FileStream(targetImage, FileMode.Open, FileAccess.Read)) { byte[] data = new byte[fs.Length]; data = new byte[fs.Length]; fs.Read(data, 0, (int)fs.Length); imageTarget.Bytes = new MemoryStream(data); } CompareFacesRequest compareFacesRequest = new CompareFacesRequest() { SourceImage = imageSource, TargetImage = imageTarget, SimilarityThreshold = similarityThreshold }; // Call operation CompareFacesResponse compareFacesResponse = rekognitionClient.CompareFaces(compareFacesRequest); // Display results //foreach (CompareFacesMatch match in compareFacesResponse.FaceMatches) compareFacesResponse.FaceMatches.ForEach(match => { ComparedFace face = match.Face; BoundingBox position = face.BoundingBox; _Solicitudes.PorcentMatched = face.Confidence; _Solicitudes.PositionLeft = position.Left; _Solicitudes.PositionTop = position.Top; }); _Solicitudes.IdTipoIdentificacion = sol.FirstOrDefault().IdTipoIdentificacion; _Solicitudes.Identificacion = sol.FirstOrDefault().Identificacion; if (_Solicitudes.PorcentMatched == 0 || _Solicitudes.PorcentMatched == null) { _Solicitudes.UnMatchedFace = compareFacesResponse.UnmatchedFaces[0].Confidence; } else { _Solicitudes.UnMatchedFace = 0; } _Solicitudes.ImageRotationSource = compareFacesResponse.SourceImageOrientationCorrection; _Solicitudes.ImageRotationTarget = compareFacesResponse.TargetImageOrientationCorrection; } return(_Solicitudes); } catch (Exception ex) { dto_excepcion.STR_MENSAJE = ex.Message; DynamicSqlDAO.guardaExcepcion(dto_excepcion, ConfigurationManager.ConnectionStrings["TwoFunTwoMeConnection"].ConnectionString); _Solicitudes.Mensaje = "ERR_imageTarget"; throw; } }
public void insertaColaRabbit(InsertPersonasWeb personasWeb) { string xClase = string.Format("{0}|{1}", MethodBase.GetCurrentMethod().Module.Name, MethodBase.GetCurrentMethod().DeclaringType.Name); string xProceso = MethodBase.GetCurrentMethod().Name; string strHostName = System.Net.Dns.GetHostName(); //IPHostEntry ipHostInfo = Dns.Resolve(Dns.GetHostName()); <-- Obsolete IPHostEntry ipHostInfo = Dns.GetHostEntry(strHostName); IPAddress ipAddress = ipHostInfo.AddressList[0]; var dto_excepcion = new UTL_TRA_EXCEPCION { STR_CLASE = xClase, STR_EVENTO = xProceso, STR_APLICATIVO = ConfigurationManager.AppSettings["APLICATIVO"].ToString(), STR_SERVIDOR = ipAddress.ToString(), STR_PARAMETROS = JsonConvert.SerializeObject(personasWeb) }; var dto_Config = new Tab_ConfigSys { llave_Config1 = "SERVICIO", llave_Config2 = "CONFIGURACION", llave_Config3 = "SERVIDOR", llave_Config4 = "RABBIT" }; try { var dto_ret_config = GetConfigRabbit(dto_Config); var factory = new ConnectionFactory() { HostName = dto_ret_config.Where(x => x.llave_Config5 == "HOSTNAME").Select(x => x.Dato_Char1).FirstOrDefault(), //Port = 15672, Password = dto_ret_config.Where(x => x.llave_Config5 == "PASSWORD").Select(x => x.Dato_Char1).FirstOrDefault(), UserName = dto_ret_config.Where(x => x.llave_Config5 == "USERNAME").Select(x => x.Dato_Char1).FirstOrDefault() }; using (var connection = factory.CreateConnection()) using (var channel = connection.CreateModel()) { //channel.QueueDeclare(queue: dto_ret_config.Where(x => x.llave_Config5 == "EXCHANGES_SOLICITUDES").Select(x => x.Dato_Char1).FirstOrDefault(), // durable: true, // exclusive: false, // autoDelete: false, // arguments: null); string message = string.Concat(personasWeb.Identificacion, "~", personasWeb.IdTipoIdentificacion, "~", personasWeb.PrimerNombre, "~", personasWeb.SegundoNombre, "~", personasWeb.PrimerApellido, "~", personasWeb.SegundoApellido, "~", personasWeb.TelefonoCel, "~", personasWeb.Correo, "~", personasWeb.IdProducto, "~", personasWeb.IdBanco, "~", personasWeb.UsrModifica, "~", personasWeb.Origen); var body = Encoding.UTF8.GetBytes(message); channel.BasicPublish(exchange: dto_ret_config.Where(x => x.llave_Config5 == "EXCHANGES_SOLICITUDES").Select(x => x.Dato_Char1).FirstOrDefault(), routingKey: "", basicProperties: null, body: body); //channel.BasicPublish(exchange: "", // routingKey: dto_ret_config.Where(x => x.llave_Config5 == "QUEUE").Select(x => x.Dato_Char1).FirstOrDefault(), // basicProperties: null, // body: body); } } catch (Exception ex) { dto_excepcion.STR_MENSAJE = ex.Message; manage = new Manager(); DynamicSqlDAO.guardaExcepcion(dto_excepcion, GlobalClass.connectionString.Where(a => a.Key == infDto.STR_COD_PAIS).FirstOrDefault().Value); } }
public Solicitudes DetectFace(List <ConfigSys> configSys, string UrlFoto, string Identificacion, string IdTipoIdentificacion, int OPC) { string xClase = string.Format("{0}|{1}", MethodBase.GetCurrentMethod().Module.Name, MethodBase.GetCurrentMethod().DeclaringType.Name); string xProceso = MethodBase.GetCurrentMethod().Name; bool resp = false; var param = new { UriFoto = UrlFoto, TipoIdentificacion = IdTipoIdentificacion, cedula = Identificacion, OPCe = OPC }; var dto_excepcion = new UTL_TRA_EXCEPCION { STR_CLASE = xClase, STR_EVENTO = xProceso, FEC_CREACION = DateTime.Now, STR_PARAMETROS = JsonConvert.SerializeObject(param), STR_SERVIDOR = System.Net.Dns.GetHostName(), STR_APLICATIVO = ConfigurationManager.AppSettings["APLICATIVO"].ToString() }; Solicitudes _Solicitudes = new Solicitudes(); var options = new CredentialProfileOptions { AccessKey = configSys[0].llave_Config1, SecretKey = configSys[0].llave_Config2 }; try { var profile = new Amazon.Runtime.CredentialManagement.CredentialProfile("AWSProfileName", options); profile.Region = RegionEndpoint.USWest1; var netSDKFile = new NetSDKCredentialsFile(); netSDKFile.RegisterProfile(profile); String targetImage = UrlFoto; // Using USWest2, not the default region using (AmazonRekognitionClient rekoClient = new AmazonRekognitionClient(configSys[0].llave_Config1, configSys[0].llave_Config2, RegionEndpoint.USEast1)) { Amazon.Rekognition.Model.Image img = new Amazon.Rekognition.Model.Image(); byte[] data = null; using (FileStream fs = new FileStream(targetImage, FileMode.Open, FileAccess.Read)) { data = new byte[fs.Length]; fs.Read(data, 0, (int)fs.Length); } img.Bytes = new MemoryStream(data); DetectTextRequest dfr = new DetectTextRequest(); dfr.Image = img; var outcome = rekoClient.DetectText(dfr); //List<string> Detectedtext = new List<string>(); //foreach (var texto in outcome.TextDetections) outcome.TextDetections.ForEach(texto => { string cedula = ""; //Detectedtext.Add(texto.DetectedText); cedula = texto.DetectedText; cedula = cedula.Replace(" ", "").Trim(); //if (OPC == 2) //{ var cedresp = cedula.Split(':'); var respuesta = cedresp.Where(x => x.ToString().Equals(Identificacion) || cedula.Equals(Identificacion)).Any(); if (respuesta) { resp = respuesta; } //if (resp.Equals(true)) texto.s; //foreach (var text in cedresp) //{ // if (text == Identificacion) // { // resp = true; // } //} //} //if (cedula == Identificacion && OPC == 1) //{ // resp = true; //} }); var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(outcome.TextDetections.Select(x => x.DetectedText)); _Solicitudes.result = resp; _Solicitudes.DetectedText = jsonString; } //return outcome.TextDetections.Select(x => x.DetectedText).ToList(); return(_Solicitudes); } catch (Exception ex) { dto_excepcion.STR_MENSAJE = ex.Message; DynamicSqlDAO.guardaExcepcion(dto_excepcion, ConfigurationManager.ConnectionStrings["TwoFunTwoMeConnection"].ConnectionString); _Solicitudes.Mensaje = "ERR_Detect Text"; throw; } }
public IHttpActionResult Procesar(DTO_GiniMachine objGiniMachine) { manager = new ManagerGiniMachine(); string xClase = string.Format("{0}|{1}", MethodBase.GetCurrentMethod().Module.Name, MethodBase.GetCurrentMethod().DeclaringType.Name); string xProceso = MethodBase.GetCurrentMethod().Name; string strHostName = System.Net.Dns.GetHostName(); IPHostEntry ipHostInfo = Dns.GetHostEntry(strHostName); IPAddress ipAddress = ipHostInfo.AddressList[0]; objGiniMachine.UsrCreacion = "WEB"; var dto_excepcion = new UTL_TRA_EXCEPCION { STR_CLASE = xClase, STR_EVENTO = xProceso, STR_APLICATIVO = ConfigurationManager.AppSettings["APLICATIVO"].ToString(), STR_SERVIDOR = ipAddress.ToString(), STR_PARAMETROS = JsonConvert.SerializeObject(objGiniMachine), FEC_CREACION = DateTime.Now }; var dto_ObjConfig = new DTO_GiniMachineConfig { Buro = "GINIMACHINE" }; try { #region CONFIGURACION GINIMACHINE dto_ObjConfig = manager.ObtenerConfigGiniMachine(dto_ObjConfig).FirstOrDefault(); #endregion #region OBTENER JSON INPUT objGiniMachine.Input = manager.ObtenerJSON(objGiniMachine).FirstOrDefault().Json; #endregion #region CONSUMIR REST GINIMACHINE RestClient cliente = new RestClient(dto_ObjConfig._EndPoint + dto_ObjConfig._Resource); // Dirección web del reporte RestRequest request = new RestRequest(); // Clase propia del RestSharp para asignar parámetros de envio. request.Method = Method.POST; request.AddHeader("Accept", "application/json"); request.AddParameter(dto_ObjConfig._ParamName1, dto_ObjConfig._ParamVal1, ParameterType.QueryString); request.AddParameter("application/json", objGiniMachine.Input, ParameterType.RequestBody); //request.AddJsonBody(objGiniMachine.Input); var respuesta = cliente.Execute(request); // Metodo que ejecuta la solicitud. if (respuesta.StatusCode == System.Net.HttpStatusCode.OK) // Si retorna OK, el reporte fue generado. { objGiniMachine.Output = respuesta.Content.ToString(); if (!string.IsNullOrEmpty(objGiniMachine.Output.ToString())) { if (objGiniMachine.Output.Contains("Approve") || objGiniMachine.Output.Contains("Decl")) { #region ALMACENAR OUTPUT BD objGiniMachine.ModelId = dto_ObjConfig._ParamVal1; objGiniMachine.Servidor = dto_ObjConfig._EndPoint; manager.GuardarResultadoGinimachine(objGiniMachine); objGiniMachine.Input = ""; #endregion objGiniMachine.Mensaje = "SUCCESS"; } } } else { String mensajeError = respuesta.Content; } #endregion } catch (Exception ex) { dto_excepcion.STR_MENSAJE = ex.Message; DynamicSqlDAO.guardaExcepcion(dto_excepcion, ConfigurationManager.ConnectionStrings["TwoFunTwoMeConnection"].ConnectionString); objGiniMachine.Status = "ERR"; objGiniMachine.Mensaje = ex.Message; } return(Json(objGiniMachine)); }