コード例 #1
0
        private void studentSaveButton_Click(object sender, EventArgs e)
        {
            aDatabase = new Database();
            newStudent = new Student(regTextBox.Text, nameTextBox.Text, emailTextBox.Text);
            string msg = aDatabase.AddStudentInDatabase(regTextBox.Text, nameTextBox.Text, emailTextBox.Text);
            MessageBox.Show(msg);


        }
コード例 #2
0
        private void studentSaveButton_Click(object sender, EventArgs e)
        {
            aDatabase = new Database();
            newStudent = new Student(regTextBox.Text, nameTextBox.Text, emailTextBox.Text);
            string msg = aDatabase.AddStudentInDatabase(regTextBox.Text, nameTextBox.Text, emailTextBox.Text);
            MessageBox.Show(msg);

            dataGridView1.DataSource = null;
            dataGridView1.DataSource = aDatabase.fillDataTable("Student");


        }
コード例 #3
0
        public string Addstudent(Student StudentObj)
        {
            if (aDictionary.Count < 15)
            {
                
                try
                {
                    string reg = StudentObj.RegNo;
                    aDictionary.Add(reg, StudentObj);
                    return "Successfully regestered";
                }
                catch (ArgumentException exception)
                {
                    return "Already Exists";
                    
                }

            }
            else
            {
                return "Maximum no of students (" + MAX_NO_OF_STUDENTS + ") has been saved. So, provided student information is not saved.";

            }
        }