public DataTable ChiSoTheoThoiGian(List <DTOPhong> liDtoPhong, DateTime time) { BAL_ChuPhong balCP = new BAL_ChuPhong(); BAL_LoaiPhong balLP = new BAL_LoaiPhong(); DataTable dtP = new DataTable(); dtP.Columns.Add("tenchuphong", typeof(string)); dtP.Columns.Add("tenloaiphong", typeof(string)); dtP.Columns.Add("maphong", typeof(Int32)); dtP.Columns.Add("tenphong", typeof(string)); dtP.Columns.Add("ngaycapnhat", typeof(DateTime)); dtP.Columns.Add("chisodien", typeof(Int64)); dtP.Columns.Add("chisonuoc", typeof(Int64)); BAL_Phong balP = new BAL_Phong(); foreach (DTOPhong dtoP in liDtoPhong) { DataRow dr = dtP.NewRow(); int maloaiphong = balP.DetailPhong(dtoP.maphong).maloaiphong; dr["tenloaiphong"] = balLP.DetailLoaiPhong(maloaiphong).tenloaiphong; int machuphong = balLP.DetailLoaiPhong(maloaiphong).machuphong; dr["tenchuphong"] = balCP.DetailChuPhong(machuphong).tenchuphong; dr["maphong"] = dtoP.maphong; dr["tenphong"] = dtoP.tenphong; dr["ngaycapnhat"] = time; if (ChiSoTheoMaPhongVaThoiGian(dtoP.maphong, time).chisodien == null) { dr["chisodien"] = DBNull.Value; } else { dr["chisodien"] = ChiSoTheoMaPhongVaThoiGian(dtoP.maphong, time).chisodien; } if (ChiSoTheoMaPhongVaThoiGian(dtoP.maphong, time).chisonuoc == null) { dr["chisonuoc"] = DBNull.Value; } else { dr["chisonuoc"] = ChiSoTheoMaPhongVaThoiGian(dtoP.maphong, time).chisonuoc; } dtP.Rows.Add(dr); } return(dtP); }