Пример #1
0
        public frmNXB()
        {
            InitializeComponent();
            nxbBUS nxbB = new nxbBUS();

            grvNXB.DataSource          = nxbB.getData();
            grvNXB.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            disable();
            btnLuu.Enabled = false;
        }
Пример #2
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            disable();
            NXB    nxb  = new NXB(txtMaNXB.Text, txtTenNXB.Text, txtMoTa.Text);
            nxbBUS nxbB = new nxbBUS();

            if (check)
            {
                if (nxbB.CheckID(txtMaNXB.Text))
                {
                    MessageBox.Show(txtMaNXB.Text + " đã tồn tại!!!");
                }
                else
                {
                    nxbB.addNXB(nxb);
                }
            }
            else
            {
                nxbB.edit(nxb);
            }
            grvNXB.DataSource = nxbB.getData();
        }