public bool modificarAconsejado(Aconsejado a /*, string campoMantenido*/) { try { conn = new MySqlConnection("server=200.16.7.96;user=inf282g3;database=inf282g3;port=3306;password=wWVyTf4lAXvjlZlC;"); cmd = new MySqlCommand(); conn.Open(); cmd.Connection = conn; cmd.CommandText = "MODIFICAR_ACONSEJADO"; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("_Id", a.Codigo.ToString()); cmd.Parameters.AddWithValue("_nombre", a.NombreCompleto); cmd.Parameters.AddWithValue("_fecha", a.FechaNacimiento); cmd.Parameters.AddWithValue("_tel", a.Telefono.ToString()); cmd.Parameters.AddWithValue("_email", a.Correo); cmd.Parameters.AddWithValue("_dir", a.Direccion); cmd.Parameters.AddWithValue("_esp", a.Especialidad); cmd.Parameters.AddWithValue("_cic", a.Ciclo.ToString()); cmd.Parameters.AddWithValue("_obser", a.Observaciones); cmd.Parameters.AddWithValue("_estad", a.Estado); cmd.ExecuteNonQuery(); conn.Close(); return(true); } catch (Exception e) { return(false); } }
private void btnCrearMatch_Click(object sender, EventArgs e) { if (dgvConsejeros.DataSource == null && dgvAconsejados.DataSource == null) { MessageBox.Show("No existen consejeros o aconsejados para elegir", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { if (dgvAconsejados.CurrentRow.DataBoundItem == null) { MessageBox.Show("No se eligió aconsejado", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (dgvConsejeros.CurrentRow.DataBoundItem == null) { MessageBox.Show("No se eligió consejero", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Aconsejado a = (Aconsejado)dgvAconsejados.CurrentRow.DataBoundItem; Consejero c = (Consejero)dgvConsejeros.CurrentRow.DataBoundItem; if (a.Estado == "Inhabilitado") { MessageBox.Show("No se puede elegir un aconsejado inhabilitado", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (c.Estado == "Inhabilitado") { MessageBox.Show("No se puede elegir un consejero inhabilitado", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if ((dtpFechaFin.Value.Day - dtpFechaInicio.Value.Day) == 0) { MessageBox.Show("No se puede elegir la fecha de hoy", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (dtpFechaFin.Value < dtpFechaInicio.Value) { MessageBox.Show("No se puede elegir una fecha anterior a hoy", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Match m = new Match(); m.IdAconsejado = a.Codigo; m.IdConsejero = c.Codigo; m.FechaAsignacion = DateTime.Today; m.FechaFin = dtpFechaFin.Value; m.Estado = "Activo"; if (mLogNeg.registrarMatch(m)) { cLogNeg.modificarConsejero(c); aLogNeg.modificarAconsejado(a); MessageBox.Show("Se estableció el Match exitósamente", "Éxito", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void modificarToolStripMenuItem_Click(object sender, EventArgs e) { frmBuscarAconsejado frmBA = new frmBuscarAconsejado(); if (frmBA.ShowDialog() == DialogResult.OK) { modificarEstado(estado.MODIFICAR_ELIMINAR); a = frmBA.AconsejadoSeleccionado; txtNombreCompleto.Text = a.NombreCompleto; ftpFechaNacimiento.Value = a.FechaNacimiento; txtNumeroTelefono.Text = a.Telefono.ToString(); txtDireccion.Text = a.Direccion; txtCodAlumno.Text = a.Codigo.ToString(); txtEspecialidad.Text = a.Especialidad; numUDCiclo.Value = a.Ciclo; txtCorreo.Text = a.Correo; txtObservaciones.Text = a.Observaciones; //if (a.Estado == "Habilitado") radHabilitado.Checked = true; //else radInhabilitado.Checked = true; } }
public BindingList <Aconsejado> devolverListaPorNombre(string nombre) { BindingList <Aconsejado> lista = new BindingList <Aconsejado>(); try { conn = new MySqlConnection("server=200.16.7.96;user=inf282g3;database=inf282g3;port=3306;password=wWVyTf4lAXvjlZlC;"); cmd = new MySqlCommand(); conn.Open(); cmd.Connection = conn; cmd.CommandText = "LISTAR_ACONSEJADOS_POR_NOMBRE"; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("_Nombre", nombre); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { Aconsejado a = new Aconsejado(); a.Codigo = Int32.Parse(reader.GetString("IdAconsejado")); a.NombreCompleto = reader.GetString("NombreCompleto"); a.FechaNacimiento = reader.GetDateTime("FechaNacimiento"); a.Telefono = Int32.Parse(reader.GetString("Telefono")); a.Correo = reader.GetString("Correo"); a.Direccion = reader.GetString("Direccion"); a.Especialidad = reader.GetString("Especialidad"); a.Ciclo = Int32.Parse(reader.GetString("Ciclo")); a.Observaciones = reader.GetString("Observaciones"); a.Estado = reader.GetString("Estado"); lista.Add(a); } return(lista); } catch (Exception e) { return(null); } }
private void btnAgregar_Click(object sender, EventArgs e) { if (txtNombreCompleto.Text == "") { MessageBox.Show("No se ingresó nombre del Aconsejado", "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else if (txtNombreCompleto.Text.Length > 60) { MessageBox.Show("Límite del campo excedido", "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (16 > (DateTime.Today.Year - ftpFechaNacimiento.Value.Year)) { MessageBox.Show("La fecha de nacimiento introducida no válida", "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } try { Int32.Parse(txtNumeroTelefono.Text); } catch (Exception exp) { MessageBox.Show("No se ingresó número de teléfono correcto", "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtNumeroTelefono.Text.Length > 9) { MessageBox.Show("Límite del campo excedido", "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtDireccion.Text == "") { MessageBox.Show("No se ingresó dirección del Aconsejado", "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else if (txtDireccion.Text.Length > 50) { MessageBox.Show("Límite del campo excedido", "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } try { Int32.Parse(txtCodAlumno.Text); } catch (Exception exp) { MessageBox.Show("Código del Aconsejado mal ingresado", "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if ((Int32.Parse(txtCodAlumno.Text) < 19900000) || (Int32.Parse(txtCodAlumno.Text) > ((DateTime.Today.Year + 1) * 10000))) { MessageBox.Show("Código ingresado no válido", "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtEspecialidad.Text == "") { MessageBox.Show("No se ingresó especialidad del Aconsejado", "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else if (txtEspecialidad.Text.Length > 50) { MessageBox.Show("Límite del campo excedido", "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtObservaciones.Text == "") { MessageBox.Show("No existen observaciones del Aconsejado", "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtCorreo.Text == "") { MessageBox.Show("No se ingresó correo del Aconsejado", "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else if (txtCorreo.Text.Length > 50) { MessageBox.Show("Límite del campo excedido", "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if ((numUDCiclo.Value < 1) & (numUDCiclo.Value > 10)) { MessageBox.Show("Ciclo elegido no válido", "Mensaje de error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } a = new Aconsejado(); a.Codigo = Int32.Parse(txtCodAlumno.Text); a.NombreCompleto = txtNombreCompleto.Text; a.FechaNacimiento = ftpFechaNacimiento.Value; a.Telefono = Int32.Parse(txtNumeroTelefono.Text); a.Correo = txtCorreo.Text; a.Direccion = txtDireccion.Text; a.Especialidad = txtEspecialidad.Text; a.Ciclo = (int)numUDCiclo.Value; a.Observaciones = txtObservaciones.Text; if (aLogicaNeg.registrarAconsejado(a)) { MessageBox.Show("Aconsejado registrado con éxito", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { return; } modificarEstado(estado.GUARDAR); }
public bool modificarAconsejado(Aconsejado a) { return(accesoDatosAconsejado.modificarAconsejado(a)); }
public bool registrarAconsejado(Aconsejado a) { return(accesoDatosAconsejado.registrarAconsejado(a)); }