//CAMBIAR ITEM public List <ENSCTRCotizacionesDetalle> ObtenerUno(string CodigoCotizacion, string Item) { DbCommand oCommand = null; List <ENSCTRCotizacionesDetalle> oListaSCTRCotizacionesDetalle = new List <ENSCTRCotizacionesDetalle>(); try { oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "usp_GenSCTRCotizacionesDetalle_sel_uno"); GenericDataAccess.AgregarParametro(oCommand, "@argCodigoCotizacion", CodigoCotizacion, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argItem", Item, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argErrorCode ", 1, TipoParametro.INT, Direccion.OUTPUT); DbDataReader oDataReader = GenericDataAccess.ExecuteReader(oCommand); if (oDataReader.Read()) { ENSCTRCotizacionesDetalle oEnListaSCTRCotizacionesDetalle = new ENSCTRCotizacionesDetalle(); oEnListaSCTRCotizacionesDetalle.CodigoCotizacion = oDataReader["CodigoCotizacion"].ToString(); oEnListaSCTRCotizacionesDetalle.CodigoTipoEmpleado = oDataReader["CodigoTipoEmpleado"].ToString(); oEnListaSCTRCotizacionesDetalle.ImporteDerechoEmision = Convert.ToDouble(oDataReader["ImporteDerechoEmision"]); oEnListaSCTRCotizacionesDetalle.ImporteDerechoEmisionPension = Convert.ToDouble(oDataReader["ImporteDerechoEmisionPension"]); oEnListaSCTRCotizacionesDetalle.ImporteIGV = Convert.ToDouble(oDataReader["ImporteIGV"]); oEnListaSCTRCotizacionesDetalle.ImporteIGVPension = Convert.ToDouble(oDataReader["ImporteIGVPension"]); oEnListaSCTRCotizacionesDetalle.ImportePrimaNeta = Convert.ToDouble(oDataReader["ImportePrimaNeta"]); oEnListaSCTRCotizacionesDetalle.ImportePrimaNetaPension = Convert.ToDouble(oDataReader["ImportePrimaNetaPension"]); oEnListaSCTRCotizacionesDetalle.ImportePrimaTotal = Convert.ToDouble(oDataReader["ImportePrimaTotal"]); oEnListaSCTRCotizacionesDetalle.ImportePrimaTotalPension = Convert.ToDouble(oDataReader["ImportePrimaTotalPension"]); oEnListaSCTRCotizacionesDetalle.Item = oDataReader["Item"].ToString(); oEnListaSCTRCotizacionesDetalle.NumeroTrabajadores = Convert.ToInt32(oDataReader["NumeroTrabajadores"]); oEnListaSCTRCotizacionesDetalle.PorcentajeCorredor = Convert.ToDouble(oDataReader["PorcentajeCorredor"]); oEnListaSCTRCotizacionesDetalle.PorcentajeCorredorPension = Convert.ToDouble(oDataReader["PorcentajeCorredorPension"]); oEnListaSCTRCotizacionesDetalle.PorcentajeCorredorPensionOpe = Convert.ToDouble(oDataReader["PorcentajeCorredorPensionOpe"]); oEnListaSCTRCotizacionesDetalle.PorcentajeTasa = Convert.ToDouble(oDataReader["PorcentajeTasa"]); oEnListaSCTRCotizacionesDetalle.PorcentajeTasaPension = Convert.ToDouble(oDataReader["PorcentajeTasaPension"]); oEnListaSCTRCotizacionesDetalle.PorcentajeTasaPensionOpe = Convert.ToDouble(oDataReader["PorcentajeTasaPensionOpe"]); oListaSCTRCotizacionesDetalle.Add(oEnListaSCTRCotizacionesDetalle); } return(oListaSCTRCotizacionesDetalle); } catch (Exception ex) { throw new Exception(); } finally { GenericDataAccess.CerrarConexion(oCommand, null); } }
public bool Actualizar(ENSCTRCotizacionesDetalle oENSCTRCotizacionesDetalle) { DbCommand oCommand = null; try { oCommand = GenericDataAccess.CreateCommand(dataProviderName, connectionString, "usp_GenSCTRCotizacionesDetalle_upd"); GenericDataAccess.AgregarParametro(oCommand, "@argCodigoCotizacion", oENSCTRCotizacionesDetalle.CodigoCotizacion, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argCodigoTipoEmpleado", oENSCTRCotizacionesDetalle.CodigoTipoEmpleado, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argImporteDerechoEmision", oENSCTRCotizacionesDetalle.ImporteDerechoEmision, TipoParametro.DBL, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argImporteDerechoEmisionPension", oENSCTRCotizacionesDetalle.ImporteDerechoEmisionPension, TipoParametro.DBL, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argImporteIGV", oENSCTRCotizacionesDetalle.ImporteIGV, TipoParametro.DBL, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argImporteIGVPension", oENSCTRCotizacionesDetalle.ImporteIGVPension, TipoParametro.DBL, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argImportePrimaNeta", oENSCTRCotizacionesDetalle.ImportePrimaNeta, TipoParametro.DBL, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argImportePrimaNetaPension", oENSCTRCotizacionesDetalle.ImportePrimaNetaPension, TipoParametro.DBL, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argImportePrimaTotal", oENSCTRCotizacionesDetalle.ImportePrimaTotal, TipoParametro.DBL, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argImportePrimaTotalPension", oENSCTRCotizacionesDetalle.ImportePrimaTotalPension, TipoParametro.DBL, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argItem", oENSCTRCotizacionesDetalle.Item, TipoParametro.STR, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argNumeroTrabajadores", oENSCTRCotizacionesDetalle.NumeroTrabajadores, TipoParametro.INT, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argPorcentajeCorredor", oENSCTRCotizacionesDetalle.PorcentajeCorredor, TipoParametro.DBL, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argPorcentajeCorredorPension", oENSCTRCotizacionesDetalle.PorcentajeCorredorPension, TipoParametro.DBL, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argPorcentajeCorredorPensionOpe", oENSCTRCotizacionesDetalle.PorcentajeCorredorPensionOpe, TipoParametro.DBL, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argPorcentajeTasa", oENSCTRCotizacionesDetalle.PorcentajeTasa, TipoParametro.DBL, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argPorcentajeTasaPension", oENSCTRCotizacionesDetalle.PorcentajeTasaPension, TipoParametro.DBL, Direccion.INPUT); GenericDataAccess.AgregarParametro(oCommand, "@argPorcentajeTasaPensionOpe", oENSCTRCotizacionesDetalle.PorcentajeTasaPensionOpe, TipoParametro.DBL, 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 static bool Actualizar(ENSCTRCotizacionesDetalle oENSCTRCotizacionesDetalle) { return((new ADSCTRCotizacionesDetalle()).Actualizar(oENSCTRCotizacionesDetalle)); }
public static bool Insertar(ENSCTRCotizacionesDetalle oENSCTRCotizacionesDetalle) { return((new ADSCTRCotizacionesDetalle()).Insertar(oENSCTRCotizacionesDetalle)); }
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); } }