public bool insertar(EntidadAlumnos entidadAlumnos) { try { Conexion.getConexion().Open(); cmd = Conexion.getConexion().CreateCommand(); cmd.CommandText = checkIfAlumnoExisteQuery; cmd.Parameters.AddWithValue("@Matriculas_Id", entidadAlumnos.matricula.matricula); Object res = cmd.ExecuteScalar(); if (res != null) { MessageBox.Show("Matricula encontrada en nuestra BD, por favor crear matricula nueva!!"); } else { cmd = Conexion.getConexion().CreateCommand(); cmd.CommandText = matricualId; cmd.Parameters.AddWithValue("@Nombre", 1420150); MySqlDataReader idM = cmd.ExecuteReader(); if (idM.Read()) { int id_M = Convert.ToInt32(idM["Id"]); idM.Close(); cmd = Conexion.getConexion().CreateCommand(); cmd.CommandText = direccionId; cmd.Parameters.AddWithValue("@Id", 1); MySqlDataReader idD = cmd.ExecuteReader(); if (idD.Read()) { int id_D = Convert.ToInt32(idD["Id"]); idD.Close(); MessageBox.Show(id_M.ToString()); MessageBox.Show(id_D.ToString()); return true; } } } } catch (Exception ex) { MessageBox.Show("No se ha podido insertar el Admin: " + ex.ToString()); } finally { Conexion.getConexionClosed(); } return false; }
public bool insertar(EntidadAlumnos entidadAlumnos) { try { Conexion.getConexion().Open(); cmd = Conexion.getConexion().CreateCommand(); cmd.CommandText = checkIfAlumnoExisteQuery; cmd.Parameters.AddWithValue("@Matriculas_Id", entidadAlumnos.matricula.matricula); Object res = cmd.ExecuteScalar(); if (res != null) { MessageBox.Show("Matricula encontrada en nuestra BD, por favor crear matricula nueva!!"); } else { cmd = Conexion.getConexion().CreateCommand(); cmd.CommandText = matricualId; cmd.Parameters.AddWithValue("@Nombre", 1420150); MySqlDataReader idM = cmd.ExecuteReader(); if (idM.Read()) { int id_M = Convert.ToInt32(idM["Id"]); idM.Close(); cmd = Conexion.getConexion().CreateCommand(); cmd.CommandText = direccionId; cmd.Parameters.AddWithValue("@Id", 1); MySqlDataReader idD = cmd.ExecuteReader(); if (idD.Read()) { int id_D = Convert.ToInt32(idD["Id"]); idD.Close(); MessageBox.Show(id_M.ToString()); MessageBox.Show(id_D.ToString()); return(true); } } } } catch (Exception ex) { MessageBox.Show("No se ha podido insertar el Admin: " + ex.ToString()); } finally { Conexion.getConexionClosed(); } return(false); }
private void btnAgregar_Click(object sender, EventArgs e) { entidadDireccion = new EntidadDireccion(); entidadDireccion.direccion = txtDireccion.Text; entidadDireccion.estado = txtEstado.Text; entidadDireccion.pais = txtPais.Text; entidadAlumnos = new EntidadAlumnos(); entidadAlumnos.apellidos = txtApellidos.Text; entidadAlumnos.carrera = txtCarrera.Text; entidadAlumnos.direccion = entidadDireccion; MessageBox.Show(cbCarreras.ToString()); }
private void btnAgregar_Click(object sender, EventArgs e) { entidadDireccion = new EntidadDireccion(); entidadDireccion.direccion = txtDireccion.Text; entidadDireccion.estado = txtEstado.Text; entidadDireccion.pais = txtPais.Text; entidadAlumnos = new EntidadAlumnos(); entidadAlumnos.apellidos = txtApellidos.Text; entidadAlumnos.carrera = txtCarrera.Text; entidadAlumnos.direccion = entidadDireccion; MessageBox.Show(cbCarreras.ToString()); }
public bool insertar(EntidadAlumnos entidadAlumnos) { return modeloAlumnos.insertar(entidadAlumnos); }
public bool actualizar(EntidadAlumnos entidadAlumnos, int id) { return modeloAlumnos.actualizar(entidadAlumnos, id); }
public bool actualizar(EntidadAlumnos entidadAlumnos, int id) { return false; }
public bool actualizar(EntidadAlumnos entidadAlumnos, int id) { return(modeloAlumnos.actualizar(entidadAlumnos, id)); }
public bool insertar(EntidadAlumnos entidadAlumnos) { return(modeloAlumnos.insertar(entidadAlumnos)); }
public bool actualizar(EntidadAlumnos entidadAlumnos, int id) { return(false); }