Пример #1
0
        public List <Categoria> buscarCategoria(string dato)
        {
            try
            {
                SqlConnection cnx = cn.conectar(); //Conexion
                cm = new SqlCommand("Aseguradora", cnx);
                cm.Parameters.AddWithValue("b", 5);
                cm.Parameters.AddWithValue("@idcategoria", "");
                cm.Parameters.AddWithValue("@tipo", dato);

                cm.CommandType = CommandType.StoredProcedure;
                cnx.Open();
                dr             = cm.ExecuteReader();
                listaCategoria = new List <Categoria>();
                while (dr.Read()) //Recorrer cada registro
                {
                    Aseguradora a = new Aseguradora();
                    a.idAseguradora = Convert.ToInt32(dr["idcategoria"].ToString());
                    a.nombreAs      = dr["tipo"].ToString();


                    listaCategoria.Add(ct);
                }
            }
            catch (Exception e)
            {
                e.Message.ToString();
                listaCategoria = null;
            }
            finally
            { cm.Connection.Close(); }
            return(listaCategoria); //regresa lista
        }
Пример #2
0
        public int EditarAseguradora(Aseguradora AS)
        {
            try
            {
                SqlConnection cnx = cn.conectar(); //Conexion
                cm = new SqlCommand("Aseguradora", cnx);
                cm.Parameters.AddWithValue("b", 4);
                cm.Parameters.AddWithValue("@idAseguradora", "");
                cm.Parameters.AddWithValue("@nombreAs", AS);
                cm.Parameters.AddWithValue("@idseguros", "");
                cm.Parameters.AddWithValue("@idProveedor", "");

                cm.CommandType = CommandType.StoredProcedure;
                cnx.Open();
                cm.ExecuteNonQuery();
                indicador = 1;
            }
            catch (Exception e)
            {
                e.Message.ToString();
                indicador = 0;
            }
            finally
            {
                cm.Connection.Close();
            }
            return(indicador);
        }
Пример #3
0
        /// <summary>
        /// AAB (Diciembre 30, 2018)
        /// Agrega una nueva aseguradora y retorna la lista final resultante
        /// </summary>
        /// <param name="aseguradora">Aseguradora agregada</param>
        /// <returns>Lista de aseguradoras</returns>
        public static List <Aseguradora> AgregarAseguradora(Aseguradora aseguradora)
        {
            try
            {
                Aseguradora        AseguradoraAliada = new Aseguradora();
                List <Aseguradora> Aseguradoras      = new List <Aseguradora>();
                Database           db         = DatabaseFactory.CreateDatabase();
                string             sqlCommand = "AgregarAseguradora";
                using (DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand))
                {
                    db.AddInParameter(dbCommand, "nombre", DbType.String, aseguradora.Nombre);
                    db.AddInParameter(dbCommand, "descripcion", DbType.String, aseguradora.Descripcion);
                    db.AddInParameter(dbCommand, "logo", DbType.String, aseguradora.Logo);

                    DataSet ds = db.ExecuteDataSet(dbCommand);
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        AseguradoraAliada = new Aseguradora();
                        AseguradoraAliada.IdAseguradora = int.Parse(ds.Tables[0].Rows[i]["idAseguradora"].ToString());
                        AseguradoraAliada.Nombre        = ds.Tables[0].Rows[i]["nombre"].ToString();
                        AseguradoraAliada.Descripcion   = ds.Tables[0].Rows[i]["descripcion"].ToString();
                        AseguradoraAliada.Logo          = ds.Tables[0].Rows[i]["logo"].ToString();
                        AseguradoraAliada.Polizas       = new List <Poliza>();
                        AseguradoraAliada.Polizas       = PolizaDAO.DarPolizasXidAseguradora(AseguradoraAliada.IdAseguradora);
                        Aseguradoras.Add(AseguradoraAliada);
                    }
                }
                return(Aseguradoras);
            }
            catch (Exception e)
            {
                Util.EventLogger.WriteLog("AseguradoraDAO:AgregarAseguradora: " + e.Message, System.Diagnostics.EventLogEntryType.Error);
                throw e;
            }
        }
 protected void btnCrear_Click(object sender, EventArgs e)
 {
     if (!gestionAseguradora.existeAseg(txtCrearNit.Text))
     {
         Aseguradora nuevaAseguradora = new Aseguradora();
         nuevaAseguradora.NitAseguradora       = txtCrearNit.Text;
         nuevaAseguradora.NombreAseguradora    = txtCrearNombre.Text;
         nuevaAseguradora.DireccionAseguradora = txtCrearDireccion.Text;
         nuevaAseguradora.TelefonoAseguradora  = txtCrearTelefono.Text;
         nuevaAseguradora.CorreoAseguradora    = txtCrearCorreo.Text;
         if (gestionAseguradora.InsertarAseg(nuevaAseguradora))
         {
             ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "swal({title: 'Creado!', text: 'El Proveedor se creo correctamente' ,icon: 'success', type: 'success'}).then(function() {window.location = 'Proveedores.aspx';});", true);
         }
         else
         {
             ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "swal({title: 'Error!',text: 'No se pudo crear el Proveedor, inténtalo más tarde', icon: 'error', timer: 1500,button: false}).then(function() { },function(dismiss) {if (dismiss === 'timer'){console.log('I was closed by the timer')}})", true);
         }
     }
     else
     {
         ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "swal({title: 'Verifica!',text: 'El Nit. del Proveedor ingresado ya existe', icon: 'warning', timer: 2000,button: false}).then(function() { },function(dismiss) {if (dismiss === 'timer'){console.log('I was closed by the timer')}})", true);
         txtCrearNit.Focus();
     }
 }
        public async Task <IActionResult> PutAseguradora([FromRoute] int id, [FromBody] Aseguradora aseguradora)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != aseguradora.Idaseguradora)
            {
                return(BadRequest());
            }

            _context.Entry(aseguradora).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AseguradoraExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         /*--RESTRINGIR AL USUARIO SI ACCEDE A LA PÁGINA SIN LOGUEO--*/
         if (Session["UsuarioAdmin"] == null)
         {
             Response.Redirect("/Aplicacion/Ingresar.aspx");
         }
         else
         {
             /*--REDIRECCIONAR SI NO EXISTE UN PROVEEDOR SELECCIONADO--*/
             if (Request.QueryString["nit"] == null)
             {
                 Response.Redirect("Proveedores.aspx");
             }
             /*--LLENAR LOS CAMPOS CON LOS DATOS DEL PROVEEDOR SELECCIONADO--*/
             else
             {
                 txtEditarNit.Text = Request.QueryString["nit"].ToString();
                 Aseguradora myAseguradora = gestionAseguradora.consultarAseg(txtEditarNit.Text);
                 txtEditarNombre.Text    = myAseguradora.NombreAseguradora;
                 txtEditarDireccion.Text = myAseguradora.DireccionAseguradora;
                 txtEditarTelefono.Text  = myAseguradora.TelefonoAseguradora;
                 txtEditarCorreo.Text    = myAseguradora.CorreoAseguradora;
             }
         }
     }
 }
Пример #7
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nombre,Codigo")] Aseguradora aseguradora)
        {
            if (id != aseguradora.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(aseguradora);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AseguradoraExists(aseguradora.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(aseguradora));
        }
Пример #8
0
        public int insertarAseguradora(Aseguradora a)
        {
            try
            {
                SqlConnection cnx = cn.conectar();                //Conexion

                cm = new SqlCommand("Pr_Aseguradora", cnx);       //Nombre del procedimiento
                cm.Parameters.AddWithValue("@b", 1);              //Valores que toman los parametros
                cm.Parameters.AddWithValue("@idAseguradora", ""); //del procedimiento
                cm.Parameters.AddWithValue("@nombreAs", a.nombreAs);
                cm.Parameters.AddWithValue("@idseguros", a.idseguros);
                cm.Parameters.AddWithValue("@idProveedor", a.idProveedor);

                cm.CommandType = CommandType.StoredProcedure; //Tipo de comando ejecutado
                cnx.Open();                                   //Abrir conexion de BD
                cm.ExecuteNonQuery();                         //Ejecucion de consulta
                indicador = 1;                                //Valor del indicador
            }
            catch (Exception e)
            {
                e.Message.ToString(); //Mostrar mensaje en caso error
                indicador = 0;
            }
            finally
            {
                cm.Connection.Close(); //Cierre de conexion
            }
            return(indicador);
        }
Пример #9
0
        public ActionResult GuardarAseguradora(Aseguradora aseguradora)
        {
            if (!ModelState.IsValid)
            {
                var viewModel = new AseguradoraViewModel(aseguradora)
                {
                    Ciudades = _context.Ciudades.ToList()
                };

                return(View("AseguradoraFormulario", viewModel));
            }


            if (aseguradora.Id == 0)
            {
                _context.Aseguradoras.Add(aseguradora);
            }
            else
            {
                var aseguradoraBD = _context.Aseguradoras.Single(a => a.Id == aseguradora.Id);
                Mapper.Map <Aseguradora, Aseguradora>(aseguradora, aseguradoraBD);
            }

            _context.SaveChanges();

            return(RedirectToAction("Index"));
        }
Пример #10
0
 public void Add(Aseguradora entity)
 {
     entity.Aseguradora_Plan.ToList().ForEach(p =>
     {
         p.UsuarioModificacion = entity.UsuarioModificacion;
         p.FechaModificacion   = entity.FechaModificacion;
     });
     unitOfWork.RepoAseguradora.Add(entity);
 }
Пример #11
0
        private static void ConigurarAsegurador(Aseguradora aseguradora)
        {
            Console.Clear();

            Console.Write("Indique el nombre de la aseguradora:");

            string nombre = Console.ReadLine();

            aseguradora.Name = nombre;
        }
Пример #12
0
        public IHttpActionResult Guardar(Aseguradora aseguradora)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var aseguradoraRepo = _aseguradoraSevice.Guardar(aseguradora);

            return(Ok(aseguradoraRepo));
        }
Пример #13
0
        public static void LoadInsurance(Aseguradora aseg, RdcModel ctxRid, AriClinicContext ctxAri)
        {
            Insurance insurance = new Insurance();

            insurance.InsuranceId = aseg.Id_aseguradora;
            insurance.Name        = aseg.Nom_aseguradora;
            insurance.OftId       = aseg.Id_aseguradora;
            ctxAri.Add(insurance);
            ctxAri.SaveChanges();
        }
        public ActionResult DeleteConfirmed(int id)

        {
            Aseguradora aseguradora = db.Aseguradoras.Find(id);

            db.Aseguradoras.Remove(aseguradora);

            db.SaveChanges();

            return(RedirectToAction("Index"));
        }
 public AseguradoraViewModel(Aseguradora aseguradora)
 {
     Id                = aseguradora.Id;
     Nombre            = aseguradora.Nombre;
     Contacto          = aseguradora.Contacto;
     Ruc               = aseguradora.Ruc;
     Direccion         = aseguradora.Direccion;
     Telefono          = aseguradora.Telefono;
     CorreoElectronico = aseguradora.CorreoElectronico;
     CiudadId          = aseguradora.CiudadId;
 }
Пример #16
0
        public async Task <IActionResult> Create([Bind("Id,Nombre,Codigo")] Aseguradora aseguradora)
        {
            if (ModelState.IsValid)
            {
                _context.Add(aseguradora);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(aseguradora));
        }
Пример #17
0
        public async Task <IActionResult> PostAseguradora([FromBody] Aseguradora aseguradora)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.Aseguradora.Add(aseguradora);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetAseguradora", new { id = aseguradora.Idaseguradora }, aseguradora));
        }
 protected void btnEditar_Click(object sender, EventArgs e)
 {
     /*--VALIDAR SI EXISTE EL PROVEEDOR--*/
     if (!gestionAseguradora.existeAseg(txtEditarNit.Text))
     {
         /*CREAR OBJETO ASEGURADORA*/
         Aseguradora myAseguradora = new Aseguradora();
         myAseguradora.NitAseguradora       = txtEditarNit.Text;
         myAseguradora.NombreAseguradora    = txtEditarNombre.Text;
         myAseguradora.DireccionAseguradora = txtEditarDireccion.Text;
         myAseguradora.TelefonoAseguradora  = txtEditarTelefono.Text;
         myAseguradora.CorreoAseguradora    = txtEditarCorreo.Text;
         string nitActual;
         nitActual = Request.QueryString["nit"];
         /*--VALIDAR SI EL PROVEEDOR HA SIDO ACTUALIZADO EN LA BASE--*/
         if (gestionAseguradora.EditarAseg(myAseguradora, nitActual))
         {
             ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "swal({title: 'Actualizado!', text: 'El Proveedor se actualizo correctamente' ,icon: 'success', type: 'success'}).then(function() {window.location = 'Proveedores.aspx';});", true);
         }
         else
         {
             ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "swal({title: 'Error!',text: 'No se pudo actualizar el Proveedor, inténtalo más tarde', icon: 'error', timer: 2500,button: false}).then(function() { },function(dismiss) {if (dismiss === 'timer'){console.log('I was closed by the timer')}})", true);
         }
         /*--VALIDAR SI EL USUARIO VA A CAMBIAR EL ID--*/
     }
     else if (txtEditarNit.Text == Request.QueryString["nit"].ToString())
     {
         /*CREAR OBJETO ASEGURADORA*/
         Aseguradora myAseguradora = new Aseguradora();
         myAseguradora.NitAseguradora       = txtEditarNit.Text;
         myAseguradora.NombreAseguradora    = txtEditarNombre.Text;
         myAseguradora.DireccionAseguradora = txtEditarDireccion.Text;
         myAseguradora.TelefonoAseguradora  = txtEditarTelefono.Text;
         myAseguradora.CorreoAseguradora    = txtEditarCorreo.Text;
         string nitActual;
         nitActual = Request.QueryString["nit"];
         /*--VALIDAR SI EL PROVEEDOR HA SIDO ACTUALIZADO EN LA BASE--*/
         if (gestionAseguradora.EditarAseg(myAseguradora, nitActual))
         {
             ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "swal({title: 'Actualizado!', text: 'El Proveedor se actualizo correctamente' ,icon: 'success', type: 'success'}).then(function() {window.location = 'Proveedores.aspx';});", true);
         }
         else
         {
             ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "swal({title: 'Error!',text: 'No se pudo crear el Proveedor, inténtalo más tarde', icon: 'error', timer: 2500,button: false}).then(function() { },function(dismiss) {if (dismiss === 'timer'){console.log('I was closed by the timer')}})", true);
         }
     }
     else
     {
         ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "swal({title: 'Verifica!',text: 'El Nit. del Proveedor ingresado ya existe', icon: 'warning', timer: 3000,button: false}).then(function() { },function(dismiss) {if (dismiss === 'timer'){console.log('I was closed by the timer')}})", true);
         txtEditarNit.Focus();
     }
 }
        public async Task <Aseguradora> ObtenerPorId(int id)
        {
            Aseguradora aseguradora = await _contexto.Aseguradoras
                                      .Where(aseguradora => aseguradora.Id == id)
                                      .FirstOrDefaultAsync();

            if (aseguradora is null)
            {
                throw new CodigoErrorHttpException($"No existe la aseguradora con id {id}", HttpStatusCode.NotFound);
            }

            return(aseguradora);
        }
        public ActionResult EditarAseguradora(int id)
        {
            var aseguradoraBD = _context.Aseguradoras.SingleOrDefault(c => c.Id == id);

            if (aseguradoraBD == null)
            {
                return(HttpNotFound());
            }

            var aseguradora = new Aseguradora(aseguradoraBD);

            return(View("AseguradoraFormulario", aseguradora));
        }
        // GET: /Aseguradoras/Details/5

        public ActionResult Details(int?id)

        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Aseguradora aseguradora = db.Aseguradoras.Find(id);

            if (aseguradora == null)
            {
                return(HttpNotFound());
            }
            return(PartialView(aseguradora));
        }
Пример #22
0
        /// <summary>
        /// AAB (Diciembre 30, 2018)
        /// Agrega una aseguradora
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnAgregarAseguradora_Click(object sender, EventArgs e)
        {
            if (txbNombre.Text.Length > 2 && txbDescripcion.Text.Length > 2 && txbLogo.Text.Length > 2)
            {
                Aseguradora AseguradoraAgregar = new Aseguradora();
                AseguradoraAgregar.Nombre      = txbNombre.Text;
                AseguradoraAgregar.Descripcion = txbDescripcion.Text;
                AseguradoraAgregar.Logo        = txbLogo.Text;

                grvAseguradoras.DataSource = ManAseguradora.AgregarAseguradora(AseguradoraAgregar);
                grvAseguradoras.DataBind();

                txbNombre.Text      = "";
                txbDescripcion.Text = "";
                txbLogo.Text        = "";
            }
        }
Пример #23
0
        public async Task <ActionResult> Create(SiniestroVm siniestroVm)
        {
            ValidarSiniestro(siniestroVm);

            Estado estado = await _repositorioEstados.ObtenerPorTipo(TipoEstado.SinValorar);

            Aseguradora aseguradora = await _repositorioAseguradoras.ObtenerPorId(siniestroVm.IdAseguradora);

            Usuario usuarioCreado = await _repositorioUsuarios.ObtenerPorId(siniestroVm.IdUsuarioAlta);

            SujetoAfectado sujetoAfectado = (SujetoAfectado)siniestroVm.IdSujetoAfectado;

            Usuario perito = await _repositorioPeritos.ObtenerPorId(siniestroVm.IdPerito);

            Danio danio = await _repositorioDanios.ObtenerPorId(siniestroVm.IdDanio);

            Siniestro siniestro = new Siniestro()
            {
                Estado              = estado,
                Aseguradora         = aseguradora,
                Direccion           = siniestroVm.Direccion,
                Descripcion         = siniestroVm.Descripcion,
                UsuarioCreado       = usuarioCreado,
                FechaHoraAlta       = DateTime.Now,
                SujetoAfectado      = sujetoAfectado,
                ImpValoracionDanios = 0.00M,
                Perito              = perito,
                Danio = danio
            };

            try
            {
                await _repositorioSiniestros.Guardar(siniestro);
            }
            catch (Exception)
            {
                return(StatusCode(500, "No se ha podido crear el siniestro"));
            }

            return(Ok(true));
        }
        public ActionResult Edit([Bind(Include = "Id,Descripcion,Direccion,Telefono1,Telefono2,Asistencia,IR,IMI")] Aseguradora aseguradora)

        {
            if (ModelState.IsValid)
            {
                if (db.Aseguradoras.FirstOrDefault(x => x.Descripcion == aseguradora.Descripcion && x.Id != aseguradora.Id) != null)
                {
                    ModelState.AddModelError("Descripcion", "La aseguradora que desea ingresar ya existe.");
                }
                else
                {
                    db.Entry(aseguradora).State = EntityState.Modified;

                    db.SaveChanges();

                    return(RedirectToAction("Index"));
                }
            }

            return(View(aseguradora));
        }
Пример #25
0
        private static void RegistrarVenta(Aseguradora aseguradora)
        {
            Console.Clear();

            Console.Write("Indique la cedula del empleado:");

            string dato = Console.ReadLine();

            var vendedor = aseguradora.listaEmpleados.FirstOrDefault(x => x.Cedula.Equals(dato));

            if (vendedor == null)
            {
                Console.WriteLine("Error cedula de empleado no registrada, intente de nuevo:");
                Console.ReadLine();
            }
            else
            {
                Console.WriteLine($"Empleado seleccionado: {vendedor.Nombre}");
                Console.Write("Indique el monto de la poliza: ");

                var montoString = Console.ReadLine();

                if (vendedor.EsCorredor)
                {
                    Corredor tempCorredor = (Corredor)vendedor;
                    float    monto        = float.Parse(montoString);
                    Console.WriteLine($"EL monto total a pagar es {tempCorredor.VenderPoliza(monto)}");
                }
                else
                {
                    if (vendedor.EsCorredor)
                    {
                        Telemercadeo tempCorredor = (Telemercadeo)vendedor;
                        float        monto        = float.Parse(montoString);
                        Console.WriteLine($"EL monto total a pagar es {tempCorredor.VenderPoliza(monto)}");
                    }
                }
                Console.ReadLine();
            }
        }
Пример #26
0
        private static void RegistrarEmpleado(Aseguradora aseguradora)
        {
            Console.Clear();

            Console.Write("Indique el tipo de empleado: (1-Corredor, 2-Telemercadeo");

            string dato = Console.ReadLine();

            Empleado empleado = null;

            if (dato.Equals("1"))
            {
                empleado            = new Corredor();
                empleado.EsCorredor = true;
            }

            else
            {
                empleado = new Telemercadeo();
            }

            Console.Write("Indique la cedula del empleado:");
            dato            = Console.ReadLine();
            empleado.Cedula = dato;

            Console.Write("Indique el nombre del empleado:");
            dato            = Console.ReadLine();
            empleado.Nombre = dato;

            Console.Write("Indique el apellido del empleado:");
            dato = Console.ReadLine();
            empleado.Apellido = dato;

            aseguradora.listaEmpleados.Add(empleado);

            Console.Write("Empleado registrado");
            Console.ReadLine();
        }
Пример #27
0
        public async Task <ActionResult> Edit(int id, SiniestroVm siniestroVm)
        {
            ValidarSiniestro(siniestroVm);

            Estado estado = await _repositorioEstados.ObtenerPorId(siniestroVm.IdEstado);

            Aseguradora aseguradora = await _repositorioAseguradoras.ObtenerPorId(siniestroVm.IdAseguradora);

            SujetoAfectado sujetoAfectado = (SujetoAfectado)siniestroVm.IdSujetoAfectado;

            Usuario perito = await _repositorioPeritos.ObtenerPorId(siniestroVm.IdPerito);

            Danio danio = await _repositorioDanios.ObtenerPorId(siniestroVm.IdDanio);

            Siniestro siniestro = await _repositorioSiniestros.ObtenerPorId(id);

            siniestro.Estado         = estado;
            siniestro.Aseguradora    = aseguradora;
            siniestro.Direccion      = siniestroVm.Direccion;
            siniestro.Descripcion    = siniestroVm.Descripcion;
            siniestro.SujetoAfectado = sujetoAfectado;
            siniestro.Perito         = perito;
            siniestro.Danio          = danio;

            if (siniestroVm.IdEstado == (int)TipoEstado.Valorado)
            {
                siniestro.ImpValoracionDanios = decimal.Parse(siniestroVm.ImpValoracionDanios);
            }
            else
            {
                siniestro.ImpValoracionDanios = 0;
            }

            await _repositorioSiniestros.Actualizar(siniestro);

            return(Ok(true));
        }
Пример #28
0
        public List <Aseguradora> listarAseguradora()
        {
            try
            {
                SqlConnection cnx = cn.conectar(); //Conexion
                cm = new SqlCommand("Pr_Aseguradora", cnx);
                cm.Parameters.AddWithValue("b", 3);
                cm.Parameters.AddWithValue("@idAseguradora", "");
                cm.Parameters.AddWithValue("@nombreAs", "");
                cm.Parameters.AddWithValue("@idseguros", "");
                cm.Parameters.AddWithValue("@idProveedor", "");

                cm.CommandType = CommandType.StoredProcedure;
                cnx.Open();
                dr = cm.ExecuteReader();
                listaAseguradora = new List <Aseguradora>(); //Lista de cuentas
                while (dr.Read())                            //Recorrer cada registro
                {
                    Aseguradora a = new Aseguradora();
                    a.idAseguradora = Convert.ToInt32(dr["idAseguradora"].ToString());
                    a.nombreAs      = dr["nombreAs"].ToString();
                    a.idseguros     = Convert.ToInt32(dr["idseguros"].ToString());
                    a.idProveedor   = Convert.ToInt32(dr["idsProveedor"].ToString());

                    listaAseguradora.Add(a); //Agregar registros encontrados a lista
                }
            }
            catch (Exception e)
            {
                e.Message.ToString();
                listaAseguradora = null;
            }
            finally
            { cm.Connection.Close(); }
            return(listaAseguradora); //regresa lista de registros
        }
Пример #29
0
 /// <summary>
 /// AAB (Diciembre 30, 2018)
 /// Agrega una nueva aseguradora y retorna la lista final resultante
 /// </summary>
 /// <param name="aseguradora">Aseguradora Agregada</param>
 /// <returns>Lista de aseguradoras</returns>
 public List <Aseguradora> AgregarAseguradora(Aseguradora aseguradora)
 {
     return(AseguradoraDAO.AgregarAseguradora(aseguradora));
 }
        public List<Aseguradora> ReportePrybeAseguradora(string FechaInicio, string FechaFin)
        {
            InicializaConexion(); 
            List<Aseguradora> listaAseguradoras = new List<Aseguradora>();

            sqlDataAdapter.SelectCommand = new SqlCommand("ReporteCobranza", sqlConnection);
            sqlDataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure;

            sqlDataAdapter.SelectCommand.Parameters.Add("@ID", SqlDbType.Int).Value = 0;
            sqlDataAdapter.SelectCommand.Parameters["@ID"].Direction = ParameterDirection.Input;

            sqlDataAdapter.SelectCommand.Parameters.Add("@Oper", SqlDbType.Int).Value = 6;
            sqlDataAdapter.SelectCommand.Parameters["@Oper"].Direction = ParameterDirection.Input;

            if (FechaInicio == "")
            {
                sqlDataAdapter.SelectCommand.Parameters.Add("@Fecha_Ini", SqlDbType.DateTime).Value = DBNull.Value;
                sqlDataAdapter.SelectCommand.Parameters["@Fecha_Ini"].Direction = ParameterDirection.Input;
            }
            else
            {

                sqlDataAdapter.SelectCommand.Parameters.Add("@Fecha_Ini", SqlDbType.DateTime).Value = Convert.ToDateTime(FechaInicio + " 00:00");
                sqlDataAdapter.SelectCommand.Parameters["@Fecha_Ini"].Direction = ParameterDirection.Input;
            }

            if (FechaFin == "")
            {

                sqlDataAdapter.SelectCommand.Parameters.Add("@Fecha_Fin", SqlDbType.DateTime).Value = DBNull.Value;
                sqlDataAdapter.SelectCommand.Parameters["@Fecha_Fin"].Direction = ParameterDirection.Input;
            }
            else
            {
                sqlDataAdapter.SelectCommand.Parameters.Add("@Fecha_Fin", SqlDbType.DateTime).Value = Convert.ToDateTime(FechaFin + " 23:59");
                sqlDataAdapter.SelectCommand.Parameters["@Fecha_Fin"].Direction = ParameterDirection.Input;
            }

            sqlDataAdapter.Fill(ds, "ReporteCobranza");

            foreach (DataRow dr in ds.Tables["ReporteCobranza"].Rows)
            {
                Aseguradora tmp = new Aseguradora();

                tmp.Id = Convert.ToString(dr["Id_Aseguradora"]);
                tmp.Nombre = Convert.ToString(dr["Nombre_Aseg"]);
                tmp.Cooperativas = ReportePRYBE(Convert.ToInt32(tmp.Id), FechaInicio, FechaFin);
                listaAseguradoras.Add(tmp);
            }

            FinalizaConexion();
            return listaAseguradoras;

        }
Пример #31
0
 public void Edit(Aseguradora entity)
 {
     unitOfWork.RepoAseguradora.Edit(entity);
 }