public bool Insertar(ENVtaBDVendedores oENVtaBDVendedores) { DbCommand oCommand = null; try { oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "usp_GenVtaBDVendedores_ins"); GenericDataAccess.AgregarParametro(oCommand, "@argApellidoMaterno", oENVtaBDVendedores.ApellidoMaterno, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argApellidoPaterno", oENVtaBDVendedores.ApellidoPaterno, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argCodigoPerfil", oENVtaBDVendedores.CodigoPerfil, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argCodigoUsuario", oENVtaBDVendedores.CodigoUsuario, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argCodigoVendedor", oENVtaBDVendedores.CodigoVendedor, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argDireccion", oENVtaBDVendedores.Direccion, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argEmail", oENVtaBDVendedores.Email, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argEstadoRegistro", oENVtaBDVendedores.EstadoRegistro, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argFechaing", oENVtaBDVendedores.Fechaing, TipoParametro.DT, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argID_perfil", oENVtaBDVendedores.ID_perfil, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argIdPersona", oENVtaBDVendedores.IdPersona, TipoParametro.INT, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argIdSociedad", oENVtaBDVendedores.IdSociedad, TipoParametro.INT, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argNombres", oENVtaBDVendedores.Nombres, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argTelefono", oENVtaBDVendedores.Telefono, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argErrorCode", 1, TipoParametro.INT, Direccion.OUTPUT); if (GenericDataAccess.ExecuteNonQuery(oCommand) > 0) { return(true); } else { return(false); } } catch (Exception ex) { throw new Excepciones.ManejoExcepciones(ex); } finally { GenericDataAccess.CerrarConexion(oCommand, null); } }
public List <ENVendedores> ObtenerTodos() { DbCommand oCommand = null; List <ENVendedores> oListaVendedores = new List <ENVendedores>(); try { oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "usp_GenVendedores_sel"); GenericDataAccess.AgregarParametro(oCommand, "@argErrorCode", 1, TipoParametro.INT, Direccion.OUTPUT); DbDataReader oDataReader = GenericDataAccess.ExecuteReader(oCommand); while (oDataReader.Read()) { ENVendedores oEnListaVendedores = new ENVendedores(); oEnListaVendedores.CodigoVendedor = oDataReader["CodigoVendedor"].ToString(); oEnListaVendedores.ApellidoPaterno = oDataReader["ApellidoPaterno"].ToString(); oEnListaVendedores.ApellidoMaterno = oDataReader["ApellidoMaterno"].ToString(); oEnListaVendedores.Nombres = oDataReader["Nombres"].ToString(); oEnListaVendedores.Direccion = oDataReader["Direccion"].ToString(); oEnListaVendedores.Telefono = oDataReader["Telefono"].ToString(); oEnListaVendedores.Email = oDataReader["Email"].ToString(); oEnListaVendedores.CodigoUsuario = oDataReader["CodigoUsuario"].ToString(); oEnListaVendedores.CodigoPerfil = oDataReader["CodigoPerfil"].ToString(); oEnListaVendedores.IdPersona = Convert.ToInt32(oDataReader["IdPersona"]); oEnListaVendedores.IdSociedad = Convert.ToInt32(oDataReader["IdSociedad"]); oEnListaVendedores.RazonSocial = oDataReader["RazonSocial"].ToString(); oEnListaVendedores.IdPersonaSociedad = Convert.ToInt32(oDataReader["IdPersonaSociedad"]); oEnListaVendedores.DescripcionVendedor = oEnListaVendedores.ApellidoPaterno + " " + oEnListaVendedores.ApellidoMaterno + " " + oEnListaVendedores.Nombres; oListaVendedores.Add(oEnListaVendedores); } return(oListaVendedores); } catch (Exception ex) { throw new Exception(); } finally { GenericDataAccess.CerrarConexion(oCommand, null); } }
public bool Actualizar(ENSaludPlanes oENSaludPlanes) { DbCommand oCommand = null; try { oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "usp_GenSaludPlanes_upd"); GenericDataAccess.AgregarParametro(oCommand, "@argCapa", oENSaludPlanes.Capa, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argClase", oENSaludPlanes.Clase, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argCodigoPlan", oENSaludPlanes.CodigoPlan, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argCreadoPor", oENSaludPlanes.CreadoPor, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argDescripcionPlan", oENSaludPlanes.DescripcionPlan, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argFechaCreacion", oENSaludPlanes.FechaCreacion, TipoParametro.DT, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argFechaModificacion", oENSaludPlanes.FechaModificacion, TipoParametro.DT, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argFinVigencia", oENSaludPlanes.FinVigencia, TipoParametro.DT, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argInicioVigencia", oENSaludPlanes.InicioVigencia, TipoParametro.DT, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argModificadoPor", oENSaludPlanes.ModificadoPor, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argMostrar", oENSaludPlanes.Mostrar, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argObservaciones", oENSaludPlanes.Observaciones, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argOncologico", oENSaludPlanes.Oncologico, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argTipoPlan", oENSaludPlanes.TipoPlan, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argErrorCode", 1, TipoParametro.INT, Direccion.OUTPUT); if (GenericDataAccess.ExecuteNonQuery(oCommand) > 0) { return(true); } else { return(false); } } catch (Exception ex) { throw new Excepciones.ManejoExcepciones(ex); } finally { GenericDataAccess.CerrarConexion(oCommand, null); } }
public ENVtaBDVendedores ObtenerUno(string CodigoVendedor) { DbCommand oCommand = null; ENVtaBDVendedores oENVtaBDVendedores = new ENVtaBDVendedores(); try { oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "usp_GenVtaBDVendedores_sel"); GenericDataAccess.AgregarParametro(oCommand, "@argCodigoVendedor", oENVtaBDVendedores.CodigoVendedor, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argErrorCode ", 1, TipoParametro.INT, Direccion.OUTPUT); DbDataReader oDataReader = GenericDataAccess.ExecuteReader(oCommand); if (oDataReader.Read()) { oENVtaBDVendedores.ApellidoMaterno = oDataReader["ApellidoMaterno"].ToString(); oENVtaBDVendedores.ApellidoPaterno = oDataReader["ApellidoPaterno"].ToString(); oENVtaBDVendedores.CodigoPerfil = oDataReader["CodigoPerfil"].ToString(); oENVtaBDVendedores.CodigoUsuario = oDataReader["CodigoUsuario"].ToString(); oENVtaBDVendedores.CodigoVendedor = oDataReader["CodigoVendedor"].ToString(); oENVtaBDVendedores.Direccion = oDataReader["Direccion"].ToString(); oENVtaBDVendedores.Email = oDataReader["Email"].ToString(); oENVtaBDVendedores.EstadoRegistro = oDataReader["EstadoRegistro"].ToString(); oENVtaBDVendedores.Fechaing = DateTime.Parse(oDataReader["Fechaing"].ToString()); oENVtaBDVendedores.ID_perfil = oDataReader["ID_perfil"].ToString(); oENVtaBDVendedores.IdPersona = Convert.ToInt32(oDataReader["IdPersona"]); oENVtaBDVendedores.IdSociedad = Convert.ToInt32(oDataReader["IdSociedad"]); oENVtaBDVendedores.Nombres = oDataReader["Nombres"].ToString(); oENVtaBDVendedores.Telefono = oDataReader["Telefono"].ToString(); } return(oENVtaBDVendedores); } catch (Exception ex) { throw new Exception(); } finally { GenericDataAccess.CerrarConexion(oCommand, null); } }
public ENSaludPlanes ObtenerUno(string CodigoPlan) { DbCommand oCommand = null; ENSaludPlanes oENSaludPlanes = new ENSaludPlanes(); try { oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "usp_GenSaludPlanes_sel"); GenericDataAccess.AgregarParametro(oCommand, "@argCodigoPlan", oENSaludPlanes.CodigoPlan, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argErrorCode ", 1, TipoParametro.INT, Direccion.OUTPUT); DbDataReader oDataReader = GenericDataAccess.ExecuteReader(oCommand); if (oDataReader.Read()) { oENSaludPlanes.Capa = oDataReader["Capa"].ToString(); oENSaludPlanes.Clase = oDataReader["Clase"].ToString(); oENSaludPlanes.CodigoPlan = oDataReader["CodigoPlan"].ToString(); oENSaludPlanes.CreadoPor = oDataReader["CreadoPor"].ToString(); oENSaludPlanes.DescripcionPlan = oDataReader["DescripcionPlan"].ToString(); oENSaludPlanes.FechaCreacion = DateTime.Parse(oDataReader["FechaCreacion"].ToString()); oENSaludPlanes.FechaModificacion = DateTime.Parse(oDataReader["FechaModificacion"].ToString()); oENSaludPlanes.FinVigencia = DateTime.Parse(oDataReader["FinVigencia"].ToString()); oENSaludPlanes.InicioVigencia = DateTime.Parse(oDataReader["InicioVigencia"].ToString()); oENSaludPlanes.ModificadoPor = oDataReader["ModificadoPor"].ToString(); oENSaludPlanes.Mostrar = oDataReader["Mostrar"].ToString(); oENSaludPlanes.Observaciones = oDataReader["Observaciones"].ToString(); oENSaludPlanes.Oncologico = oDataReader["Oncologico"].ToString(); oENSaludPlanes.TipoPlan = oDataReader["TipoPlan"].ToString(); } return(oENSaludPlanes); } catch (Exception ex) { throw new Exception(); } finally { GenericDataAccess.CerrarConexion(oCommand, null); } }
public List <ENSaludContratos> ObtenerTodos(string CodigoCliente) { DbCommand oCommand = null; List <ENSaludContratos> oListaSaludContratos = new List <ENSaludContratos>(); try { oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "usp_GenSaludContratos_sel"); GenericDataAccess.AgregarParametro(oCommand, "@argCodigoCliente", CodigoCliente, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argErrorCode ", 1, TipoParametro.INT, Direccion.OUTPUT); DbDataReader oDataReader = GenericDataAccess.ExecuteReader(oCommand); while (oDataReader.Read()) { ENSaludContratos oEnListaSaludContratos = new ENSaludContratos(); oEnListaSaludContratos.CodigoCliente = oDataReader["CodigoCliente"].ToString(); oEnListaSaludContratos.CodigoContrato = oDataReader["CodigoContrato"].ToString(); oEnListaSaludContratos.CodigoCorredor = oDataReader["CodigoCorredor"].ToString(); oEnListaSaludContratos.CodigoCotizacion = oDataReader["CodigoCotizacion"].ToString(); oEnListaSaludContratos.CodigoEjecutivo = oDataReader["CodigoEjecutivo"].ToString(); oEnListaSaludContratos.CodigoTipoContrato = oDataReader["CodigoTipoContrato"].ToString(); oEnListaSaludContratos.FinVigencia = DateTime.Parse(oDataReader["FinVigencia"].ToString()); oEnListaSaludContratos.FlagTmp = oDataReader["FlagTmp"].ToString(); oEnListaSaludContratos.InicioVigencia = DateTime.Parse(oDataReader["InicioVigencia"].ToString()); oEnListaSaludContratos.RazonSocial = oDataReader["RazonSocial"].ToString(); oEnListaSaludContratos.RUC = oDataReader["RUC"].ToString(); oListaSaludContratos.Add(oEnListaSaludContratos); } return(oListaSaludContratos); } catch (Exception ex) { throw new Exception(); } finally { GenericDataAccess.CerrarConexion(oCommand, null); } }
public bool Insertar(ENSaludContratos oENSaludContratos) { DbCommand oCommand = null; string sCodigoContrato = ""; string sCodigoCotizacion = ""; //if (oENSaludContratos.CodigoContrato is null) //{ sCodigoContrato = ""; } try { oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "sp_Cli_ContratoGrabarContrato"); GenericDataAccess.AgregarParametro(oCommand, "@CodigoCliente", oENSaludContratos.CodigoCliente, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@CodigoContrato", sCodigoContrato, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@CodigoCotizacion", sCodigoCotizacion, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@CodigoTipoContrato", oENSaludContratos.CodigoTipoContrato, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@InicioVigencia", oENSaludContratos.InicioVigencia.ToString("dd/MM/yyyy"), TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@FinalVigencia", oENSaludContratos.FinVigencia.ToString("dd/MM/yyyy"), TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@CodigoCorredor", oENSaludContratos.CodigoCorredor, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@CodigoEjecutivo", oENSaludContratos.CodigoEjecutivo, TipoParametro.STR, Direccion.INPUT); if (GenericDataAccess.ExecuteNonQuery(oCommand) > 0) { return(true); } else { return(false); } } catch (Exception ex) { throw new Excepciones.ManejoExcepciones(ex); } finally { GenericDataAccess.CerrarConexion(oCommand, null); } }
public ENSCTRCotizaciones ObtenerUno(string CodigoCotizacion) { DbCommand oCommand = null; ENSCTRCotizaciones oENSCTRCotizaciones = new ENSCTRCotizaciones(); try { oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "ws_Ctz_CotizacionLeerIAFAS"); GenericDataAccess.AgregarParametro(oCommand, "@NumeroCotizacion", CodigoCotizacion, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@CodigoCliente", " ", TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@CodigoCorredor", " ", TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@FechaInicio", " ", TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@FechaFin", " ", TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@CodigoUsuario", " ", TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@Tipo", "C", TipoParametro.STR, Direccion.INPUT); DbDataReader oDataReader = GenericDataAccess.ExecuteReader(oCommand); while (oDataReader.Read()) { oENSCTRCotizaciones.CodigoPerfil = oDataReader["CodigoPerfil"].ToString(); oENSCTRCotizaciones.CodigoCotizacion = oDataReader["CodigoCotizacion"].ToString(); oENSCTRCotizaciones.CodigoCliente = oDataReader["CodigoCliente"].ToString(); oENSCTRCotizaciones.CodigoCIIU = oDataReader["CodigoCIIU"].ToString(); oENSCTRCotizaciones.CodigoCorredor = oDataReader["CodigoCorredor"].ToString(); oENSCTRCotizaciones.FechaInicio = oDataReader["FechaInicio"].ToString(); oENSCTRCotizaciones.FechaFin = oDataReader["FechaFin"].ToString(); oENSCTRCotizaciones.TiempoCobertura = Convert.ToInt32(oDataReader["TiempoCobertura"]); oENSCTRCotizaciones.CodigoMoneda = oDataReader["CodigoMoneda"].ToString(); oENSCTRCotizaciones.FechaCotizacion = DateTime.Parse(oDataReader["FechaCotizacion"].ToString()); oENSCTRCotizaciones.CodigoUsuarioRegistro = oDataReader["CodigoUsuarioRegistro"].ToString(); oENSCTRCotizaciones.CodigoEstado = oDataReader["CodigoEstado"].ToString(); oENSCTRCotizaciones.FechaHoraModificacion = DateTime.Parse(oDataReader["FechaHoraModificacion"].ToString()); oENSCTRCotizaciones.IdCotizacion = Convert.ToInt32(oDataReader["IdCotizacion"]); oENSCTRCotizaciones.Origen = oDataReader["Origen"].ToString(); oENSCTRCotizaciones.PSPoliza = oDataReader["PSPoliza"].ToString(); oENSCTRCotizaciones.UbigeoRiesgo = oDataReader["UbigeoRiesgo"].ToString(); oENSCTRCotizaciones.GrupoCIIU = oDataReader["GrupoCIIU"].ToString(); oENSCTRCotizaciones.PrimaManual = oDataReader["PrimaManual"].ToString(); oENSCTRCotizaciones.CodigoEjecutivo = oDataReader["CodigoEjecutivo"].ToString(); oENSCTRCotizaciones.CodigoBrokerAsociado = oDataReader["CodigoBrokerAsociado"].ToString(); oENSCTRCotizaciones.NroFacturacion = oDataReader["NroFacturacion"].ToString(); oENSCTRCotizaciones.EstadoFacturacion = oDataReader["EstadoFacturacion"].ToString(); oENSCTRCotizaciones.CodigoRenovacion = oDataReader["CodigoRenovacion"].ToString(); oENSCTRCotizaciones.EstadoRegistaroTXT = oDataReader["EstadoRegistaroTXT"].ToString(); oENSCTRCotizaciones.CodigoSede = oDataReader["CodigoSede"].ToString(); oENSCTRCotizaciones.EmpresaRUC = oDataReader["EmpresaRUC"].ToString(); oENSCTRCotizaciones.EmpresaNombre = oDataReader["EmpresaNombre"].ToString(); oENSCTRCotizaciones.DescripcionCIIU = oDataReader["DescripcionCIIU"].ToString(); oENSCTRCotizaciones.DescripcionCorredor = oDataReader["DescripcionCorredor"].ToString(); oENSCTRCotizaciones.DescripcionEstado = oDataReader["DescripcionEstado"].ToString(); oENSCTRCotizaciones.CodigoContrato = oDataReader["CodigoContrato"].ToString(); oENSCTRCotizaciones.ProcesoResultado = oDataReader["ProcesoResultado"].ToString(); oENSCTRCotizaciones.ProcesoMensaje = oDataReader["ProcesoMensaje"].ToString(); } return(oENSCTRCotizaciones); } catch (Exception ex) { throw new Exception(); } finally { GenericDataAccess.CerrarConexion(oCommand, null); } }
public ENSCTRCotizaciones Cotizar(ENSCTRCotizaciones oENSCTRCotizaciones) { DbCommand oCommand = null; List <ENSCTRCotizaciones> oListaSCTRCotizaciones = new List <ENSCTRCotizaciones>(); List <ENSCTRCotizacionesDetalle> oListaSCTRCotizacionesDetalle = new List <ENSCTRCotizacionesDetalle>(); try { string sTipoProceso = "C"; double iPorcentajeTasa = 0; double iPorcentajeCorredor = 0; double iPorcentajeTasaAdm = 0; double iPorcentajeCorredorAdm = 0; double iPorcentajeTasaOpe = 0; double iPorcentajeCorredorOpe = 0; double iImportePrimaNeta = 0; double iImporteDerechoEmision = 0; double iImporteIGV = 0; double iImportePrimaTotal = 0; string sCodigoUsuario = "grojas"; string sCodigoCorredor = "J6969"; string sUbigeoRiesgo = ""; string sFechaInicio = ""; string sFechaFin = ""; string sFechaCotizacion = ""; string sCodigoMoneda = ""; string sProcesoResultado = ""; string sProcesoMensaje = ""; string sFlagExcepcion = ""; sFechaInicio = String.Format("{0:yyyyMMdd}", oENSCTRCotizaciones.dtm_FechaInicio); sFechaFin = String.Format("{0:yyyyMMdd}", oENSCTRCotizaciones.dtm_FechaFin); if (oENSCTRCotizaciones.UbigeoRiesgo is null) { sUbigeoRiesgo = oENSCTRCotizaciones.CodigoDptoR + oENSCTRCotizaciones.CodigoProvR + oENSCTRCotizaciones.CodigoDistR; } else { sUbigeoRiesgo = oENSCTRCotizaciones.UbigeoRiesgo; } if (oENSCTRCotizaciones.PorcentajeCorredor != 0) { iPorcentajeCorredor = oENSCTRCotizaciones.PorcentajeCorredor; } else { iPorcentajeCorredor = 100; } oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "ws_Ctz_PerCotizacionConsulta"); //ENSCTRCotizaciones oEnListaSCTRCotizaciones = new ENSCTRCotizaciones(); GenericDataAccess.AgregarParametro(oCommand, "@TipoProceso", sTipoProceso, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@EmpresaRUC", oENSCTRCotizaciones.EmpresaRUC, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@EmpresaNombre", oENSCTRCotizaciones.EmpresaNombre, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@CodigoCorredor", sCodigoCorredor, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@CodigoCIIU", oENSCTRCotizaciones.CodigoCIIU, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@MontoOperativos", oENSCTRCotizaciones.DetMontoPlanillaOpe, TipoParametro.DBL, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@NumeroOperativos", oENSCTRCotizaciones.DetNumeroTrabajadoresOpe, TipoParametro.INT, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@MontoAdministrativos", oENSCTRCotizaciones.DetMontoPlanillaAdm, TipoParametro.DBL, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@NumeroAdministrativos", oENSCTRCotizaciones.DetNumeroTrabajadoresAdm, TipoParametro.INT, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@CodigoMoneda", oENSCTRCotizaciones.CodigoMoneda, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@FechaInicio", sFechaInicio, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@FechaFin", sFechaFin, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@TiempoCobertura", oENSCTRCotizaciones.TiempoCobertura, TipoParametro.INT, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@PorcentajeTasa", iPorcentajeTasa, TipoParametro.DBL, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@PorcentajeCorredor", iPorcentajeCorredor, TipoParametro.DBL, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@NumeroCotizacion", "", TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@Usuario", sCodigoUsuario, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@UbigeoRiesgo", sUbigeoRiesgo, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@Origen", oENSCTRCotizaciones.Origen, TipoParametro.STR, Direccion.INPUT); DbDataReader oDataReader = GenericDataAccess.ExecuteReader(oCommand); ENSCTRCotizacionesDetalle oEnListaSCTRCotizaciones1 = new ENSCTRCotizacionesDetalle(); if (oDataReader.HasRows) { while (oDataReader.Read()) { oEnListaSCTRCotizaciones1.CodigoTipoEmpleado = oDataReader["CodigoTipoAsegurado"].ToString(); oEnListaSCTRCotizaciones1.ImportePrimaNeta = Convert.ToDouble(oDataReader["ImportePrimaNeta"]); oEnListaSCTRCotizaciones1.ImporteDerechoEmision = Convert.ToDouble(oDataReader["ImporteDerechoEmision"]); oEnListaSCTRCotizaciones1.ImporteIGV = Convert.ToDouble(oDataReader["ImporteIGV"]); oEnListaSCTRCotizaciones1.ImportePrimaTotal = Convert.ToDouble(oDataReader["ImportePrimaTotal"]); oEnListaSCTRCotizaciones1.CodigoCotizacion = oDataReader["CodigoTipoAsegurado"].ToString(); sFechaCotizacion = oDataReader["FechaCotizacion"].ToString(); sCodigoMoneda = oDataReader["CodigoMoneda"].ToString(); oEnListaSCTRCotizaciones1.PorcentajeTasa = Convert.ToDouble(oDataReader["PorcentajeTasa"]); oEnListaSCTRCotizaciones1.PorcentajeCorredor = Convert.ToDouble(oDataReader["PorcentajeCorredor"]); sProcesoResultado = oDataReader["ProcesoResultado"].ToString(); sProcesoMensaje = oDataReader["ProcesoMensaje"].ToString(); sFlagExcepcion = oDataReader["FlagExcepcion"].ToString(); iImportePrimaNeta = iImportePrimaNeta + oEnListaSCTRCotizaciones1.ImportePrimaNeta; iImporteDerechoEmision = iImporteDerechoEmision + oEnListaSCTRCotizaciones1.ImporteDerechoEmision;; iImporteIGV = iImporteIGV + oEnListaSCTRCotizaciones1.ImporteIGV; iImportePrimaTotal = iImportePrimaTotal + oEnListaSCTRCotizaciones1.ImportePrimaTotal; if (oEnListaSCTRCotizaciones1.CodigoTipoEmpleado != "2") { iPorcentajeTasaAdm = oEnListaSCTRCotizaciones1.PorcentajeTasa; iPorcentajeCorredorAdm = oEnListaSCTRCotizaciones1.PorcentajeCorredor; } else { iPorcentajeTasaOpe = oEnListaSCTRCotizaciones1.PorcentajeTasa; iPorcentajeCorredorOpe = oEnListaSCTRCotizaciones1.PorcentajeCorredor; } oListaSCTRCotizacionesDetalle.Add(oEnListaSCTRCotizaciones1); } } oENSCTRCotizaciones.ImportePrimaNeta = iImportePrimaNeta; oENSCTRCotizaciones.ImporteIGV = iImporteIGV; oENSCTRCotizaciones.ImportePrimaTotal = iImportePrimaTotal; oENSCTRCotizaciones.ImporteDerechoEmision = iImporteDerechoEmision; oENSCTRCotizaciones.PorcentajeCorredor = iPorcentajeCorredorAdm; oENSCTRCotizaciones.PorcentajeTasa = iPorcentajeTasaAdm; return(oENSCTRCotizaciones); // return oListaSCTRCotizacionesDetalle; } catch (Exception ex) { throw new Excepciones.ManejoExcepciones(ex); } finally { GenericDataAccess.CerrarConexion(oCommand, null); } }
public ENSCTRCotizaciones ObtenerUnoConDetalle(string CodigoCotizacion) { DbCommand oCommand = null; ENSCTRCotizaciones oENSCTRCotizaciones = new ENSCTRCotizaciones(); try { oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "ws_Ctz_CotizacionLeerIAFAS_Detalle"); GenericDataAccess.AgregarParametro(oCommand, "@argCodigoCotizacion", CodigoCotizacion, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argErrorCode", 1, TipoParametro.INT, Direccion.OUTPUT); DbDataReader oDataReader = GenericDataAccess.ExecuteReader(oCommand); while (oDataReader.Read()) { oENSCTRCotizaciones.CodigoPerfil = oDataReader["CodigoPerfil"].ToString(); oENSCTRCotizaciones.CodigoCotizacion = oDataReader["CodigoCotizacion"].ToString(); oENSCTRCotizaciones.CodigoCliente = oDataReader["CodigoCliente"].ToString(); oENSCTRCotizaciones.CodigoCIIU = oDataReader["CodigoCIIU"].ToString(); oENSCTRCotizaciones.CodigoCorredor = oDataReader["CodigoCorredor"].ToString(); oENSCTRCotizaciones.FechaInicio = oDataReader["FechaInicio"].ToString(); oENSCTRCotizaciones.FechaFin = oDataReader["FechaFin"].ToString(); oENSCTRCotizaciones.TiempoCobertura = Convert.ToInt32(oDataReader["TiempoCobertura"]); oENSCTRCotizaciones.CodigoMoneda = oDataReader["CodigoMoneda"].ToString(); oENSCTRCotizaciones.FechaCotizacion = DateTime.Parse(oDataReader["FechaCotizacion"].ToString()); oENSCTRCotizaciones.CodigoUsuarioRegistro = oDataReader["CodigoUsuarioRegistro"].ToString(); oENSCTRCotizaciones.CodigoEstado = oDataReader["CodigoEstado"].ToString(); oENSCTRCotizaciones.FechaHoraModificacion = DateTime.Parse(oDataReader["FechaHoraModificacion"].ToString()); oENSCTRCotizaciones.IdCotizacion = Convert.ToInt32(oDataReader["IdCotizacion"]); oENSCTRCotizaciones.Origen = oDataReader["Origen"].ToString(); oENSCTRCotizaciones.PSPoliza = oDataReader["PSPoliza"].ToString(); oENSCTRCotizaciones.UbigeoRiesgo = oDataReader["UbigeoRiesgo"].ToString(); oENSCTRCotizaciones.GrupoCIIU = oDataReader["GrupoCIIU"].ToString(); oENSCTRCotizaciones.PrimaManual = oDataReader["PrimaManual"].ToString(); oENSCTRCotizaciones.CodigoEjecutivo = oDataReader["CodigoEjecutivo"].ToString(); oENSCTRCotizaciones.CodigoBrokerAsociado = oDataReader["CodigoBrokerAsociado"].ToString(); oENSCTRCotizaciones.NroFacturacion = oDataReader["NroFacturacion"].ToString(); oENSCTRCotizaciones.EstadoFacturacion = oDataReader["EstadoFacturacion"].ToString(); oENSCTRCotizaciones.CodigoRenovacion = oDataReader["CodigoRenovacion"].ToString(); oENSCTRCotizaciones.EstadoRegistaroTXT = oDataReader["EstadoRegistaroTXT"].ToString(); oENSCTRCotizaciones.CodigoSede = oDataReader["CodigoSede"].ToString(); oENSCTRCotizaciones.EmpresaRUC = oDataReader["EmpresaRUC"].ToString(); oENSCTRCotizaciones.EmpresaNombre = oDataReader["EmpresaNombre"].ToString(); oENSCTRCotizaciones.DescripcionCIIU = oDataReader["DescripcionCIIU"].ToString(); oENSCTRCotizaciones.DescripcionCorredor = oDataReader["DescripcionCorredor"].ToString(); oENSCTRCotizaciones.DescripcionEstado = oDataReader["DescripcionEstado"].ToString(); oENSCTRCotizaciones.CodigoContrato = oDataReader["CodigoContrato"].ToString(); oENSCTRCotizaciones.ProcesoResultado = oDataReader["ProcesoResultado"].ToString(); oENSCTRCotizaciones.ProcesoMensaje = oDataReader["ProcesoMensaje"].ToString(); //Detalle Operativos oENSCTRCotizaciones.DetCodigoCotizacionOpe = oDataReader["DetCodigoCotizacionOpe"].ToString(); oENSCTRCotizaciones.DetCodigoTipoEmpleadoOpe = oDataReader["DetCodigoTipoEmpleadoOpe"].ToString(); oENSCTRCotizaciones.DetImporteDerechoEmisionOpe = Convert.ToDouble(oDataReader["DetImporteDerechoEmisionOpe"]); //oENSCTRCotizaciones.DetImporteDerechoEmisionPensionOpe = Convert.ToDouble(oDataReader["DetImporteDerechoEmisionPensionOpe"]); oENSCTRCotizaciones.DetImporteDerechoEmisionPensionOpe = oDataReader["DetImporteDerechoEmisionPensionOpe"] == DBNull.Value ? 0.00 : Convert.ToDouble(oDataReader["DetImporteDerechoEmisionPensionOpe"]); oENSCTRCotizaciones.DetImporteIGVOpe = Convert.ToDouble(oDataReader["DetImporteIGVOpe"]); //oENSCTRCotizaciones.DetImporteIGVPensionOpe = Convert.ToDouble(oDataReader["DetImporteIGVPensionOpe"]); oENSCTRCotizaciones.DetImporteIGVPensionOpe = oDataReader["DetImporteIGVPensionOpe"] == DBNull.Value ? 0.00 : Convert.ToDouble(oDataReader["DetImporteIGVPensionOpe"]); //oENSCTRCotizaciones.DetImportePrimaNetaOpe = Convert.ToDouble(oDataReader["DetImportePrimaNetaOpe"]); oENSCTRCotizaciones.DetImportePrimaNetaOpe = oDataReader["DetImportePrimaNetaOpe"] == DBNull.Value ? 0.00 : Convert.ToDouble(oDataReader["DetImportePrimaNetaOpe"]); //oENSCTRCotizaciones.DetImportePrimaNetaPensionOpe = Convert.ToDouble(oDataReader["DetImportePrimaNetaPensionOpe"]); oENSCTRCotizaciones.DetImportePrimaNetaPensionOpe = oDataReader["DetImportePrimaNetaPensionOpe"] == DBNull.Value ? 0.00 : Convert.ToDouble(oDataReader["DetImportePrimaNetaPensionOpe"]); oENSCTRCotizaciones.DetImportePrimaTotalOpe = Convert.ToDouble(oDataReader["DetImportePrimaTotalOpe"]); //oENSCTRCotizaciones.DetImportePrimaTotalPensionOpe = Convert.ToDouble(oDataReader["DetImportePrimaTotalPensionOpe"]); oENSCTRCotizaciones.DetItemOpe = oDataReader["DetItemOpe"].ToString(); oENSCTRCotizaciones.DetMontoPlanillaOpe = Convert.ToDouble(oDataReader["DetMontoPlanillaOpe"].ToString()); oENSCTRCotizaciones.DetNumeroTrabajadoresOpe = Convert.ToInt32(oDataReader["DetNumeroTrabajadoresOpe"]); oENSCTRCotizaciones.DetPorcentajeCorredorOpe = Convert.ToDouble(oDataReader["DetPorcentajeCorredorOpe"]); oENSCTRCotizaciones.DetPorcentajeTasaOpe = Convert.ToDouble(oDataReader["DetPorcentajeTasaOpe"]); oENSCTRCotizaciones.DetPorcentajeTasaPensionOpe = Convert.ToDouble(oDataReader["DetPorcentajeTasaPensionOpe"]); oENSCTRCotizaciones.DetPorcentajeCorredorPensionOpe = Convert.ToDouble(oDataReader["DetPorcentajeCorredorPensionOpe"]); //Detalle Administrativos oENSCTRCotizaciones.DetCodigoCotizacionAdm = oDataReader["DetCodigoCotizacionAdm"].ToString(); oENSCTRCotizaciones.DetCodigoTipoEmpleadoAdm = oDataReader["DetCodigoTipoEmpleadoAdm"].ToString(); oENSCTRCotizaciones.DetImporteDerechoEmisionAdm = Convert.ToDouble(oDataReader["DetImporteDerechoEmisionAdm"]); oENSCTRCotizaciones.DetImporteDerechoEmisionPensionAdm = Convert.ToDouble(oDataReader["DetImporteDerechoEmisionPensionAdm"]); oENSCTRCotizaciones.DetImporteIGVAdm = Convert.ToDouble(oDataReader["DetImporteIGVAdm"]); oENSCTRCotizaciones.DetImporteIGVPensionAdm = Convert.ToDouble(oDataReader["DetImporteIGVPensionAdm"]); oENSCTRCotizaciones.DetImportePrimaNetaAdm = Convert.ToDouble(oDataReader["DetImportePrimaNetaAdm"]); oENSCTRCotizaciones.DetImportePrimaNetaPensionAdm = Convert.ToDouble(oDataReader["DetImportePrimaNetaPensionAdm"]); oENSCTRCotizaciones.DetImportePrimaTotalAdm = Convert.ToDouble(oDataReader["DetImportePrimaTotalAdm"]); oENSCTRCotizaciones.DetImportePrimaTotalPensionAdm = Convert.ToDouble(oDataReader["DetImportePrimaTotalPensionAdm"]); oENSCTRCotizaciones.DetItemAdm = oDataReader["DetItemAdm"].ToString(); oENSCTRCotizaciones.DetMontoPlanillaAdm = Convert.ToDouble(oDataReader["DetMontoPlanillaAdm"].ToString()); oENSCTRCotizaciones.DetNumeroTrabajadoresAdm = Convert.ToInt32(oDataReader["DetNumeroTrabajadoresAdm"]); oENSCTRCotizaciones.DetPorcentajeCorredorAdm = Convert.ToDouble(oDataReader["DetPorcentajeCorredorAdm"]); oENSCTRCotizaciones.DetPorcentajeTasaAdm = Convert.ToDouble(oDataReader["DetPorcentajeTasaAdm"]); oENSCTRCotizaciones.DetPorcentajeTasaPensionAdm = Convert.ToDouble(oDataReader["DetPorcentajeTasaPensionAdm"]); oENSCTRCotizaciones.DetPorcentajeCorredorPensionAdm = Convert.ToDouble(oDataReader["DetPorcentajeCorredorPensionAdm"]); //Nuevos oENSCTRCotizaciones.Direccion = oDataReader["Direccion"].ToString(); oENSCTRCotizaciones.Ubigeo = oDataReader["Ubigeo"].ToString(); oENSCTRCotizaciones.UbigeoRiesgo = oDataReader["UbigeoRiesgo"].ToString(); oENSCTRCotizaciones.CodigoDpto = oDataReader["CodDpto"].ToString(); oENSCTRCotizaciones.CodigoProv = oDataReader["CodProv"].ToString(); oENSCTRCotizaciones.CodigoDist = oDataReader["CodDist"].ToString(); oENSCTRCotizaciones.CodigoDptoR = oDataReader["CodDptoR"].ToString(); oENSCTRCotizaciones.CodigoProvR = oDataReader["CodProvR"].ToString(); oENSCTRCotizaciones.CodigoDistR = oDataReader["CodDistR"].ToString(); oENSCTRCotizaciones.ImportePrimaNeta = Convert.ToDouble(oDataReader["ImportePrimaNeta"]); oENSCTRCotizaciones.ImporteIGV = Convert.ToDouble(oDataReader["ImporteIGV"]); oENSCTRCotizaciones.ImportePrimaTotal = Convert.ToDouble(oDataReader["ImportePrimaTotal"]); oENSCTRCotizaciones.ImporteDerechoEmision = Convert.ToDouble(oDataReader["ImporteDerechoEmision"]); oENSCTRCotizaciones.ImportePrimaNetaPension = Convert.ToDouble(oDataReader["ImportePrimaNetaPension"]); oENSCTRCotizaciones.ImporteIGVPension = Convert.ToDouble(oDataReader["ImporteIGVPension"]); oENSCTRCotizaciones.ImportePrimaTotalPension = Convert.ToDouble(oDataReader["ImportePrimaTotalPension"]); oENSCTRCotizaciones.ImporteDerechoEmisionPension = Convert.ToDouble(oDataReader["ImporteDerechoEmisionPension"]); oENSCTRCotizaciones.PorcentajeTasaPension = Convert.ToDouble(oDataReader["PorcentajeTasaPension"]); oENSCTRCotizaciones.PorcentajeCorredorPension = Convert.ToDouble(oDataReader["PorcentajeCorredorPension"]); oENSCTRCotizaciones.PorcentajeTasa = Convert.ToDouble(oDataReader["PorcentajeTasa"]); oENSCTRCotizaciones.PorcentajeCorredor = Convert.ToDouble(oDataReader["PorcentajeCorredor"]); oENSCTRCotizaciones.dtm_FechaInicio = DateTime.Parse(oDataReader["FechaInicio"].ToString()); oENSCTRCotizaciones.dtm_FechaFin = DateTime.Parse(oDataReader["FechaFin"].ToString()); } return(oENSCTRCotizaciones); } catch (Exception ex) { throw new Exception(); } finally { GenericDataAccess.CerrarConexion(oCommand, null); } }
public bool Actualizar(ENSCTRCotizaciones oENSCTRCotizaciones) { DbCommand oCommand = null; try { string sTipoProceso = "U"; double iPorcentajeTasa = 0; double iPorcentajeCorredor = 0; string sCodigoUsuario = "grojas"; string sCodigoCorredor = "J6969"; string sUbigeoRiesgo = ""; string sFechaInicio = ""; string sFechaFin = ""; sFechaInicio = String.Format("{0:yyyyMMdd}", oENSCTRCotizaciones.dtm_FechaInicio); sFechaFin = String.Format("{0:yyyyMMdd}", oENSCTRCotizaciones.dtm_FechaFin); if (oENSCTRCotizaciones.UbigeoRiesgo is null) { sUbigeoRiesgo = oENSCTRCotizaciones.CodigoDptoR + oENSCTRCotizaciones.CodigoProvR + oENSCTRCotizaciones.CodigoDistR; } else { sUbigeoRiesgo = oENSCTRCotizaciones.UbigeoRiesgo; } if (oENSCTRCotizaciones.PorcentajeCorredor != 0) { iPorcentajeCorredor = oENSCTRCotizaciones.PorcentajeCorredor; } else { iPorcentajeCorredor = 100; } if (oENSCTRCotizaciones.PorcentajeTasa != 0) { iPorcentajeTasa = oENSCTRCotizaciones.PorcentajeTasa; } else { iPorcentajeTasa = 0; } oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "ws_Ctz_PerCotizacionConsulta"); GenericDataAccess.AgregarParametro(oCommand, "@TipoProceso", sTipoProceso, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@EmpresaRUC", oENSCTRCotizaciones.EmpresaRUC, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@EmpresaNombre", oENSCTRCotizaciones.EmpresaNombre, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@CodigoCorredor", sCodigoCorredor, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@CodigoCIIU", oENSCTRCotizaciones.CodigoCIIU, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@MontoOperativos", oENSCTRCotizaciones.DetMontoPlanillaOpe, TipoParametro.DBL, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@NumeroOperativos", oENSCTRCotizaciones.DetNumeroTrabajadoresOpe, TipoParametro.INT, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@MontoAdministrativos", oENSCTRCotizaciones.DetMontoPlanillaAdm, TipoParametro.DBL, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@NumeroAdministrativos", oENSCTRCotizaciones.DetNumeroTrabajadoresAdm, TipoParametro.INT, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@CodigoMoneda", oENSCTRCotizaciones.CodigoMoneda, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@FechaInicio", sFechaInicio, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@FechaFin", sFechaFin, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@TiempoCobertura", oENSCTRCotizaciones.TiempoCobertura, TipoParametro.INT, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@PorcentajeTasa", iPorcentajeTasa, TipoParametro.DBL, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@PorcentajeCorredor", iPorcentajeCorredor, TipoParametro.DBL, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@NumeroCotizacion", "", TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@Usuario", sCodigoUsuario, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@UbigeoRiesgo", sUbigeoRiesgo, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@Origen", oENSCTRCotizaciones.Origen, TipoParametro.STR, Direccion.INPUT); if (GenericDataAccess.ExecuteNonQuery(oCommand) > 0) { return(true); } else { return(false); } } catch (Exception ex) { throw new Excepciones.ManejoExcepciones(ex); } finally { GenericDataAccess.CerrarConexion(oCommand, null); } }
public bool Actualizar(ENSaludAsegurados oENSaludAsegurados) { DbCommand oCommand = null; string sUbigeo = ""; try { if (oENSaludAsegurados.CodigoUbigeo is null) { sUbigeo = oENSaludAsegurados.CodigoDpto + oENSaludAsegurados.CodigoProv + oENSaludAsegurados.CodigoDist; } else { sUbigeo = oENSaludAsegurados.CodigoUbigeo; } oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "usp_GenSaludAsegurados_upd"); GenericDataAccess.AgregarParametro(oCommand, "@argApellidoMaterno", oENSaludAsegurados.ApellidoMaterno, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argApellidoPaterno", oENSaludAsegurados.ApellidoPaterno, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argApellidosNombres", oENSaludAsegurados.ApellidosNombres, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argCantidadCarnet", oENSaludAsegurados.CantidadCarnet, TipoParametro.INT, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argCategoria", oENSaludAsegurados.Categoria, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argCelular", oENSaludAsegurados.Celular, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argCodigoCentroCosto", oENSaludAsegurados.CodigoCentroCosto, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argCodigoCliente", oENSaludAsegurados.CodigoCliente, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argCodigoCotizacion", oENSaludAsegurados.CodigoCotizacion, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argCodigoDocumentoIdentidad", oENSaludAsegurados.CodigoDocumentoIdentidad, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argCodigoParentesco", oENSaludAsegurados.CodigoParentesco, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argCodigoSexo", oENSaludAsegurados.CodigoSexo, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argCodigoTipoTrabajador", oENSaludAsegurados.CodigoTipoTrabajador, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argCodigoTitular", oENSaludAsegurados.CodigoTitular, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argCodigoTrabajador", oENSaludAsegurados.CodigoTrabajador, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argCodigoUbigeo", sUbigeo, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argDireccion", oENSaludAsegurados.Direccion, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argEmail", oENSaludAsegurados.Email, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argEstado", oENSaludAsegurados.Estado, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argFechaAlta", oENSaludAsegurados.FechaAlta, TipoParametro.DT, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argFechaBaja", oENSaludAsegurados.FechaBaja, TipoParametro.DT, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argFechaEmisionCarnet", oENSaludAsegurados.FechaEmisionCarnet, TipoParametro.DT, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argFechaFinLatencia", oENSaludAsegurados.FechaFinLatencia, TipoParametro.DT, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argFechaInicioLatencia", oENSaludAsegurados.FechaInicioLatencia, TipoParametro.DT, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argFechaNacimiento", oENSaludAsegurados.FechaNacimiento, TipoParametro.DT, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argFechaReemisionCarnet", oENSaludAsegurados.FechaReemisionCarnet, TipoParametro.DT, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argNombres", oENSaludAsegurados.Nombres, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argNumeroDocumentoIdentidad", oENSaludAsegurados.NumeroDocumentoIdentidad, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argPeso", oENSaludAsegurados.Peso, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argRegAddDate", oENSaludAsegurados.RegAddDate, TipoParametro.DT, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argRegAddUser", oENSaludAsegurados.RegAddUser, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argRegEdtDate", oENSaludAsegurados.RegEdtDate, TipoParametro.DT, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argRegEdtUser", oENSaludAsegurados.RegEdtUser, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argSCTREstadoCivil", oENSaludAsegurados.SCTREstadoCivil, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argSCTRMoneda", oENSaludAsegurados.SCTRMoneda, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argSCTRPSCertificado", oENSaludAsegurados.SCTRPSCertificado, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argSCTRSueldo", oENSaludAsegurados.SCTRSueldo, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argSCTRTipoTrabajador", oENSaludAsegurados.SCTRTipoTrabajador, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argTalla", oENSaludAsegurados.Talla, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argTelefono", oENSaludAsegurados.Telefono, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argUbicubi", oENSaludAsegurados.CodigoUbigeo, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argErrorCode", 1, TipoParametro.INT, Direccion.OUTPUT); if (GenericDataAccess.ExecuteNonQuery(oCommand) > 0) { return(true); } else { return(false); } } catch (Exception ex) { throw new Excepciones.ManejoExcepciones(ex); } finally { GenericDataAccess.CerrarConexion(oCommand, null); } }
public ENSaludAsegurados ObtenerUno(string CodigoCliente, string CodigoTitular, string Categoria) { DbCommand oCommand = null; ENSaludAsegurados oENSaludAsegurados = new ENSaludAsegurados(); try { oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "usp_GenSaludAsegurados_sel_uno"); GenericDataAccess.AgregarParametro(oCommand, "@argCodigoCliente", CodigoCliente, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argCodigoTitular", CodigoTitular, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argCategoria", Categoria, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argErrorCode ", 1, TipoParametro.INT, Direccion.OUTPUT); DbDataReader oDataReader = GenericDataAccess.ExecuteReader(oCommand); if (oDataReader.Read()) { oENSaludAsegurados.ApellidoMaterno = oDataReader["ApellidoMaterno"].ToString(); oENSaludAsegurados.ApellidoPaterno = oDataReader["ApellidoPaterno"].ToString(); oENSaludAsegurados.ApellidosNombres = oDataReader["ApellidosNombres"].ToString(); oENSaludAsegurados.CantidadCarnet = Convert.ToInt32(oDataReader["CantidadCarnet"]); oENSaludAsegurados.Categoria = oDataReader["Categoria"].ToString(); oENSaludAsegurados.Celular = oDataReader["Celular"].ToString(); oENSaludAsegurados.CodigoCentroCosto = oDataReader["CodigoCentroCosto"].ToString(); oENSaludAsegurados.CodigoCliente = oDataReader["CodigoCliente"].ToString(); oENSaludAsegurados.CodigoCotizacion = oDataReader["CodigoCotizacion"].ToString(); oENSaludAsegurados.CodigoDocumentoIdentidad = oDataReader["CodigoDocumentoIdentidad"].ToString(); oENSaludAsegurados.CodigoParentesco = oDataReader["CodigoParentesco"].ToString(); oENSaludAsegurados.CodigoSexo = oDataReader["CodigoSexo"].ToString(); oENSaludAsegurados.CodigoTipoTrabajador = oDataReader["CodigoTipoTrabajador"].ToString(); oENSaludAsegurados.CodigoTitular = oDataReader["CodigoTitular"].ToString(); oENSaludAsegurados.CodigoTrabajador = oDataReader["CodigoTrabajador"].ToString(); oENSaludAsegurados.CodigoUbigeo = oDataReader["CodigoUbigeo"].ToString(); if (oENSaludAsegurados.CodigoUbigeo.Length == 0) { oENSaludAsegurados.CodigoUbigeo = "150101"; } oENSaludAsegurados.CodigoDpto = oENSaludAsegurados.CodigoUbigeo.Substring(0, 2); oENSaludAsegurados.CodigoProv = oENSaludAsegurados.CodigoUbigeo.Substring(2, 2); oENSaludAsegurados.CodigoDist = oENSaludAsegurados.CodigoUbigeo.Substring(4, 2); oENSaludAsegurados.Direccion = oDataReader["Direccion"].ToString(); oENSaludAsegurados.Email = oDataReader["Email"].ToString(); oENSaludAsegurados.Estado = oDataReader["Estado"].ToString(); oENSaludAsegurados.FechaAlta = oDataReader["FechaAlta"] == DBNull.Value ? DateTime.Now : Convert.ToDateTime(oDataReader["FechaAlta"]); //oEnListaSaludAsegurados.FechaBaja = DateTime.Parse(oDataReader["FechaBaja"].ToString()); oENSaludAsegurados.FechaBaja = oDataReader["FechaBaja"] == DBNull.Value ? DateTime.Now : Convert.ToDateTime(oDataReader["FechaBaja"]); //oEnListaSaludAsegurados.FechaEmisionCarnet = DateTime.Parse(oDataReader["FechaEmisionCarnet"].ToString()); oENSaludAsegurados.FechaEmisionCarnet = oDataReader["FechaEmisionCarnet"] == DBNull.Value ? DateTime.Now : Convert.ToDateTime(oDataReader["FechaEmisionCarnet"]); //oEnListaSaludAsegurados.FechaFinLatencia = DateTime.Parse(oDataReader["FechaFinLatencia"].ToString()); oENSaludAsegurados.FechaFinLatencia = oDataReader["FechaFinLatencia"] == DBNull.Value ? DateTime.Now : Convert.ToDateTime(oDataReader["FechaFinLatencia"]); //oEnListaSaludAsegurados.FechaInicioLatencia = DateTime.Parse(oDataReader["FechaInicioLatencia"].ToString()); oENSaludAsegurados.FechaInicioLatencia = oDataReader["FechaInicioLatencia"] == DBNull.Value ? DateTime.Now : Convert.ToDateTime(oDataReader["FechaInicioLatencia"]); //oEnListaSaludAsegurados.FechaNacimiento = DateTime.Parse(oDataReader["FechaNacimiento"].ToString()); oENSaludAsegurados.FechaNacimiento = oDataReader["FechaNacimiento"] == DBNull.Value ? DateTime.Now : Convert.ToDateTime(oDataReader["FechaNacimiento"]); //oEnListaSaludAsegurados.FechaReemisionCarnet = DateTime.Parse(oDataReader["FechaReemisionCarnet"].ToString()); oENSaludAsegurados.FechaReemisionCarnet = oDataReader["FechaReemisionCarnet"] == DBNull.Value ? DateTime.Now : Convert.ToDateTime(oDataReader["FechaReemisionCarnet"]); //oENSaludAsegurados.FechaAlta = DateTime.Parse(oDataReader["FechaAlta"].ToString()); //oENSaludAsegurados.FechaBaja = DateTime.Parse(oDataReader["FechaBaja"].ToString()); //oENSaludAsegurados.FechaEmisionCarnet = DateTime.Parse(oDataReader["FechaEmisionCarnet"].ToString()); //oENSaludAsegurados.FechaFinLatencia = DateTime.Parse(oDataReader["FechaFinLatencia"].ToString()); //oENSaludAsegurados.FechaInicioLatencia = DateTime.Parse(oDataReader["FechaInicioLatencia"].ToString()); //oENSaludAsegurados.FechaNacimiento = DateTime.Parse(oDataReader["FechaNacimiento"].ToString()); //oENSaludAsegurados.FechaReemisionCarnet = DateTime.Parse(oDataReader["FechaReemisionCarnet"].ToString()); oENSaludAsegurados.Nombres = oDataReader["Nombres"].ToString(); oENSaludAsegurados.NumeroDocumentoIdentidad = oDataReader["NumeroDocumentoIdentidad"].ToString(); oENSaludAsegurados.Peso = oDataReader["Peso"].ToString(); oENSaludAsegurados.RegAddDate = DateTime.Parse(oDataReader["RegAddDate"].ToString()); oENSaludAsegurados.RegAddUser = oDataReader["RegAddUser"].ToString(); oENSaludAsegurados.RegEdtDate = DateTime.Parse(oDataReader["RegEdtDate"].ToString()); oENSaludAsegurados.RegEdtUser = oDataReader["RegEdtUser"].ToString(); oENSaludAsegurados.SCTREstadoCivil = oDataReader["SCTREstadoCivil"].ToString(); oENSaludAsegurados.SCTRMoneda = oDataReader["SCTRMoneda"].ToString(); oENSaludAsegurados.SCTRPSCertificado = oDataReader["SCTRPSCertificado"].ToString(); oENSaludAsegurados.SCTRSueldo = oDataReader["SCTRSueldo"].ToString(); oENSaludAsegurados.SCTRTipoTrabajador = oDataReader["SCTRTipoTrabajador"].ToString(); oENSaludAsegurados.Talla = oDataReader["Talla"].ToString(); oENSaludAsegurados.Telefono = oDataReader["Telefono"].ToString(); } return(oENSaludAsegurados); } catch (Exception ex) { throw new Exception(); } finally { GenericDataAccess.CerrarConexion(oCommand, null); } }