private void button3_Click(object sender, EventArgs e) { BuscarProfesor form = new BuscarProfesor(); if (String.IsNullOrEmpty(txtCodigoSolicitud.Text)) { MessageBox.Show("Debe seleccionar primero una solicitud aprobada"); return; } var result = form.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { Profesor profesor = form.profesor; bool profesorEnLista = horarios.Exists(p => p.profesor.codigo.Equals(profesor.codigo)); if (profesorEnLista) { MessageBox.Show("El docente ya se encuentra agregado a la lista"); return; } var index = dataJurado.Rows.Add(); dataJurado.Rows[index].Cells[0].Value = "Remover"; dataJurado.Rows[index].Cells[1].Value = profesor.codigo; dataJurado.Rows[index].Cells[2].Value = profesor.nombreCompleto(); dataJurado.Rows[index].Cells[3].Value = false; HorarioSustentacion horario = new HorarioSustentacion(); horario.solicitud = solicitud; horario.profesor = profesor; horarios.Add(horario); } }
public void registrarHorario(HorarioSustentacion horario, SqlConnection cn, SqlTransaction transaccion) { String nombreProcedure = "REGISTRAR_JURADO_SUSTENTACION"; SqlCommand comando = new SqlCommand(nombreProcedure, cn); if (transaccion != null) { comando.Transaction = transaccion; } comando.CommandType = System.Data.CommandType.StoredProcedure; comando.Parameters.AddWithValue("@SOLICITUD_ID", horario.solicitud.id); comando.Parameters.AddWithValue("@PROFESOR_ID", horario.profesor.id); comando.Parameters.AddWithValue("@LUGAR", horario.lugar); comando.Parameters.AddWithValue("@FECHA", horario.fecha); comando.Parameters.AddWithValue("@HORA", horario.hora); comando.Parameters.AddWithValue("@FECHA_FIN", horario.fechaFin); comando.Parameters.AddWithValue("@JEFE", horario.esPresidente); comando.Parameters.AddWithValue("@DURACION", horario.duracion); comando.ExecuteNonQuery(); }
void dataJurado_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == dataJurado.Columns["Remover"].Index) { DialogResult dr = MessageBox.Show("Esta seguro de remover el docente de la lista de jurados?", "Confirmacion de accion", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information); if (dr == DialogResult.Yes) { String codigoAlumno = dataJurado.Rows[e.RowIndex].Cells[1].Value.ToString(); HorarioSustentacion profesorARemover = horarios.Find(p => p.profesor.codigo.Equals(codigoAlumno)); horarios.Remove(profesorARemover); dataJurado.Rows.RemoveAt(e.RowIndex); } } if (e.ColumnIndex == dataJurado.Columns["PresidenteJurado"].Index) { bool seleccionado = !Boolean.Parse(dataJurado.Rows[e.RowIndex].Cells[3].Value.ToString()); dataJurado.Rows[e.RowIndex].Cells[3].Value = seleccionado; String codigoAlumno = dataJurado.Rows[e.RowIndex].Cells[1].Value.ToString(); HorarioSustentacion profesorSeleccionado = horarios.Find(p => p.profesor.codigo.Equals(codigoAlumno)); profesorSeleccionado.esPresidente = seleccionado; } }