Esempio n. 1
0
 private void LoadStudent(Student s)
 {
     cbName.Text = s.Name;
     cbCourse.Text = s.Course;
     cbYear.Text = s.Year.ToString();
     cbTerm.Text = s.Term;
     txtGrade.Text = s.GradeValue.ToString();
 }
Esempio n. 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            var student = new Student(cbName.Text, cbCourse.Text, Convert.ToInt16(cbYear.Text), cbTerm.Text, Convert.ToDouble(txtGrade.Text));

            if (editIndex == -1)
                ParentFrm.AddStudent(student);
            else
                ParentFrm.EditStudent(student, editIndex);

            Close();
        }
Esempio n. 3
0
        public void LoadFromTxt(string path = @"StudGradesDB.txt")
        {
            var textDB = File.ReadAllText(path).Trim().Split('\n');

            foreach (var line in textDB)
            {
                var ls = line.Replace("\r", string.Empty).Split('|');

                var s  = new Student
                {
                    Name = ls[0],
                    Course = ls[1],
                    Year = Convert.ToInt16(ls[2]),
                    Term = ls[3],
                    GradeValue = Convert.ToDouble(ls[4])
                };

                AddStudent(s);
            }
        }
Esempio n. 4
0
 public void EditStudent(Student s, int i)
 {
     students[i] = s;
     RefreshStudentList();
     SaveToText();
 }
Esempio n. 5
0
 public void AddStudent(Student s)
 {
     students.Add(s);
     RefreshStudentList();
     SaveToText();
 }