Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 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;
     }
 }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        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);
        }