Example #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["LoaiNguoiDung"] != "NhanVien" && Session["LoaiNguoiDung"] != "QuanLy")
        {
            Response.Redirect("ErrorPage.aspx");
            return;
        }
        string r = (string)Request["request"];

        if (r == "LayDanhSachMonAn")
        {
            LayDanhSachMonAn();
            return;
        }
        if (r == "CapNhatTinhTrang")
        {
            MonAnBUS bus = new MonAnBUS();
            CapNhat(bus.CapNhatTinhTrang);
            return;
        }
        if (r == "CapNhatTrangThaiHienThi")
        {
            MonAnBUS bus = new MonAnBUS();
            CapNhat(bus.CapNhatTrangThaiHienThi);
            return;
        }
        if (r == "XoaMonAn")
        {
            XoaMonAn();
            return;
        }
    }
Example #2
0
 private void MonAn_Load(object sender, EventArgs e)
 {
     dsnlBUS = new DSNguyenLieuBUS();
     maBUS   = new MonAnBUS();
     this.loadData_Vao_GridView();
     clear();
 }
Example #3
0
    //Hàm của Nghi, truyền mã thực đơn lên từ client, chứ không gán vào session
    private void ChiTietThucDon()
    {
        int ma_thuc_don = int.Parse(Request["mathucdon"].ToString());

        ThucDonBUS thucdonBUS = new ThucDonBUS();
        MonAnBUS   monanBUS   = new MonAnBUS();
        XL_THE     Kq         = new XL_THE("DANH_SACH");

        ArrayList arr = thucdonBUS.ThongTinThucDon(ma_thuc_don);

        for (int i = 0; i < arr.Count; i++)
        {
            MonAnDTO MonAn = monanBUS.ChiTietMonAn(int.Parse(arr[i].ToString()));

            XL_THE Kq1 = new XL_THE("MonAn");

            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("Gia", MonAn.Gia.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Kq.Danh_sach_the.Add(Kq1);
        }
        XL_CHUOI.XuatXML(Response, Kq.Chuoi());
    }
    private void Ghi_nhan_dat_hang()
    {
        ArrayList arr      = new ArrayList();
        int       ma       = int.Parse(Request["Ma"].ToString());
        MonAnBUS  monanBUS = new MonAnBUS();

        if (Request["Loai"] == "0")
        {
            MonAnDTO MonAn = monanBUS.ChiTietMonAn(ma);

            Item_online mon_an = new Item_online();
            mon_an.Ma_item           = MonAn.Ma_mon;
            mon_an.Ten_item          = MonAn.Ten_mon;
            mon_an.Hinh_anh_minh_hoa = MonAn.Hinh_anh_minh_hoa;
            mon_an.Gia       = MonAn.Gia;
            mon_an.Loai_item = 0;
            mon_an.So_luong  = int.Parse(Request["So_luong"].ToString());

            Session["Item_online"] = mon_an;
        }
        else if (Request["Loai"] == "1")
        {
            ThucDonBUS thucdonBUS = new ThucDonBUS();
            //ThucDonDTO ThucDon = thucdonBUS.ThongTinThucDon(ma);
            ThucDonDTO thuc_don = thucdonBUS.ChiTietThucDon(ma);

            Item_online mon_an = new Item_online();
            mon_an.Ma_item           = thuc_don.Ma_thuc_don;
            mon_an.Ten_item          = thuc_don.Ten_thuc_don;
            mon_an.Hinh_anh_minh_hoa = thuc_don.Hinh_anh_minh_hoa;
            mon_an.Gia       = thuc_don.Gia;
            mon_an.Loai_item = 1;
            mon_an.So_luong  = int.Parse(Request["So_luong"].ToString());

            Session["Item_online"] = mon_an;
        }
        else
        {
            ThucDonCaNhanBUS thucdonBUS = new ThucDonCaNhanBUS();
            //ThucDonDTO ThucDon = thucdonBUS.ThongTinThucDon(ma);
            ThucDonCaNhanDTO thuc_don = thucdonBUS.ChiTietThucDonCaNhan(ma);

            Item_online mon_an = new Item_online();
            mon_an.Ma_item           = thuc_don.Ma_thuc_don_ca_nhan;
            mon_an.Ten_item          = thuc_don.Ten_thuc_don;
            mon_an.Hinh_anh_minh_hoa = thuc_don.Hinh_anh;
            mon_an.Gia       = thuc_don.Gia;
            mon_an.Loai_item = 1;
            mon_an.So_luong  = int.Parse(Request["So_luong"].ToString());

            Session["Item_online"] = mon_an;
        }
    }
 public ChiTietMonAn(MonAnDTO ma)
 {
     maBUS      = new MonAnBUS();
     nlBUS      = new NguyenLieuBUS();
     dsnlBUS    = new DSNguyenLieuBUS();
     qdBUS      = new QuyDinhBUS();
     quydinh    = qdBUS.Laydulieu();
     this.maDTO = ma;
     GiaTien    = ma.dongia;
     InitializeComponent();
     loadDataVaoComboBox();
     loadData_Vao_GridView();
 }
Example #6
0
        public static void showDanhSachNguyenLieuTheoMonAnLenComboNguyenLieu(MonAnDTO monAn, ComboBox cb)
        {
            ArrayList dsNguyenLieuTheoMon = new ArrayList();

            dsNguyenLieuTheoMon = MonAnBUS.layDanhSachNguyenLieuTheoMonAn(monAn);


            for (int i = 0; i < dsNguyenLieuTheoMon.Count; i++)
            {
                MonAn_NguyenLieuDTO dto = (MonAn_NguyenLieuDTO)dsNguyenLieuTheoMon[i];
                cb.Items.Add(dto);
            }
        }
 public ChiTietHoaDon(hoaDonDTO hoadon)
 {
     maBUS       = new MonAnBUS();
     nlBUS       = new NguyenLieuBUS();
     dsmaBUS     = new DSMonAnBUS();
     hdBUS       = new hoaDonBUS();
     qdBUS       = new QuyDinhBUS();
     dsnlBUS     = new DSNguyenLieuBUS();
     quydinh     = qdBUS.Laydulieu();
     this.hoadon = hoadon;
     InitializeComponent();
     loadDataVaoComboBox();
     loadData_Vao_GridView();
 }
Example #8
0
    private void XoaMonAn()
    {
        string strMaMonAn = (string)Request["MaMonAn"];

        int      maMonAn = int.Parse(strMaMonAn);
        MonAnBUS bus     = new MonAnBUS();
        bool     flag    = bus.XoaMonAn(maMonAn);

        XL_THE        the       = new XL_THE("goc");
        XL_THUOC_TINH thuoctinh = new XL_THUOC_TINH("kq", flag ? "1" : "0");

        the.Danh_sach_thuoc_tinh.Add(thuoctinh);
        string chuoi = the.Chuoi();

        XL_CHUOI.XuatChuoi(Response, chuoi);
    }
Example #9
0
    private void Lay_danh_sach()
    {
        MonAnBUS monanBUS = new MonAnBUS();

        MonAnDTO[] DsMonAn = monanBUS.DanhSachMonAn();

        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());
    }
Example #10
0
    private void Chi_tiet_thuc_don()
    {
        int ma_thuc_don = int.Parse(Session["MaThucDon"].ToString());

        //oFFS_BUS_WS.WebService service = new oFFS_BUS_WS.WebService();
        ThucDonBUS thucdonBUS = new ThucDonBUS();
        MonAnBUS   monanBUS   = new MonAnBUS();
        XL_THE     Kq         = new XL_THE("DANH_SACH");

        ArrayList arr = thucdonBUS.ThongTinThucDon(ma_thuc_don);

        for (int i = 0; i < arr.Count; i++)
        {
            MonAnDTO MonAn = monanBUS.ChiTietMonAn(int.Parse(arr[i].ToString()));

            XL_THE Kq1 = new XL_THE("MonAn");

            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());
    }
Example #11
0
    private void LayDSMonAnHienThi()
    {
        int pageNum = int.Parse((string)Request["pageNum"]);

        MonAnBUS monanBUS = new MonAnBUS();

        MonAnDTO[] DsMonAn = monanBUS.LayDSMonAnHienThi(pageNum, pageSize);

        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];

            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());
    }
Example #12
0
    void TongSoTrang()
    {
        MonAnBUS bus       = new MonAnBUS();
        int      tongsomon = bus.TongSoMonAn();
        int      kq        = -1;

        // không lỗi
        if (tongsomon != -1)
        {
            kq  = tongsomon / pageSize;
            kq += (tongsomon % pageSize != 0) ? 1 : 0;
        }
        XL_THE        the       = new XL_THE("goc");
        XL_THUOC_TINH thuoctinh = new XL_THUOC_TINH("TongSoTrang", kq.ToString());

        the.Danh_sach_thuoc_tinh.Add(thuoctinh);
        string chuoi = the.Chuoi();

        XL_CHUOI.XuatChuoi(Response, chuoi);
    }
Example #13
0
    protected void DsQuaTang()
    {
        MonAnBUS monanBUS = new MonAnBUS();
        double   limit    = double.Parse((string)Request["limit"]);

        MonAnDTO[] DsMonAn = monanBUS.LayDSQuaTang(limit);

        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];

            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());
    }
Example #14
0
        private void showDanhSachNguyenLieuTheoMonAn(MonAnDTO monAn)
        {
            ArrayList dsNguyenLieuTheoMon = new ArrayList();

            dsNguyenLieuTheoMon = MonAnBUS.layDanhSachNguyenLieuTheoMonAn(monAn);


            for (int i = 0; i < dsNguyenLieuTheoMon.Count; i++)
            {
                ArrayList dsKQ = new ArrayList();
                dsKQ = KhoHangBUS.layDSKhoHang_NguyenLieu(GlobalVariables.maNhaHang, ((MonAn_NguyenLieuDTO)dsNguyenLieuTheoMon[i]).NguyenLieu);

                for (int j = 0; j < dsKQ.Count; j++)
                {
                    KhoHang_NguyenLieuDTO dto = (KhoHang_NguyenLieuDTO)dsKQ[j];
                    if (!ingrid_dsOrNot(dto))
                    {
                        grid_ds.Rows.Add();
                        showThongTinKhoHang_NguyenLieuDTOLenGrid(grid_ds.RowCount - 1, dto);
                    }
                }
            }
        }
Example #15
0
    protected void ThemMonMoi()
    {
        MonAnDTO monanDTO = new MonAnDTO();

        monanDTO.Ten_mon           = XL_CHUOI.Nhap(Request, "tenmon");
        monanDTO.Ma_loai_mon       = int.Parse(XL_CHUOI.Nhap(Request, "loaimon"));
        monanDTO.Hinh_anh_minh_hoa = XL_CHUOI.Nhap(Request, "hinhanh");
        monanDTO.Mo_ta             = XL_CHUOI.Nhap(Request, "mota");
        monanDTO.Gia         = Decimal.Parse(XL_CHUOI.Nhap(Request, "gia"));
        monanDTO.Don_vi_tinh = XL_CHUOI.Nhap(Request, "donvitinh");
        String strTag = XL_CHUOI.Nhap(Request, "tag");

        monanDTO.Diem_binh_chon      = 0;
        monanDTO.Tinh_trang          = bool.Parse(XL_CHUOI.Nhap(Request, "tinhtrang"));
        monanDTO.Trang_thai_hien_thi = bool.Parse(XL_CHUOI.Nhap(Request, "hienthi"));

        MonAnBUS monanBUS = new MonAnBUS();
        int      Kq       = monanBUS.ThemMonAn(monanDTO, strTag);

        XL_THE        the = new XL_THE("goc");
        XL_THUOC_TINH thuoc_tinh;

        if (Kq != 0)
        {
            thuoc_tinh = new XL_THUOC_TINH("kq", "true");
        }
        else
        {
            thuoc_tinh = new XL_THUOC_TINH("kq", "false");
        }

        the.Danh_sach_thuoc_tinh.Add(thuoc_tinh);
        string chuoi = the.Chuoi();

        XL_CHUOI.XuatChuoi(Response, chuoi);
    }
Example #16
0
    public void LayDSTenMonAn()
    {
        MonAnBUS monanBUS = new MonAnBUS();

        MonAnDTO[] DsMonAn = monanBUS.DanhSachMonAn();

        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];

            XL_THUOC_TINH Thuoc_tinh = new XL_THUOC_TINH("MaMon", MonAn.Ma_mon.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("TenMon", MonAn.Ten_mon);
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Kq.Danh_sach_the.Add(Kq1);
        }

        XL_CHUOI.XuatXML(Response, Kq.Chuoi());
    }
Example #17
0
    private void LayCTDonHang()
    {
        int maDonHang = int.Parse(Request["MaDonHang"]);

        XL_THE kq = new XL_THE("DanhSachCTDonHang");

        CTDonHangBUS ctdhbus = new CTDonHangBUS();

        CTDonHangDTO[] arrCtdhDto = ctdhbus.DanhSachCTDonHang(maDonHang);
        foreach (CTDonHangDTO ctdh in arrCtdhDto)
        {
            XL_THE the = new XL_THE("CTDonHang");

            // mã chi tiết đơn hàng
            XL_THUOC_TINH Thuoc_tinh = new XL_THUOC_TINH("MaCTDonHang", ctdh.Ma_ct_don_hang.ToString());
            the.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);


            string loai = "";
            string ten  = "";
            switch (ctdh.Loai_item)
            {
            case 0:     // món ăn
                loai = "Món ăn";
                MonAnBUS maBus = new MonAnBUS();
                MonAnDTO ma    = maBus.ChiTietMonAn(ctdh.Ma_item);

                if (ma != null)
                {
                    ten = ma.Ten_mon;
                }
                else
                {
                    ten = "Món ăn này không tồn tại";
                }
                break;

            case 1:     // thực đơn
                loai = "Thực đơn";
                ThucDonBUS tdBus = new ThucDonBUS();
                ThucDonDTO tdDto = tdBus.ChiTietThucDon(ctdh.Ma_item);
                if (tdDto != null)
                {
                    ten = tdDto.Ten_thuc_don;
                }
                else
                {
                    ten = "Thực đơn này không tồn tại";
                }
                break;

            case 2:     // thực đơn cá nhân
                loai = "Thực đơn cá nhân";
                ThucDonCaNhanBUS tdcnBus = new ThucDonCaNhanBUS();
                ThucDonCaNhanDTO tdcnDto = tdcnBus.ChiTietThucDonCaNhan(ctdh.Ma_item);
                if (tdcnDto != null)
                {
                    ten = tdcnDto.Ten_thuc_don;
                }
                else
                {
                    ten = "Thực đơn cá nhân này không tồn tại";
                }
                break;
            }

            // Tên món hoặc tên thực đơn
            Thuoc_tinh = new XL_THUOC_TINH("Ten", ten);
            the.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            // Loại đơn hàng
            Thuoc_tinh = new XL_THUOC_TINH("LoaiItem", loai);
            the.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            // Số lượng
            Thuoc_tinh = new XL_THUOC_TINH("SoLuong", ctdh.So_luong.ToString());
            the.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            // Thành tiền
            Thuoc_tinh = new XL_THUOC_TINH("ThanhTien", ctdh.Thanh_tien.ToString());
            the.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            kq.Danh_sach_the.Add(the);
        }

        XL_CHUOI.XuatXML(Response, kq.Chuoi());
    }
Example #18
0
    public int ThemMonAn(MonAnDTO monan, String strTag)
    {
        MonAnBUS monanBUS = new MonAnBUS();

        return(monanBUS.ThemMonAn(monan, strTag));
    }
Example #19
0
    protected void DsMonAnThuocLoaiMonBatKy()
    {
        int pageSize = 5;

        if (Request["results"] != null)
        {
            pageSize = int.Parse((string)Request["results"]);
        }

        int pageNum    = 1;
        int startIndex = 0;

        if (Request["startIndex"] != null)
        {
            startIndex = int.Parse((string)Request["startIndex"]);
            pageNum    = (startIndex / pageSize) + 1;
        }

        MonAnBUS  mon_anBUS = new MonAnBUS();
        ArrayList dsMonAn   = new ArrayList();
        int       index     = 0;
        int       loaimon   = -1;

        if (Session["LoaiNguoiDung"].ToString() == "NhanVien")
        {
            loaimon = int.Parse((string)Request["LoaiMon"]);
        }
        else
        {
            loaimon = int.Parse(Session["LoaiMon"].ToString());
        }
        dsMonAn = mon_anBUS.LayDSMonAnThuocLoaiMonBatKy(loaimon);
        int n = dsMonAn.Count;

        XL_THE Kq = new XL_THE("DANH_SACH");

        if (Session["LoaiNguoiDung"].ToString() == "NhanVien") //co phan trang
        {
            index = startIndex;
            n     = startIndex + pageSize;
            n     = (n < dsMonAn.Count) ? n : dsMonAn.Count;

            XL_THUOC_TINH Thuoc_tinh = new XL_THUOC_TINH("totalRecords", dsMonAn.Count.ToString());
            Kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
        }



        for (int i = index; i < n; i++)
        {
            XL_THE Kq1 = new XL_THE("MonAn");

            MonAnDTO MonAn = (MonAnDTO)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());
    }
Example #20
0
    public MonAnDTO[] DanhSachMonAn()
    {
        MonAnBUS monanBUS = new MonAnBUS();

        return(monanBUS.DanhSachMonAn());
    }
Example #21
0
    void LayDanhSachMonAn()
    {
        // Xử lý request
        int pageSize = 10;

        if (Request["results"] != null)
        {
            pageSize = int.Parse((string)Request["results"]);
        }

        int pageNum = 1;

        if (Request["startIndex"] != null)
        {
            pageNum = (int.Parse((string)Request["startIndex"]) / pageSize) + 1;
        }

        LoaiMonBUS lmBus = new LoaiMonBUS();
        MonAnBUS   bus   = new MonAnBUS();

        MonAnDTO[] kq = bus.DanhSachMonAn(pageNum, pageSize);

        int tongSoMonAn = bus.TongSoMonAn();

        XL_THE        Kq         = new XL_THE("DANH_SACH");
        XL_THUOC_TINH Thuoc_tinh = new XL_THUOC_TINH("totalRecords", tongSoMonAn.ToString());

        Kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

        foreach (MonAnDTO dto in kq)
        {
            XL_THE the = new XL_THE("MonAn");

            Thuoc_tinh = new XL_THUOC_TINH("MaMonAn", dto.Ma_mon.ToString());
            the.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Thuoc_tinh = new XL_THUOC_TINH("TenMonAn", dto.Ten_mon);
            the.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            LoaiMonDTO lmDto = lmBus.ChiTietLoaiMon(dto.Ma_loai_mon);
            Thuoc_tinh = new XL_THUOC_TINH("LoaiMonAn", lmDto.Ten_loai_mon);
            the.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Thuoc_tinh = new XL_THUOC_TINH("MoTa", dto.Mo_ta);
            the.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Thuoc_tinh = new XL_THUOC_TINH("HinhAnhMinhHoa", dto.Hinh_anh_minh_hoa);
            the.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Thuoc_tinh = new XL_THUOC_TINH("Gia", dto.Gia.ToString());
            the.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Thuoc_tinh = new XL_THUOC_TINH("TrangThaiHienThi", dto.Trang_thai_hien_thi ? "1" : "0");
            the.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Thuoc_tinh = new XL_THUOC_TINH("TinhTrang", dto.Tinh_trang ? "1" : "0");
            the.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Kq.Danh_sach_the.Add(the);
        }

        XL_CHUOI.XuatXML(Response, Kq.Chuoi());
    }
Example #22
0
    protected void DsMonAnThuocLoaiMon()
    {
        // Xử lý request
        int pageSize = 5;

        if (Request["results"] != null)
        {
            pageSize = int.Parse((string)Request["results"]);
        }

        int pageNum    = 1;
        int startIndex = 0;

        if (Request["startIndex"] != null)
        {
            startIndex = int.Parse((string)Request["startIndex"]);
            pageNum    = (startIndex / pageSize) + 1;
        }

        MonAnBUS  mon_anBUS = new MonAnBUS();
        ArrayList dsMonAn   = new ArrayList();
        int       index     = 0;
        int       loaimon   = -1;

        if (Session["LoaiNguoiDung"] == "NhanVien" || Session["LoaiNguoiDung"] == "QuanLy")
        {
            loaimon = int.Parse((string)Request["LoaiMon"]);
        }
        else
        {
            loaimon = int.Parse(Session["LoaiMon"].ToString());
        }

        dsMonAn = mon_anBUS.LayDSMonAnThuocLoaiMonBatKy(loaimon);
        int n = dsMonAn.Count;

        XL_THE Kq = new XL_THE("DANH_SACH");

        if (Session["LoaiNguoiDung"] == "NhanVien" || Session["LoaiNguoiDung"] == "QuanLy") //co phan trang
        {
            index = startIndex;
            n     = startIndex + pageSize;
            n     = (n < dsMonAn.Count) ? n : dsMonAn.Count;

            XL_THUOC_TINH Thuoc_tinh = new XL_THUOC_TINH("totalRecords", dsMonAn.Count.ToString());
            Kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
        }

        LoaiMonDTO lmDto = (new LoaiMonBUS()).ChiTietLoaiMon(loaimon);   //chu íu lấy tên loại món

        for (int i = index; i < n; i++)
        {
            XL_THE Kq1 = new XL_THE("MonAn");

            MonAnDTO MonAn = (MonAnDTO)dsMonAn[i];
//             if (MonAn.Trang_thai_hien_thi == false)
//                 continue;
            XL_THUOC_TINH Thuoc_tinh = new XL_THUOC_TINH("MaMonAn", MonAn.Ma_mon.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Thuoc_tinh = new XL_THUOC_TINH("TenMonAn", MonAn.Ten_mon);
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Thuoc_tinh = new XL_THUOC_TINH("LoaiMonAn", lmDto.Ten_loai_mon);
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Thuoc_tinh = new XL_THUOC_TINH("MoTa", MonAn.Mo_ta);
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Thuoc_tinh = new XL_THUOC_TINH("HinhAnhMinhHoa", MonAn.Hinh_anh_minh_hoa);
            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("TrangThaiHienThi", MonAn.Trang_thai_hien_thi ? "1" : "0");
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Thuoc_tinh = new XL_THUOC_TINH("TinhTrang", MonAn.Tinh_trang ? "1": "0");
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Kq.Danh_sach_the.Add(Kq1);
        }

        XL_CHUOI.XuatXML(Response, Kq.Chuoi());
    }
Example #23
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());
    }