예제 #1
0
 public static bool addStudent(Student newStudent)
 {
     try
     {
         using (var writer = new StreamWriter(operations.FilePath, true))
         {
             writer.WriteLine(newStudent);
         }
         return true;
     } catch(Exception)
     {
         return false;
     }
 }
예제 #2
0
        protected void buttonClick_Click(object sender, EventArgs e)
        {
            var addInd = new Student(
                    this.nameText.Text,
                    this.facultyText.Text,
                    int.Parse(this.numberText.Text),
                    int.Parse(this.averageText.Text)

                );

            if(operations.addStudent(addInd))
            {
                this.nameText.Text = string.Empty;
                this.facultyText.Text = string.Empty;
                this.numberText.Text = string.Empty;
                this.averageText.Text = string.Empty;
                this.messageAdd.Text = "Successfuly added Data";
            }
        }