コード例 #1
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());
    }
コード例 #2
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 == "LayDanhSachThucDon")
        {
            LayDanhSachThucDon();
            return;
        }
        if (r == "CapNhatTinhTrang")
        {
            ThucDonBUS bus = new ThucDonBUS();
            CapNhat(bus.CapNhatTinhTrang);
            return;
        }
        if (r == "CapNhatTrangThaiHienThi")
        {
            ThucDonBUS bus = new ThucDonBUS();
            CapNhat(bus.CapNhatTrangThaiHienThi);
            return;
        }
        if (r == "XoaThucDon")
        {
            XoaThucDon();
            return;
        }
    }
コード例 #3
0
        public void LoadData()
        {
            maTDMoi = DoAnQLKaraokeBUS.ThucDonBUS.MaThucDonMoi();
            //trThai = 1;
            //TrangThai();
            LoaiThucDonBUS lp = new LoaiThucDonBUS();

            cbo_Loai.DataSource    = lp.DanhSachLoaiTD().FindAll(o => o.TINHTRANG == true);
            cbo_Loai.ValueMember   = "MALOAITD";
            cbo_Loai.DisplayMember = "TEN";

            TinhTrangTDBUS tt = new TinhTrangTDBUS();

            cbo_TT.DataSource    = tt.DSTINHTRANGTD();
            cbo_TT.ValueMember   = "MATTR";
            cbo_TT.DisplayMember = "TENTTR";

            //load datagridviewcomboboxcolum truoc khi load ds .
            DataGridViewComboBoxColumn dgv_LoaiTD = (DataGridViewComboBoxColumn)dgv_ThucDon.Columns["colLOAITD"];

            dgv_LoaiTD.DataSource    = lp.DanhSachLoaiTD().FindAll(o => o.TINHTRANG == true);
            dgv_LoaiTD.ValueMember   = "MALOAITD";
            dgv_LoaiTD.DisplayMember = "TEN";

            DataGridViewComboBoxColumn dgvcb_tinhtrang = (DataGridViewComboBoxColumn)dgv_ThucDon.Columns["colTINHTRANG"];

            dgvcb_tinhtrang.DataSource    = tt.DSTINHTRANGTD();
            dgvcb_tinhtrang.ValueMember   = "MATTR";
            dgvcb_tinhtrang.DisplayMember = "TENTTR";

            //DataGridViewCheckBoxColumn dgvckb = (DataGridViewCheckBoxColumn)dgv_sanpham.Columns["TinhTrang"];
            ThucDonBUS b = new ThucDonBUS();

            dgv_ThucDon.DataSource = b.DanhSachTD();
        }
コード例 #4
0
        private void XuLyTraCuu(int loaiTD, int tinhTrang)
        {
            ThucDonBUS        b   = new ThucDonBUS();
            List <ThucDonDTO> lst = b.DanhSachTD().FindAll(o => o.LOAITD == loaiTD && o.TINHTRANG == tinhTrang);

            dgv_ThucDon.DataSource = lst;
        }
コード例 #5
0
    protected void LayDSThucDon()
    {
        ThucDonBUS ThucDonBUS = new ThucDonBUS();

        ThucDonDTO[] DsThucDon = ThucDonBUS.DSThucDonThuocLoaiThucDon(int.Parse(Request["MaLoaiThucDon"].ToString()));

        XL_THE Kq = new XL_THE("DANH_SACH");

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

            ThucDonDTO ThucDon = DsThucDon[i];

            XL_THUOC_TINH Thuoc_tinh = new XL_THUOC_TINH("Ma_thuc_don", ThucDon.Ma_thuc_don.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Ten_thuc_don", ThucDon.Ten_thuc_don);
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Hinh_anh_minh_hoa", ThucDon.Hinh_anh_minh_hoa);
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Gia", ThucDon.Gia.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Ma_loai_thuc_don", ThucDon.Ma_loai_thuc_don.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Tinh_trang", ThucDon.Tinh_trang.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Trang_thai_hien_thi", ThucDon.Trang_thai_hien_thi.ToString());

            Kq.Danh_sach_the.Add(Kq1);
        }

        XL_CHUOI.XuatXML(Response, Kq.Chuoi());
    }
コード例 #6
0
ファイル: FrmXemBaoCao.cs プロジェクト: ARYPHAMM/DAKARAOKE24
        private void subTenTD(object sender, SubreportProcessingEventArgs e)
        {
            ThucDonBUS        tdBUS = new ThucDonBUS();
            string            matd  = e.Parameters["paMATD"].Values[0].ToString();
            List <ThucDonDTO> lsTD  = tdBUS.DanhSachTD().FindAll(o => o.MATD.Trim() == matd.Trim());

            e.DataSources.Add(new ReportDataSource("ThucDon", lsTD));
        }
コード例 #7
0
    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;
        }
    }
コード例 #8
0
    private void XoaThucDon()
    {
        string strMaThucDon = (string)Request["MaThucDon"];

        int        maThucDon = int.Parse(strMaThucDon);
        ThucDonBUS bus       = new ThucDonBUS();
        bool       flag      = bus.XoaThucDon(maThucDon);

        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);
    }
コード例 #9
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());
    }
コード例 #10
0
        private void LoadData()
        {
            lv_thucDon.Items.Clear();


            ctHdBUS             = new ChiTietHoaDonBUS();
            lsCTHDDTO           = ctHdBUS.DanhSachChiTietHD(FrmQLHoaDon.hdHienHanh.MAHD);
            dgv_CTHD.DataSource = lsCTHDDTO;

            tdBUS     = new ThucDonBUS();
            lsThucDon = tdBUS.DanhSachTD().FindAll(o => o.TINHTRANG == 1);

            foreach (ThucDonDTO td in lsThucDon)
            {
                ListViewItem item = new ListViewItem(td.TENTHUCDON, td.MATD.Trim() + ".jpg");
                item.SubItems.Add(td.MATD);
                item.SubItems.Add(td.GIA.Replace("VNĐ", "").Replace(".", ""));
                lv_thucDon.Items.Add(item);
            }
            // ten thuc don
        }
コード例 #11
0
    private void Lay_danh_sach()
    {
        ThucDonBUS thucdonBUS = new ThucDonBUS();

        ThucDonDTO[] DsThucDon = thucdonBUS.DanhSachThucDon();

        XL_THE Kq = new XL_THE("DANH_SACH");

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

            ThucDonDTO ThucDon = DsThucDon[i];
            if (ThucDon.Trang_thai_hien_thi == false)
            {
                continue;
            }
            XL_THUOC_TINH Thuoc_tinh = new XL_THUOC_TINH("Ma_thuc_don", ThucDon.Ma_thuc_don.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Ten_thuc_don", ThucDon.Ten_thuc_don);
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Hinh_anh_minh_hoa", ThucDon.Hinh_anh_minh_hoa);
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Gia", ThucDon.Gia.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Ma_loai_thuc_don", ThucDon.Ma_loai_thuc_don.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Tinh_trang", ThucDon.Tinh_trang.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Trang_thai_hien_thi", ThucDon.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());
    }
コード例 #12
0
    protected void ThemThucDon()
    {
        ThucDonDTO dto = new ThucDonDTO();

        dto.Ten_thuc_don      = XL_CHUOI.Nhap(Request, "ten");
        dto.Ma_loai_thuc_don  = int.Parse(XL_CHUOI.Nhap(Request, "maloai"));
        dto.Mo_ta             = XL_CHUOI.Nhap(Request, "mota");
        dto.Hinh_anh_minh_hoa = XL_CHUOI.Nhap(Request, "hinhanh");
        dto.Gia                 = decimal.Parse(XL_CHUOI.Nhap(Request, "gia"));
        dto.Tinh_trang          = bool.Parse(XL_CHUOI.Nhap(Request, "tinhtrang"));
        dto.Trang_thai_hien_thi = bool.Parse(XL_CHUOI.Nhap(Request, "hienthi"));

        String strTag       = XL_CHUOI.Nhap(Request, "tag");
        String strDsMaMonAn = XL_CHUOI.Nhap(Request, "dsmamonan");

        String[] M = strDsMaMonAn.Split(new String[] { "-" }, StringSplitOptions.RemoveEmptyEntries);

        ThucDonBUS bus = new ThucDonBUS();
        int        Kq  = bus.ThemThucDon(dto, M, 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);
    }
コード例 #13
0
    protected void DsThucDonThuocLoaiThucDon()
    {
        ThucDonBUS thuc_donBUS = new ThucDonBUS();
        ArrayList  dsThucDon   = thuc_donBUS.LayDSThucDonThuocLoaiThucDonBatKy(int.Parse(Session["LoaiThucDon"].ToString()));

        XL_THE Kq = new XL_THE("DANH_SACH");

        for (int i = 0; i < dsThucDon.Count; i++)
        {
            XL_THE Kq1 = new XL_THE("ThucDon");

            ThucDonDTO ThucDon = (ThucDonDTO)dsThucDon[i];
            if (ThucDon.Trang_thai_hien_thi == false)
            {
                continue;
            }
            XL_THUOC_TINH Thuoc_tinh = new XL_THUOC_TINH("Ma_thuc_don", ThucDon.Ma_thuc_don.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Ten_thuc_don", ThucDon.Ten_thuc_don);
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Hinh_anh_minh_hoa", ThucDon.Hinh_anh_minh_hoa);
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Gia", ThucDon.Gia.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Ma_loai_thuc_don", ThucDon.Ma_loai_thuc_don.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Tinh_trang", ThucDon.Tinh_trang.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Trang_thai_hien_thi", ThucDon.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());
    }
コード例 #14
0
    public void LayDSTenThucDon()
    {
        ThucDonBUS bus = new ThucDonBUS();

        ThucDonDTO[] DsThucDon = bus.DanhSachThucDon();

        XL_THE Kq = new XL_THE("DANH_SACH");

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

            ThucDonDTO dto = DsThucDon[i];

            XL_THUOC_TINH Thuoc_tinh = new XL_THUOC_TINH("MaThucDon", dto.Ma_thuc_don.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("TenThucDon", dto.Ten_thuc_don);
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Kq.Danh_sach_the.Add(Kq1);
        }

        XL_CHUOI.XuatXML(Response, Kq.Chuoi());
    }
コード例 #15
0
    protected void Lay_danh_sach_thuc_don_tu_tao()
    {
        int makhachhang = int.Parse(Session["MaNguoiDung"].ToString());

        ThucDonBUS       thucdonbus = new ThucDonBUS();
        ThucDonCaNhanBUS thcnBus    = new ThucDonCaNhanBUS();

        ThucDonCaNhanDTO[] arr = thcnBus.LayDSThucDonYeuThich(makhachhang);

        if (arr == null)
        {
            return;
        }

        XL_THE Kq = new XL_THE("DANH_SACH");

        for (int i = 0; i < arr.Length; i++)
        {
            XL_THE           Kq1           = new XL_THE("ThucDon");
            ThucDonCaNhanDTO ThucDonCaNhan = (ThucDonCaNhanDTO)arr[i];
            //ThucDonDTO thucdon = thucdonbus.ChiTietThucDon(ThucDonCaNhan.Ma_thuc_don_ca_nhan);

            XL_THUOC_TINH Thuoc_tinh = new XL_THUOC_TINH("Ma_thuc_don", ThucDonCaNhan.Ma_thuc_don_ca_nhan.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Ten_thuc_don", ThucDonCaNhan.Ten_thuc_don);
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Hinh_anh_minh_hoa", ThucDonCaNhan.Hinh_anh);
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Gia", ThucDonCaNhan.Gia.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Kq.Danh_sach_the.Add(Kq1);
        }

        XL_CHUOI.XuatXML(Response, Kq.Chuoi());
    }
コード例 #16
0
        private void btn_luu_Click(object sender, EventArgs e)
        {
            ThucDonDTO TD = new ThucDonDTO();

            try
            {
                TD.MATD       = txt_MaTD.Text.Trim();
                TD.TENTHUCDON = txt_TenTD.Text.Trim();
                TD.GIA        = int.Parse(txt_Gia.Text.Replace(".", "")).ToString().Trim();
                TD.LOAITD     = int.Parse(cbo_Loai.SelectedValue.ToString());
                TD.TINHTRANG  = int.Parse(cbo_TT.SelectedValue.ToString());
            }
            catch
            {
                MessageBox.Show("Thieu thong tin");
                return;
            }

            ThucDonBUS a = new ThucDonBUS();

            if (trThai == 2)
            {
                if (pbo_hinhanh.Image == null)
                {
                    MessageBox.Show("Vui lòng chọn hình ảnh !");
                    return;
                }

                bool kq = a.Them(TD);


                if (kq)
                {
                    pbo_hinhanh.Name = maTDMoi.Trim();
                    MessageBox.Show(pbo_hinhanh.Name);
                    pbo_hinhanh.Image.Save(duongDanHA + pbo_hinhanh.Name + ".jpg");
                    FrmChinh frmmain = (FrmChinh)this.MdiParent;
                    frmmain.lsNDDTO = new LichSuNguoiDungDTO()
                    {
                        MAND     = frmmain.nvDangNhap.MAND,
                        MANV     = frmmain.nvDangNhap.MANV,
                        THOIGIAN = DateTime.Parse(DateTime.Now.ToString("dd/MM/yyy HH:mm")),
                        SUKIEN   = "Thực đơn " + txt_TenTD.Text + " được thêm vào hệ thống"
                    };
                    bool ktls = frmmain.lsNDBUS.ThemLichSuNguoiDung(frmmain.lsNDDTO);
                    trThai     = 1;
                    TDhienhanh = null;
                    LoadData();
                    TrangThai();
                    Bind();
                }
                else
                {
                    MessageBox.Show("Them that bai !");
                }
            }
            else
            {
                bool kt = a.CapNhat(TD);
                if (!kt)
                {
                    MessageBox.Show("Cập nhật thất bại");
                }
                else
                {
                    if (ckh_doihinh.Checked && pbo_hinhanh.Image != null)
                    {
                        pbo_hinhanh.Name = TD.MATD.Trim();
                        MessageBox.Show(pbo_hinhanh.Name);
                        pbo_hinhanh.Image.Save(duongDanHA + pbo_hinhanh.Name + ".jpg");
                    }
                    MessageBox.Show("Cập nhật thành công!");
                    FrmChinh frmmain = (FrmChinh)this.MdiParent;
                    frmmain.lsNDDTO = new LichSuNguoiDungDTO()
                    {
                        MAND     = frmmain.nvDangNhap.MAND,
                        MANV     = frmmain.nvDangNhap.MANV,
                        THOIGIAN = DateTime.Parse(DateTime.Now.ToString("dd/MM/yyy HH:mm")),
                        SUKIEN   = "Thực đơn " + txt_TenTD.Text + " được cập nhật"
                    };
                    bool ktls = frmmain.lsNDBUS.ThemLichSuNguoiDung(frmmain.lsNDDTO);
                    trThai     = 1;
                    TDhienhanh = null;
                    LoadData();
                    TrangThai();
                    Bind();
                }
            }
        }
コード例 #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());
    }
コード例 #18
0
    void LayDanhSachThucDon()
    {
        // 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;
        }

        ThucDonBUS bus = new ThucDonBUS();

        ThucDonDTO[] kq = bus.DanhSachThucDon(pageNum, pageSize);

        LoaiThucDonBUS ltdBus = new LoaiThucDonBUS();

        int tongSoThucDon = bus.TongSoThucDon();

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

        Kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

        foreach (ThucDonDTO dto in kq)
        {
            XL_THE the = new XL_THE("ThucDon");

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

            Thuoc_tinh = new XL_THUOC_TINH("TenThucDon", dto.Ten_thuc_don);
            the.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            LoaiThucDonDTO ltdDto = ltdBus.ChiTietLoaiThucDon(dto.Ma_loai_thuc_don);
            Thuoc_tinh = new XL_THUOC_TINH("LoaiThucDon", ltdDto.Ten_loai_thuc_don);
            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());
    }
コード例 #19
0
    protected void TimKiem()
    {
        ThucDonBUS thuc_donBUS = new ThucDonBUS();

        ThucDonDTO[] dsThucDon;
        ArrayList    arr = (ArrayList)Session["info"];

        if (arr.Count == 1)
        {
            string ten_thuc_don = arr[0].ToString();
            dsThucDon = thuc_donBUS.TimKiemThucDonTheoTen(ten_thuc_don);
        }
        else
        {
            string ten_thuc_don     = "";
            int    ma_loai_thuc_don = -1;
            string tag     = "";
            double gia_min = -1;
            double gia_max = -1;

            if (arr[0].ToString() != "null")
            {
                ten_thuc_don = arr[0].ToString();
            }
            if (arr[1].ToString() != "null")
            {
                ma_loai_thuc_don = 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());
            }

            dsThucDon = thuc_donBUS.TimKiemThucDonNangCao(ten_thuc_don, ma_loai_thuc_don, tag, gia_min, gia_max);
        }

        XL_THE Kq = new XL_THE("DANH_SACH");

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

            ThucDonDTO ThucDon = dsThucDon[i];
            if (ThucDon.Trang_thai_hien_thi == false)
            {
                continue;
            }
            XL_THUOC_TINH Thuoc_tinh = new XL_THUOC_TINH("Ma_thuc_don", ThucDon.Ma_thuc_don.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Ten_thuc_don", ThucDon.Ten_thuc_don);
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Hinh_anh_minh_hoa", ThucDon.Hinh_anh_minh_hoa);
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Gia", ThucDon.Gia.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Ma_loai_thuc_don", ThucDon.Ma_loai_thuc_don.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Tinh_trang", ThucDon.Tinh_trang.ToString());
            Kq1.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);
            Thuoc_tinh = new XL_THUOC_TINH("Trang_thai_hien_thi", ThucDon.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());
    }