Ejemplo n.º 1
0
        private Socio getSocio()
        {
            var    dgv    = dgvSocio.CurrentRow;
            string cedula = dgv.Cells[0].Value.ToString();

            return(SociosController.leerI(cedula));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Guarda los nuevos datos de un socio existente
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            //Instancia de administracion
            //Si el usuario no es administrador
            var          permiso = MainContainer.sesion.Id_tipo;
            DialogResult admin   = DialogResult.Yes;

            if (permiso != 1)
            {
                var adminmodule = new Transacciones.Administracion("Guardar nuevo registro");
                adminmodule.ShowDialog();
                admin = adminmodule.resultado;
            }
            if (admin.Equals(DialogResult.Yes))
            {
                bool ban = Validaciones();
                if (ban)
                {
                    int result = -1;
                    try
                    {
                        result = SociosController.modificar(dtpF_asociacion.Value, txtCedula.Text, txtNombres.Text, txtApellidos.Text, txtDirecion.Text, txtTelefono.Text, txtCorreo.Text, rbtnActivo.Checked);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Error durante la insercion de datos", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    if (result > 0)
                    {
                        //dgvSocio.Rows.Clear();
                        var socioMod = SociosController.leerI(txtCedula.Text.Trim());
                        //dgvSocio.Rows.Add(socioMod.Identificacion, socioMod.Nombres, socioMod.Apellidos, socioMod.Direccion, socioMod.Telefono, socioMod.Correo, socioMod.FechaAsociacion);
                        limpiarControles();
                        MessageBox.Show("Socio Agregado Correctamente!", "Registros Actualizados",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                        reload();
                        habilitarEdicion(false);
                    }
                    else
                    {
                        MessageBox.Show("No se ha podido Ingresar", "Error durante la insercion",
                                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Ejemplo n.º 3
0
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     if (validarControles())
     {
         try
         {
             int r;
             //Obteniendo el id de socio
             Socio idSocio = SociosController.leerI(txtCodSocio.Text);
             //Verificar si ya existe un vehiculo con la misma placa
             var vehiculo = VehiculosController.leer(placaMod);
             if (vehiculo == null)
             {
                 r = VehiculosController.agregar(idSocio.Personas.Id_persona, txtPlaca.Text, txtMarca.Text, txtModelo.Text);
             }
             else
             {
                 r = VehiculosController.modificar(vehiculo.Id_Vehiculo, vehiculo.Id_socio, txtPlaca.Text, txtMarca.Text, txtModelo.Text);
             }
             if (r > 0)
             {
                 MessageBox.Show("Vehiculo Agregado Correctamente", "Datos guardados!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 clean();
                 if (!txtPlaca.Enabled || vehiculo != null)
                 {
                     this.Close();
                 }
             }
             else
             {
                 MessageBox.Show("No se ha podido ingresar el registro", "Error Durante la insercion!", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Error Durante la insercion!", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         MessageBox.Show("Quedan campos sin llenar", "Falta Información!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 4
0
        private void dgvSocio_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            //obtener la fila deseada
            string cedula   = dgvSocio.SelectedRows[0].Cells[0].Value.ToString();
            var    socioMod = SociosController.leerI(cedula);

            if (socioMod != null)
            {
                txtNombres.Text       = socioMod.Personas.Nombres;
                txtApellidos.Text     = socioMod.Personas.Apellidos;
                txtCedula.Text        = socioMod.Personas.Identificacion;
                txtTelefono.Text      = socioMod.Personas.Identificacion;
                txtDirecion.Text      = socioMod.Personas.Direccion;
                txtCorreo.Text        = socioMod.Personas.Correo;
                dtpF_asociacion.Value = socioMod.FechaAsociacion;
                //Para?
                //dgvSocio.Rows.Add(socioMod.Identificacion, socioMod.Nombres, socioMod.Apellidos, socioMod.Direccion, socioMod.Telefono, socioMod.Correo, socioMod.FechaAsociacion);
                habilitarEdicion(true);
            }
        }