Beispiel #1
0
        private void btnThemMoi_Click(object sender, EventArgs e)
        {
            if (txtMaSV.Text == "")
            {
                MessageBox.Show("Rỗng", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (txtHoten.Text == "")
            {
                MessageBox.Show("Rỗng", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (txtDiaChi.Text == "")
            {
                MessageBox.Show("Rỗng", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            BAL_SINHVIEN bal_sv   = new BAL_SINHVIEN();
            int          masv     = int.Parse(txtMaSV.Text);
            string       hoten    = txtHoten.Text;
            string       diachi   = txtDiaChi.Text;
            DateTime     ngaysinh = dtpNgaySinh.Value;
            int          malop    = int.Parse(cbLop.SelectedValue.ToString());
            //txtHoten.Text = malop.ToString();
            bool result = bal_sv.Them(new SINHVIEN(masv, hoten, diachi, ngaysinh, malop));

            if (result)
            {
                LoadDataGridView();
                MessageBox.Show("Thành Công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);

                return;
            }
            MessageBox.Show("Thất Bại", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }