Пример #1
0
        private void btnThayDoiLoaiPhong_Click(object sender, EventArgs e)
        {
            int    id                 = int.Parse(txtMaLoaiPhong.Text);
            string tenLoai            = txtTenLoaiPhong.Text;
            int    SL_KhachBinhThuong = int.Parse(nSL_KhachBinhThuong.Value.ToString());
            int    SL_KhachToiDa      = int.Parse(nSoLuongKhachToiDa.Value.ToString());

            if (float.TryParse(txtDonGia.Text, out float donGia))
            {
                if (float.TryParse(txtPhuThuPhong.Text, out float phuThu))
                {
                    if (tenLoai == "")
                    {
                        MessageBox.Show("Tên loại phòng không được để trống!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                    int result = PhongDAO.updateLoaiPhong(id, tenLoai, SL_KhachBinhThuong, SL_KhachToiDa, donGia, phuThu);
                    if (result >= 1)
                    {
                        MessageBox.Show("Thay đổi thông tin loại phòng thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        dtgLoaiPhong.DataSource = PhongDAO.DSLoaiPhong();
                        clearBindingLoaiPhong();
                        addBindingLoaiPhong();
                    }
                }
            }
        }
Пример #2
0
 private void ucCaiDat_Load(object sender, EventArgs e)
 {
     dtgLoaiKhach.DataSource = LoaiKhachDAO.DSLoaiKhach();
     addBindingLoaiKhach();
     dtgLoaiPhong.DataSource = PhongDAO.DSLoaiPhong();
     addBindingLoaiPhong();
 }