Ejemplo n.º 1
0
        private void BtnManageUpdate_Click(object sender, EventArgs e)
        {
            dgvStudent.DataSource      = bll.GetStudent();
            dgvStudent.BackgroundColor = Color.White;

            try
            {
                DAL.StudentClass studentClass = new DAL.StudentClass(DAL.StudentClass.StudentCode, txtStudentNumber.Text, txtName.Text, txtSurname.Text, txtEmailAddress.Text);
                int x = bll.UpdateStudent(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();
        }
Ejemplo n.º 2
0
        protected void btnManageUpdate(object sender, EventArgs e)
        {
            try
            {
                DAL.StudentClass studentClass = new DAL.StudentClass(DAL.StudentClass.StudentCode, txtStudentNumber.Text, txtName.Text, txtSurname.Text, txtEmailAddress.Text);
                int x = bll.UpdateStudent(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();
        }
Ejemplo n.º 3
0
        private void dgvStudent_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                DAL.StudentClass studclass = new DAL.StudentClass(int.Parse(dgvStudent.SelectedRows[0].Cells[0].Value.ToString()));

                var values = bll.SelectedForUpdateStudent(studclass);

                txtStudentNumber.Text = values.Rows[0].Table.Rows[0].ItemArray[1].ToString();
                txtName.Text          = values.Rows[0].Table.Rows[0].ItemArray[2].ToString();
                txtSurname.Text       = values.Rows[0].Table.Rows[0].ItemArray[3].ToString();
                txtEmailAddress.Text  = values.Rows[0].Table.Rows[0].ItemArray[4].ToString();
            }
#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
            {
            }
        }