private void btnMatricular_Click(object sender, EventArgs e) { string periodo; if (DateTime.Now.Month == 1 || DateTime.Now.Month == 2 || DateTime.Now.Month == 3 || DateTime.Now.Month == 4) { periodo = "I"; } else if (DateTime.Now.Month == 5 || DateTime.Now.Month == 6 || DateTime.Now.Month == 7 || DateTime.Now.Month == 8) { periodo = "II"; } else { periodo = "III"; } Enrollment matricula = new Enrollment(cedula, 1234, periodo, DateTime.Now, "", DateTime.Now); enrollments.AddLast(matricula); eda.writeEnrollmentn(enrollments); StudentCalification sc = new StudentCalification(periodo, Courses.ElementAt(Lista.SelectedIndex).id, cedula, 0, "Reprobado", teachers.ElementAt(cmbProfesor.SelectedIndex)); califications.AddLast(sc); ReportCourse rp = new ReportCourse(0, "", cedula, "Pendiente", DateTime.Now, Courses.ElementAt(Lista.SelectedIndex).id); reports.AddLast(rp); rcda.writeCalification(reports); scda.writeCalification(califications); }
public LinkedList <StudentCalification> readCalification() { LinkedList <StudentCalification> enrollments = new LinkedList <StudentCalification>(); StreamReader sr = new StreamReader(@"Calification.txt"); try { String line = null; line = sr.ReadLine(); while (line != null) { string[] dats = line.Split(','); StudentCalification en = new StudentCalification(dats[2], dats[1], int.Parse(dats[0]), int.Parse(dats[3]), dats[4], int.Parse(dats[5])); enrollments.AddLast(en); line = sr.ReadLine(); } sr.Close(); } catch (Exception e) { Console.WriteLine("Exception: " + e.Message); } finally { sr.Close(); } return(enrollments); }
private void button1_Click(object sender, EventArgs e) { StudentCalification std = myStudentcalifications.ElementAt(seleccion); StudentCalification edited = std; edited.calification = int.Parse(txtNota.Text); edited.state = comboBox1.Text; califications.Find(std).Value = edited; scda.writeCalification(califications); MessageBox.Show("Cambio exitoso"); }