예제 #1
0
    protected void TimKiem()
    {
        MonAnBUS  monanBUS = new MonAnBUS();
        ArrayList arr      = (ArrayList)Session["info"];

        MonAnDTO[] dsMonAn;
        if (arr.Count == 1)
        {
            string ten_mon = arr[0].ToString();
            dsMonAn = monanBUS.TimKiemMonAnTheoTen(ten_mon);
        }
        else
        {
            string ten_mon     = "";
            int    ma_loai_mon = -1;
            string tag         = "";
            double gia_min     = -1;
            double gia_max     = -1;

            if (arr[0].ToString() != "null")
            {
                ten_mon = arr[0].ToString();
            }
            if (arr[1].ToString() != "null")
            {
                ma_loai_mon = int.Parse(arr[1].ToString());
            }
            if (arr[2].ToString() != "null")
            {
                tag = arr[2].ToString();
            }
            if (arr[3].ToString() != "null")
            {
                gia_min = double.Parse(arr[3].ToString());
            }
            if (arr[4].ToString() != "null")
            {
                gia_max = double.Parse(arr[4].ToString());
            }

            dsMonAn = monanBUS.TimKiemMonAnNangCao(ten_mon, ma_loai_mon, tag, gia_min, gia_max);
        }

        XL_THE Kq = new XL_THE("DANH_SACH");

        for (int i = 0; i < dsMonAn.Length; i++)
        {
            XL_THE Kq1 = new XL_THE("MonAn");

            MonAnDTO MonAn = dsMonAn[i];
            if (MonAn.Trang_thai_hien_thi == false)
            {
                continue;
            }
            XL_THUOC_TINH Thuoc_tinh = new XL_THUOC_TINH("Ma_mon", MonAn.Ma_mon.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Ten_mon", MonAn.Ten_mon);
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Hinh_anh_minh_hoa", MonAn.Hinh_anh_minh_hoa);
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Mo_ta", MonAn.Mo_ta);
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Diem_binh_chon", MonAn.Diem_binh_chon.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Don_vi_tinh", MonAn.Don_vi_tinh);
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Gia", MonAn.Gia.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Ma_loai_mon", MonAn.Ma_loai_mon.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Tinh_trang", MonAn.Tinh_trang.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Trang_thai_hien_thi", MonAn.Trang_thai_hien_thi.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Kq.Danh_sach_the.Add(Kq1);
        }

        XL_CHUOI.XuatXML(Response, Kq.Chuoi());
    }