コード例 #1
0
        /// <summary>
        /// 画面の初期化処理をおこなう
        /// </summary>
        private void ScreenClear()
        {
            this.MaintenanceMode = null;
            if (SearchHeader != null)
            {
                SearchHeader = null;
            }
            if (SearchDetail != null)
            {
                SearchDetail.Clear();
                for (int i = 0; i < 10; i++)
                {
                    SearchDetail.Rows.Add(SearchDetail.NewRow());
                }
            }
            if (SeikyuTable != null)
            {
                SeikyuTable = null;
            }

            ChangeKeyItemChangeable(true);
            ResetAllValidation();

            this.txt会社名.Text1 = ccfg.自社コード.ToString();
            this.txt伝票番号.Focus();
        }
コード例 #2
0
        // No-271 Add Start
        #region F5 行追加
        /// <summary>
        /// F5 リボン 行追加
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public override void OnF5Key(object sender, KeyEventArgs e)
        {
            if (this.MaintenanceMode == null)
            {
                return;
            }

            if (SearchDetail.Rows.Count >= 10)
            {
                MessageBox.Show("明細行数が上限に達している為、これ以上追加できません。", "明細上限", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }

            DataRow dtlRow = SearchDetail.NewRow();

            dtlRow["伝票番号"] = this.txt伝票番号.Text;
            if (SearchDetail.Rows.Count > 0)
            {
                dtlRow["行番号"] = (int)SearchDetail.Rows[SearchDetail.Rows.Count - 1]["行番号"] + 1;
            }
            else
            {
                dtlRow["行番号"] = 1;
            }

            SearchDetail.Rows.Add(dtlRow);

            // 行追加後は追加行を選択させる
            int newRowIdx = SearchDetail.Rows.Count - 1;

            gcSpreadGrid.ActiveCellPosition = new CellPosition(newRowIdx, (int)GridColumnsMapping.金種コード);
        }
コード例 #3
0
        /// <summary>
        /// 取得内容を各コントロールに設定
        /// </summary>
        /// <param name="ds"></param>
        private void SetTblData(DataSet ds)
        {
            // 移動ヘッダ情報設定
            DataTable tblHd = ds.Tables[T05_HEADER_TABLE_NAME];

            SearchHeader = tblHd.Rows[0];
            SearchHeader.AcceptChanges();

            // 移動明細情報設定
            DataTable tblDtl = ds.Tables[T05_DETAIL_TABLE_NAME];

            SearchDetail = tblDtl;
            SearchDetail.AcceptChanges();

            // データ状態から編集状態を設定
            if (SearchDetail.Select("金種コード > 0").Count() == 0)
            {
                // 新規行を追加
                for (int i = 0; i < 10; i++)
                {
                    DataRow row = SearchDetail.NewRow();
                    row["伝票番号"] = AppCommon.IntParse(tblHd.Rows[0]["伝票番号"].ToString());
                    row["行番号"]  = (i + 1);

                    SearchDetail.Rows.Add(row);
                }

                this.MaintenanceMode = AppConst.MAINTENANCEMODE_ADD;

                this.txt入金日.Focus();
            }
            else
            {
                this.MaintenanceMode = AppConst.MAINTENANCEMODE_EDIT;

                // 金種名称を設定
                int rIdx = 0;
                foreach (DataRow row in SearchDetail.Rows)
                {
                    if (string.IsNullOrEmpty(row["金種コード"].ToString()))
                    {
                        continue;
                    }

                    setSpreadGridValue(rIdx, GridColumnsMapping.金種名, 金種Dic[int.Parse(row["金種コード"].ToString())]);

                    rIdx++;
                }

                // 不足分レコードを追加
                for (int i = SearchDetail.Rows.Count; i < 10; i++)
                {
                    DataRow row = SearchDetail.NewRow();
                    row["伝票番号"] = AppCommon.IntParse(tblHd.Rows[0]["伝票番号"].ToString());
                    row["行番号"]  = (i + 1);

                    SearchDetail.Rows.Add(row);
                }

                this.gcSpreadGrid.Focus();
                this.gcSpreadGrid.ActiveCellPosition = new CellPosition(0, GridColumnsMapping.金種コード.GetHashCode());
            }
        }