예제 #1
0
        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);
                }
            }
        }
예제 #2
0
        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);
            }
        }