Ejemplo n.º 1
0
        private void UCTheLoai_Load(object sender, EventArgs e)
        {
            DataTable  tb;
            TheLoai_BO tlBO = new TheLoai_BO();

            tb = tlBO.DS();
            dgTheLoai.DataSource = tb;
        }
Ejemplo n.º 2
0
        private void btnThemTL_Click(object sender, EventArgs e)
        {
            TheLoai_DTO thDTO = new TheLoai_DTO();

            thDTO.MaTL  = txtMaTL.Text;
            thDTO.TenTL = txtTenTL.Text;
            TheLoai_BO tlBO   = new TheLoai_BO();
            int        result = 0;

            result = tlBO.Them(thDTO);
            if (result > 0)
            {
                MessageBox.Show("Thêm thông tin thành công");
            }
            else
            {
                MessageBox.Show("Thông tin này đã tồn tại!");
            }
        }
Ejemplo n.º 3
0
        private void btnXoaTL_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Bạn có muốn xóa hay không?", "thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                string MaTL;

                MaTL = txtMaTL.Text;
                TheLoai_BO tlBO   = new TheLoai_BO();
                int        result = tlBO.Xoa(MaTL);
                if (result > 0)
                {
                    MessageBox.Show("Xóa thành công");
                }
                else
                {
                    MessageBox.Show("Xóa không thành công");
                }
            }
        }
Ejemplo n.º 4
0
        private void btnSuaTL_Click(object sender, EventArgs e)
        {
            TheLoai_DTO thDTO = new TheLoai_DTO();

            thDTO.MaTL  = txtMaTL.Text;
            thDTO.TenTL = txtTenTL.Text;

            TheLoai_BO tlBO   = new TheLoai_BO();
            int        result = 0;

            result = tlBO.Sua(thDTO);
            if (result > 0)
            {
                MessageBox.Show("Sửa thành công!");
            }
            else
            {
                MessageBox.Show("Sửa thất bại!");
            }
        }