Beispiel #1
0
        private void SetScreenValues(FormKakeiboSqlService.ModelKakeibo model)
        {
            Logger.WriteLine($"{MethodBase.GetCurrentMethod().Name}");

            // 残金・収入・支出を更新
            customReadOnlyTextBoxZankin.Text    = model.Zankin.ToString();
            customReadOnlyTextBoxShunyu.Text    = model.SumShunyu.ToString();
            customReadOnlyTextBoxShishutsu.Text = model.SumShishutsu.ToString();

            (gridRireki.DataSource as BindingSource).DataSource = model.RirekiTable;
            (gridShukei.DataSource as BindingSource).DataSource = model.ShukeiTable;

            // シーケンス列を非表示にする
            gridRireki.Columns["seq"].Visible = false;

            // ヘッダの表示名を変える
            gridRireki.Columns["hiduke"].HeaderText  = "日付";
            gridRireki.Columns["naiyou"].HeaderText  = "用途";
            gridRireki.Columns["nyukin"].HeaderText  = "収入";
            gridRireki.Columns["shukkin"].HeaderText = "支出";
            gridRireki.Columns["zankin"].HeaderText  = "残金";
            gridRireki.Columns["bikou"].HeaderText   = "備考";
        }
Beispiel #2
0
        /// <summary>
        /// 検索処理
        /// </summary>
        /// <param name="sv"></param>
        /// <returns>取得件数</returns>
        private async Task <int> Search(FormKakeiboSqlService sv)
        {
            Logger.StartMethod(MethodBase.GetCurrentMethod().Name);

            gridRireki.DataSource = new BindingSource();
            gridShukei.DataSource = new BindingSource();

            // 新規Model生成
            Model = new FormKakeiboSqlService.ModelKakeibo();

            // 履歴・残金を読み込む
            int ret = await sv.GetKakeiboData(Model);

            if (ret >= 0)
            {
                // 検索結果を画面に設定
                SetScreenValues(Model);

                // 残金を編集不可にする
                gridRireki.Columns["zankin"].ReadOnly = true;

                // スクロールを最終に移動
                gridRireki.ScrollToLast();
                // 選択を解除
                gridRireki.ClearSelection();
                // 最終行を選択
                int lastindex = gridRireki.Rows.GetLastRow(DataGridViewElementStates.None);
                if (lastindex >= 0)
                {
                    gridRireki.Rows[lastindex].Selected = true;
                }
            }

            Logger.EndMethod(MethodBase.GetCurrentMethod().Name, ret.ToString());
            return(ret);
        }