private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 10) { if (flagMenuPpal == 1) { //new CancelacionProfesionalForm(menuPpal, TablaProfesionales.Rows[e.RowIndex][0].ToString(), TablaProfesionales.Rows[e.RowIndex][1].ToString(), TablaProfesionales.Rows[e.RowIndex][2].ToString()); this.Dispose(); return; } ProfesionalClass prof = new ProfesionalClass(); prof.apellido = TablaProfesionales.Rows[e.RowIndex][2].ToString(); prof.nombre = TablaProfesionales.Rows[e.RowIndex][1].ToString(); prof.numeroDocumento = Convert.ToInt32(TablaProfesionales.Rows[e.RowIndex][4].ToString()); prof.matricula = Convert.ToInt32(TablaProfesionales.Rows[e.RowIndex][0].ToString()); prof.direccion = TablaProfesionales.Rows[e.RowIndex][5].ToString(); prof.numeroTelefono = Convert.ToInt32(TablaProfesionales.Rows[e.RowIndex][7].ToString()); prof.mail = TablaProfesionales.Rows[e.RowIndex][6].ToString(); prof.fechaNacimiento = Convert.ToDateTime(TablaProfesionales.Rows[e.RowIndex][8].ToString()); prof.tipoDocumento = TablaProfesionales.Rows[e.RowIndex][3].ToString(); prof.sexo = Convert.ToChar(TablaProfesionales.Rows[e.RowIndex][9].ToString()); if (eliminar) { // Se quiere eliminar Profesional // Conexion al server SqlConnection myConnection = SQL_Methods.IniciarConnection(); SqlCommand comando = new SqlCommand("ORACLE_FANS.baja_profesional", myConnection); comando.CommandType = CommandType.StoredProcedure; comando.Parameters.Add("@mat", SqlDbType.Int).Value = Convert.ToInt32(TablaProfesionales.Rows[e.RowIndex][0].ToString()); comando.ExecuteReader(); MessageBox.Show(TablaProfesionales.Rows[e.RowIndex][2].ToString() + " " + TablaProfesionales.Rows[e.RowIndex][1].ToString() + " ha sido eliminado."); menu.Visible = true; this.Dispose(); } else { // Se quiere modificar un Profesional new AddModProfesional(menu, true, prof); this.Dispose(); } } }
public AddModProfesional(ProfesionalABM sender, bool flag, ProfesionalClass prof) { InitializeComponent(); profesional = prof; nombre.Text = profesional.nombre; apellido.Text = profesional.apellido; numDoc.Text = profesional.numeroDocumento.ToString(); direccion.Text = profesional.direccion; telefono.Text = profesional.numeroTelefono.ToString(); mail.Text = profesional.mail; fecNac.Text = profesional.fechaNacimiento.ToString(); matricula.Text = profesional.matricula.ToString(); tipoDocBox.Text = profesional.tipoDocumento; sexoBox.Text = Convert.ToString(profesional.sexo); matricula.ReadOnly = true; numDoc.ReadOnly = true; fecNac.Enabled = false; abmProfesional = sender; abmProfesional.Visible = false; this.Visible = true; modificar = flag; this.Text = "ABM Profesionales - Modificar Profesional"; cargarEspecialidades(); }