public List <DTO.Food> GetListFood() { List <DTO.Food> list = new List <DTO.Food>(); string query = "select * from FOOD"; DataTable data = DAO.DataProvider.Instance.ExecuteQuery(query); foreach (DataRow item in data.Rows) { DTO.Food food = new DTO.Food(item); list.Add(food); } return(list); }
public List <Food> SearchFoodByName(string name) { List <DTO.Food> list = new List <DTO.Food>(); string query = string.Format("SELECT * FROM dbo.Food WHERE dbo.fuConvertToUnsign1(name) LIKE N'%' + dbo.fuConvertToUnsign1(N'{0}') + '%'", name); DataTable data = DataProvider.Instance.ExecuteQuery(query); foreach (DataRow item in data.Rows) { DTO.Food food = new DTO.Food(item); list.Add(food); } return(list); }
public List <DTO.Food> GetFoodByCategoryID(int id) { List <DTO.Food> list = new List <DTO.Food>(); string query = "Select * from Food where idCategory = " + id; DataTable data = DataProvider.Instance.ExecuteQuery(query); foreach (DataRow item in data.Rows) { DTO.Food food = new DTO.Food(item); list.Add(food); } return(list); }
public RecipeDetail(int id) { InitializeComponent(); food = FoodDAO.getById(id.ToString()); this.DataContext = food; LoadStepList(); if (food.VideoLink != null && food.VideoLink.Length > 0) { videoLink.Visibility = Visibility.Visible; } else { videoLink.Visibility = Visibility.Collapsed; } }
public static void UpdateSanPham(DTO.Food food) { string sql = "update MONAN set TenMon = N'" + food.TenMon + "', idLoaiMon = '" + food.IdLoaiMon + "', GiaTien = '" + food.GiaTien + "' where id = '" + food.Id + "'"; KetNoiCSDL.NonQuery(sql); }
public static void InsertSanPham(DTO.Food food) { string sql = "Insert into MONAN(TenMon, idLoaiMon, GiaTien) Values (N'" + food.TenMon + "', " + food.IdLoaiMon + ", " + food.GiaTien + ")"; KetNoiCSDL.NonQuery(sql); }