コード例 #1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            Phong  table       = listVThongTinPhong.Tag as Phong;
            string maPhong     = (cbbPhong.SelectedItem as Phong).MA;
            string tenPhong    = (cbbPhong.SelectedItem as Phong).TenPhong;
            string maLoaiPhong = (cbbChonLoaiPhongDeSua.SelectedItem as LoaiPhong).MA;
            string donViTienTe = txtDonViTien.Text;
            float  a;
            var    thugiaphong = float.TryParse(txtGiaPhong.Text, out a);

            if (thugiaphong)
            {
                float giaPhong = float.Parse(txtGiaPhong.Text);
                PhongDAO.Instances.UpdatePhong(maPhong, tenPhong, maLoaiPhong, giaPhong, donViTienTe);
                LoadDanhSach();
                LoadThongTinPhong(maPhong);
                LoadDanhSachThongKeTinhTrangPhong();

                MessageBox.Show("Thành Công");
            }
            else
            {
                MessageBox.Show("Bạn Phải Nhập Giá Phòng Kiểu Số");
            }
        }
コード例 #2
0
        private void grVDatPhong_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            List <DatPhong> danhsachdatphong = DatPhongDAO.Instances.HienThiDanhSachDatPhong();
            int             i = 0;

            foreach (var item in danhsachdatphong)
            {
                grVDatPhong.Rows[i].Tag = item;
                i++;
            }

            foreach (DataGridViewRow item in grVDatPhong.Rows)
            {
                DatPhong datPhong = item.Tag as DatPhong;
                if (item.Selected)
                {
                    foreach (var item1 in cbbMaDatPhong.Items)
                    {
                        if (datPhong.MaDatPhong == (item1 as DatPhong).MaDatPhong)
                        {
                            cbbMaDatPhong.SelectedItem = item1;
                        }
                    }
                    if (datPhong.NgayDi.ToString() == "")
                    {
                        dtpNgayDi.Value = dtpNgayDi.MaxDate;
                    }
                    else
                    {
                        dtpNgayDi.Value = (DateTime)datPhong.NgayDi;
                    }
                    dtpNgayO.Value = datPhong.NgayO;
                    maphong        = datPhong.MaPhong;
                    Phong phong          = PhongDAO.Instances.LoadPhongTheoMaPhong(datPhong.MaPhong);
                    int   IndexLoaiPhong = TimKiemLoaiPhongVuaChon(phong.MA, phong.MaLoaiPhong);
                    int   IndexPhong     = TimKiemPhongVuaChon(phong.MA, phong.MaLoaiPhong);
                    LoadLoaiPhongVaocbbLoaiPhong(IndexLoaiPhong);
                    LoadPhongVaocbbPhong(IndexPhong, phong.MaLoaiPhong);
                    txtTraTruoc.Text = datPhong.TraTruoc.ToString();

                    //for (int b = 0; b < cbbDichVu.Items.Count; b++)
                    //{
                    //    DichVu dichVu = cbbDichVu.Items[b] as DichVu;
                    //    if (dichVu.MaDV == datPhong.MaDV)
                    //        cbbDichVu.SelectedIndex = b;
                    //}
                    //txtSoPhan.Text = datPhong.SoLuong.ToString();
                    KhachHang_huy khachHang_Huy = KhachHangDAO_huy.Instances.TimKHTheoMAKH(datPhong.MaKH);
                    txtBChungMinhThu.Text = khachHang_Huy.ChungMinhThu;
                }
            }
        }
コード例 #3
0
 public HopDong(string so_HD, KhachHang KH, DangKiDV DangKiDV, Phong Phong, string phuongThucThanhToan,
                string ngayNhanPhong, int songaythue, string ngayTraPhong, NhanVien NhanVien)
 {
     this.so_HD               = so_HD;
     this.songaythue          = songaythue;
     this.KH                  = KH;
     this.DangKiDV            = DangKiDV;
     this.Phong               = Phong;
     this.phuongThucThanhToan = phuongThucThanhToan;
     this.giaTien             = DangKiDV.giaTien * songaythue + Phong.LoaiPhong.giaTien * songaythue;
     if (KH.ma_loaiKH.ten_LoaiKH == "VIP")
     {
         this.giaTien *= 0.95;
     }
     this.ngayNhanPhong = ngayNhanPhong;
     this.ngayTraPhong  = ngayTraPhong;
     this.NhanVien      = NhanVien;
     this.Phong.DaThue  = true;
 }
コード例 #4
0
ファイル: QuanLiThuePhong.cs プロジェクト: quockhoibui/QLKS
        void SuaPhong()
        {
            using (QuanLiKhachSanEntities db = new QuanLiKhachSanEntities())
            {
                string id = txbIDPhong.Text;

                Phong phong = db.Phong.Find(id);

                int loai      = (cbLoaiPhong.SelectedValue as LoaiPhong).ID;
                int trangthai = (cbTrangThai.SelectedValue as TinhTrang).ID;

                phong.IDLoai      = loai;
                phong.IDTinhTrang = trangthai;


                db.SaveChanges();

                MessageBox.Show("Sửa phòng thành công");
                LoadPhong(dtgvPhong);
            }
        }
コード例 #5
0
 public Phong(Phong PH)
 {
     this.soPhong   = PH.soPhong;
     this.ThietBi   = PH.ThietBi;
     this.LoaiPhong = PH.LoaiPhong;
 }