Exemple #1
0
        void RefreshDataBinding_ChuyenDatPhong()
        {
            PhongDTO phongDto = PhongBUS.LayThongTinPhong(chiTietDatPhong.MaPhong);

            txtLoaiPhong_Old.EditValue = LoaiPhongBUS.LayLoaiPhong(phongDto).TenLoaiPhong;
            txtMaPhong_Old.EditValue   = phongDto.MaPhong;
            txtTang_Old.EditValue      = phongDto.Tang;
            txtTenPhong_Old.EditValue  = phongDto.TenPhong;
            txtGhiChu_Old.EditValue    = phongDto.GhiChu;

            txtPhong.Properties.DataSource    = dtPhong = DatPhongBUS.LayCacPhongConTrongTrongThoiGian(DatPhongBUS.LayThongTinDatPhong(chiTietDatPhong.MaDatPhong).ThoiGianDatPhong, ThamSoBUS.LayKhoangThoiGianToiThieuGiuaHaiLanThue());
            txtPhong.Properties.DisplayMember = "TenPhong";
            txtPhong.Properties.ValueMember   = "MaPhong";
        }
Exemple #2
0
        private void txtGioVao_Properties_EditValueChanged(object sender, EventArgs e)
        {
            dtPhong = DatPhongBUS.LayCacPhongConTrongTrongThoiGian(txtGioVao.Time, ThamSoBUS.LayKhoangThoiGianToiThieuGiuaHaiLanThue());
            dtPhong.Columns.Add(new DataColumn("colThoiDiemDatPhongGanNhat_Sau"));
            dtPhong.Columns.Add(new DataColumn("colThoiDiemDatPhongGanNhat_Truoc"));
            dtPhong.Columns.Add(new DataColumn("colTinhTrangPhong"));

            foreach (DataRow r in dtPhong.Rows)
            {
                DateTime t = DatPhongBUS.LayThoiDiemDatPhongGanNhat_Sau((int)r["MaPhong"], txtGioVao.Time);
                r["colThoiDiemDatPhongGanNhat_Sau"] = t == DateTime.MinValue ? "Không có" : t.ToString("dd/MM/yyyy hh:mm");

                t = DatPhongBUS.LayThoiDiemDatPhongGanNhat_Truoc((int)r["MaPhong"], txtGioVao.Time);
                r["colThoiDiemDatPhongGanNhat_Truoc"] = t == DateTime.MinValue ? "Không có" : t.ToString("dd/MM/yyyy hh:mm");

                r["colTinhTrangPhong"] = PhongBUS.LayTinhTrangPhong((int)r["MaTinhTrangPhong"]).TinhTrangPhong + " " + (listPhongDangThue.ContainsKey((int)r["MaPhong"])? "(" + ToCustomString((DateTime.Now - listPhongDangThue[(int)r["MaPhong"]].GioThuePhong)) + ")":"");
            }
            txtPhong.Properties.DataSource = dtPhong;

            selectedPhong.Clear();
            txtPhong.Refresh();
        }