private void Editar_Click(object sender, EventArgs e) { //buscar registro Registro TempReg = new Registro(); TempReg = DM.GetLastRegistroAddedByMatricula(int.Parse(NotificationsList.GetSubItemsFromSelectedIndex(1))); //modificarlo TempReg.Hora_Salida = Hora_S.Text; //guardar DM.UpdateFromNotification(TempReg); //eliminarlo de la lista DeleteSelectedIndex(false, NotificationsList.SelectedIndices); NotificationsList.DeleteSelectedIndex(false); }
private void DeleteSelectedIndex(bool All, ListView.SelectedIndexCollection Selection) { if (All) { for (int i = Notifiy.Count - 1; i >= 0; i--) { Notifiy.RemoveAt(i); } } else { if (Selection.Count <= 1) { if (((StudentData)Notifiy[Selection[0]]).Registros.Matricula.CompareTo(int.Parse(NotificationsList.GetSubItemsFromSelectedIndex(1))) != 1) { Notifiy.RemoveAt(Selection[0]); } } else { for (int i = Selection.Count - 1; i >= 0; i--) { Notifiy.RemoveAt(Selection[i]); } } } }