コード例 #1
0
        public string GetMenuById(Stream stream)
        {
            string ID = string.Empty;

            StreamReader sr = new StreamReader(stream);


            try
            {
                string s = sr.ReadToEnd(); s = RestConsoleDemo.BLL.Helper.Base64Helper.DecodeBase64NotEnd(s);

                ResponseHelper.SetHeaderInfo();
                NameValueCollection nvc = System.Web.HttpUtility.ParseQueryString(s);
                ID = nvc["Id"];
                string Token = nvc["Token"];
                UserBill.CheckToken(Token);
                int    id  = Convert.ToInt32(ID);
                string str = MenuBill.GetMenuById(id);
                return(str);
            }
            catch (Exception ex)
            {
                return(RestConsoleDemo.BLL.Helper.ResponseHelper.ResponseMsg("-1", ex.Message, ""));
            }
        }
コード例 #2
0
        public List <MenuBill> getBillByTableID(int tableID)
        {
            int             check    = 1;
            List <MenuBill> listMenu = new List <MenuBill>();
            DataTable       dtBill   = new DataTable();

            dtBill = DAL_InfoHoaDon.Instance.GetIFUncheckByTableID(tableID);
            foreach (DataRow row in dtBill.Rows)
            {
                check = 0;
                MenuBill mNew = new MenuBill(row);
                foreach (MenuBill menu in listMenu)
                {
                    if (menu.TenMon == mNew.TenMon)
                    {
                        menu.SoLuong += mNew.SoLuong;
                        check         = 1;
                    }
                }
                if (check == 0)
                {
                    listMenu.Add(mNew);
                }
            }
            return(listMenu);
        }
コード例 #3
0
ファイル: MenuDAO.cs プロジェクト: hado-569/ManagerCoffeStore
        public List <MenuBill> GetListMenuByTable(int id)
        {
            List <MenuBill> listMenu = new List <MenuBill>();
            string          query    = "select f.ten,bi.count,f.price,f.price*bi.count as totalPrice from Billinfor as bi , Bill as b , Food as f where bi.idBill = b.id and bi.idFood = f.id and b.status=0 and b.idTable = " + id;
            DataTable       data     = DataProvider.Instance.ExcuteQuery(query);

            foreach (DataRow item in data.Rows)
            {
                MenuBill m = new MenuBill(item);
                listMenu.Add(m);
            }
            return(listMenu);
        }
コード例 #4
0
ファイル: BillDAO.cs プロジェクト: newElliot/CoffeeShop
        public List <MenuBill> PrintBill(int idBill)
        {
            List <MenuBill> list  = new List <MenuBill>();
            string          query = "select p.id ,p.name, p.price, bi.count, p.price*bi.count as [Total] from Bill as b, BillInfo as bi, Product as p where b.id = bi.idBill and p.id = bi.idProduct and b.checkOut = 0 and  idBill = " + idBill;
            DataTable       data  = DataProvider.Instance.ExcuteQuery(query);

            foreach (DataRow item in data.Rows)
            {
                MenuBill menu = new MenuBill(item);
                list.Add(menu);
            }

            return(list);
        }
コード例 #5
0
        /// <summary>
        /// Hiển thị hóa đơn cho bàn có id là ...
        /// </summary>
        /// <returns></returns>
        public List <MenuBill> GetDetailBillInfoByIdTable(int idTable)
        {
            List <MenuBill> list = new List <MenuBill>();

            string query = "select p.id as id, p.name as name, p.price as price, bi.count as count, (p.price * bi.count) as total from Bill as b, BillInfo as bi, Product as p where b.id = bi.idBill and p.id = bi.idProduct and b.checkOut = 0 and b.idTableFood = " + idTable;

            DataTable data = DataProvider.Instance.ExcuteQuery(query);

            foreach (DataRow item in data.Rows)
            {
                MenuBill menu = new MenuBill(item);
                list.Add(menu);
            }
            return(list);
        }
コード例 #6
0
        public string GetTreeMenu(Stream stream)
        {
            StreamReader sr = new StreamReader(stream);

            try
            {
                string s = sr.ReadToEnd(); s = RestConsoleDemo.BLL.Helper.Base64Helper.DecodeBase64NotEnd(s);

                ResponseHelper.SetHeaderInfo();
                NameValueCollection nvc = System.Web.HttpUtility.ParseQueryString(s);
                string Token            = nvc["Token"];

                string str = MenuBill.GetTreeMenu();
                return(str);
            }
            catch (Exception ex)
            {
                return(RestConsoleDemo.BLL.Helper.ResponseHelper.ResponseMsg("-1", ex.Message, ""));
            }
        }
コード例 #7
0
        public string DeleteMenu(Stream stream)
        {
            StreamReader sr = new StreamReader(stream);

            try
            {
                ResponseHelper.SetHeaderInfo();
                string s = sr.ReadToEnd(); s = RestConsoleDemo.BLL.Helper.Base64Helper.DecodeBase64NotEnd(s);

                NameValueCollection nvc = System.Web.HttpUtility.ParseQueryString(s);
                string Token            = nvc["Token"];
                UserBill.CheckToken(Token);
                string   delStr = nvc["str"];
                string[] list   = delStr.Split(',');
                string   str    = MenuBill.DeleteMenu(list);
                return(str);
            }
            catch (Exception ex)
            {
                return(RestConsoleDemo.BLL.Helper.ResponseHelper.ResponseMsg("-1", ex.Message, ""));
            }
        }
コード例 #8
0
        public string GetAllMenuInfo(Stream stream)
        {
            StreamReader sr = new StreamReader(stream);

            try
            {
                string s = sr.ReadToEnd(); s = RestConsoleDemo.BLL.Helper.Base64Helper.DecodeBase64NotEnd(s);

                ResponseHelper.SetHeaderInfo();
                NameValueCollection nvc = System.Web.HttpUtility.ParseQueryString(s);
                string ParameterStr     = nvc["ParameterStr"];
                int    PageSize         = Convert.ToInt32(nvc["PageSize"]);
                int    CurrentPage      = Convert.ToInt32(nvc["CurrentPage"]);
                string Token            = nvc["Token"];
                UserBill.CheckToken(Token);
                string str = MenuBill.GetAllMenuInfo(ParameterStr, PageSize, CurrentPage);
                return(str);
            }
            catch (Exception ex)
            {
                return(RestConsoleDemo.BLL.Helper.ResponseHelper.ResponseMsg("-1", ex.Message, ""));
            }
        }