public List <DetailBill> GetDetailBills(int idTable) { int idBill = new CoffeeDAO().SelectIdBillByIdTable(idTable); List <DetailBill> detailBills = new CoffeeDAO().SelectDetailBillByIdBill(idBill); return(detailBills); }
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); }
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); }
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); }
public Object GetRating() { Category cat = new CoffeeDAO().SelectCatRating(); List <ProductTopping> products = new CoffeeDAO().SelectAllProductToppingByRating(); CatProductTopping catProduct = new CatProductTopping(products, cat); return((Object)catProduct); }
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; }
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); }
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); }
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(); } }
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); * }*/ }
public List <Product> GetAllProductInCatByName(int idCat, string name) { List <Product> pro = new CoffeeDAO().SearchProductInCatByName(idCat, name); return(pro); }
public List <Product> GetAllProductByName(string name) { List <Product> pro = new CoffeeDAO().SearchProductByName(name); return(pro); }
public List <Account> GetAllAccount() { List <Account> acc = new CoffeeDAO().SelectAllAccount(); return(acc); }
public List <LTGD_Project.DTO.Table> GetAllTable() { List <LTGD_Project.DTO.Table> tables = new CoffeeDAO().getAllTable(); return(tables); }
public List <Category> GetAllCat() { List <Category> cat = new CoffeeDAO().SelectAllCategory(); return(cat); }
public bool AddAccount(Account acc) { bool result = new CoffeeDAO().AddAccount(acc); return(result); }
public ProductTopping SelectCatProductToppingByName(int idProduct) { ProductTopping product = new CoffeeDAO().SelectAllProductToppingByIdPro(idProduct); return(product); }
public bool AddCategory(Category cat) { bool result = new CoffeeDAO().AddCategory(cat); return(result); }
public bool UpdateAccount(Account acc) { bool result = new CoffeeDAO().UpdateAccount(acc); return(result); }
public List <Product> GetAllProductByIdCat(int idCat) { List <Product> pro = new CoffeeDAO().SelectAllProductByIdCat(idCat); return(pro); }
public bool DeleteProductByIdProduct(int idProduct) { bool result = new CoffeeDAO().DeleteProductById(idProduct); return(result); }
public List <Product> GetAllProduct() { List <Product> pro = new CoffeeDAO().SelectAllProduct(); return(pro); }
public bool DeleteCategoryByIdCat(int idCat) { bool result = new CoffeeDAO().DeleteCategoryByIdCat(idCat); return(result); }
public bool AddProduct(ProductUpdate pro) { bool result = new CoffeeDAO().AddProduct(pro); return(result); }
public List <Topping> SelectToppingByIdProduct(int idProduct) { List <Topping> listTop = new CoffeeDAO().SelectToppingByIdProduct(idProduct); return(listTop); }
public int AddBillAndDetailBill(Bill bill) { int result = new CoffeeDAO().AddBillAndDetailBill(bill); return(result); }
public bool UpdateCategory(Category cat) { bool result = new CoffeeDAO().UpdateCategory(cat); return(result); }
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); } } } }
public bool DeleteAccount(string idAccount) { bool result = new CoffeeDAO().DeleteAccount(idAccount); return(result); }