コード例 #1
0
ファイル: BookingService.cs プロジェクト: SermadNajar/WCF
        public void DeleteFood(int id)
        {
            BFood          food           = new BFood(id);
            FoodController foodController = new FoodController();

            foodController.DeleteFood(food);
        }
コード例 #2
0
ファイル: DBFood.cs プロジェクト: SermadNajar/WCF
        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);
        }
コード例 #3
0
ファイル: BookingService.cs プロジェクト: SermadNajar/WCF
        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);
        }
コード例 #4
0
    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
                    }
                }
            }
        }
    }
コード例 #5
0
ファイル: BookingService.cs プロジェクト: SermadNajar/WCF
        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);
        }
コード例 #6
0
 public void CreateFood(BFood food, float x, float y)
 {
     _foodContainer.AddChild(food);
     food.x = x;
     food.y = y;
     _foods.Add(food);
 }
コード例 #7
0
ファイル: DBFood.cs プロジェクト: SermadNajar/WCF
        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);
        }
コード例 #8
0
    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);
    }
コード例 #9
0
 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;
     }
 }
コード例 #10
0
ファイル: DBFood.cs プロジェクト: SermadNajar/WCF
 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();
         }
     }
 }
コード例 #11
0
ファイル: DBFood.cs プロジェクト: SermadNajar/WCF
 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();
         }
     }
 }
コード例 #12
0
    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));
    }
コード例 #13
0
ファイル: DBFood.cs プロジェクト: SermadNajar/WCF
 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();
         }
     }
 }
コード例 #14
0
ファイル: BookingService.cs プロジェクト: SermadNajar/WCF
 public BOrderLine CreateOrderLineFood(int quantity, BFood bFood, BOrder bOrder)
 {
     throw new NotImplementedException();
 }
コード例 #15
0
        public void DeleteFood(BFood food)
        {
            DBFood dBFood = new DBFood();

            dBFood.DeleteFood(food);
        }
コード例 #16
0
        public void UpdateFood(BFood food)
        {
            DBFood dBFood = new DBFood();

            dBFood.UpdateFood(food);
        }
コード例 #17
0
        public void CreateFood(BFood food)
        {
            DBFood dBFood = new DBFood();

            dBFood.CreateFood(food);
        }