예제 #1
0
        public void Load()
        {
            DataTable dt = new ThietBiDao().DSPhong();

            cbMaPhong.DataSource    = dt;
            cbMaPhong.DisplayMember = "MaPhong";
            cbMaPhong.SelectedIndex = -1;
        }
예제 #2
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            int c = new ThietBiDao().addTB(new THIETBI {
                idPhong = Int32.Parse(cbMaPhong.Text), TenThietBi = txtTenTB.Text, SoLuong = Int32.Parse(txtSoLuong.Text)
            });

            if (c > 0)
            {
                MessageBox.Show("Thêm thiết bị thành công!");
                dgvDS.DataSource = new ThietBiDao().DsTBTheoPhong(cbMaPhong.Text);
            }
            else
            {
                MessageBox.Show("Thêm thất bại !");
            }
        }
예제 #3
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            bool c = new ThietBiDao().xoaTB(new THIETBI {
                idPhong = Int32.Parse(cbMaPhong.Text), TenThietBi = txtTenTB.Text, SoLuong = Int32.Parse(txtSoLuong.Text)
            });

            if (c)
            {
                MessageBox.Show("Xóa thiết bị thành công!");
                dgvDS.DataSource = new ThietBiDao().DsTBTheoPhong(cbMaPhong.Text);
                txtTenTB.Text    = "";
                txtSoLuong.Text  = "";
            }
            else
            {
                MessageBox.Show("Xóa thất bại !");
            }
        }