private void AlumnosList_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { int currentMouseOverRow = AlumnosList.HitTest(e.X, e.Y).RowIndex; if (currentMouseOverRow >= 0) { AlumnosList.ClearSelection(); AlumnosList.Rows[currentMouseOverRow].Selected = true; mcMenu.Show(AlumnosList, new Point(e.X, e.Y)); } } }
private void pnlData_Load(object sender, EventArgs e) { if (!FromContext) { metroCarrera.SelectedIndex = 0; metroSemestre.SelectedIndex = 0; AddStudent.Enabled = true; Cancel.Enabled = true; DeleteStudent.Enabled = false; Edit.Enabled = false; FirstLoad = false; SetStudents(); A_Matricula.Focus(); AlumnosList.ClearSelection(); FirstLoad = true; } else { metroCarrera.SelectedIndex = 0; metroSemestre.SelectedIndex = 0; AddStudent.Enabled = false; Cancel.Enabled = true; DeleteStudent.Enabled = false; AlumnosList.Enabled = false; A_Matricula.Enabled = false; A_Nombre.Enabled = false; A_ApellidoP.Enabled = false; A_ApellidoM.Enabled = false; metroCarrera.Enabled = false; metroSemestre.Enabled = false; Becario.Enabled = false; ServicioSocial.Enabled = false; Verano.Enabled = false; Invierno.Enabled = false; //AlumnosList.View = View.Details; //SetSingleStudent(int.Parse("1427409")); SetSingleStudent(int.Parse(Matricula_Alumno)); A_Matricula.Focus(); Edit.Enabled = false; } }
private void pnlData_Shown(object sender, EventArgs e) { AlumnosList.ClearSelection(); }
private void DeleteStudent_Click(object sender, EventArgs e) { if (!Edit.Enabled) { DialogResult Result = MetroFramework.MetroMessageBox.Show(this, "Esta seguro que desea eliminar el registro?" , "ADVERTENCIA - CAMBIO EN PROCESO", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (Result == DialogResult.Yes) { student.Matricula = int.Parse(A_Matricula.Text); student.Nombre = A_Nombre.Text; student.Second_Name = A_ApellidoP.Text; student.Second_Name2 = A_ApellidoM.Text; student.Carrera = metroCarrera.Text; student.Semestre = int.Parse(metroSemestre.Text); student.T_Servicio = tipoServicio.ToString(); student.Periodo = periodo.ToString(); DM.DeleteStudent(student); //AlumnosList.DeleteSelectedIndex(false); //StateText.Text = "Alumno Eliminado..."; DialogResult Result2 = MetroFramework.MetroMessageBox.Show(this, "El registro ha sido eliminado con exito." , "ELIMINADO", MessageBoxButtons.OK, MessageBoxIcon.Information); if (Result2 == DialogResult.OK) { A_Matricula.Text = ""; A_Nombre.Text = ""; A_ApellidoP.Text = ""; A_ApellidoM.Text = ""; metroCarrera.SelectedIndex = 0; metroSemestre.SelectedIndex = 0; Becario.Checked = true; Verano.Checked = true; A_Matricula.Focus(); AddStudent.Enabled = true; Cancel.Enabled = true; DeleteStudent.Enabled = false; Edit.Enabled = false; this.swipe(false); } } else if (Result == DialogResult.No) { A_Matricula.Text = ""; A_Nombre.Text = ""; A_ApellidoP.Text = ""; A_ApellidoM.Text = ""; metroCarrera.SelectedIndex = 0; metroSemestre.SelectedIndex = 0; Becario.Checked = true; Verano.Checked = true; A_Matricula.Focus(); AddStudent.Enabled = true; Cancel.Enabled = true; DeleteStudent.Enabled = false; Edit.Enabled = false; } } else { DialogResult Result = MetroFramework.MetroMessageBox.Show(this, "Desea continuar sin aplicar los cambios?" , "ADVERTENCIA - CAMBIO EN PROCESO", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (Result == DialogResult.Yes) { DeleteStudent.Text = "Eliminar"; A_Matricula.Text = ""; A_Nombre.Text = ""; A_ApellidoP.Text = ""; A_ApellidoM.Text = ""; metroCarrera.SelectedIndex = 0; metroSemestre.SelectedIndex = 0; Becario.Checked = true; Verano.Checked = true; A_Matricula.Focus(); AddStudent.Enabled = true; Cancel.Enabled = true; DeleteStudent.Enabled = false; Edit.Enabled = false; AlumnosList.ClearSelection(); mat = null; } if (Result == DialogResult.No) { ////Continue in code } } }