Пример #1
0
        public List <DetailBill> GetDetailBills(int idTable)
        {
            int idBill = new CoffeeDAO().SelectIdBillByIdTable(idTable);
            List <DetailBill> detailBills = new CoffeeDAO().SelectDetailBillByIdBill(idBill);

            return(detailBills);
        }
Пример #2
0
        public Object SelectCatProductToppingByIdCat(int idCat)
        {
            Category cat = new CoffeeDAO().SelectCatByIdCat(idCat);
            List <ProductTopping> products   = new CoffeeDAO().SelectAllProductToppingByIdCat(idCat);
            CatProductTopping     catProduct = new CatProductTopping(products, cat);

            return((Object)catProduct);
        }
Пример #3
0
        public Object CheckSignIn(Account acc)
        {
            int          result       = new CoffeeDAO().CheckSignIn(acc);
            Account      account      = new CoffeeDAO().GetAccount(acc.IdAccount);
            AccountCheck accountCheck = new AccountCheck(account, result);

            return((Object)accountCheck);
        }
Пример #4
0
        public Object GetDetailBillByIdTable(int idTable)
        {
            List <Menu> detailBills = new CoffeeDAO().SelectMenu(idTable);
            string      note        = new CoffeeDAO().SelectNoteBill(idTable);
            MenuNote    menu        = new MenuNote(note, detailBills);

            return((Object)menu);
        }
Пример #5
0
        public Object GetRating()
        {
            Category cat = new CoffeeDAO().SelectCatRating();
            List <ProductTopping> products   = new CoffeeDAO().SelectAllProductToppingByRating();
            CatProductTopping     catProduct = new CatProductTopping(products, cat);

            return((Object)catProduct);
        }
Пример #6
0
        private void GetAutoCompleteFilter()
        {
            CoffeeDAO        dao  = new CoffeeDAO();
            List <CoffeeDTO> list = dao.getCoffeeList();
            var source            = new AutoCompleteStringCollection();

            foreach (var dto in list)
            {
                source.Add(dto.Name);
            }
            txtFilter.AutoCompleteCustomSource = source;
            txtFilter.AutoCompleteMode         = AutoCompleteMode.Suggest;
            txtFilter.AutoCompleteSource       = AutoCompleteSource.CustomSource;
        }
Пример #7
0
        public Object SelectAllCatProduct()
        {
            int count = new CoffeeDAO().SelectAllCategory().Count();
            List <CatProduct> listCatProduct = new List <CatProduct>();

            for (int i = 1; i <= count; i++)
            {
                Category       cat        = new CoffeeDAO().SelectCatByIdCat(i);
                List <Product> products   = new CoffeeDAO().SelectAllProductByIdCat(i);
                CatProduct     catProduct = new CatProduct(products, cat);
                listCatProduct.Add(catProduct);
            }
            return((Object)listCatProduct);
        }
Пример #8
0
        public Object SelectCatProductToppingByName(string name)
        {
            int count = new CoffeeDAO().SelectAllCategory().Count();
            List <CatProductTopping> listCatProduct = new List <CatProductTopping>();

            for (int i = 1; i <= count; i++)
            {
                Category cat = new CoffeeDAO().SelectCatByIdCat(i);
                List <ProductTopping> products   = new CoffeeDAO().SearchProToppingByNameIdCat(name, i);
                CatProductTopping     catProduct = new CatProductTopping(products, cat);
                if (products.Count() > 0)
                {
                    listCatProduct.Add(catProduct);
                }
            }
            return((Object)listCatProduct);
        }
Пример #9
0
 private void txtFilter_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         listCoffee.DataSource = null;
         string sFilter = txtFilter.Text;
         listCoffee.BeginUpdate();
         listCoffee.Items.Clear();
         CoffeeDAO        dao        = new CoffeeDAO();
         List <CoffeeDTO> list       = dao.getCoffeeList();
         List <CoffeeDTO> filterList = new List <CoffeeDTO>();
         foreach (var dto in list)
         {
             if (dto.Name.ToLower().Contains(sFilter.ToLower()))
             {
                 filterList.Add(dto);
             }
         }
         bsCoffee.DataSource      = filterList;
         listCoffee.DataSource    = bsCoffee;
         listCoffee.DisplayMember = "Name";
         listCoffee.EndUpdate();
     }
 }
Пример #10
0
        private void LoadList()
        {
            CoffeeDAO        dao  = new CoffeeDAO();
            List <CoffeeDTO> list = dao.getCoffeeList();

            bsCoffee.DataSource = list;

            lbName.DataBindings.Clear();
            txtDesc.DataBindings.Clear();
            TotalPrice.DataBindings.Clear();

            lbName.DataBindings.Add("Text", bsCoffee, "Name");
            txtDesc.DataBindings.Add("Text", bsCoffee, "Description");
            txtPrice.DataBindings.Add("Text", bsCoffee, "Price");
            TotalPrice.DataBindings.Add("Text", bsCoffee, "Price");

            listCoffee.DataSource    = bsCoffee;
            listCoffee.DisplayMember = "Name";

            /*foreach (CoffeeDTO item in list)
             * {
             *  listCoffee.Items.Add(item.Name);
             * }*/
        }
Пример #11
0
        public List <Product> GetAllProductInCatByName(int idCat, string name)
        {
            List <Product> pro = new CoffeeDAO().SearchProductInCatByName(idCat, name);

            return(pro);
        }
Пример #12
0
        public List <Product> GetAllProductByName(string name)
        {
            List <Product> pro = new CoffeeDAO().SearchProductByName(name);

            return(pro);
        }
Пример #13
0
        public List <Account> GetAllAccount()
        {
            List <Account> acc = new CoffeeDAO().SelectAllAccount();

            return(acc);
        }
Пример #14
0
        public List <LTGD_Project.DTO.Table> GetAllTable()
        {
            List <LTGD_Project.DTO.Table> tables = new CoffeeDAO().getAllTable();

            return(tables);
        }
Пример #15
0
        public List <Category> GetAllCat()
        {
            List <Category> cat = new CoffeeDAO().SelectAllCategory();

            return(cat);
        }
Пример #16
0
        public bool AddAccount(Account acc)
        {
            bool result = new CoffeeDAO().AddAccount(acc);

            return(result);
        }
Пример #17
0
        public ProductTopping SelectCatProductToppingByName(int idProduct)
        {
            ProductTopping product = new CoffeeDAO().SelectAllProductToppingByIdPro(idProduct);

            return(product);
        }
Пример #18
0
        public bool AddCategory(Category cat)
        {
            bool result = new CoffeeDAO().AddCategory(cat);

            return(result);
        }
Пример #19
0
        public bool UpdateAccount(Account acc)
        {
            bool result = new CoffeeDAO().UpdateAccount(acc);

            return(result);
        }
Пример #20
0
        public List <Product> GetAllProductByIdCat(int idCat)
        {
            List <Product> pro = new CoffeeDAO().SelectAllProductByIdCat(idCat);

            return(pro);
        }
Пример #21
0
        public bool DeleteProductByIdProduct(int idProduct)
        {
            bool result = new CoffeeDAO().DeleteProductById(idProduct);

            return(result);
        }
Пример #22
0
        public List <Product> GetAllProduct()
        {
            List <Product> pro = new CoffeeDAO().SelectAllProduct();

            return(pro);
        }
Пример #23
0
        public bool DeleteCategoryByIdCat(int idCat)
        {
            bool result = new CoffeeDAO().DeleteCategoryByIdCat(idCat);

            return(result);
        }
Пример #24
0
        public bool AddProduct(ProductUpdate pro)
        {
            bool result = new CoffeeDAO().AddProduct(pro);

            return(result);
        }
Пример #25
0
        public List <Topping> SelectToppingByIdProduct(int idProduct)
        {
            List <Topping> listTop = new CoffeeDAO().SelectToppingByIdProduct(idProduct);

            return(listTop);
        }
Пример #26
0
        public int AddBillAndDetailBill(Bill bill)
        {
            int result = new CoffeeDAO().AddBillAndDetailBill(bill);

            return(result);
        }
Пример #27
0
        public bool UpdateCategory(Category cat)
        {
            bool result = new CoffeeDAO().UpdateCategory(cat);

            return(result);
        }
Пример #28
0
        public bool AddProductToBill(AddProductToBill addProductToBill)
        {
            IFirebaseConfig config = new FirebaseConfig
            {
                AuthSecret = "dHDi653cpD0hHaOOrAwgtlTahn7FC9ZBhYoDjeWV",
                BasePath   = "https://cafe-4b7dd.firebaseio.com/"
            };

            IFirebaseClient client = new FirebaseClient(config);

            if (client == null)
            {
                return(false);
            }
            else
            {
                int idBill = new CoffeeDAO().SelectIdBill(addProductToBill.IdTable);
                if (idBill == -1)
                {
                    bool result1 = new CoffeeDAO().AddBill(addProductToBill.IdTable, addProductToBill.IdAccount, addProductToBill.Note);
                    if (result1)
                    {
                        bool result2 = new CoffeeDAO().UpdateStatusTable(addProductToBill.IdTable, "Có người");
                        if (result2)
                        {
                            for (int i = 0; i < addProductToBill.Product.Count(); i++)
                            {
                                int  id      = new CoffeeDAO().SelectIdBillLast();
                                bool result3 = new CoffeeDAO().AddDetailBill(id, addProductToBill.Product[i].IdProduct, addProductToBill.Product[i].Quantity, addProductToBill.Product[i].PriceProduct, addProductToBill.Product[i].toppingAdds);
                                if (result3 == false)
                                {
                                    return(false);
                                }
                            }
                            _ = EditStatusTableFirebase(addProductToBill.IdTable, addProductToBill.NameTable, "Có người", client);
                            _ = EditNoteTableFirebase(client, addProductToBill.IdTable, addProductToBill.Note);
                            return(true);
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                //Bill đã tồn tại
                else
                {
                    //Xóa hết
                    List <int> idDetailBills = new CoffeeDAO().SelectIdDetailBill(idBill);
                    if (idDetailBills.Count > 0)
                    {
                        for (int i = 0; i < idDetailBills.Count(); i++)
                        {
                            List <int> idDetailTopping = new CoffeeDAO().SelectIdDetailTopping(idDetailBills[i]);
                            if (idDetailTopping.Count > 0)
                            {
                                for (int j = 0; j < idDetailTopping.Count; j++)
                                {
                                    bool result0 = new CoffeeDAO().DeleteDetailTopping(idDetailTopping[j]);
                                    if (result0 == false)
                                    {
                                        return(false);
                                    }
                                }
                            }
                            bool result = new CoffeeDAO().DeleteDetailBill(idDetailBills[i]);
                            if (result == false)
                            {
                                return(false);
                            }
                        }
                    }
                    _ = EditStatusTableFirebase(addProductToBill.IdTable, addProductToBill.NameTable, "Trống", client);
                    bool result11 = new CoffeeDAO().XoaBill(idBill);
                    if (result11)
                    //Add lại
                    {
                        bool result1 = new CoffeeDAO().AddBill(addProductToBill.IdTable, addProductToBill.IdAccount, addProductToBill.Note);
                        if (result1)
                        {
                            bool result2 = new CoffeeDAO().UpdateStatusTable(addProductToBill.IdTable, "Có người");
                            if (result2)
                            {
                                for (int i = 0; i < addProductToBill.Product.Count(); i++)
                                {
                                    int  id      = new CoffeeDAO().SelectIdBillLast();
                                    bool result3 = new CoffeeDAO().AddDetailBill(id, addProductToBill.Product[i].IdProduct, addProductToBill.Product[i].Quantity, addProductToBill.Product[i].PriceProduct, addProductToBill.Product[i].toppingAdds);
                                    if (result3 == false)
                                    {
                                        return(false);
                                    }
                                }
                                _ = EditStatusTableFirebase(addProductToBill.IdTable, addProductToBill.NameTable, "Có người", client);
                                _ = EditNoteTableFirebase(client, addProductToBill.IdTable, addProductToBill.Note);
                                return(true);
                            }
                            else
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
Пример #29
0
        public bool DeleteAccount(string idAccount)
        {
            bool result = new CoffeeDAO().DeleteAccount(idAccount);

            return(result);
        }