public void DeleteFood(int id) { BFood food = new BFood(id); FoodController foodController = new FoodController(); foodController.DeleteFood(food); }
public List <BFood> GetAllFood() { List <BFood> foods = new List <BFood>(); BFood tempF; BFoodCategory tempFC; using (SqlConnection connection = new SqlConnection(_connectionString)) { connection.Open(); using (SqlCommand cmd = connection.CreateCommand()) { cmd.CommandText = "select food.id as fid, food.name as fname, food.price as price, foodcategory.id as id, FoodCategory.name as name from Food, FoodCategory where Food.foodCategoryID = FoodCategory.id"; SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { tempF = new BFood(); tempFC = new BFoodCategory(); tempF.Id = reader.GetInt32(reader.GetOrdinal("fid")); tempF.Name = reader.GetString(reader.GetOrdinal("fname")); tempF.Price = reader.GetDecimal(reader.GetOrdinal("price")); tempFC.Id = reader.GetInt32(reader.GetOrdinal("id")); tempFC.Name = reader.GetString(reader.GetOrdinal("name")); tempF.FoodCategory = tempFC; foods.Add(tempF); } } } return(foods); }
public void UpdateFood(int id, string name, decimal price, BFoodCategory foodCategory) { BFood food = new BFood(id, name, price, foodCategory); FoodController foodController = new FoodController(); foodController.UpdateFood(food); }
public void HandleMultiTouch(FTouch[] touches) { foreach (FTouch touch in touches) { if (touch.phase == TouchPhase.Began) { //we go reverse order so that if we remove a banana it doesn't matter //and also so that that we check from front to back for (int f = _foods.Count - 1; f >= 0; f--) { BFood food = _foods[f]; Vector2 touchPos = food.GlobalToLocal(touch.position); if (food.textureRect.Contains(touchPos)) { TouchFood(food); CreateExplodeEffect(food); break; //break so that a touch can only hit one banana at a time } } } } }
public void CreateFood(string name, decimal price, int foodCategoryId, BFoodCategory foodCategory) { BFood food = new BFood(name, price, foodCategoryId, foodCategory); FoodController foodController = new FoodController(); foodController.CreateFood(food); }
public void CreateFood(BFood food, float x, float y) { _foodContainer.AddChild(food); food.x = x; food.y = y; _foods.Add(food); }
public List <BFood> GetAllFoodCat() { List <BFood> foods = new List <BFood>(); BFood tempF; BFoodCategory tempFC; using (SqlConnection connection = new SqlConnection(_connectionString)) { connection.Open(); using (SqlCommand cmd = connection.CreateCommand()) { cmd.CommandText = "select fo.id as id, fo.name, fo.price, fo.foodCategoryId, fc.id as category, fc.name as foodCategoryName from Food fo RIGHT OUTER JOIN FoodCategory fc ON fo.foodCategoryId = fc.id"; SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { tempF = new BFood(); tempFC = new BFoodCategory(); tempF.Id = reader.GetInt32(reader.GetOrdinal("id")); tempF.Name = reader.GetString(reader.GetOrdinal("name")); tempF.Price = reader.GetDecimal(reader.GetOrdinal("price")); tempF.FoodCategoryId = reader.GetInt32(reader.GetOrdinal("foodCategoryId")); tempFC.Id = reader.GetInt32(reader.GetOrdinal("category")); tempFC.Name = reader.GetString(reader.GetOrdinal("foodCategoryName")); tempF.FoodCategory = tempFC; foods.Add(tempF); } } } return(foods); }
public void CreateFood(string foodName, float x, float y) { BFood food = new BFood(foodName); _foodContainer.AddChild(food); food.x = x; food.y = y; _foods.Add(food); }
private void TouchFood(BFood food) { if (BMain.instance.selected_foods.Contains(food)) { BMain.instance.selected_foods.Remove(food); food.alpha = 1f; } else { BMain.instance.selected_foods.Add(food); food.alpha = 0.5f; } }
public void DeleteFood(BFood food) { using (SqlConnection connection = new SqlConnection(_connectionString)) { connection.Open(); using (SqlCommand cmdDeleteFood = connection.CreateCommand()) { cmdDeleteFood.CommandText = "delete from Food where id = @id"; cmdDeleteFood.Parameters.AddWithValue("Id", food.Id); cmdDeleteFood.ExecuteNonQuery(); } } }
public void CreateFood(BFood food) { using (SqlConnection connection = new SqlConnection(_connectionString)) { connection.Open(); using (SqlCommand cmdInsertFood = connection.CreateCommand()) { cmdInsertFood.CommandText = "INSERT INTO Food(Name, Price, FoodCategoryId) VALUES(@Name, @Price, @FoodCategoryId)"; cmdInsertFood.Parameters.AddWithValue("Name", food.Name); cmdInsertFood.Parameters.AddWithValue("Price", food.Price); cmdInsertFood.Parameters.AddWithValue("foodCategoryId", food.FoodCategoryId); cmdInsertFood.ExecuteNonQuery(); } } }
private void CreateExplodeEffect(BFood food) { //we can't just get its x and y, because they might be transformed somehow Vector2 foodPos = _effectHolder.OtherToLocal(food, Vector2.zero); FSprite explodeSprite = new FSprite("Banana"); _effectHolder.AddChild(explodeSprite); explodeSprite.shader = FShader.Additive; explodeSprite.x = foodPos.x; explodeSprite.y = foodPos.y; explodeSprite.rotation = food.rotation; Go.to(explodeSprite, 0.3f, new TweenConfig().floatProp("scale", 1.3f).floatProp("alpha", 0.0f).onComplete(HandleExplodeSpriteComplete)); }
public void UpdateFood(BFood food) { using (SqlConnection connection = new SqlConnection(_connectionString)) { connection.Open(); using (SqlCommand cmdUpdateFood = connection.CreateCommand()) { cmdUpdateFood.CommandText = "update food set name = @name, price = @price, foodCategoryId = @foodCategoryId where id = @id"; cmdUpdateFood.Parameters.AddWithValue("id", food.Id); cmdUpdateFood.Parameters.AddWithValue("name", food.Name); cmdUpdateFood.Parameters.AddWithValue("price", food.Price); cmdUpdateFood.Parameters.AddWithValue("foodCategoryId", food.FoodCategory.Id); cmdUpdateFood.ExecuteNonQuery(); } } }
public BOrderLine CreateOrderLineFood(int quantity, BFood bFood, BOrder bOrder) { throw new NotImplementedException(); }
public void DeleteFood(BFood food) { DBFood dBFood = new DBFood(); dBFood.DeleteFood(food); }
public void UpdateFood(BFood food) { DBFood dBFood = new DBFood(); dBFood.UpdateFood(food); }
public void CreateFood(BFood food) { DBFood dBFood = new DBFood(); dBFood.CreateFood(food); }