public ActionResult Crear(ENSCTRCotizaciones cotizacion, string BotonCotizar, string BotonGrabar) { ENSCTRCotizaciones oENSCTRCotizaciones = null; oENSCTRCotizaciones = new ENSCTRCotizaciones(); if (ModelState.IsValid) { if (BotonCotizar != null) { oENSCTRCotizaciones = Cotizar2(cotizacion); } if (BotonGrabar != null) { if (cotizacion.CodigoCotizacion != null) { LNSCTRCotizaciones.Actualizar(cotizacion); oENSCTRCotizaciones = cotizacion; //return View(cotizacion); } else { LNSCTRCotizaciones.Insertar(cotizacion); oENSCTRCotizaciones = cotizacion; //return View(cotizacion); } return(RedirectToAction("Index", "SCTRCotizacion")); } //aqui } return(View(oENSCTRCotizaciones)); }
public ENSCTRCotizaciones Cotizar2(ENSCTRCotizaciones cotizacion) { ENSCTRCotizaciones oENSCTRCotizaciones = null; if (ModelState.IsValid) { LNSCTRCotizaciones.Cotizar(cotizacion); ViewBag.CodigoDpto = new SelectList(LNUbigeoDpto.ObtenerDpto().ToList(), "CodigoDpto", "DescripcionDpto"); ViewBag.CodigoProv = new SelectList(LNUbigeoProv.ObtenerProv(cotizacion.CodigoDpto).ToList(), "CodigoProv", "DescripcionProv"); ViewBag.CodigoDist = new SelectList(LNUbigeoDist.ObtenerDist(cotizacion.CodigoDpto, cotizacion.CodigoProv).ToList(), "CodigoDist", "DescripcionDist"); ViewBag.CodigoDptoR = new SelectList(LNUbigeoDpto.ObtenerDpto().ToList(), "CodigoDpto", "DescripcionDpto"); ViewBag.CodigoProvR = new SelectList(LNUbigeoProv.ObtenerProv(cotizacion.CodigoDptoR).ToList(), "CodigoProv", "DescripcionProv"); ViewBag.CodigoDistR = new SelectList(LNUbigeoDist.ObtenerDist(cotizacion.CodigoDptoR, cotizacion.CodigoProvR).ToList(), "CodigoDist", "DescripcionDist"); ViewBag.GrupoCIIU = new SelectList(LNCIIUPrincipal.ObtenerCIIUPrincipal().ToList(), "CodigoCIIU", "DescripcionCIIU"); ViewBag.CodigoCIIU = new SelectList(LNCIIUEspecifica.ObtenerCIIUEspecifica(cotizacion.GrupoCIIU).ToList(), "CodigoCIIU", "DescripcionCIIU"); ViewBag.CodigoMoneda = new SelectList(LNMonedas.ObtenerTodos().ToList(), "CodigoMoneda", "DescripcionMoneda"); oENSCTRCotizaciones = new ENSCTRCotizaciones(); // Traer datos de cotizacion y copiar en oENSCTRCotizaciones //Obteniendo propiedades de la clase - declarando lista PropertyInfo[] lstProp = typeof(ENSCTRCotizaciones).GetProperties(); foreach (PropertyInfo oProperty in lstProp) { string NombreAtributo = oProperty.Name; string Tipo = oProperty.PropertyType.Name.ToString(); var val1 = cotizacion.GetType().GetProperty(NombreAtributo).GetValue(cotizacion, null); if (val1 != null) { if (Tipo == "Int32") { int valor = Convert.ToInt32(oProperty.GetValue(cotizacion)); oProperty.SetValue(oENSCTRCotizaciones, valor); } if (Tipo == "String") { string valor = oProperty.GetValue(cotizacion).ToString(); oProperty.SetValue(oENSCTRCotizaciones, valor); } if (Tipo == "DateTime") { DateTime valor = DateTime.Parse(oProperty.GetValue(cotizacion).ToString()); oProperty.SetValue(oENSCTRCotizaciones, valor); } if (Tipo == "Double") { Double valor = Convert.ToDouble(oProperty.GetValue(cotizacion)); oProperty.SetValue(oENSCTRCotizaciones, valor); } } } } // return View(oENSCTRCotizaciones); //return View(cotizacion); return(oENSCTRCotizaciones); }
public ActionResult ValoresIniciales(ENSCTRCotizaciones cotizacion) { ViewBag.CodigoDpto = new SelectList(LNUbigeoDpto.ObtenerDpto().ToList(), "CodigoDpto", "DescripcionDpto"); ViewBag.CodigoProv = new SelectList(LNUbigeoProv.ObtenerProv(cotizacion.CodigoDpto).ToList(), "CodigoProv", "DescripcionProv"); ViewBag.CodigoDist = new SelectList(LNUbigeoDist.ObtenerDist(cotizacion.CodigoDpto, cotizacion.CodigoProv).ToList(), "CodigoDist", "DescripcionDist"); ViewBag.CodigoDptoR = new SelectList(LNUbigeoDpto.ObtenerDpto().ToList(), "CodigoDpto", "DescripcionDpto"); ViewBag.CodigoProvR = new SelectList(LNUbigeoProv.ObtenerProv(cotizacion.CodigoDptoR).ToList(), "CodigoProv", "DescripcionProv"); ViewBag.CodigoDistR = new SelectList(LNUbigeoDist.ObtenerDist(cotizacion.CodigoDptoR, cotizacion.CodigoProvR).ToList(), "CodigoDist", "DescripcionDist"); ViewBag.GrupoCIIU = new SelectList(LNCIIUPrincipal.ObtenerCIIUPrincipal().ToList(), "CodigoCIIU", "DescripcionCIIU"); ViewBag.CodigoCIIU = new SelectList(LNCIIUEspecifica.ObtenerCIIUEspecifica(cotizacion.GrupoCIIU).ToList(), "CodigoCIIU", "DescripcionCIIU"); ViewBag.CodigoMoneda = new SelectList(LNMonedas.ObtenerTodos().ToList(), "CodigoMoneda", "DescripcionMoneda"); return(View()); }
public ActionResult Crear(string id = "") { ENSCTRCotizaciones oENSCTRCotizaciones = null; if (id != "") { oENSCTRCotizaciones = LNSCTRCotizaciones.ObtenerUnoConDetalle(id); ViewBag.CodigoDpto = new SelectList(LNUbigeoDpto.ObtenerDpto().ToList(), "CodigoDpto", "DescripcionDpto", oENSCTRCotizaciones.CodigoDpto); ViewBag.CodigoProv = new SelectList(LNUbigeoProv.ObtenerProv(oENSCTRCotizaciones.CodigoDpto).ToList(), "CodigoProv", "DescripcionProv", oENSCTRCotizaciones.CodigoProv); ViewBag.CodigoDist = new SelectList(LNUbigeoDist.ObtenerDist(oENSCTRCotizaciones.CodigoDpto, oENSCTRCotizaciones.CodigoProv).ToList(), "CodigoDist", "DescripcionDist", oENSCTRCotizaciones.CodigoDist); ViewBag.CodigoDptoR = new SelectList(LNUbigeoDpto.ObtenerDpto().ToList(), "CodigoDpto", "DescripcionDpto", oENSCTRCotizaciones.CodigoDpto); ViewBag.CodigoProvR = new SelectList(LNUbigeoProv.ObtenerProv(oENSCTRCotizaciones.CodigoDpto).ToList(), "CodigoProv", "DescripcionProv", oENSCTRCotizaciones.CodigoProv); ViewBag.CodigoDistR = new SelectList(LNUbigeoDist.ObtenerDist(oENSCTRCotizaciones.CodigoDpto, oENSCTRCotizaciones.CodigoProv).ToList(), "CodigoDist", "DescripcionDist", oENSCTRCotizaciones.CodigoDist); ViewBag.GrupoCIIU = new SelectList(LNCIIUPrincipal.ObtenerCIIUPrincipal().ToList(), "CodigoCIIU", "DescripcionCIIU", oENSCTRCotizaciones.GrupoCIIU); ViewBag.CodigoCIIU = new SelectList(LNCIIUEspecifica.ObtenerCIIUEspecifica(oENSCTRCotizaciones.GrupoCIIU).ToList(), "CodigoCIIU", "DescripcionCIIU", oENSCTRCotizaciones.CodigoCIIU); ViewBag.CodigoMoneda = new SelectList(LNMonedas.ObtenerTodos().ToList(), "CodigoMoneda", "DescripcionMoneda", oENSCTRCotizaciones.CodigoMoneda); //Guardar Codigo Cliente para Emisión System.Web.HttpContext.Current.Session["codigocliente"] = oENSCTRCotizaciones.CodigoCliente; } else { ViewBag.CodigoDpto = new SelectList(LNUbigeoDpto.ObtenerDpto().ToList(), "CodigoDpto", "DescripcionDpto"); ViewBag.CodigoProv = new SelectList(LNUbigeoProv.ObtenerProv("15").ToList(), "CodigoProv", "DescripcionProv"); ViewBag.CodigoDist = new SelectList(LNUbigeoDist.ObtenerDist("15", "01").ToList(), "CodigoDist", "DescripcionDist"); ViewBag.CodigoDptoR = new SelectList(LNUbigeoDpto.ObtenerDpto().ToList(), "CodigoDpto", "DescripcionDpto"); ViewBag.CodigoProvR = new SelectList(LNUbigeoProv.ObtenerProv("15").ToList(), "CodigoProv", "DescripcionProv"); ViewBag.CodigoDistR = new SelectList(LNUbigeoDist.ObtenerDist("15", "01").ToList(), "CodigoDist", "DescripcionDist"); ViewBag.GrupoCIIU = new SelectList(LNCIIUPrincipal.ObtenerCIIUPrincipal().ToList(), "CodigoCIIU", "DescripcionCIIU"); ViewBag.CodigoCIIU = new SelectList(LNCIIUEspecifica.ObtenerCIIUEspecifica("17120").ToList(), "CodigoCIIU", "DescripcionCIIU"); ViewBag.CodigoMoneda = new SelectList(LNMonedas.ObtenerTodos().ToList(), "CodigoMoneda", "DescripcionMoneda"); oENSCTRCotizaciones = new ENSCTRCotizaciones(); oENSCTRCotizaciones.dtm_FechaInicio = DateTime.Now; // valores default para nuevos oENSCTRCotizaciones.dtm_FechaFin = DateTime.Parse("31/12/2021"); // valores default para nuevos //Solo Para pruebas oENSCTRCotizaciones.EmpresaRUC = "20508863475"; oENSCTRCotizaciones.EmpresaNombre = "GLINFOSAC"; oENSCTRCotizaciones.Direccion = "SANTA CRUZ 376"; oENSCTRCotizaciones.DetMontoPlanillaAdm = 20000; oENSCTRCotizaciones.DetMontoPlanillaOpe = 15000; oENSCTRCotizaciones.DetNumeroTrabajadoresAdm = 20; oENSCTRCotizaciones.DetNumeroTrabajadoresOpe = 15; } return(View(oENSCTRCotizaciones)); }
public JsonResult Cotizar1(string empresaruc, string empresanombre, string codigocorredor, string codigociiu, double montooperativos, int numerooperativos, double montoadministrativos, int numeroadministrativos, string codigomoneda, DateTime fechainicio, DateTime fechafin, int tiempocobertura, double porcentajetasa, double porcentajecorredor, string numerocotizacion, string usuario, string ubigeoriesgo, string codigodpto, string codigoprov, string codigodist, string codigodptor, string codigoprovr, string codigodistr, string grupociiu) { ENSCTRCotizaciones cotizacion = new ENSCTRCotizaciones(); cotizacion.EmpresaRUC = empresaruc; cotizacion.EmpresaNombre = empresanombre; cotizacion.CodigoCIIU = codigociiu; cotizacion.DetMontoPlanillaOpe = montooperativos; cotizacion.DetNumeroTrabajadoresOpe = numerooperativos; cotizacion.DetMontoPlanillaAdm = montoadministrativos; cotizacion.DetNumeroTrabajadoresAdm = numeroadministrativos; cotizacion.CodigoMoneda = codigomoneda; cotizacion.FechaInicio = String.Format("{0:yyyyMMdd}", fechainicio); cotizacion.FechaFin = String.Format("{0:yyyyMMdd}", fechafin); cotizacion.TiempoCobertura = tiempocobertura; cotizacion.PorcentajeTasa = porcentajetasa; cotizacion.CodigoUsuarioRegistro = usuario; cotizacion.UbigeoRiesgo = ubigeoriesgo; cotizacion.CodigoDpto = codigodpto; cotizacion.CodigoDptoR = codigodptor; cotizacion.CodigoProv = codigoprov; cotizacion.CodigoProvR = codigoprovr; cotizacion.CodigoDist = codigodist; cotizacion.CodigoDistR = codigodistr; cotizacion.GrupoCIIU = grupociiu; LNSCTRCotizaciones.Cotizar(cotizacion); ENRespuestaCotizacion eNRespuestaCotizacion = new ENRespuestaCotizacion(); eNRespuestaCotizacion.ImportePrimaNeta = Math.Truncate(cotizacion.ImportePrimaNeta * 100) / 100; eNRespuestaCotizacion.ImporteIGV = Math.Truncate(cotizacion.ImporteIGV * 100) / 100; eNRespuestaCotizacion.ImportePrimaTotal = Math.Truncate(cotizacion.ImportePrimaTotal * 100) / 100; eNRespuestaCotizacion.ImporteDerechoEmision = Math.Truncate(cotizacion.ImporteDerechoEmision * 100) / 100; eNRespuestaCotizacion.PorcentajeCorredor = Math.Truncate(cotizacion.PorcentajeCorredor * 100) / 100; eNRespuestaCotizacion.PorcentajeTasa = Math.Truncate(cotizacion.PorcentajeTasa * 100) / 100; if (ModelState.IsValid) { return(Json(eNRespuestaCotizacion, JsonRequestBehavior.AllowGet)); } return(Json(eNRespuestaCotizacion, JsonRequestBehavior.AllowGet)); }
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 static ENSCTRCotizaciones Cotizar(ENSCTRCotizaciones oENSCTRCotizaciones) { return((new ADSCTRCotizaciones()).Cotizar(oENSCTRCotizaciones)); }
public static bool Actualizar(ENSCTRCotizaciones oENSCTRCotizaciones) { return((new ADSCTRCotizaciones()).Actualizar(oENSCTRCotizaciones)); }
public static bool Insertar(ENSCTRCotizaciones oENSCTRCotizaciones) { return((new ADSCTRCotizaciones()).Insertar(oENSCTRCotizaciones)); }