Beispiel #1
0
        private void BtnManageAdd_Click(object sender, EventArgs e)
        {
            try
            {
                DAL.StudentClass studentClass = new DAL.StudentClass(txtStudentNumber.Text, txtName.Text, txtSurname.Text, txtEmailAddress.Text);
                int x = bll.AddStudent(studentClass);

                if (x > 0)
                {
                    txtStudentNumber.Clear();
                    txtName.Clear();
                    txtSurname.Clear();
                    txtEmailAddress.Clear();
                }
                else
                {
                    MessageBox.Show("Please input valid data.");
                }
            }
#pragma warning disable CS0168 // The variable 'b' is declared but never used
            catch (Exception b)
#pragma warning restore CS0168 // The variable 'b' is declared but never used
            {
                MessageBox.Show("Please input valid data.");
            }
            dgvStudent.DataSource = bll.GetStudent();
        }
Beispiel #2
0
        protected void btnManageAdd(object sender, EventArgs e)
        {
            try
            {
                DAL.StudentClass studentClass = new DAL.StudentClass(txtStudentNumber.Text, txtName.Text, txtSurname.Text, txtEmailAddress.Text);
                int x = bll.AddStudent(studentClass);

                if (x > 0)
                {
                    txtStudentNumber.Text = "";
                    txtName.Text          = "";
                    txtSurname.Text       = "";
                    txtEmailAddress.Text  = "";
                }
                else
                {
                }
            }
#pragma warning disable CS0168 // The variable 'b' is declared but never used
            catch (Exception b)
#pragma warning restore CS0168 // The variable 'b' is declared but never used
            {
            }
            dgStudent.DataSource = bll.GetStudent();
            dgStudent.DataBind();
        }