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 <ReportCourse> readCalification() { LinkedList <ReportCourse> enrollments = new LinkedList <ReportCourse>(); StreamReader sr = new StreamReader(@"Report.txt"); try { String line = null; line = sr.ReadLine(); while (line != null) { string[] dats = line.Split(','); ReportCourse en = new ReportCourse(int.Parse(dats[0]), dats[1], int.Parse(dats[2]), dats[3], DateTime.Parse(dats[4]), 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) { if (cmbPendiente.SelectedIndex > -1) { ReportCourse edited = Myreports.ElementAt(cmbPendiente.SelectedIndex); edited.Description = txtDesc.Text; edited.State = "Aplicada"; reports.Find(Myreports.ElementAt(cmbPendiente.SelectedIndex)).Value = edited; rcda.writeCalification(reports); MessageBox.Show("Evaluación aplicada"); } else { MessageBox.Show("Seleccione una evaluacion para continuar"); } }