Exemple #1
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            string bau = "";

            if (rbtnSi.Text == "Si")
            {
                bau = "Si";
            }
            if (rbtnSi.Text == "No")
            {
                bau = "No";
            }
            try
            {
                ConexionDB.enlace();
                comando = new SqlCommand("update Miembro set nombre_miembro ='" + txtNombre.Text + "', apellido_miembro = '" + txtApellido.Text + "', fecha = '" + datetime_Fecha.Text + "', correo = '" + txtCorreo.Text + "', direccion_miembro = '" + txtdireccion.Text + "', genero = '" + cmbGenero.SelectedIndex + "', estado = '" + cmbUsuario.SelectedIndex + "', observacion = '" + txtObs.Text + "', telefono = '" + txtTelefono.Text + "', bautizo = '" + bau + "', id_dias = '" + cmbDias.SelectedIndex + "' where identidad = '" + txtIdentidad.Text + "'", ConexionDB.enlace());
                if (comando.ExecuteNonQuery() > 0)
                {
                    MessageBox.Show("Miembro Modificado Exitosamente\nContacto #: " + txtIdentidad.Text + "\nNombre completo: " + txtNombre.Text + " " + txtApellido.Text, "Modificacion Exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Limpiar();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ocurrio un Problema: " + ex.ToString(), "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                ConexionDB.enlace().Close();
            }
        }
Exemple #2
0
 private void btneliminar_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("El Contacto #: " + txtIdentidad.Text + "\nNombre Completo: " + txtNombre.Text + " " + txtApellido.Text + "\n¿Desea eliminar el contacto?", "Eliminar Miembro", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         ConexionDB.enlace();
         comando = new SqlCommand("DELETE FROM Miembro where identidad ='" + txtIdentidad.Text + "'", ConexionDB.enlace());
         comando.ExecuteNonQuery();
         Limpiar();
     }
 }
Exemple #3
0
        public void SeleccionTalento(ComboBox t)
        {
            conectar = ConexionDB.enlace();
            comando  = new SqlCommand(string.Format("SELECT descripcion_talento FROM Tipo_talento"), conectar);
            dataleer = comando.ExecuteReader();

            while (dataleer.Read())
            {
                t.Items.Add(dataleer[0].ToString());
            }
            conectar.Close();
            t.Items.Insert(0, "Seleccione el Talento");
            t.SelectedIndex = 0;
            return;
        }
Exemple #4
0
 public bool guardar_Usuario()
 {
     conectar = ConexionDB.enlace();
     comando  = new SqlCommand(string.Format("INSERT INTO Miembro (identidad, nombre_miembro, apellido_miembro, fecha, correo, direccion_miembro, genero, estado, observacion, telefono, bautizo, id_dias)" +
                                             " values ('" + identidad + "', '" + Nombre_Persona + "', '" + Apellido_Persona + "', '" + fecha + "', '" + correo + "', '" + direccion + "', '" + genero + "'," +
                                             " '" + estado + "', '" + observacion + "', '" + telefono + "', '" + bautizo + "', " + disponibilidad + ")", identidad, Nombre_Persona, Apellido_Persona, fecha, correo, direccion, genero, estado, observacion, telefono, bautizo, disponibilidad), conectar);
     if (comando.ExecuteNonQuery() > 0)
     {
         conectar.Close();
         return(true);
     }
     else
     {
         conectar.Close();
         return(false);
     }
 }
Exemple #5
0
 public void Buscar_Miembro(string query, string valor)
 {
     try
     {
         dtgUsuario.Rows.Clear();
         ConexionDB.enlace();
         comando   = new SqlCommand(query + valor, ConexionDB.enlace());
         adapter   = new SqlDataAdapter(comando);
         datatabla = new DataTable();
         adapter.Fill(datatabla);
         if (datatabla.Rows.Count > 0)
         {
             for (int i = 0; i < datatabla.Rows.Count; i++)
             {
                 string id = datatabla.Rows[i][12].ToString();
                 string Nombre_Completo = datatabla.Rows[i][1].ToString() + " " + datatabla.Rows[i][2].ToString();
                 string fecha           = datatabla.Rows[i][3].ToString();
                 string direccion       = datatabla.Rows[i][5].ToString();
                 cmbGenero.SelectedIndex = int.Parse(datatabla.Rows[i][6].ToString());
                 string genero   = cmbGenero.Text;
                 string telefono = datatabla.Rows[i][9].ToString();
                 cmbEstado.SelectedIndex = int.Parse(datatabla.Rows[i][7].ToString());
                 string estado  = cmbEstado.Text;
                 string bautizo = datatabla.Rows[i][10].ToString();
                 cmbDias.SelectedIndex = int.Parse(datatabla.Rows[i][11].ToString());
                 string disponibilidad = cmbDias.Text;
                 string obs            = datatabla.Rows[i][8].ToString();
                 dtgUsuario.Rows.Add(id, Nombre_Completo, fecha, direccion, genero, telefono, estado, bautizo, disponibilidad, obs);
             }
             limpiar();
         }
         else
         {
             MessageBox.Show("No se Encontro");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         ConexionDB.enlace().Close();
     }
 }
Exemple #6
0
 public void Buscar_Usuario(string id)
 {
     ConexionDB.enlace();
     comando = new SqlCommand("SELECT * FROM Miembro where identidad = @id_user", ConexionDB.enlace());
     comando.Parameters.AddWithValue("id_user", id);
     adapter   = new SqlDataAdapter(comando);
     datatabla = new DataTable();
     adapter.Fill(datatabla);
     if (datatabla.Rows.Count == 1)
     {
         txtNombre.Text           = datatabla.Rows[0][1].ToString();
         txtApellido.Text         = datatabla.Rows[0][2].ToString();
         datetime_Fecha.Text      = datatabla.Rows[0][3].ToString();
         cmbGenero.SelectedIndex  = int.Parse(datatabla.Rows[0][6].ToString());
         txtdireccion.Text        = datatabla.Rows[0][5].ToString();
         txtCorreo.Text           = datatabla.Rows[0][4].ToString();
         txtTelefono.Text         = datatabla.Rows[0][9].ToString();
         cmbUsuario.SelectedIndex = 1;
         cmbEstado.SelectedIndex  = int.Parse(datatabla.Rows[0][7].ToString());
         if (datatabla.Rows[0][10].ToString() == "Si")
         {
             rbtnSi.Checked = true;
         }
         else
         {
             rbtnNo.Checked = true;
         }
         cmbDias.SelectedIndex = int.Parse(datatabla.Rows[0][11].ToString());
         txtObs.Text           = datatabla.Rows[0][8].ToString();
         gbDatos.Enabled       = true;
         gbInfo.Enabled        = true;
         btneliminar.Enabled   = true;
         btnGuardar.Enabled    = true;
         txtIdentidad.Enabled  = false;
         btnBuscar.Enabled     = false;
     }
     ConexionDB.enlace().Close();
 }