public int UpThietBi(BEL_ThietBi equip)
        {
            string sql    = "UPDATE dbo.ThietBiPhong SET TenTB = @tenTB , SoLuong = @soluong , MaLoaiPhong = @maLoaiPhong WHERE MaTB = @maTB";
            int    result = DataProvider.Instance.ExecuteNonQuery(sql, new object[] { equip.TenTB, equip.Soluong, equip.MaLoaiPhong, equip.MaTB });

            return(result);
        }
        public int DelThietBi(BEL_ThietBi equip)
        {
            string sql    = "UPDATE dbo.ThietBiPhong SET TrangThai = 'No' WHERE MaTB = @maTB";
            int    result = DataProvider.Instance.ExecuteNonQuery(sql, new object[] { equip.MaTB });

            return(result);
        }
        public int InsertThietBi(BEL_ThietBi equip)
        {
            string sql    = "INSERT INTO [dbo].[ThietBiPhong] VALUES( @maTB , @tenTB , @soluong , @maLoaiPhong , @trangthai )";
            int    result = DataProvider.Instance.ExecuteNonQuery(sql, new object[] { equip.MaTB, equip.TenTB, equip.Soluong, equip.MaLoaiPhong, "Yes" });

            return(result);
        }
        public List <BEL_ThietBi> LoadThietBi()
        {
            List <BEL_ThietBi> list = new List <BEL_ThietBi>();
            DataTable          Data = DAL_ThietBi.Instance.LoadThietBi();

            foreach (DataRow row in Data.Rows)
            {
                BEL_ThietBi item = new BEL_ThietBi(row);
                list.Add(item);
            }
            return(list);
        }
示例#5
0
        private void btnTBXoa_Click(object sender, EventArgs e)
        {
            BEL_ThietBi tb = new BEL_ThietBi(txtMaTB.Text, txttenTB.Text, txtsoluong.Text, txtmaloaiphong.Text);

            if (BAL_ThietBi.Instance.DelThietBi(tb))
            {
                LoadThietBi();
                MessageBox.Show("Xóa thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                MessageBox.Show("Xóa thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
示例#6
0
 private void btnTBSua_Click(object sender, EventArgs e)
 {
     if (KiemTraTrong())
     {
         BEL_ThietBi tb = new BEL_ThietBi(txtMaTB.Text, txttenTB.Text, txtsoluong.Text, txtmaloaiphong.Text);
         if (BAL_ThietBi.Instance.UpThietBi(tb))
         {
             LoadThietBi();
             MessageBox.Show("Sửa thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             MessageBox.Show("Sửa thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     else
     {
         MessageBox.Show("Hãy điền đầy đủ thông tin", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        public bool DelThietBi(BEL_ThietBi tb)
        {
            int result = DAL_ThietBi.Instance.DelThietBi(tb);

            return(result > 0);
        }