Esempio n. 1
0
        private void btnAddStudent_Click(object sender, EventArgs e)
        {
            // assign status based on radio button
            string status = "";

            if (rdoPostgraduate.Checked)
            {
                status = "POST";
            }
            else if (rdoUndergraduate.Checked)
            {
                status = "UNDER";
            }

            //if statements to prevent blank entries
            if (txtFName.Text != "")
            {
                if (txtLName.Text != "")
                {
                    if (txtPhone.Text != "")
                    {
                        //use student methods AddStudent() to add a student to the list
                        studentMethod.AddStudent(txtFName.Text, txtLName.Text, txtPhone.Text, txtEmail.Text, studentMethod.IdGenerator(), status);
                        //clear page after adding
                        txtFName.Clear();
                        txtLName.Clear();
                        txtPhone.Clear();
                        txtEmail.Clear();
                        rdoPostgraduate.Checked  = false;
                        rdoUndergraduate.Checked = false;

                        MessageBox.Show("Student Added");
                    }
                    else
                    {
                        MessageBox.Show("Please fill in all the fields");
                    }
                }
                else
                {
                    MessageBox.Show("Please fill in all the fields");
                }
            }
            else
            {
                MessageBox.Show("Please fill in all the fields");
            }
        }
Esempio n. 2
0
        private void btnAddStudent_Click(object sender, EventArgs e)
        {
            string status = "";


            if (rdoPostgraduate.Checked)
            {
                status = "POST";
            }
            else if (rdoUndergraduate.Checked)
            {
                status = "UNDER";
            }

            stu.AddStudent(txtFName.Text, txtLName.Text, txtPhone.Text, txtEmail.Text, stu.IdGenerator(), status);
        }