private void ThayDoiTrangThaiPhong(GiaoDich gd1) { List <ChiTietGiaoDich> chiTietGDs = HE.sp_LayChiTietGiaoDichTheoIdGiaoDich(gd1.ID).ToList(); for (int i = 0; i < chiTietGDs.Count; i++) { sp_LayThongTinPhong_Result p = HE.sp_LayThongTinPhong(chiTietGDs.ElementAt(i).ID_MaPhong).Single(); if (p.TrangThai == 1) { HE.sp_CapNhatTrangThaiPhong(p.ID, 2); } else { HE.sp_CapNhatTrangThaiPhong(p.ID, 1); } } }
private void showGridThanhToan(GiaoDich gd1) { if (GridThanhToan.RowCount > 1) { GridThanhToan.Rows.Clear(); } using (var HE1 = new HOLYBIRDRESORTEntities()) { List <ChiTietGiaoDich> ctgds = HE1.sp_LayChiTietGiaoDichTheoIdGiaoDich(gd1.ID).ToList(); for (int i = 0; i < ctgds.Count; i++) { string stt = (i + 1).ToString(); string maPhong = HE1.sp_LayThongTinPhong(ctgds[i].ID_MaPhong).Single().MaPhong; String[] row = new String[] { stt, maPhong }; GridThanhToan.Rows.Add(row); } } }
private void showHoaDon(int idGiaoDich) { GiaoDich gd = HE.sp_LayGiaoDichTheoId(idGiaoDich).Single(); lbMaDoanHoaDon.Text = gd.MaDoan; lbTongTienHoaDon.Text = gd.TongTien.ToString(); KhachHang kh = HE.sp_LayTenNguoiDaiDienTheoId(gd.ID_NguoiDaiDien).Single(); lbDaiDienHoaDon.Text = kh.HoTen; List <ChiTietGiaoDich> ctgds = HE.sp_LayChiTietGiaoDichTheoIdGiaoDich(gd.ID).ToList(); if (GridHoaDon.RowCount > 0) { GridHoaDon.Rows.Clear(); } for (int i = 0; i < ctgds.Count; i++) { string stt = (i + 1).ToString(); sp_LayThongTinPhong_Result phong = HE.sp_LayThongTinPhong(ctgds[i].ID_MaPhong).Single(); string maPhong = phong.MaPhong; int donGia = (int)phong.DonGia; int thoiGian = 1; if (ctgds[i].NgayBatDau != null && ctgds[i].NgayKetThuc != null) { TimeSpan time = (TimeSpan)(ctgds[i].NgayKetThuc - ctgds[i].NgayBatDau); thoiGian = time.Days; } int thanhTien = (int)ctgds[i].ThanhTien; String[] row = new String[] { stt, maPhong, donGia.ToString(), thoiGian.ToString(), thanhTien.ToString() }; GridHoaDon.Rows.Add(row); } }