Esempio n. 1
0
        /***************「登録ボタン」が押された時*********************/
        private void Insert01_Clicked(object sender, EventArgs e)
        {
            /*
             * if (!s_switch)//食材の登録だったら
             * {
             *  FoodModel.InsertFood(1, NameEntry.Text, result, yyyymmdd);//試し
             *  DisplayAlert(NameEntry.Text + yyyymmdd.ToString("yyyy/MM/dd"), "あと" + result.ToString() + "日", "OK");
             *
             *  NameEntry.Text = "";
             *
             *  FoodPicker.Date = new DateTime(now.Year, now.Month, now.Day);//
             * }
             * else//保存食品の登録だったら
             * {
             *  qty = int.Parse(NumEntry.Text);
             *  StockFoodModel.InsertStock(1, NameEntry.Text, qty, UnitEntry.Text);
             *  DisplayAlert(NameEntry.Text, qty.ToString() + UnitEntry.Text, "OK");
             *
             *  NameEntry.Text = "";
             *  NumEntry.Text = "";
             *  UnitEntry.Text = "";
             * }
             */

            if (!(NameEntry.Text == null) && !(NameEntry.Text.Equals("")))
            {
                if (!s_switch)                                                 //食材の登録だったら
                {
                    FoodModel.InsertFood(1, NameEntry.Text, result, yyyymmdd); //試し
                    DisplayAlert(NameEntry.Text + yyyymmdd.ToString("yyyy/MM/dd"), "あと" + result.ToString() + "日", "OK");

                    NameEntry.Text = "";

                    FoodPicker.Date = new DateTime(now.Year, now.Month, now.Day);//
                }
                else//保存食品の登録だったら
                {
                    qty = int.Parse(NumEntry.Text);
                    StockFoodModel.InsertStock(1, NameEntry.Text, qty, UnitEntry.Text);
                    DisplayAlert(NameEntry.Text, qty.ToString() + UnitEntry.Text, "OK");

                    NameEntry.Text = "";
                    NumEntry.Text  = "";
                    UnitEntry.Text = "";
                }
            }
            else
            {
                DisplayAlert("入力エラー", "食品名を入力してください", "OK");
            }
        }
        /***************「登録ボタン」が押された時*********************/
        private void Insert01_Clicked(object sender, EventArgs e)
        {
            if (!s_switch)                                                 //食材の登録だったら
            {
                FoodModel.InsertFood(1, NameEntry.Text, result, yyyymmdd); //試し
                DisplayAlert(NameEntry.Text + yyyymmdd.ToString(), "あと" + result.ToString() + "日", "OK");

                NameEntry.Text = "";

                FoodPicker.Date = new DateTime(now.Year, now.Month, now.Day);//
            }
            else//保存食品の登録だったら
            {
                qty = int.Parse(NumEntry.Text);
                StockFoodModel.InsertStock(1, NameEntry.Text, qty, UnitEntry.Text);
                DisplayAlert(NameEntry.Text, qty.ToString() + UnitEntry.Text, "OK");

                NameEntry.Text = "";
                NumEntry.Text  = "";
                UnitEntry.Text = "";
            }
        }
Esempio n. 3
0
        /***************「登録ボタン」が押された時*********************/
        private void Insert01_Clicked(object sender, EventArgs e)
        {
            if (!(NameEntry.Text == null) && !(NameEntry.Text.Equals("")))
            {
                if (!s_switch)                                                     //食材の登録だったら
                {
                    if (!(yyyymmdd.ToString("yyyy/MM/dd").Equals("0001/01/01")))   //日付が入力されている
                    {
                        FoodModel.InsertFood(1, NameEntry.Text, result, yyyymmdd); //試し
                        DisplayAlert(NameEntry.Text + yyyymmdd.ToString("yyyy/MM/dd"), "あと" + result.ToString() + "日", "OK");

                        NameEntry.Text = "";

                        FoodPicker.Date = new DateTime(now.Year, now.Month, now.Day);
                    }
                    else
                    {
                        yyyymmdd = now;
                        FoodModel.InsertFood(1, NameEntry.Text, result, yyyymmdd);//試し
                        DisplayAlert(NameEntry.Text + yyyymmdd.ToString("yyyy/MM/dd"), "あと" + result.ToString() + "日", "OK");

                        NameEntry.Text = "";

                        FoodPicker.Date = new DateTime(now.Year, now.Month, now.Day);
                    }
                }
                else//保存食品の登録だったら
                {
                    if ((!(NumEntry.Text == null) && !(NumEntry.Text.Equals(""))) && (!(UnitEntry.Text == null) && !(UnitEntry.Text.Equals(""))))
                    {
                        if (!(yyyymmdd.ToString("yyyy/MM/dd").Equals("0001/01/01")))//日付が入力されている
                        {
                            qty = int.Parse(NumEntry.Text);
                            StockFoodModel.InsertStock(1, NameEntry.Text, qty, UnitEntry.Text);
                            DisplayAlert(NameEntry.Text, qty.ToString() + UnitEntry.Text, "OK");

                            NameEntry.Text = "";
                            NumEntry.Text  = "";
                            UnitEntry.Text = "";
                        }
                        else
                        {
                            yyyymmdd = now;
                            qty      = int.Parse(NumEntry.Text);
                            StockFoodModel.InsertStock(1, NameEntry.Text, qty, UnitEntry.Text);
                            DisplayAlert(NameEntry.Text, qty.ToString() + UnitEntry.Text, "OK");

                            NameEntry.Text = "";
                            NumEntry.Text  = "";
                            UnitEntry.Text = "";
                        }
                    }
                    else
                    {
                        DisplayAlert("入力エラー", "数量・単位を入力してください", "OK");
                    }
                }
            }
            else
            {
                DisplayAlert("入力エラー", "食品名を入力してください", "OK");
            }
        }
Esempio n. 4
0
        /***************「登録ボタン」が押された時*********************/
        private void Insert01_Clicked(object sender, EventArgs e)
        {
            if (!(NameEntry.Text == null) && !(NameEntry.Text.Equals("")))
            {
                if (!s_switch)                                                   //食材の登録だったら
                {
                    if (!(yyyymmdd.ToString("yyyy/MM/dd").Equals("0001/01/01"))) //日付が入力されている
                    {
                        if (result < 0)
                        {
                            DisplayAlert("期限入力エラー", "日付が現在より前のものになっています", "OK");
                        }
                        else
                        {
                            FoodModel.InsertFood(1, NameEntry.Text, result, yyyymmdd);//試し
                            DisplayAlert(NameEntry.Text + yyyymmdd.ToString("yyyy/MM/dd"), "あと" + result.ToString() + "日", "OK");

                            NameEntry.Text = "";

                            FoodPicker.Date = new DateTime(now.Year, now.Month, now.Day);
                        }
                    }
                    else
                    {
                        yyyymmdd = now;
                        FoodModel.InsertFood(1, NameEntry.Text, result, yyyymmdd);    //試し
                        DisplayAlert(NameEntry.Text + yyyymmdd.ToString("yyyy/MM/dd"), "あと" + result.ToString() + "日", "OK");

                        NameEntry.Text  = "";
                        FoodPicker.Date = new DateTime(now.Year, now.Month, now.Day);

                        //FoodPicker.Date = new DateTime(now.Year, now.Month, now.Day);
                    }
                }
                else//保存食品の登録だったら
                {
                    if ((!(NumEntry.Text == null) && !(NumEntry.Text.Equals(""))) && (!(UnitEntry.Text == null) && !(UnitEntry.Text.Equals(""))))
                    {
                        qty = int.Parse(NumEntry.Text);
                        if (qty >= 0) //数量がプラス
                        {
                            /*if (!(yyyymmdd.ToString("yyyy/MM/dd").Equals("0001/01/01")))//日付が入力されている
                             * {
                             *  StockFoodModel.InsertStock(1, NameEntry.Text, qty, UnitEntry.Text);
                             *  DisplayAlert(NameEntry.Text, qty.ToString() + UnitEntry.Text, "OK");
                             *
                             *  NameEntry.Text = "";
                             *  NumEntry.Text = "";
                             *  UnitEntry.Text = "";
                             * }
                             * else
                             * {
                             *  yyyymmdd = now;*/
                            StockFoodModel.InsertStock(1, NameEntry.Text, qty, UnitEntry.Text);
                            DisplayAlert(NameEntry.Text, qty.ToString() + UnitEntry.Text, "OK");

                            NameEntry.Text = "";
                            NumEntry.Text  = "";
                            UnitEntry.Text = "";
                            // }
                        }
                        else
                        {
                            DisplayAlert("入力エラー", "数量がマイナスです", "OK");
                        }
                    }
                    else
                    {
                        DisplayAlert("入力エラー", "数量・単位を入力してください", "OK");
                    }
                }
            }
            else
            {
                DisplayAlert("入力エラー", "食品名を入力してください", "OK");
            }
        }