Пример #1
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();
        }