Esempio n. 1
0
        // 要望リスト初期化メソッド
        private ObservableCollection <DemandsInformation> GetDemands()
        {
            DatabaseAccess db          = new DatabaseAccess();
            var            all_demands = db.Get_AllDemandInformation();

            foreach (var demand in all_demands)
            {
                // クソみたいなコード(解説 : クラスを変えるのがめんどくさいので無理やりmIDをuser_nameに置換している)
                UsersInformation ui = db.Get_UserInformation(demand._mid);
                demand._mid = ui._user_name;

                Demands.Add(demand);
            }
            return(Demands);
        }
 /// <summary>
 /// ログイン中のユーザーのStaticParamをアップデートします。
 /// </summary>
 /// <returns>trueの場合正常,falseの場合異常を示す</returns>
 public static bool update_user()
 {
     try
     {
         DatabaseAccess   db   = new DatabaseAccess();
         UsersInformation user = db.Get_UserInformation(StaticParam._mID);
         StaticParam._balance    = user._balance;
         StaticParam._userName   = user._user_name;
         StaticParam._permission = user._permission;
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Esempio n. 3
0
        private void Debug_Button_Click_1(object sender, RoutedEventArgs e)
        {
            Enable_Toggle();
            // mIDが登録されているかのチェック
            DatabaseAccess db = new DatabaseAccess();

            if (db.Search_UserInformation("01148E4778184D03"))
            {
                // タイマーの停止
                this._timer.Stop();
                // ユーザー情報の取得
                UsersInformation user = db.Get_UserInformation("01148E4778184D03");
                StaticParam._mID        = user._mid;
                StaticParam._userName   = user._user_name;
                StaticParam._balance    = user._balance;
                StaticParam._permission = user._permission;
                // 遷移
                Frame.Navigate(typeof(MenuScreen), user);
            }
        }
Esempio n. 4
0
        // タイマー用メソッド
        // カードが翳された場合、画面遷移を行う
        private async void Check_Card(object sender, object e)
        {
            try
            {
                string mID = await Getmid();

                if (mID != "")
                {
                    Enable_Toggle();
                    // mIDが登録されているかのチェック
                    DatabaseAccess db = new DatabaseAccess();
                    if (db.Search_UserInformation(mID))
                    {
                        // タイマーの停止
                        this._timer.Stop();
                        // ユーザー情報の取得
                        UsersInformation user = db.Get_UserInformation(mID);
                        StaticParam._mID        = user._mid;
                        StaticParam._userName   = user._user_name;
                        StaticParam._balance    = user._balance;
                        StaticParam._permission = user._permission;
                        // 遷移
                        Frame.Navigate(typeof(MenuScreen), user);
                    }
                    else
                    {
                        // ダイアログ表示中も裏でタイマーが走るようなので一旦止めています。
                        // CheckFunction.Show_Messageを使用していないのは非同期スレッドが立つらしく確認する前にタイマーがスタートしてしまう為
                        this._timer.Stop();
                        var msg = new ContentDialog();
                        msg.Title             = "Error";
                        msg.Content           = "登録されていないカードです。";
                        msg.PrimaryButtonText = "OK";
                        await msg.ShowAsync();

                        this._timer.Start();
                    }
                }
            }catch {
            }
        }
Esempio n. 5
0
        // タイマー用メソッド
        private async void Check_Card(object sender, object e)
        {
            string mID = "";

            // タイマーの停止
            this._timer.Stop();

            // カードを離した際のGetmid()で例外が走るみたいなので応急措置です
            try
            {
                mID = await Getmid();
            }catch {
                this._timer.Start();
                return;
            }

            try
            {
                if (mID != "")
                {
                    // mIDが登録されていた場合
                    // mIDが登録されているかのチェック
                    DatabaseAccess db = new DatabaseAccess();
                    if (db.Search_UserInformation(mID))
                    {
                        // 事前処理
                        // 決済額のリセット
                        total_price = 0;

                        // カード情報表示
                        UsersInformation uis = db.Get_UserInformation(mID);
                        USER_INFO.Text = uis._user_name + " 様  残高 " + uis._balance + "円";

                        // 入力内容チェック
                        if (Items.Count <= 0)
                        {
                            this._timer.Start();
                            return;
                        }


                        foreach (Item checkItem in Items)
                        {
                            if (checkItem._num <= 0)
                            {
                                var msg = new ContentDialog();
                                msg.Title             = "Error";
                                msg.Content           = checkItem._itemName + "の個数が0になっています。";
                                msg.PrimaryButtonText = "OK";
                                await msg.ShowAsync();

                                JANCODE_TEXT.Focus(FocusState.Keyboard);
                                this._timer.Start();

                                return;
                            }

                            if (db.isStocked_Item(checkItem._janCode, checkItem._num))
                            {
                            }
                            else
                            {
                                var msg = new ContentDialog();
                                msg.Title             = "Error";
                                msg.Content           = checkItem._itemName + "の在庫数が不足しています。";
                                msg.PrimaryButtonText = "OK";
                                await msg.ShowAsync();

                                JANCODE_TEXT.Focus(FocusState.Keyboard);
                                this._timer.Start();
                                return;
                            }
                        }
                        // 入力内容チェックここまで

                        foreach (Item it in Items)
                        {
                            total_price += it._price * it._num;
                        }
                        // 決済可否チェック

                        if (db.Check_Payment(mID, total_price))
                        {
                            db.Exec_Payment(mID, total_price);
                            foreach (Item item in Items)
                            {
                                db.Insert_Purchase_Log(mID, item._janCode, item._num, item._price);
                                db.Reduce_Item(item._janCode, item._num);
                            }
                            UsersInformation ui = db.Get_UserInformation(mID);
                            // ここで音を出してもいいかも
                            SE.Play();
                            USER_INFO.Text = uis._user_name + " 様  残高 " + (uis._balance - total_price) + "円 決済成功";
                            var msg = new ContentDialog();
                            msg.FontSize          = 74;
                            msg.Title             = "決済に成功しました。";
                            msg.Content           = "残高 " + ui._balance + "円";
                            msg.PrimaryButtonText = "OK";
                            //await msg.ShowAsync();
                            Items.Clear();
                            JANCODE_TEXT.Focus(FocusState.Keyboard);
                            this._timer.Start();
                            return;
                        }
                        else
                        {
                            var msg = new ContentDialog();
                            msg.Title             = "Error";
                            msg.Content           = "残高が不足しています。";
                            msg.PrimaryButtonText = "OK";
                            await msg.ShowAsync();

                            JANCODE_TEXT.Focus(FocusState.Keyboard);
                            this._timer.Start();
                            return;
                        }

                        // 決済可否チェックここまで
                    }
                    else
                    {
                        // ダイアログ表示中も裏でタイマーが走るようなので一旦止めています。
                        // CheckFunction.Show_Messageを使用していないのは非同期スレッドが立つらしく確認する前にタイマーがスタートしてしまう為

                        var msg = new ContentDialog();
                        msg.Title             = "Error";
                        msg.Content           = "登録されていないカードです。";
                        msg.PrimaryButtonText = "OK";
                        await msg.ShowAsync();

                        JANCODE_TEXT.Focus(FocusState.Keyboard);
                        this._timer.Start();
                    }
                }
                else
                {
                    this._timer.Start();
                    USER_INFO.Text = "";
                }
            }
            catch (Exception es)
            {
                var msg = new ContentDialog();
                msg.Title             = "Error";
                msg.Content           = "不明なエラーです。管理者に問い合わせて下さい。\n" + es;
                msg.PrimaryButtonText = "OK";
                await msg.ShowAsync();

                JANCODE_TEXT.Focus(FocusState.Keyboard);
                this._timer.Start();
            }
        }