Ejemplo n.º 1
0
 private void PictureBox2_Click(object sender, EventArgs e)
 {
     if (txtc.Text.Trim() != "" && dtp.Text.Trim() != "" && txtg.Text.Trim() != "" && txta.Text.Trim() != "" && cmb4.Text.Trim() != "")
     {
         Conection.Conectar();
         string     actualizar = "UPDATE Asistencias SET Codigo_asistencia=@c, Fecha_asistencia=@f, Codigo_grado=@g, Carnet=@a, Control_asistencia=@ca WHERE  Codigo_asistencia=@c";
         SqlCommand cmd2       = new SqlCommand(actualizar, Conection.Conectar());
         cmd2.Parameters.AddWithValue("@c", txtc.Text);
         cmd2.Parameters.Add(new SqlParameter("@f", SqlDbType.Date));
         cmd2.Parameters["@f"].Value = dtp.Text;
         cmd2.Parameters.AddWithValue("@g", txtg.Text);
         cmd2.Parameters.AddWithValue("@a", txta.Text);
         cmd2.Parameters.AddWithValue("@ca", cmb4.Text);
         cmd2.ExecuteNonQuery();
         MessageBox.Show("Registro modificdo", "HECHO", MessageBoxButtons.OK, MessageBoxIcon.Information);
         limpiar();
         dgv.DataSource = llenar_grid();
     }
     else
     {
         MessageBox.Show("Campos Vacios", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 2
0
 private void PictureBox1_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtc.Text.Trim() != "" && txtn.Text.Trim() != "" && txta.Text.Trim() != "" && txtce.Text.Trim() != "" && txtu.Text.Trim() != "" && txtcl.Text.Trim() != "")
         {
             if (email_bien_escrito(txtce.Text))
             {
                 Conection.Conectar();
                 string     insertar = "INSERT INTO Administradores(Codigo_administrador, Nombre_administrador, Apellido_administrador, Correo_administrador, Alias_administrador, Clave_administrador) VALUES (@c, @n, @a, @ce, @u, @cl)";
                 SqlCommand cmd1     = new SqlCommand(insertar, Conection.Conectar());
                 cmd1.Parameters.AddWithValue("@c", txtc.Text);
                 cmd1.Parameters.AddWithValue("@n", txtn.Text);
                 cmd1.Parameters.AddWithValue("@a", txta.Text);
                 cmd1.Parameters.AddWithValue("@ce", txtce.Text);
                 cmd1.Parameters.AddWithValue("@u", txtu.Text);
                 cmd1.Parameters.AddWithValue("@cl", txtcl.Text);
                 cmd1.ExecuteNonQuery();
                 MessageBox.Show("Registro agregado", "HECHO", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 limpiar();
                 dgv.DataSource = llenar_grid();
             }
             else
             {
                 MessageBox.Show("Ingrese un correo electronico valido", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             MessageBox.Show("Campos Vacios", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     catch (Exception error)
     {
         MessageBox.Show("Algo salio mal", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 3
0
 private void PictureBox2_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtc.Text.Trim() != "" && txtn.Text.Trim() != "" && txta.Text.Trim() != "" && txtce.Text.Trim() != "" && txtu.Text.Trim() != "" && txtcl.Text.Trim() != "")
         {
             if (email_bien_escrito(txtce.Text))
             {
                 Conection.Conectar();
                 string     actualizar = "UPDATE Maestros SET Codigo_maestro=@c, Nombre_maestro=@n, Apellido_maestro=@a, Correo_maestro=@ce, Alias_maestro=@u, Clave_maestro=@cl WHERE Codigo_maestro=@c";
                 SqlCommand cmd2       = new SqlCommand(actualizar, Conection.Conectar());
                 cmd2.Parameters.AddWithValue("@c", txtc.Text);
                 cmd2.Parameters.AddWithValue("@n", txtn.Text);
                 cmd2.Parameters.AddWithValue("@a", txta.Text);
                 cmd2.Parameters.AddWithValue("@ce", txtce.Text);
                 cmd2.Parameters.AddWithValue("@u", txtu.Text);
                 cmd2.Parameters.AddWithValue("@cl", txtcl.Text);
                 cmd2.ExecuteNonQuery();
                 MessageBox.Show("Registro modificdo", "HECHO", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 limpiar();
                 dgv.DataSource = llenar_grid();
             }
             else
             {
                 MessageBox.Show("Ingrese un correo electronico valido", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             MessageBox.Show("Campos Vacios", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     catch (Exception error)
     {
         MessageBox.Show("Algo salio mal", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }