public FoodPageViewModel()
        {
            if (FoodModel.SelectFood() != null)//
            {
                var query = FoodModel.SelectFood();

                Foods = new ObservableCollection <Food>();
                foreach (var food in query)
                {
                    Food f = new Food
                    {
                        F_name   = food.F_name,
                        F_result = food.F_result
                    };
                    Foods.Add(f);
                }
            }
            else
            {
                Foods = new ObservableCollection <Food> {
                    new Food {
                        F_name = "NoData",
                        //F_date = new DateTime(1970,1,1)
                        F_result = 999
                    }
                };
            }
        }
        /***************「登録ボタン」が押された時*********************/
        private void Insert01_Clicked(object sender, EventArgs e)
        {
            //Foodテーブルにインサートする
            //FoodModel.InsertFood(1, NameEntry.Text, d);//
            //DisplayAlert(NameEntry.Text, d.ToString(), "ok");

            FoodModel.InsertFood(1, NameEntry.Text, result);//
            DisplayAlert(NameEntry.Text, result.ToString(), "ok");

            FoodModel.SelectFood();//ワンチャン
        }
Ejemplo n.º 3
0
        public FoodPageViewModel()
        {
            /*
             * if (FoodModel.SelectFood() != null)
             * {
             *  var query = FoodModel.SelectFood();
             *
             *
             *  foreach (var food in query)
             *  {
             *      Analytics.TrackEvent("food name=" + food.F_name + "  food date=" + food.F_date);
             *
             *      Foods = new ObservableCollection<Food>{
             *          new Food
             *          {
             *              F_name = food.F_name,
             *              F_date = food.F_date
             *          }
             *      };
             *  }
             * }
             */

            if (FoodModel.SelectFood() != null)
            {
                var query = FoodModel.SelectFood();

                Foods = new ObservableCollection <Food>();
                foreach (var food in query)
                {
                    Food f = new Food
                    {
                        F_name = food.F_name,
                        F_date = food.F_date
                    };
                    Foods.Add(f);
                }
            }
            else
            {
                Foods = new ObservableCollection <Food> {
                    new Food {
                        F_name = "NoData",
                        F_date = new DateTime(1970, 1, 1)
                    }
                };
            }
        }
Ejemplo n.º 4
0
        public FoodPageViewModel()
        {
            if (FoodModel.SelectFood() != null)
            {
                var query01 = FoodModel.SelectFood();

                Foods = new ObservableCollection <Food>();
                foreach (var food01 in query01)
                {
                    Food f01 = new Food
                    {
                        F_no     = food01.F_no,
                        F_name   = food01.F_name,
                        F_result = food01.F_result,
                        F_date   = food01.F_date
                    };

                    FoodModel.UpdateF_date(food01.F_no, food01.F_name, food01.F_result, food01.F_date);
                    Foods.Add(f01);
                    //FoodModel.UpdateF_date(food01.F_no, food01.F_name, food01.F_result, food01.F_date);
                }

                Foods = new ObservableCollection <Food>();
                foreach (var food02 in query01)
                {
                    Food f02 = new Food
                    {
                        F_no     = food02.F_no,
                        F_name   = food02.F_name,
                        F_result = food02.F_result,
                        F_date   = food02.F_date
                    };
                    Foods.Add(f02);
                }
            }
            else
            {
                Foods = new ObservableCollection <Food> {
                    new Food {
                        F_name = "NoData",
                        //F_date = new DateTime(1970,1,1)
                        F_result = 999
                    }
                };
            }
        }
Ejemplo n.º 5
0
        public FoodPageViewModel()
        {
            /*************おかしくなったらここを解除****************/

            /*
             * if (FoodModel.SelectFood() != null)
             * {
             *
             *  var query = FoodModel.SelectFood();
             *
             *  Foods = new ObservableCollection<Food>();
             *  foreach (var food in query)
             *  {
             *      Food f = new Food
             *      {
             *          F_no = food.F_no,
             *          F_name = food.F_name,
             *          F_result = food.F_result,
             *          F_date = food.F_date
             *      };
             *      Foods.Add(f);
             *  }
             *
             * }
             * else
             * {
             *  Foods = new ObservableCollection<Food> {
             *      new Food {
             *         F_name = "NoData",
             *         //F_date = new DateTime(1970,1,1)
             *         F_result = 999
             *      }
             *  };
             * }
             */

            /**********************ダメだったらここを消す********************/
            if (FoodModel.SelectFood() != null)
            {
                var query01 = FoodModel.SelectFood();

                Foods = new ObservableCollection <Food>();
                foreach (var food01 in query01)
                {
                    Food f01 = new Food
                    {
                        F_no     = food01.F_no,
                        F_name   = food01.F_name,
                        F_result = food01.F_result,
                        F_date   = food01.F_date
                    };

                    FoodModel.UpdateF_date(food01.F_no, food01.F_name, food01.F_result, food01.F_date);
                    Foods.Add(f01);
                    //FoodModel.UpdateF_date(food01.F_no, food01.F_name, food01.F_result, food01.F_date);
                }

                Foods = new ObservableCollection <Food>();
                foreach (var food02 in query01)
                {
                    Food f02 = new Food
                    {
                        F_no     = food02.F_no,
                        F_name   = food02.F_name,
                        F_result = food02.F_result,
                        F_date   = food02.F_date
                    };
                    Foods.Add(f02);
                }
            }
            else
            {
                Foods = new ObservableCollection <Food> {
                    new Food {
                        F_name = "NoData",
                        //F_date = new DateTime(1970,1,1)
                        F_result = 999
                    }
                };
            }
            /****************************************************************/
        }