Exemplo n.º 1
0
        private void TimKiemTheoYeuCau(int s)
        {
            PhongDTO thongtin = LayThongTinTimKiem();

            if (s == 1)
            {
                lstt = PhongBUS.DanhSachPhongYeuCau(thongtin);
                for (int i = 0; i < lstt.Count; i++)
                {
                    lstt[i].DonGia = Convert.ToDecimal(string.Format("{0:0,0}", lstt[i].DonGia));
                }
                gcDanhSachPhong.DataSource = lstt;
            }
            else if (s == 2)
            {
                lstt = PhongBUS.DanhSachPhongTheoLoai(thongtin);
                for (int i = 0; i < lstt.Count; i++)
                {
                    lstt[i].DonGia = Convert.ToDecimal(string.Format("{0:0,0}", lstt[i].DonGia));
                }
                gcDanhSachPhong.DataSource = lstt;
            }
            else if (s == 3)
            {
                lstt = PhongBUS.DanhSachPhongTheoLoaiTheoYeuCau(thongtin);
                for (int i = 0; i < lstt.Count; i++)
                {
                    lstt[i].DonGia = Convert.ToDecimal(string.Format("{0:0,0}", lstt[i].DonGia));
                }
                gcDanhSachPhong.DataSource = lstt;
            }
            else if (s == 4)
            {
                decimal dgtu = Convert.ToDecimal(txtDonGiaTu.Text);
                lstt = PhongBUS.DanhSachPhongTheoDGTu(dgtu);
                for (int i = 0; i < lstt.Count; i++)
                {
                    lstt[i].DonGia = Convert.ToDecimal(string.Format("{0:0,0}", lstt[i].DonGia));
                }
                gcDanhSachPhong.DataSource = lstt;
            }
            else if (s == 5)
            {
                decimal dgtu  = Convert.ToDecimal(txtDonGiaTu.Text);
                decimal dgden = Convert.ToDecimal(txtDonGiaDen.Text);
                lstt = PhongBUS.DanhSachPhongTheoKhoangDG(dgtu, dgden);
                for (int i = 0; i < lstt.Count; i++)
                {
                    lstt[i].DonGia = Convert.ToDecimal(string.Format("{0:0,0}", lstt[i].DonGia));
                }
                gcDanhSachPhong.DataSource = lstt;
            }
            else if (s == 6)
            {
                decimal dgden = Convert.ToDecimal(txtDonGiaDen.Text);

                lstt = PhongBUS.DanhSachPhongTheoDGDen(dgden);
                for (int i = 0; i < lstt.Count; i++)
                {
                    lstt[i].DonGia = Convert.ToDecimal(string.Format("{0:0,0}", lstt[i].DonGia));
                }
                gcDanhSachPhong.DataSource = lstt;
            }
        }