示例#1
0
        /// <summary>
        /// new した直後の内容に戻します。
        /// </summary>
        /// <param name="o_Table_StyleSheet"></param>
        /// <param name="log_Reports"></param>
        public void Clear(Table_Humaninput xenonTable_Stylesheet, Log_Reports log_Reports)
        {
            Log_Method pg_Method = new Log_MethodImpl();

            pg_Method.BeginMethod(Info_Operating.Name_Library, this, "Clear", log_Reports);

            //
            //

            this.Dictionary_RecordStyle.Clear();

            MemoryToMemory_Stylesheet mToO = new MemoryToMemory_Stylesheet();
            MemoryStyles moStyles          = mToO.Translate(xenonTable_Stylesheet, log_Reports);

            foreach (KeyValuePair <string, RecordXenonStyle> kvp in moStyles.Dictionary_RecordStyle)
            {
                this.Dictionary_RecordStyle.Add(kvp.Key, kvp.Value);
            }

            goto gt_EndMethod;
            //
            //
gt_EndMethod:
            pg_Method.EndMethod(log_Reports);
        }
示例#2
0
        //────────────────────────────────────────
        #endregion



        #region アクション
        //────────────────────────────────────────

        public void SetDataSource(Table_Humaninput o_Table, Log_Reports log_Reports)
        {
            this.table_Humaninput = o_Table;

            Utility_TableviewImpl u_tblView = new Utility_TableviewImpl();

            u_tblView.IsVisibled_Fieldtype = true;

            u_tblView.SetDataSourceToListView(
                o_Table, this.listView1, log_Reports);
            if (!log_Reports.Successful)
            {
                // 既エラー。
                goto gt_EndMethod;
            }

            u_tblView.CopyTo(this.listView1, this.listView2, log_Reports);
            if (!log_Reports.Successful)
            {
                // 既エラー。
                goto gt_EndMethod;
            }

            //
gt_EndMethod:
            return;
        }
示例#3
0
文件: Form1.cs 项目: muzudho/CSVExE
        //────────────────────────────────────────
        public void SetDataSource(Table_Humaninput o_Table, Log_Reports log_Reports)
        {
            this.table_Humaninput = o_Table;

            Utility_TableviewImpl u_tblView = new Utility_TableviewImpl();
            u_tblView.IsVisibled_Fieldtype = true;

            u_tblView.SetDataSourceToListView(
                o_Table, this.listView1, log_Reports);
            if (!log_Reports.Successful)
            {
                // 既エラー。
                goto gt_EndMethod;
            }

            u_tblView.CopyTo(this.listView1, this.listView2, log_Reports);
            if (!log_Reports.Successful)
            {
                // 既エラー。
                goto gt_EndMethod;
            }

            //
            gt_EndMethod:
            return;
        }
示例#4
0
        //────────────────────────────────────────
        #endregion



        #region アクション
        //────────────────────────────────────────

        /// <summary>
        /// テーブルを、SRS形式のCSVファイルで書き出します。
        ///
        ///
        /// SRS仕様の実装状況
        /// ここでは、先頭行を0行目と数えるものとします。
        /// (1)CSVの1行目は列名です。
        /// (2)2行目は型名です。
        /// (3)3行目はコメントです。
        ///
        /// (4)データ・テーブル部で、0列目に「EOF」と入っていれば終了。大文字・小文字は区別せず。
        ///    それ以降に、コメントのようなデータが入力されていることがあるが、フィールドの型に一致しないことがあるので無視。
        ///    TODO EOF以降の行も、コメントとして残したい。
        ///
        /// (5)列名にENDがある場合、その手前までの列が有効データです。
        ///    END以降の列は無視します。
        ///    TODO END以降の行も、コメントとして残したい。
        ///
        /// (6)int型として指定されているフィールドのデータ・テーブル部に空欄があった場合、DBNull(データベース用のヌル)とします。
        /// </summary>
        /// <param name="csvText"></param>
        /// <returns>列名情報も含むテーブル。列の型は文字列型とします。</returns>
        public string ToCsvText(
            Table_Humaninput xTable,
            Log_Reports log_Reports
            )
        {
            //出力するCSVテキスト
            string result;

            if (xTable.Format_Table_Humaninput.IsRowcolumnreverse)
            {
                //
                // 行と列が逆になっているテーブル
                //

                ToCsv_Table_RowColReversedImpl_ toCsv_RowColReversed = new ToCsv_Table_RowColReversedImpl_();
                toCsv_RowColReversed.O_ExceptedFields = this.ExceptedFields;

                result = toCsv_RowColReversed.ToCsvText(xTable, log_Reports);
                if (!log_Reports.Successful)
                {
                    // 既エラー
                    goto gt_EndMethod;
                }
            }
            else
            {
                ToCsv_Table_RowColRegularImpl_ toCsv_Normal = new ToCsv_Table_RowColRegularImpl_();
                toCsv_Normal.ExceptedFields = this.ExceptedFields;

                result = toCsv_Normal.ToCsvText(xTable, log_Reports);
                if (!log_Reports.Successful)
                {
                    // 既エラー
                    goto gt_EndMethod;
                }
            }

            goto gt_EndMethod;

            //
            //
            //
            //
gt_EndMethod:
            return(result);
        }
示例#5
0
        //────────────────────────────────────────
        #endregion



        #region アクション
        //────────────────────────────────────────

        /// <summary>
        /// テーブルを、SRS形式のCSVファイルで書き出します。
        ///
        ///
        /// SRS仕様の実装状況
        /// ここでは、先頭行を0行目と数えるものとします。
        /// (1)CSVの1行目は列名です。
        /// (2)2行目は型名です。
        /// (3)3行目はコメントです。
        ///
        /// (4)データ・テーブル部で、0列目に「EOF」と入っていれば終了。大文字・小文字は区別せず。
        ///    それ以降に、コメントのようなデータが入力されていることがあるが、フィールドの型に一致しないことがあるので無視。
        ///    TODO EOF以降の行も、コメントとして残したい。
        ///
        /// (5)列名にENDがある場合、その手前までの列が有効データです。
        ///    END以降の列は無視します。
        ///    TODO END以降の行も、コメントとして残したい。
        ///
        /// (6)int型として指定されているフィールドのデータ・テーブル部に空欄があった場合、DBNull(データベース用のヌル)とします。
        /// </summary>
        /// <param name="csvText"></param>
        /// <returns>列名情報も含むテーブル。列の型は文字列型とします。</returns>
        public string ToCsvText(
            Table_Humaninput tableH,
            Log_Reports log_Reports
            )
        {
            string sResult;

            if (tableH.Format_Table_Humaninput.IsRowcolumnreverse)
            {
                //
                // 行と列が逆になっているテーブル
                //

                ToCsv_Table_Humaninput_RowColReversedImpl toCsv_RowColReversed = new ToCsv_Table_Humaninput_RowColReversedImpl();
                toCsv_RowColReversed.O_ExceptedFields = this.ExceptedFields;

                sResult = toCsv_RowColReversed.ToCsvText(tableH, log_Reports);
                if (!log_Reports.Successful)
                {
                    // 既エラー
                    goto gt_EndMethod;
                }
            }
            else
            {
                ToCsv_Table_Humaninput_RowColRegularImpl toCsv_Normal = new ToCsv_Table_Humaninput_RowColRegularImpl();
                toCsv_Normal.ExceptedFields = this.ExceptedFields;

                sResult = toCsv_Normal.ToCsvText(tableH, log_Reports);
                if (!log_Reports.Successful)
                {
                    // 既エラー
                    goto gt_EndMethod;
                }
            }

            goto gt_EndMethod;

            //
            //
            //
            //
gt_EndMethod:
            return(sResult);
        }
        //────────────────────────────────────────
        /// <summary>
        /// テーブルを、SRS形式のCSVファイルで書き出します。
        /// 
        /// 
        /// SRS仕様の実装状況
        /// ここでは、先頭行を0行目と数えるものとします。
        /// (1)CSVの1行目は列名です。
        /// (2)2行目は型名です。
        /// (3)3行目はコメントです。
        /// 
        /// (4)データ・テーブル部で、0列目に「EOF」と入っていれば終了。大文字・小文字は区別せず。
        ///    それ以降に、コメントのようなデータが入力されていることがあるが、フィールドの型に一致しないことがあるので無視。
        ///    TODO EOF以降の行も、コメントとして残したい。
        /// 
        /// (5)列名にENDがある場合、その手前までの列が有効データです。
        ///    END以降の列は無視します。
        ///    TODO END以降の行も、コメントとして残したい。
        /// 
        /// (6)int型として指定されているフィールドのデータ・テーブル部に空欄があった場合、DBNull(データベース用のヌル)とします。
        /// </summary>
        /// <param name="csvText"></param>
        /// <returns>列名情報も含むテーブル。列の型は文字列型とします。</returns>
        public string ToCsvText(
            Table_Humaninput tableH,
            Log_Reports log_Reports
            )
        {
            string sResult;

            if (tableH.Format_Table_Humaninput.IsRowcolumnreverse)
            {
                //
                // 行と列が逆になっているテーブル
                //

                ToCsv_Table_Humaninput_RowColReversedImpl toCsv_RowColReversed = new ToCsv_Table_Humaninput_RowColReversedImpl();
                toCsv_RowColReversed.O_ExceptedFields = this.ExceptedFields;

                sResult = toCsv_RowColReversed.ToCsvText(tableH, log_Reports);
                if (!log_Reports.Successful)
                {
                    // 既エラー
                    goto gt_EndMethod;
                }
            }
            else
            {
                ToCsv_Table_Humaninput_RowColRegularImpl toCsv_Normal = new ToCsv_Table_Humaninput_RowColRegularImpl();
                toCsv_Normal.ExceptedFields = this.ExceptedFields;

                sResult = toCsv_Normal.ToCsvText(tableH, log_Reports);
                if (!log_Reports.Successful)
                {
                    // 既エラー
                    goto gt_EndMethod;
                }
            }

            goto gt_EndMethod;

            //
            //
            //
            //
            gt_EndMethod:
            return sResult;
        }
示例#7
0
        //────────────────────────────────────────

        /// <summary>
        ///
        /// </summary>
        /// <param name="namelist_Field"></param>
        /// <param name="value_TableH"></param>
        /// <param name="log_Reports"></param>
        public void AddField(
            string namelist_Field,
            Table_Humaninput value_TableH,
            Log_Reports log_Reports
            )
        {
            List <string>         list_NameField = new CsvTo_ListImpl().Read(namelist_Field);
            RecordFielddefinition recordFielddefinition;

            bool bHit = value_TableH.TryGetFieldDefinitionByName(
                out recordFielddefinition,
                list_NameField,
                true,
                log_Reports
                );

            if (!log_Reports.Successful || !bHit)
            {
                // 既エラー。
                goto gt_EndMethod;
            }

            int nIx = 0;

            recordFielddefinition.ForEach(delegate(Fielddefinition fielddefinition, ref bool isBreak2, Log_Reports log_Reports2)
            {
                this.list_FieldKeies.Add(
                    new Fieldkey(list_NameField[nIx], fielddefinition.ToString_Type(), fielddefinition.Comment));

                nIx++;
            }, log_Reports);


            //
            //
            //
            //
gt_EndMethod:
            return;
        }
示例#8
0
        //────────────────────────────────────────
        /// <summary>
        /// 
        /// </summary>
        /// <param name="namelist_Field"></param>
        /// <param name="value_TableH"></param>
        /// <param name="log_Reports"></param>
        public void AddField(
            string namelist_Field,
            Table_Humaninput value_TableH,
            Log_Reports log_Reports
            )
        {
            List<string> list_NameField = new CsvTo_ListImpl().Read(namelist_Field);
            RecordFielddefinition recordFielddefinition;

             bool bHit = value_TableH.TryGetFieldDefinitionByName(
                out recordFielddefinition,
                list_NameField,
                true,
                log_Reports
                );
            if (!log_Reports.Successful || !bHit)
            {
                // 既エラー。
                goto gt_EndMethod;
            }

            int nIx = 0;
            recordFielddefinition.ForEach(delegate(Fielddefinition fielddefinition, ref bool isBreak2, Log_Reports log_Reports2)
            {
                this.list_FieldKeies.Add(
                    new Fieldkey(list_NameField[nIx], fielddefinition.ToString_Type(), fielddefinition.Comment));

                nIx++;
            }, log_Reports);

            //
            //
            //
            //
            gt_EndMethod:
            return;
        }
示例#9
0
        /// <summary>
        /// new した直後の内容に戻します。
        /// </summary>
        /// <param name="o_Table_StyleSheet"></param>
        /// <param name="log_Reports"></param>
        public void Clear(Table_Humaninput xenonTable_Stylesheet, Log_Reports log_Reports)
        {
            Log_Method pg_Method = new Log_MethodImpl();
            pg_Method.BeginMethod(Info_Operating.Name_Library, this, "Clear",log_Reports);

            //
            //

            this.Dictionary_RecordStyle.Clear();

            MemoryToMemory_Stylesheet mToO = new MemoryToMemory_Stylesheet();
            MemoryStyles moStyles = mToO.Translate(xenonTable_Stylesheet, log_Reports);

            foreach (KeyValuePair<string, RecordXenonStyle> kvp in moStyles.Dictionary_RecordStyle)
            {
                this.Dictionary_RecordStyle.Add(kvp.Key, kvp.Value);
            }

            goto gt_EndMethod;
            //
            //
            gt_EndMethod:
            pg_Method.EndMethod(log_Reports);
        }
示例#10
0
        //────────────────────────────────────────

        /// <summary>
        /// 例えば、次の2つの物を与えると、
        /// ●ID=10、EXPL=赤、と入っている行。
        /// ●「%1%:%2%|ID|EXPL」という文字列。
        ///
        /// すると、次の文字列が返ってくる。
        /// ●「10:EXPL」
        ///
        /// %1%はID、%2%はEXPLに当たる。
        /// </summary>
        /// <param name="sFormat"></param>
        /// <param name="dataRowView"></param>
        /// <param name="xenonTable"></param>
        /// <param name="sErrorMsg"></param>
        /// <returns></returns>
        public string Perform(
            string sFormat,
            DataRowView dataRowView,
            Table_Humaninput xenonTable,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();

            log_Method.BeginMethod(Info_Table.Name_Library, this, "Perform", log_Reports);


            string result;

            if (null == xenonTable)
            {
                // エラー
                // テーブルが未指定の場合

                goto gt_Error_NullTable;
            }


            CsvTo_DataTableImpl reader = new CsvTo_DataTableImpl();

            reader.CharSeparator = '|';
            DataTable scriptParameters = reader.Read(
                sFormat
                );


            if (scriptParameters.Rows.Count < 1)
            {
                // 警告
                // 項目の表示書式が指定されていない場合
                //
                result = "(【Er:301;】表示書式未指定、レイアウト設定で)";

                // エラーにはしない。
                if (log_Method.CanWarning())
                {
                    log_Method.WriteWarning_ToConsole("(【Er:301;】表示書式未指定、レイアウト設定で)");
                }

                goto gt_EndMethod;
            }

            DataRow dataRow = scriptParameters.Rows[0];

            object[] recordFields = dataRow.ItemArray;// ItemArrayは1回の呼び出しが重い。



            Builder_TexttemplateP1pImpl formatString = new Builder_TexttemplateP1pImpl();

            formatString.Text = recordFields[0].ToString();//例:"%1%:%2%"
            //.Console.WriteLine(this.GetType().Name + "#CreateText: recordFields[0].ToString()=[" + recordFields[0].ToString() + "]");

            FieldToParameters      fieldToParameters             = new FieldToParameters();
            Configurationtree_Node parent_Configurationtree_Node = new Configurationtree_NodeImpl("!ハードコーディング_RecordFormatStringImpl#CreateText", null);

            // フィールド名のリストが続く。
            for (int nIndex = 1; nIndex < recordFields.Length; nIndex++)
            {
                //.Console.WriteLine(this.GetType().Name + "#CreateText: index=[" + index + "] recordFields[index].ToString()=[" + recordFields[index].ToString() + "]");

                string sFieldName = recordFields[nIndex].ToString();
                fieldToParameters.AddField(
                    sFieldName,
                    xenonTable,
                    log_Reports
                    );

                if (!log_Reports.Successful)
                {
                    // 既エラー。
                    result = "(エラー)";
                    goto gt_EndMethod;
                }
            }

            fieldToParameters.Perform(ref formatString, dataRowView, xenonTable, log_Reports);
            if (!log_Reports.Successful)
            {
                // 既エラー。
                result = "(エラー)";
                goto gt_EndMethod;
            }

            result = formatString.Perform(log_Reports);


            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_NullTable:
            result = "(テーブルが未指定です)";
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー131!", log_Method);
                r.Message = "(エラー。テーブルが未指定です)";
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(result);
        }
        //────────────────────────────────────────
        /// <summary>
        /// 例えば、次の2つの物を与えると、
        /// ●ID=10、EXPL=赤、と入っている行。
        /// ●「%1%:%2%|ID|EXPL」という文字列。
        /// 
        /// すると、次の文字列が返ってくる。
        /// ●「10:EXPL」
        /// 
        /// %1%はID、%2%はEXPLに当たる。
        /// </summary>
        /// <param name="sFormat"></param>
        /// <param name="dataRowView"></param>
        /// <param name="xenonTable"></param>
        /// <param name="sErrorMsg"></param>
        /// <returns></returns>
        public string Perform(
            string sFormat,
            DataRowView dataRowView,
            Table_Humaninput xenonTable,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();
            log_Method.BeginMethod(Info_Table.Name_Library, this, "Perform",log_Reports);

            string result;

            if ( null==xenonTable)
            {
                // エラー
                // テーブルが未指定の場合

                goto gt_Error_NullTable;
            }

            CsvTo_DataTableImpl reader = new CsvTo_DataTableImpl();
            reader.CharSeparator = '|';
            DataTable scriptParameters = reader.Read(
                sFormat
                );

            if (scriptParameters.Rows.Count<1)
            {
                // 警告
                // 項目の表示書式が指定されていない場合
                //
                result = "(【Er:301;】表示書式未指定、レイアウト設定で)";

                // エラーにはしない。
                if (log_Method.CanWarning())
                {
                    log_Method.WriteWarning_ToConsole("(【Er:301;】表示書式未指定、レイアウト設定で)");
                }

                goto gt_EndMethod;
            }

            DataRow dataRow = scriptParameters.Rows[0];

            object[] recordFields = dataRow.ItemArray;// ItemArrayは1回の呼び出しが重い。

            Builder_TexttemplateP1pImpl formatString = new Builder_TexttemplateP1pImpl();
            formatString.Text = recordFields[0].ToString();//例:"%1%:%2%"
            //.Console.WriteLine(this.GetType().Name + "#CreateText: recordFields[0].ToString()=[" + recordFields[0].ToString() + "]");

            FieldToParameters fieldToParameters = new FieldToParameters();
            Configurationtree_Node parent_Configurationtree_Node = new Configurationtree_NodeImpl("!ハードコーディング_RecordFormatStringImpl#CreateText",null);
            // フィールド名のリストが続く。
            for (int nIndex = 1; nIndex < recordFields.Length; nIndex++)
            {
                //.Console.WriteLine(this.GetType().Name + "#CreateText: index=[" + index + "] recordFields[index].ToString()=[" + recordFields[index].ToString() + "]");

                string sFieldName = recordFields[nIndex].ToString();
                fieldToParameters.AddField(
                    sFieldName,
                    xenonTable,
                    log_Reports
                    );

                if (!log_Reports.Successful)
                {
                    // 既エラー。
                    result = "(エラー)";
                    goto gt_EndMethod;
                }
            }

            fieldToParameters.Perform(ref formatString, dataRowView, xenonTable, log_Reports);
            if (!log_Reports.Successful)
            {
                // 既エラー。
                result = "(エラー)";
                goto gt_EndMethod;
            }

            result = formatString.Perform(log_Reports);

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_NullTable:
            result = "(テーブルが未指定です)";
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー131!", log_Method);
                r.Message = "(エラー。テーブルが未指定です)";
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return result;
        }
示例#12
0
 //────────────────────────────────────────
 public KeyconfigImpl()
 {
     this.dic_KeyCnf = new Dictionary<int, KeyconfigPadImpl>();
     this.o_Table_Keycnf = null;
 }
示例#13
0
        private string ToText(
            List <List <string> > rsltTable,
            Table_Humaninput table
            )
        {
            bool bCommaEnding = table.Format_Table_Humaninput.IsCommaending;


            //
            // 行列をひっくり返して保存します。
            //
            List <StringBuilder> lineWriters = new List <StringBuilder>();

            for (int nR = 0; nR < rsltTable.Count; nR++)
            {
                List <string> row = rsltTable[nR];

                for (int nC = 0; nC < row.Count; nC++)
                {
                    if (lineWriters.Count <= nC)
                    {
                        lineWriters.Add(new StringBuilder());
                    }

                    lineWriters[nC].Append(row[nC]);

                    // 行列がひっくり返っているので分かりづらいが、
                    // 次の行があれば、カンマを付ける。
                    if (nR + 1 < rsltTable.Count)
                    {
                        lineWriters[nC].Append(",");
                    }
                }
            }


            StringBuilder sb_Result = new StringBuilder();

            for (int nL = 0; nL < lineWriters.Count; nL++)
            {
                sb_Result.Append(lineWriters[nL].ToString());

                //
                // EOF
                //
                if (0 == nL)
                {
                    sb_Result.Append(",");
                    sb_Result.Append(ToCsv_Table_RowColRegularImpl_.S_EOF);
                }

                if (bCommaEnding)
                {
                    //
                    // 行の末尾を「,」で終わる場合。
                    //
                    sb_Result.Append(",");
                }

                sb_Result.Append(Environment.NewLine);
            }

            //
            // 最終行:EOF列の手前まで、「END」で埋めます。
            //
            {
                // 行数と同じ数の1個手前まで。
                for (int nC = 0; nC < rsltTable.Count - 1; nC++)
                {
                    sb_Result.Append(
                        ToCsv_Table_RowColRegularImpl_.S_EOL
                        //ToCsv_Table_Humaninput_RowColRegularImpl.S_END
                        );
                    sb_Result.Append(",");
                }
                // 行数と同じ数に。
                sb_Result.Append(
                    ToCsv_Table_RowColRegularImpl_.S_EOL
                    //ToCsv_Table_Humaninput_RowColRegularImpl.S_END
                    );

                // EOF列には END は付けません。

                if (bCommaEnding)
                {
                    //
                    // 行の末尾を「,」で終わる場合。
                    //
                    sb_Result.Append(",");
                }
            }

            // 最後に一応、改行を付けておきます。
            sb_Result.Append(Environment.NewLine);//改行

            return(sb_Result.ToString());
        }
示例#14
0
 public void RemoveFrom(Table_Humaninput tableH)
 {
     tableH.DataTable.Rows.Remove(this.DataRow);
 }
示例#15
0
        //────────────────────────────────────────
        /// <summary>
        /// 『レイアウト設定ファイル』を読取ります。
        /// </summary>
        public void LoadUserformconfigFile(
            TableUserformconfig fo_Config_Formgroup,
            Table_Humaninput o_Table_Form,
            MemoryApplication memoryApplication,
            Log_Reports pg_Logging
            )
        {
            Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            pg_Method.BeginMethod(Info_LayoutImpl.Name_Library, this, "LoadUserformconfigFile",pg_Logging);
            //
            //

            //
            // データ・タイプです。
            string sTypeData;
            if (pg_Logging.Successful)
            {
                if (null != o_Table_Form.Typedata)
                {
                    sTypeData = o_Table_Form.Typedata;
                }
                else
                {
                    sTypeData = "";
                }
            }
            else
            {
                sTypeData = "";
            }

            if (pg_Logging.Successful)
            {
                // TREEフィールドの有無チェック

                if (
                    ValuesTypeData.S_TABLE_FORM == sTypeData
                    &&
                    !o_Table_Form.DataTable.Columns.Contains(NamesFld.S_TREE))
                {
                    //
                    // エラー
                    goto gt_Error_NotFoundTreeField;
                }
            }

            string sFoundName;
            string sFoundNameRef;
            if (pg_Logging.Successful)
            {
                // NAMEフィールドの存在する有無
                bool bExistsName = o_Table_Form.DataTable.Columns.Contains("NAME");
                // NAME_REFフィールドの存在する有無
                bool bExistsNameRef = o_Table_Form.DataTable.Columns.Contains("NAME_REF");
                // NAME、NAME_REFフィールドが同時に存在する有無
                bool bExistsDoubleNames = bExistsName && bExistsNameRef;

                //
                // コントロールのプロパティー設定を読取。
                //
                foreach (DataRow dataRow in o_Table_Form.DataTable.Rows)
                {
                    RecordUserformconfig fo_Record = null;
                    bool bRecordNew = false;

                    //
                    // ・NAMEとNAME_REFフィールドの両方に記述があればエラー。
                    // ・NAMEフィールドがあり、コントロール名が記述されていれば、レコードを新規作成。
                    // ・NAME_REFフィールドがあり、コントロール名が記述されていれば、既存レコードを編集。
                    //

                    if (bExistsNameRef)
                    {
                        string sFieldName = "NAME_REF";

                        pg_Logging.Log_Callstack.Push(pg_Method, "①");
                        String_HumaninputImpl.TryParse(
                            dataRow[sFieldName],// この連想配列は大文字・小文字を区別しないのが欠点。
                            out sFoundNameRef,
                            o_Table_Form.Name,
                            sFieldName,
                            pg_Method,
                            pg_Logging
                            );
                        pg_Logging.Log_Callstack.Pop(pg_Method, "①");

                        if (!pg_Logging.Successful)
                        {
                            // エラー
                            goto gt_EndMethod;
                        }

                    }
                    else
                    {
                        sFoundNameRef = "";
                    }

                    if (bExistsName)
                    {
                        string sFieldName = "NAME";
                        if (dataRow[sFieldName] is DBNull)
                        {
                            //
                            // NAMEフィールドが空欄ならレコードを無視。
                            continue;
                        }

                        pg_Logging.Log_Callstack.Push(pg_Method, "②");
                        String_HumaninputImpl.TryParse(
                            dataRow[sFieldName],
                            out sFoundName,
                            o_Table_Form.Name,
                            sFieldName,
                            pg_Method,
                            pg_Logging
                            );
                        pg_Logging.Log_Callstack.Pop(pg_Method, "②");

                        if (!pg_Logging.Successful)
                        {
                            // エラー
                            goto gt_EndMethod;
                        }
                    }
                    else
                    {
                        sFoundName = "";
                    }

                    if (bExistsDoubleNames && "" != sFoundName && "" != sFoundNameRef)
                    {
                        // エラー
                        goto gt_Error_DoubleNames;
                    }

                    if (bExistsName && "" != sFoundName)
                    {
                        fo_Record = new RecordUserformconfigImpl(fo_Config_Formgroup);
                        bRecordNew = true;
                    }

                    if (bExistsNameRef && "" != sFoundNameRef)
                    {
                        foreach (RecordUserformconfig fo_Record2 in fo_Config_Formgroup.List_RecordUserformconfig)
                        {
                            string sName_Control;
                            fo_Record2.TryGetString(out sName_Control, NamesFld.S_NAME, true, "", memoryApplication, pg_Logging);

                            if (sName_Control == sFoundNameRef)
                            {
                                fo_Record = fo_Record2;
                                break;
                            }
                        }
                    }

                    if (null == fo_Record)
                    {
                        continue;
                    }

                    if (pg_Logging.Successful)
                    {
                        //
                        // レイアウト・テーブル一覧。
                        // またはレイアウト・テーブル。
                        // または未指定。
                        //

                        if (
                            ValuesTypeData.S_TABLES_FORM == sTypeData ||
                            ValuesTypeData.S_TABLE_FORM == sTypeData ||
                            "" == sTypeData)
                        {
                            int nResult = this.Read_Form(
                                fo_Record,
                                dataRow,
                                o_Table_Form,
                                fo_Config_Formgroup,
                                memoryApplication,
                                pg_Logging
                                );

                            if (2 == nResult)
                            {
                                // 追加せず中断する。
                                continue;
                            }
                        }
                    }

                    if (pg_Logging.Successful)
                    {
                        //
                        // レイアウト・テーブル(リスト)
                        //
                        if (ValuesTypeData.S_TABLE_FORM_LST == sTypeData)
                        {
                            int nResult = this.Read_FormLst(
                                true,
                                fo_Record,
                                dataRow,
                                o_Table_Form,
                                pg_Logging
                                );

                            if (2 == nResult)
                            {
                                // 編集せず中断する。
                                continue;
                            }
                        }
                    }

                    if (pg_Logging.Successful)
                    {
                        // 正常時。

                        if (bRecordNew)
                        {
                            fo_Config_Formgroup.List_RecordUserformconfig.Add(fo_Record);
                        }
                    }
                }//各行
            }
            else
            {
                //config_formGroup = null;
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_NotFoundTreeField:
            // テーブルタイプが「Form」で、"TREE" フィールドがないとき。
            // (Form_lstタイプには、TREEフィールドは要らない)
            if (pg_Logging.CanCreateReport)
            {
                Log_RecordReports r = pg_Logging.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー91026!", pg_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append("指定のテーブル[");
                s.Append(o_Table_Form.Name);
                s.Append("に、");
                s.Newline();

                s.Append("TREEフィールドが見つかりませんでした。TREEフィールドは必要です。");
                s.Newline();

                s.Newline();
                s.Newline();

                //
                // 問題箇所ヒント
                //
                s.Append(" BaseDirectory=[");
                s.Append(o_Table_Form.Expression_Filepath_ConfigStack.Directory_Base);
                s.Append("]");
                s.Newline();
                s.Newline();

                s.Append(" HumanInputText=[");
                s.Append(o_Table_Form.Expression_Filepath_ConfigStack.Humaninput);
                s.Append("]");
                s.Newline();
                s.Newline();

                // ヒント
                s.Append(r.Message_Configuration(o_Table_Form));

                r.Message = s.ToString();
                pg_Logging.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_DoubleNames:
            // NAMEフィールドと、NAME_REFフィールドの両方に記述があれば。
            // (両方に記述してはいけない)
            if (pg_Logging.CanCreateReport)
            {
                Log_RecordReports r = pg_Logging.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー901!", pg_Method);

                Log_TextIndented t = new Log_TextIndentedImpl();
                t.Append("指定のテーブル[");
                t.Append(o_Table_Form.Name);
                t.Append("の中に、");
                t.Newline();

                t.Append("NAMEとNAME_REFフィールドの両方に記述があるものがありました。");
                t.Newline();
                t.Append("両方同時に記述してはいけません。");
                t.Newline();

                t.Newline();
                t.Newline();

                t.Append("NAME=[");
                t.Append(sFoundName);
                t.Append("]");
                t.Newline();

                t.Append("NAME_REF=[");
                t.Append(sFoundNameRef);
                t.Append("]");
                t.Newline();

                t.Newline();
                t.Newline();

                //
                // 問題箇所ヒント
                //
                t.Append(" BaseDirectory=[");
                t.Append(o_Table_Form.Expression_Filepath_ConfigStack.Directory_Base);
                t.Append("]");
                t.Newline();
                t.Newline();

                t.Append(" HumanInputText=[");
                t.Append(o_Table_Form.Expression_Filepath_ConfigStack.Humaninput);
                t.Append("]");
                t.Newline();
                t.Newline();

                // ヒント
                t.Append(r.Message_Configuration(o_Table_Form));

                r.Message = t.ToString();
                pg_Logging.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            pg_Method.EndMethod(pg_Logging);
        }
示例#16
0
        //────────────────────────────────────────
        public RecordSetImpl(Table_Humaninput xenonTable)
        {
            this.xenonTable = xenonTable;

            this.list_Field = new List<Dictionary<string, Value_Humaninput>>();
        }
示例#17
0
        //────────────────────────────────────────
        /// <summary>
        /// 指定のフィールド名だけに絞り込んだサブテーブルを作って返します。
        /// </summary>
        /// <param name="sFieldNameList"></param>
        /// <returns></returns>
        public static Table_Humaninput CreateSubTableBySelect(
            string name_NewTable,
            List<string> list_Src_SNewFieldName,
            Expression_Node_Filepath expr_Fpath_NewTable,
            EnumLogic enumWhereLogic,
            List<Recordcondition> list_Reccond,
            Table_Humaninput src_XenonTable,
            Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl();
            log_Method.BeginMethod(Info_Table.Name_Library, "Util_Table", "CreateSubTableBySelect",log_Reports);

            //
            //
            //
            //

            Table_Humaninput tableH_New = new Table_HumaninputImpl(
                name_NewTable, expr_Fpath_NewTable, expr_Fpath_NewTable.Cur_Configuration);

            RecordFielddefinition recordFielddefinigion_New;
            List<List<string>> sFieldListList;
            Utility_Table.SelectFieldListList(
                out sFieldListList,
                out recordFielddefinigion_New,
                enumWhereLogic,
                list_Src_SNewFieldName,
                list_Reccond,
                src_XenonTable,
                log_Reports
                );

            //
            // 新しいテーブルを作成します。(列定義の追加)
            //
            tableH_New.CreateTable(recordFielddefinigion_New, log_Reports);

            if (tableH_New.DataTable.Columns.Count < 1)
            {
                // エラー。
                goto gt_Error_ZeroField;
            }
            else if (tableH_New.RecordFielddefinition.Count < 1)
            {
                // エラー。
                goto gt_Error_ZeroFieldDef;
            }

            // 不要なレコードを除去して絞り込んだ後で、
            // レコード追加。
            {
                tableH_New.AddRecordList(sFieldListList, recordFielddefinigion_New, log_Reports);
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_ZeroField:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー471!", log_Method);

                Log_TextIndented t = new Log_TextIndentedImpl();

                t.Append(" フィールドが0件のテーブルを作ることはできません。newFldDefList=[");
                t.Append(recordFielddefinigion_New.Count);
                t.Append("]");

                t.Newline();
                t.Newline();

                // ヒント

                r.Message = t.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_ZeroFieldDef:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー472!", log_Method);

                Log_TextIndented t = new Log_TextIndentedImpl();

                t.Append(" フィールド定義が0件のテーブルを作ることはできません。o_NewTable.FieldDefinitions.Count=[");
                t.Append(tableH_New.RecordFielddefinition.Count);
                t.Append("]");

                t.Newline();
                t.Newline();

                // ヒント

                r.Message = t.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return tableH_New;
        }
示例#18
0
        //────────────────────────────────────────
        public void Perfrom()
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            Log_Reports log_Reports_ThisMethod = new Log_ReportsImpl(log_Method);
            log_Method.BeginMethod( Info_PartsnumPut.Name_Library, this, "Perform", log_Reports_ThisMethod);

            this.out_Errormessage = "";
            this.out_Table_Humaninput = new Table_HumaninputImpl("名無し", null, new Configurationtree_NodeImpl(log_Method.Fullname, null));

            // CSV読取
            string text_Csv;
            try
            {
                text_Csv = System.IO.File.ReadAllText(this.In_Filepathabsolute, Encoding.Default);
            }
            catch (Exception e)
            {
                // エラー
                this.out_Errormessage = e.Message;
                goto gt_EndMethod;
            }

            Request_ReadsTable request = new Request_ReadsTableImpl();
            Format_Table_Humaninput format = new Format_Table_HumaninputImpl();

            CsvTo_Table_HumaninputImpl trans = new CsvTo_Table_HumaninputImpl();
            this.out_Table_Humaninput = trans.Read(
                text_Csv,
                request,
                format,
                log_Reports_ThisMethod
                );

            goto gt_EndMethod;
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports_ThisMethod);
            return;
        }
        //────────────────────────────────────────
        /// <summary>
        /// 「"」や「,」には対応していない。
        /// </summary>
        /// <param name="table"></param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        public string ToCsvText(
            Table_Humaninput table,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            log_Method.BeginMethod(Info_Table.Name_Library, this, "ToCsvText",log_Reports);

            string sResult = "";

            //
            //
            // (0)
            //
            //

            if (null == table)
            {
                // エラー
                goto gt_Error_NullTable;
            }

            //
            //
            // テーブルは、次の処理が一番重い。
            //
            // object[] dataRowItems = dataRow.ItemArray;
            //
            // 行から列一覧を取得する処理は、最大で、行数と同じ値までにしたい。
            //
            //

            //
            //
            // (1)
            //
            //

            List<List<string>> rsltTable = this.ToModel(table, log_Reports);
            if (!log_Reports.Successful)
            {
                // 既エラー。
                goto gt_EndMethod;
            }

            sResult = this.ToText(rsltTable, table);

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_NullTable:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー452!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.Append("(プログラム内部エラー)tableがヌルでした。");
                s.Newline();

                // ヒント

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return sResult;
        }
        private string ToText(
            List<List<string>> rsltTable,
            Table_Humaninput table
            )
        {
            bool bCommaEnding = table.Format_Table_Humaninput.IsCommaending;

            //
            // 行列をひっくり返して保存します。
            //
            List<StringBuilder> lineWriters = new List<StringBuilder>();

            for (int nR = 0; nR < rsltTable.Count; nR++)
            {
                List<string> row = rsltTable[nR];

                for (int nC = 0; nC < row.Count; nC++)
                {
                    if (lineWriters.Count <= nC)
                    {
                        lineWriters.Add(new StringBuilder());
                    }

                    lineWriters[nC].Append(row[nC]);

                    // 行列がひっくり返っているので分かりづらいが、
                    // 次の行があれば、カンマを付ける。
                    if (nR + 1 < rsltTable.Count)
                    {
                        lineWriters[nC].Append(",");
                    }
                }
            }

            StringBuilder sb_Result = new StringBuilder();

            for (int nL = 0; nL < lineWriters.Count; nL++)
            {
                sb_Result.Append(lineWriters[nL].ToString());

                //
                // EOF
                //
                if (0 == nL)
                {
                    sb_Result.Append(",");
                    sb_Result.Append(ToCsv_Table_Humaninput_RowColRegularImpl.S_EOF);
                }

                if (bCommaEnding)
                {
                    //
                    // 行の末尾を「,」で終わる場合。
                    //
                    sb_Result.Append(",");
                }

                sb_Result.Append(Environment.NewLine);
            }

            //
            // 最終行:EOF列の手前まで、「END」で埋めます。
            //
            {
                // 行数と同じ数の1個手前まで。
                for (int nC = 0; nC < rsltTable.Count - 1; nC++)
                {
                    sb_Result.Append(ToCsv_Table_Humaninput_RowColRegularImpl.S_END);
                    sb_Result.Append(",");
                }
                // 行数と同じ数に。
                sb_Result.Append(ToCsv_Table_Humaninput_RowColRegularImpl.S_END);

                // EOF列には END は付けません。

                if (bCommaEnding)
                {
                    //
                    // 行の末尾を「,」で終わる場合。
                    //
                    sb_Result.Append(",");
                }
            }

            // 最後に一応、改行を付けておきます。
            sb_Result.Append(Environment.NewLine);//改行

            return sb_Result.ToString();
        }
        //────────────────────────────────────────
        private List<List<string>> ToModel(
            Table_Humaninput table,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            log_Method.BeginMethod(Info_Table.Name_Library, this, "ToModel",log_Reports);

            Fielddefinition err_FldDef;

            // 「フィールド定義部」「データ部」両方含むテーブル。
            List<List<string>> rsltTable = new List<List<string>>();

            // フィールド名をカンマ区切りで出力します。最後にENDを付加します。

            // フィールド定義部
            //List<Fielddefinition> list_FieldDefinition = table.List_Fielddefinition;

            // データ・テーブル部
            DataTable dataTable = table.DataTable;

            // 「END,END,END...」行を除く、行数。
            int nHorizontalCountExceptEnd = table.RecordFielddefinition.Count;
            //essageBox.Show("「END,END,END...」行を除く、行数=[" + horizontalCountExceptEnd + "]", this.GetType().Name + "#Textize_rowColReversed: (Table)");

            bool bAllIntFields = table.Format_Table_Humaninput.IsAllintfieldsActivated;

            DataRow dataRow;

            string sCellValue;

            //
            // フィールド名の行
            //
            {
                List<string> sList_FieldNameRow = new List<string>();

                table.RecordFielddefinition.ForEach(delegate(Fielddefinition fielddefinition, ref bool isBreak2, Log_Reports log_Reports2)
                {
                    if (this.O_ExceptedFields.TryExceptedField(fielddefinition.Name_Trimupper))
                    {
                        // 出力しないフィールドの場合、無視します。
                    }
                    else
                    {
                        sList_FieldNameRow.Add(fielddefinition.Name_Humaninput);
                    }
                }, log_Reports);

                rsltTable.Add(sList_FieldNameRow);
            }

            //
            // 型名の行
            //
            if (bAllIntFields)
            {
                //
                // 全部 int型フィールドなので、型名を記述しない場合。
                //
            }
            else
            {
                //
                // 型名を記述する場合。
                //

                List<string> sList_FieldTypeRow = new List<string>();

                table.RecordFielddefinition.ForEach(delegate(Fielddefinition fielddefinition, ref bool isBreak2, Log_Reports log_Reports2)
                {
                    if (this.O_ExceptedFields.TryExceptedField(fielddefinition.Name_Trimupper))
                    {
                        // 出力しないフィールドの場合、無視します。
                    }
                    else
                    {

                        switch(fielddefinition.Type_Field)
                        {
                            case EnumTypeFielddefinition.String:
                                {
                                    sList_FieldTypeRow.Add(FielddefinitionImpl.S_STRING);
                                }
                                break;
                            case EnumTypeFielddefinition.Int:
                                {
                                    sList_FieldTypeRow.Add(FielddefinitionImpl.S_INT);
                                }
                                break;
                            case EnumTypeFielddefinition.Bool:
                                {
                                    sList_FieldTypeRow.Add(FielddefinitionImpl.S_BOOL);
                                }
                                break;
                            default:
                                {
                                    // TODO エラー対応。

                                    // 未定義の型があった場合、そのまま出力します。
                                    // C#のメッセージになるかと思います。
                                    sList_FieldTypeRow.Add(fielddefinition.ToString_Type());
                                }
                                break;
                        }

                    }
                }, log_Reports);
            }

            //
            // コメント行
            //
            {
                List<string> sList_FieldNameRow = new List<string>();
                table.RecordFielddefinition.ForEach(delegate(Fielddefinition fielddefinition, ref bool isBreak2, Log_Reports log_Reports2)
                {
                    if (this.O_ExceptedFields.TryExceptedField(fielddefinition.Name_Trimupper))
                    {
                        // 出力しないフィールドの場合、無視します。
                    }
                    else
                    {
                        sList_FieldNameRow.Add(fielddefinition.Comment);
                    }
                }, log_Reports);
                rsltTable.Add(sList_FieldNameRow);
            }

            //
            // データ部(フィールド定義部の次の行から始まるテーブル)
            //
            {
                // 「列定義」「EOF」列を除く、「データ部」だけの列数。
                int nDataCount = dataTable.Rows.Count;

                for (int nR = 0; nR < nDataCount; nR++)
                {
                    dataRow = dataTable.Rows[nR];
                    object[] itemArray = dataRow.ItemArray;//ItemArrayは1回の呼び出しが重い。

                    List<string> sList_DtRow = new List<string>();
                    int indexColumn = 0;
                    table.RecordFielddefinition.ForEach(delegate(Fielddefinition fielddefinition, ref bool isBreak2, Log_Reports log_Reports2)
                    {
                        if (this.O_ExceptedFields.TryExceptedField(fielddefinition.Name_Trimupper))
                        {
                            // 出力しないフィールドの場合、無視します。
                        }
                        else
                        {

                            if (itemArray[indexColumn] is Value_Humaninput)
                            {
                                sCellValue = ((Value_Humaninput)itemArray[indexColumn]).Text;
                            }
                            else
                            {
                                // (11)エラー
                                err_FldDef = fielddefinition;
                                isBreak2 = true;
                                goto gt_Error_UndefinedFieldType;
                            }

                            sList_DtRow.Add(sCellValue);
                        }

                        goto gt_EndInnermethod;
                        //
                        #region 異常系
                    //────────────────────────────────────────
                    gt_Error_UndefinedFieldType:
                        if (log_Reports.CanCreateReport)
                        {
                            Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                            r.SetTitle("▲エラー455!", log_Method);

                            Log_TextIndented s = new Log_TextIndentedImpl();

                            s.Append("(プログラム内部エラー)未定義のフィールド型=[");
                            s.Append(err_FldDef.ToString_Type());
                            s.Append("]");
                            s.Newline();

                            // ヒント

                            r.Message = s.ToString();
                            log_Reports.EndCreateReport();
                        }
                    goto gt_EndInnermethod;
                        //────────────────────────────────────────
                        #endregion
                        //
                    gt_EndInnermethod:
                        indexColumn++;
                    }, log_Reports);

                    rsltTable.Add(sList_DtRow);
                }
            }

            goto gt_EndMethod;
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return rsltTable;
        }
        //────────────────────────────────────────
        /// <summary>
        /// 
        /// </summary>
        /// <param name="dataRow"></param>
        /// <param name="forIndexTable_csvAbsFilePath"></param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        private MemoryCodefileinfo Read_RequestPart_Script(
            DataRow dataRow,
            string sFpatha_Aafilescsv,
            Table_Humaninput o_Table_Aafiles,
            Log_Reports log_Reports
            )
        {
            //
            //
            //
            //()メソッド開始
            //
            //
            //
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Functions.Name_Library, this, "Read_RequestPart_Script",log_Reports);

            //
            // 「各テーブル」の引数
            MemoryCodefileinfo result = new MemoryCodefileinfoImpl();

            //
            // 呼出名。
            //
            {
                string sName;

                bool bParsedSuccessful = String_HumaninputImpl.TryParse(
                    dataRow[NamesFld.S_NAME],
                    out sName,
                    sFpatha_Aafilescsv,
                    NamesFld.S_NAME,
                    log_Method,
                    log_Reports
                    );

                if (bParsedSuccessful)
                {
                    result.Name = sName;
                }
            }

            //
            // タイプデータ。
            //
            {
                string sTypedata;

                bool bParsedSuccessful = String_HumaninputImpl.TryParse(
                    dataRow[NamesFld.S_TYPE_DATA],
                    out sTypedata,
                    sFpatha_Aafilescsv,
                    NamesFld.S_NAME,
                    log_Method,
                    log_Reports
                    );

                if (bParsedSuccessful)
                {
                    result.Typedata = sTypedata;
                }
            }

            //
            // フォルダーと、ファイルパス。
            //
            Expression_Node_Filepath ec_Fpath;
            {
                this.Read_Folder_File(
                    out ec_Fpath,
                    result.Name,
                    sFpatha_Aafilescsv,
                    dataRow,
                    o_Table_Aafiles,
                    log_Reports
                    );

                result.Expression_Filepath = ec_Fpath;
            }

            goto gt_EndMethod;
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return result;
        }
        //────────────────────────────────────────
        /// <summary>
        /// Aa_Files.xmlの「FOLDER」「FILE」列を読取ります。
        /// </summary>
        /// <param name="ec_Fpath"></param>
        /// <param name="sTableNameToPuts"></param>
        /// <param name="sFpatha_Aafiles"></param>
        /// <param name="dataRow"></param>
        /// <param name="o_IndexTable"></param>
        /// <param name="log_Reports"></param>
        private void Read_Folder_File(
            out Expression_Node_Filepath ec_Fpath,
            string sTableNameToPuts,
            string sFpatha_Aafiles,
            DataRow dataRow,
            Table_Humaninput o_IndexTable,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            log_Method.BeginMethod(Info_Functions.Name_Library, this, "Read_Folder_File",log_Reports);

            string sFpath;//バックアップ用に使い回す文字列。
            ec_Fpath = null;//セットパス用に使い回す。

            {
                //
                // フォルダー変数の指定の有無
                //
                string sNamevarFolder;
                {
                    string sFieldName2 = NamesFld.S_FOLDER;
                    if (String_HumaninputImpl.TryParse(
                        dataRow[sFieldName2],
                        out sNamevarFolder,
                        o_IndexTable.Name,
                        sFieldName2,
                        log_Method,
                        log_Reports))
                    {
                        // 正常、スルー。
                    }
                    else
                    {
                        sNamevarFolder = "";
                    }
                }

                // テーブルのファイルのパスを取得
                string sName_Field = NamesFld.S_FILE;
                if (String_HumaninputImpl.TryParse(
                    dataRow[sName_Field],
                    out sFpath,
                    o_IndexTable.Name,
                    sName_Field,
                    log_Method,
                    log_Reports))
                {

                    if ("" != sNamevarFolder.Trim())
                    {
                        // FOLDER列に、変数名が指定されているとき。

                        Expression_Node_String ec_Namevar_Folder = new Expression_Leaf_StringImpl(sNamevarFolder.Trim(), null, new Configurationtree_NodeImpl(o_IndexTable.Name, null));//todo:

                        log_Reports.Log_Callstack.Push(log_Method, "③");
                        Expression_Node_Filepath ec_Fopath = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(
                            ec_Namevar_Folder, true, log_Reports);
                        log_Reports.Log_Callstack.Pop(log_Method, "③");

                        if (null == ec_Fopath)
                        {
                            goto gt_Error_NullFolder;
                        }

                        //if (log_Method.CanDebug(1))
                        //{
                        //    log_Method.WriteDebug_ToConsole(".csvのFOLDER列に[" + sNamevarFolder + "]と指定されていました。");
                        //}

                        log_Reports.Log_Callstack.Push(log_Method, "⑧");
                        //bug:フォルダーパスだと Execute4_OnExpressionString は空白を返す??
                        string sFopath2 = ec_Fopath.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                        if ("" == sFopath2)
                        {
                            //bug:フォルダーパスだと Execute4_OnExpressionString は空白を返すようなので、入力値をそのまま返すことにした。
                            sFopath2 = ec_Fopath.Humaninput.Trim();
                        }
                        log_Reports.Log_Callstack.Pop(log_Method, "⑧");

                        //if (log_Method.CanDebug(1))
                        //{
                        //    log_Method.WriteDebug_ToConsole("[" + sNamevarFolder + "]変数の内容は["+sFopath2+"]");
                        //    //this.Owner_MemoryApplication.MemoryVariables.WriteDebug_ToConsole();
                        //}

                        // 「フォルダー」 + 「¥」 + 「相対パス」
                        sFpath = sFopath2 + System.IO.Path.DirectorySeparatorChar + sFpath;
                    }
                }

                //
                // ファイルパス
                //
                Configurationtree_NodeFilepath cf_Fpath1;
                {
                    StringBuilder s = new StringBuilder();
                    s.Append("L11_1[");
                    s.Append(NamesFile.S_AA_FILES_CSV);
                    s.Append("ファイルの");
                    s.Append(sTableNameToPuts);
                    s.Append("指定=");
                    s.Append(sFpath);
                    s.Append("]");
                    cf_Fpath1 = new Configurationtree_NodeFilepathImpl(s.ToString(), null);
                    //cf_Fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L11_1", new Configurationtree_NodeImpl(s.ToString(), null));
                }

                cf_Fpath1.InitPath(sFpath, log_Reports);

                if (!log_Reports.Successful)
                {
                    // エラー
                    goto gt_EndMethod;
                }

                ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath1);
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_NullFolder:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration), log_Reports);//設定位置パンくずリスト

                this.Owner_MemoryApplication.CreateErrorReport("Er:110009;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
示例#24
0
 public Record_HumaninputImpl(string config, Table_Humaninput owner_TableH)
     : base(config, owner_TableH)
 {
     this.dataRow = owner_TableH.DataTable.NewRow();
     //this.configuration_Node = owner_TableH;
 }
示例#25
0
        //────────────────────────────────────────

        /// <summary>
        /// テーブルを、コレクションに追加します。
        /// </summary>
        /// <param select="oTable"></param>
        public void AddTable_Humaninput(
            Table_Humaninput o_Table,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);

            log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "AddTable_Humaninput", log_Reports);

            string sTableName_Trimed = o_Table.Name_Table.Trim();

            if ("" == sTableName_Trimed)
            {
                // エラー
                goto gt_Error_NoName;
            }

            if (log_Reports.Successful)
            {
                if (!this.Dictionary_Table_Humaninput.ContainsKey(sTableName_Trimed))
                {
                    this.dictionary_Table_Humaninput[sTableName_Trimed] = o_Table;
                }
                else
                {
                    // エラー
                    goto gt_Error_OverlappedTableName;
                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_NoName:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー930!", log_Method);

                StringBuilder t = new StringBuilder();
                t.Append("テーブル名を指定してください。無名です。[");
                t.Append(o_Table.Name);
                t.Append("]");
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);

                t.Append("テーブルを登録するには、テーブル名が必要です。");
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);

                // ヒント

                r.Message = t.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_OverlappedTableName:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー931!", log_Method);

                StringBuilder t = new StringBuilder();
                t.Append("登録しようとしたテーブルの名前は、既に登録されていました。[");
                t.Append(o_Table.Name);
                t.Append("]");
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);

                t.Append("同じ名前のテーブルは、2度登録できません。");
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);

                // ヒント
                t.Append(r.Message_Configuration(o_Table));

                r.Message = t.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
示例#26
0
        /// <summary>
        /// コントロールのスタイルを設定します。
        /// </summary>
        /// <param name="fo_Config"></param>
        /// <param name="oFolderPath_forms"></param>
        /// <param name="form"></param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        public void P1_XToMemory_Userformconfig(
            TableUserformconfig fo_Config,
            Table_Humaninput o_Table_Form,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "P1_XToMemory_Userformconfig", log_Reports);
            //
            //

            if (log_Reports.Successful)
            {
                // 正常時

                this.xToMemory_Form.LoadUserformconfigFile(
                    fo_Config,
                    o_Table_Form,
                    this.Owner_MemoryApplication,
                    log_Reports
                    );

            }
            else
            {
                //config_form = null;
            }

            //
            //
            //
            //
            log_Method.EndMethod(log_Reports);
        }
示例#27
0
        //────────────────────────────────────────
        /// <summary>
        /// 「(Form_lst)補完レイアウト_テーブル」用。
        /// </summary>
        /// <returns>0:正常終了、2:continue。</returns>
        private int Read_FormLst(
            bool bNameRefRequired,
            RecordUserformconfig fo_Record,
            DataRow dataRow,
            Table_Humaninput o_Table_Form,
            Log_Reports pg_Logging
            )
        {
            Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            pg_Method.BeginMethod(Info_LayoutImpl.Name_Library, this, "Read_LayoutLst",pg_Logging);
            //
            //

            int nResult = 0;

            int nIntValue;// = 0;
            string sValue;// = "";
            //bool boolValue;// = false;

            if (bNameRefRequired)
            {
                //
                // NAME_REF が未記入ならスキップ
                string sFieldName = NamesFld.S_NAME_REF;
                if (dataRow.Table.Columns.Contains(sFieldName))
                {
                    if (dataRow[sFieldName] is DBNull)
                    {
                        // この連想配列は大文字・小文字を区別しないのが欠点。

                        // NAME_REFフィールドが未記入の場合は、空行と判断して、無視します。
                        nResult = 2;
                        goto gt_EndMethod;
                    }
                }
                else
                {
                    if (pg_Logging.CanCreateReport)
                    {
                        Log_RecordReports r = pg_Logging.BeginCreateReport(EnumReport.Error);
                        r.SetTitle("▲エラー921!", pg_Method);
                        r.Message = "[" + sFieldName + "]フィールドは、[" + o_Table_Form.Name + "]には存在しませんでした。";
                        pg_Logging.EndCreateReport();
                    }
                }
            }

            //
            // ITEM_HEIGHT_PX
            //
            {
                string sFieldName = NamesFld.S_ITEM_HEIGHT_PX;
                if (dataRow.Table.Columns.Contains(sFieldName))
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "(25)");
                    bool bBool = !Int_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out nIntValue,
                        EnumOperationIfErrorvalue.Spaces_To_Alt_Value, // 空行追加時のエラー抑制のため。
                        -1,
                        pg_Logging
                        );
                    pg_Logging.Log_Callstack.Pop(pg_Method, "(25)");

                    if (bBool)
                    {
                        // パース失敗時

                        // 無視
                    }
                    else
                    {
                        if (!pg_Logging.Successful)
                        {
                            // エラー
                            goto gt_EndMethod;
                        }

                        if (nIntValue < 1 || 256 <= nIntValue)
                        {
                            // 1未満、または256以上をセットするとエラーになるので無視。
                            // 空欄(-1)
                        }
                        else
                        {
                            fo_Record.Set(NamesFld.S_ITEM_HEIGHT_PX, EnumTypedb.Int, nIntValue, pg_Logging);
                            //fo_Record.NItemHeightPx = nIntValue;
                        }
                    }

                }
                else
                {
                    //
                    // スルーすること。初期化してはいけない。
                    //
                }
            }

            //
            // ITEM_DISPLAY_FORMAT
            //
            {
                string sFieldName = NamesFld.S_ITEM_DISPLAY_FORMAT;
                if (dataRow.Table.Columns.Contains(sFieldName))
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "(26)");
                    bool bBool = String_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out sValue,
                        o_Table_Form.Name,
                        sFieldName,
                        pg_Method,
                        pg_Logging);
                    pg_Logging.Log_Callstack.Pop(pg_Method, "(26)");

                    if (bBool)
                    {
                        fo_Record.Set(NamesFld.S_ITEM_DISPLAY_FORMAT, EnumTypedb.String, sValue, pg_Logging);
                        //fo_Record.SItemDisplayFormat = sValue;
                    }
                    else
                    {
                        fo_Record.Set(NamesFld.S_ITEM_DISPLAY_FORMAT, EnumTypedb.String, "", pg_Logging);
                        //fo_Record.SItemDisplayFormat = "";
                    }

                    if (!pg_Logging.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }

                }
                else
                {
                    //
                    // スルーすること。初期化してはいけない。
                    //
                }
            }

            //
            // LIST_VALUE_FIELD
            //
            {
                string sFieldName = NamesFld.S_LIST_VALUE_FIELD;
                if (dataRow.Table.Columns.Contains(sFieldName))
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "(27)");
                    bool bBool = String_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out sValue,
                        o_Table_Form.Name,
                        sFieldName,
                        pg_Method,
                        pg_Logging);
                    pg_Logging.Log_Callstack.Pop(pg_Method, "(27)");

                    if (bBool)
                    {
                        fo_Record.Set(NamesFld.S_LIST_VALUE_FIELD, EnumTypedb.String, sValue, pg_Logging);
                        //fo_Record.SListValueField = sValue;
                    }
                    else
                    {
                        fo_Record.Set(NamesFld.S_LIST_VALUE_FIELD, EnumTypedb.String, "", pg_Logging);
                        //fo_Record.SListValueField = "";
                    }

                    if (!pg_Logging.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }

                }
                else
                {
                    //
                    // スルーすること。初期化してはいけない。
                    //
                }
            }

            //
            //
            //
            //
            gt_EndMethod:
            pg_Method.EndMethod(pg_Logging);
            return nResult;
        }
示例#28
0
        //────────────────────────────────────────

        /// <summary>
        /// 「変数設定ファイル」のテーブルを読み取り、変数を登録します。
        /// </summary>
        /// <param oVariableName="varOTable"></param>
        /// <param oVariableName="log_Reports"></param>
        public void Load(
            Table_Humaninput o_Table_Var,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(1, Log_ReportsImpl.BDebugmode_Static);

            log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "Load", log_Reports);
            //

            if (log_Method.CanDebug(1))
            {
                log_Method.WriteDebug_ToConsole("「変数登録ファイル」を Load します。");
            }

            //
            //
            //
            //

            if (null == o_Table_Var)
            {
                goto gt_Error_NullTable;
            }



            if (null != this.parent_Variablesconfig_Configurationtree)
            {
                goto gt_Error_DoubleLoad;
            }


            string err_SFolder;
            string err_SName;

            if (log_Reports.Successful)
            {
                this.parent_Variablesconfig_Configurationtree = new Configurationtree_NodeImpl(NamesNode.S_VARIABLE_CONFIG, o_Table_Var.Expression_Filepath_ConfigStack.Cur_Configuration);
                if (!log_Reports.Successful)
                {
                    // 既エラー。
                    goto gt_EndMethod;
                }

                foreach (DataRow dataRow in o_Table_Var.DataTable.Rows)
                {
                    string sStringValue;// = "";

                    // ソース情報として使うだけ。
                    Configurationtree_Node cf_VarRecord1 = new Configurationtree_NodeImpl(NamesNode.S_VARIABLE_RECORD, parent_Variablesconfig_Configurationtree);

                    // 注意: dataRow[]の連想配列は大文字・小文字を区別しないのが欠点。

                    //NAME列
                    {
                        string sFldName = NamesFld.S_NAME;//フィールド名。
                        if (o_Table_Var.ContainsField(sFldName, true, log_Reports))
                        {
                            if (String_HumaninputImpl.TryParse(
                                    dataRow[sFldName],
                                    out sStringValue,
                                    o_Table_Var.Name,
                                    sFldName,
                                    log_Method,
                                    log_Reports))
                            {
                            }
                            else
                            {
                                sStringValue = "";
                            }

                            if (!log_Reports.Successful)
                            {
                                // エラー
                                goto gt_EndMethod;
                            }

                            cf_VarRecord1.Dictionary_Attribute.Set(PmNames.S_NAME.Name_Pm, sStringValue, log_Reports);
                        }
                    }

                    // FOLDER列 (オプション)
                    {
                        string sFldName = NamesFld.S_FOLDER;
                        if (o_Table_Var.ContainsField(sFldName, false, log_Reports))
                        {
                            if (String_HumaninputImpl.TryParse(
                                    dataRow[sFldName],
                                    out sStringValue,
                                    o_Table_Var.Name,
                                    sFldName,
                                    log_Method,
                                    log_Reports))
                            {
                            }
                            else
                            {
                                sStringValue = "";
                            }

                            if (!log_Reports.Successful)
                            {
                                // エラー
                                goto gt_EndMethod;
                            }

                            //if (log_Method.CanDebug(1))
                            //{
                            //    log_Method.WriteDebug_ToConsole("「変数登録ファイル」FOLDER列=[" + sStringValue + "]");
                            //}
                            cf_VarRecord1.Dictionary_Attribute.Set(PmNames.S_FOLDER.Name_Pm, sStringValue, log_Reports);
                        }
                        else
                        {
                            //なければ無視。
                        }
                    }

                    // VALUE列
                    {
                        string sFldName = NamesFld.S_VALUE;//フィールド名。
                        if (o_Table_Var.ContainsField(sFldName, true, log_Reports))
                        {
                            if (String_HumaninputImpl.TryParse(
                                    dataRow[sFldName],
                                    out sStringValue,
                                    o_Table_Var.Name,
                                    sFldName,
                                    log_Method,
                                    log_Reports))
                            {
                            }
                            else
                            {
                                sStringValue = "";
                            }

                            if (!log_Reports.Successful)
                            {
                                // エラー
                                goto gt_EndMethod;
                            }

                            cf_VarRecord1.Dictionary_Attribute.Set(PmNames.S_VALUE.Name_Pm, sStringValue, log_Reports);
                        }
                    }

                    //
                    // 変数を登録。
                    //
                    if (log_Reports.Successful)
                    {
                        //NAME列
                        string sName;
                        cf_VarRecord1.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName, true, log_Reports);

                        //FOLDER列 (オプション)
                        string sFolder;
                        bool   bExistsFolder = cf_VarRecord1.Dictionary_Attribute.TryGetValue(PmNames.S_FOLDER, out sFolder, false, log_Reports);

                        string sValue;
                        cf_VarRecord1.Dictionary_Attribute.TryGetValue(PmNames.S_VALUE, out sValue,
                                                                       false, //空文字列でも可。
                                                                       log_Reports);

                        if (NamesVar.Test_Filepath(sName))
                        {
                            //ファイルパス変数の場合。
                            Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("変数[" + sName + "]", this.parent_Variablesconfig_Configurationtree);
                            cf_Fpath.InitPath(
                                sValue,
                                log_Reports
                                );
                            if ("" != sFolder)
                            {
                                //if (log_Method.CanDebug(1))
                                //{
                                //    log_Method.WriteDebug_ToConsole("「変数登録ファイル」FOLDER列指定あり=[" + sFolder + "]");
                                //}

                                Expression_Node_String   ec_Namevar_Folder = new Expression_Leaf_StringImpl(sFolder, null, this.parent_Variablesconfig_Configurationtree);
                                Expression_Node_Filepath ec_Fopath_Folder  = this.GetExpressionfilepathByVariablename(
                                    ec_Namevar_Folder,
                                    true,
                                    log_Reports
                                    );
                                cf_Fpath.SetDirectory_Base(ec_Fopath_Folder.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));
                            }
                            //else
                            //{
                            //    if (log_Method.CanDebug(1))
                            //    {
                            //        log_Method.WriteDebug_ToConsole("「変数登録ファイル」FOLDER列指定なし");
                            //    }
                            //}

                            Expression_Node_Filepath ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath);

                            this.PutFilepath(
                                sName,
                                ec_Fpath,
                                true,
                                log_Reports
                                );

                            //if (log_Method.CanDebug(1))
                            //{
                            //    log_Method.WriteDebug_ToConsole("「変数登録ファイル」ファイルパス変数=[" + sName + "] 値=[" + ec_Fpath.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]");
                            //}
                        }
                        else
                        {
                            //ファイルパス以外の変数の場合。
                            //if (log_Method.CanDebug(1))
                            //{
                            //    log_Method.WriteDebug_ToConsole("「変数登録ファイル」ファイルパス以外の変数=[" + sName + "]");
                            //}

                            if (bExistsFolder && "" != sFolder)
                            {
                                //ファイルパス変数以外の変数で、FOLDER列値を指定しているのはエラーです。
                                //※FOLDER列が存在する場合だけエラーチェックします。FOLDER列値がない場合は、sFolderには"null"が入っているので無視します。

                                err_SName   = sName;
                                err_SFolder = sFolder;
                                goto gt_Error_InputFolder;
                            }

                            this.PutString(
                                sName,
                                sValue,
                                log_Reports
                                );
                        }
                    }
                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_InputFolder:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("Er:402;", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append("[");
                s.Append(err_SName);
                s.Append("]変数に、");
                s.Append(PmNames.S_FOLDER.Name_Attribute);
                s.Append("列値を指定しているのはエラーです。");
                s.Newline();
                s.Append(PmNames.S_FOLDER.Name_Attribute);
                s.Append("列値は、ファイルパス変数にしか書いてはいけません。");
                s.Newline();
                s.Append("ファイルパス変数は、「");
                s.Append(NamesVar.S_SP_);
                s.Append("」、「");
                s.Append(NamesVar.S_UP_);
                s.Append("」で始まる名前の変数です。");
                s.Newline();
                s.Newline();

                s.AppendI(1, PmNames.S_FOLDER.Name_Attribute);
                if (null == err_SFolder)
                {
                    s.Append("=ヌル。");
                }
                else
                {
                    s.Append("=[");
                    s.Append(err_SFolder);
                    s.Append("]");
                }
                s.Newline();
                s.Newline();

                // ヒント

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_NullTable:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー918!", log_Method);

                StringBuilder t = new StringBuilder();
                t.Append("指定されたテーブルは、ヌルでした。");
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);

                // ヒント

                r.Message = t.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_DoubleLoad:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー919!", log_Method);

                StringBuilder t = new StringBuilder();
                t.Append("既に「変数設定ファイル」はロードされているのに、");
                t.Append(Environment.NewLine);
                t.Append("また 「変数設定ファイル」をロードしようとしました。");
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);

                // ヒント

                r.Message = t.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
示例#29
0
 public Record_HumaninputImpl(string config, Table_Humaninput owner_TableH)
     : base(config, owner_TableH)
 {
     this.dataRow = owner_TableH.DataTable.NewRow();
     //this.configuration_Node = owner_TableH;
 }
示例#30
0
        //────────────────────────────────────────
        #endregion



        #region アクション
        //────────────────────────────────────────

        public void TryGetTable_Variables(
            out Table_Humaninput out_xenonTable_Variables,
            String filepath_Startup,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);

            log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "TryGetTable_Variables", log_Reports);

            out_xenonTable_Variables = null;

            //『Sp:Variables;』で指定されているテーブル
            XenonName xenonName_Variable = new XenonNameImpl(NamesVar.S_SP_VARIABLES, new Configurationtree_NodeImpl("!ハードコーディング_MoNorenImpl#LoadVariables", null));

            //
            // 「変数設定ファイル」のファイルパス。
            //
            log_Reports.Log_Callstack.Push(log_Method, "①");
            Expression_Node_Filepath ec_Fpath_Variables = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(
                new Expression_Leaf_StringImpl(xenonName_Variable.SValue, null, xenonName_Variable.Cur_Configuration),
                false,//必須ではありません。未該当であればヌルを返します。
                log_Reports
                );

            log_Reports.Log_Callstack.Pop(log_Method, "①");

            if (log_Reports.Successful)
            {
                if (null == ec_Fpath_Variables)
                {
                    //
                    // "Sp:Variables;" が未指定の場合、何もしません。
                    //
                    goto gt_EndMethod;
                }
            }

            //指定されていた場合。
            if (log_Reports.Successful)
            {
                //
                // CSVソースファイル読取
                //
                CsvTo_Table_HumaninputImpl reader = new CsvTo_Table_HumaninputImpl();

                Request_ReadsTable      request_tblReads = new Request_ReadsTableImpl();
                Format_Table_Humaninput tblFormat_puts   = new Format_Table_HumaninputImpl();
                request_tblReads.Name_PutToTable     = NamesVar.S_ST_VARIABLES2;
                request_tblReads.Expression_Filepath = ec_Fpath_Variables;

                out_xenonTable_Variables = reader.Read(
                    request_tblReads,
                    tblFormat_puts,
                    true,
                    log_Reports
                    );
            }

            goto gt_EndMethod;
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
        //────────────────────────────────────────
        /// <summary>
        /// 「Aa_Files.csv」に書かれている「テーブル」と「スクリプト」を読取り、登録します。
        /// </summary>
        private void ReadAndRegisterFiles(
            Table_Humaninput xenonTable_Aafilescsv,
            Log_Reports log_Reports
            )
        {
            //
            //
            //
            //()メソッド開始
            //
            //
            //
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Functions.Name_Library, this, "ReadAndRegisterFiles",log_Reports);

            string err_STypedata;

            //
            //
            //
            // 「Aa_Files.csv」自身の絶対ファイルパス
            //
            //
            //
            string sFpatha_Aafilescsv;
            if (log_Reports.Successful)
            {
                sFpatha_Aafilescsv = xenonTable_Aafilescsv.Expression_Filepath_ConfigStack.Execute4_OnExpressionString(
                    EnumHitcount.Unconstraint, log_Reports);
                if (!log_Reports.Successful)
                {
                    // 既エラー。
                    goto gt_EndMethod;
                }
            }
            else
            {
                sFpatha_Aafilescsv = null;
            }

            //
            //
            //
            //「TYPE_DATA」というフィールドは必須です。
            //
            //
            //
            bool isExists_FieldTypedata;
            if (log_Reports.Successful)
            {
                if (xenonTable_Aafilescsv.DataTable.Columns.Contains(NamesFld.S_TYPE_DATA))
                {
                    isExists_FieldTypedata = true;
                }
                else
                {
                    isExists_FieldTypedata = false;
                }
            }
            else
            {
                isExists_FieldTypedata = false;
            }

            int err_NRow=1;//行番号
            if (log_Reports.Successful)
            {

                //
                // テーブルを全て(読み込まないもの除く)読み取ります。
                //

                foreach (DataRow datarow in xenonTable_Aafilescsv.DataTable.Rows)
                {

                    Request_ReadsTable requestRead = this.CreateReadRequest(
                        datarow,
                        xenonTable_Aafilescsv,
                        log_Reports);

                    if (!log_Reports.Successful)
                    {
                        //既エラー時、ループ抜け。
                        break;
                    }

                    //
                    // テーブルを読み取るのか、XMLを読み取るのかの区別。
                    //
                    if (
                        ValuesTypeData.TestTable(requestRead.Typedata) ||
                        !isExists_FieldTypedata //TYPE_DATAフィールドそのものが無ければ、エラーとはせず、テーブルとして読み込みます。
                        )
                    {
                        //
                        // テーブルなら。
                        //

                        Format_Table_Humaninput forTable_format = this.Read_RequestPart_Table(
                            datarow, sFpatha_Aafilescsv, log_Reports);

                        Table_Humaninput oTable;
                        // テーブル読取の実行。(書き出し専用の場合は、登録だけする)
                        oTable = this.ReadTable(
                            requestRead,
                            forTable_format,
                            log_Reports
                            );

                        // テーブルは読み込まなくても、登録はする。
                        if (log_Reports.Successful)
                        {
                            // アプリケーション・モデルに、テーブルを登録
                            this.Owner_MemoryApplication.MemoryTables.AddTable_Humaninput(
                                oTable,
                                log_Reports
                                );
                        }
                        //
                    }
                    else if(
                        ValuesTypeData.TestCode(requestRead.Typedata)
                        )
                    {
                        //
                        // XMLなら。
                        //

                        MemoryCodefileinfo moScriptfileInfo = this.Read_RequestPart_Script(
                            datarow,
                            sFpatha_Aafilescsv,
                            xenonTable_Aafilescsv,
                            log_Reports
                            );

                        // 登録
                        if (log_Reports.Successful)
                        {
                            this.Owner_MemoryApplication.MemoryCodefiles.Add(
                                moScriptfileInfo,
                                log_Reports
                                );
                        }

                        //requestRead.
                        log_Method.WriteDebug_ToConsole("sTypeData=[" + requestRead.Typedata + "]");
                    }
                    else
                    {
                        //エラー。
                        err_STypedata = requestRead.Typedata;
                        goto gt_Error_TypeData;
                    }

                    //エラー報告用の行カウンター。
                    err_NRow++;
                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_TypeData:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, NamesFld.S_TYPE_DATA, log_Reports);//フィールド名TYPE_DATA
                tmpl.SetParameter(2, err_STypedata, log_Reports);//TYPE_DATAフィールドの値
                tmpl.SetParameter(3, ValuesTypeData.Message_Allitems(), log_Reports);//TYPE_DATAフィールドに設定できる値のリスト

                Configurationtree_Node cf = new Configurationtree_NodeImpl("データ部" + err_NRow + "行", xenonTable_Aafilescsv.Parent);
                tmpl.SetParameter(4, Log_RecordReportsImpl.ToText_Configuration(cf), log_Reports);//設定位置パンくずリスト

                this.Owner_MemoryApplication.CreateErrorReport("Er:110011;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
示例#32
0
        //────────────────────────────────────────
        /// <summary>
        /// テーブルを、コレクションに追加します。
        /// </summary>
        /// <param select="oTable"></param>
        public void AddTable_Humaninput(
            Table_Humaninput o_Table,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "AddTable_Humaninput", log_Reports);

            string sTableName_Trimed = o_Table.Name_Table.Trim();

            if(""==sTableName_Trimed)
            {
                // エラー
                goto gt_Error_NoName;
            }

            if (log_Reports.Successful)
            {
                if (!this.Dictionary_Table_Humaninput.ContainsKey(sTableName_Trimed))
                {
                    this.dictionary_Table_Humaninput[sTableName_Trimed] = o_Table;
                }
                else
                {
                    // エラー
                    goto gt_Error_OverlappedTableName;
                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_NoName:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー930!", log_Method);

                StringBuilder t = new StringBuilder();
                t.Append("テーブル名を指定してください。無名です。[");
                t.Append(o_Table.Name);
                t.Append("]");
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);

                t.Append("テーブルを登録するには、テーブル名が必要です。");
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);

                // ヒント

                r.Message = t.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_OverlappedTableName:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー931!", log_Method);

                StringBuilder t = new StringBuilder();
                t.Append("登録しようとしたテーブルの名前は、既に登録されていました。[");
                t.Append(o_Table.Name);
                t.Append("]");
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);

                t.Append("同じ名前のテーブルは、2度登録できません。");
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);

                // ヒント
                t.Append(r.Message_Configuration(o_Table));

                r.Message = t.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
示例#33
0
        //────────────────────────────────────────
        #endregion



        #region アクション
        //────────────────────────────────────────

        /// <summary>
        /// 「"」や「,」には対応していない。
        /// </summary>
        /// <param name="table"></param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        public string ToCsvText(
            Table_Humaninput table,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);

            log_Method.BeginMethod(Info_Table.Name_Library, this, "ToCsvText", log_Reports);

            string sResult = "";


            //
            //
            // (0)
            //
            //

            if (null == table)
            {
                // エラー
                goto gt_Error_NullTable;
            }


            //
            //
            // テーブルは、次の処理が一番重い。
            //
            // object[] dataRowItems = dataRow.ItemArray;
            //
            // 行から列一覧を取得する処理は、最大で、行数と同じ値までにしたい。
            //
            //

            //
            //
            // (1)
            //
            //


            List <List <string> > rsltTable = this.ToModel(table, log_Reports);

            if (!log_Reports.Successful)
            {
                // 既エラー。
                goto gt_EndMethod;
            }

            sResult = this.ToText(rsltTable, table);

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_NullTable:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー452!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.Append("(プログラム内部エラー)tableがヌルでした。");
                s.Newline();

                // ヒント

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(sResult);
        }
示例#34
0
        //────────────────────────────────────────

        /// <summary>
        ///
        /// </summary>
        /// <param name="dataRow"></param>
        /// <param name="forIndexTable_csvAbsFilePath"></param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        private MemoryCodefileinfo Read_RequestPart_Script(
            DataRow dataRow,
            string sFpatha_Aafilescsv,
            Table_Humaninput o_Table_Aafiles,
            Log_Reports log_Reports
            )
        {
            //
            //
            //
            //()メソッド開始
            //
            //
            //
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);

            log_Method.BeginMethod(Info_Functions.Name_Library, this, "Read_RequestPart_Script", log_Reports);

            //
            // 「各テーブル」の引数
            MemoryCodefileinfo result = new MemoryCodefileinfoImpl();


            //
            // 呼出名。
            //
            {
                string sName;

                bool bParsedSuccessful = String_HumaninputImpl.TryParse(
                    dataRow[NamesFld.S_NAME],
                    out sName,
                    sFpatha_Aafilescsv,
                    NamesFld.S_NAME,
                    log_Method,
                    log_Reports
                    );

                if (bParsedSuccessful)
                {
                    result.Name = sName;
                }
            }


            //
            // タイプデータ。
            //
            {
                string sTypedata;

                bool bParsedSuccessful = String_HumaninputImpl.TryParse(
                    dataRow[NamesFld.S_TYPE_DATA],
                    out sTypedata,
                    sFpatha_Aafilescsv,
                    NamesFld.S_NAME,
                    log_Method,
                    log_Reports
                    );

                if (bParsedSuccessful)
                {
                    result.Typedata = sTypedata;
                }
            }


            //
            // フォルダーと、ファイルパス。
            //
            Expression_Node_Filepath ec_Fpath;

            {
                this.Read_Folder_File(
                    out ec_Fpath,
                    result.Name,
                    sFpatha_Aafilescsv,
                    dataRow,
                    o_Table_Aafiles,
                    log_Reports
                    );

                result.Expression_Filepath = ec_Fpath;
            }


            goto gt_EndMethod;
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(result);
        }
示例#35
0
        //────────────────────────────────────────
        #endregion



        #region アクション
        //────────────────────────────────────────

        /// <summary>
        /// where句の最初の条件を引っこ抜く。
        /// 条件に合うものを一気に集めてくる形になっているが、
        /// SelectedRecords に機能を持たせるか?
        /// </summary>
        /// <param name="out_Name_KeyField"></param>
        /// <param name="out_FielddefinitionKey2"></param>
        /// <param name="out_Value_Expected"></param>
        /// <param name="childReccondList"></param>
        /// <param name="tableH"></param>
        /// <param name="log_Reports"></param>
        public void GetFirstAwhrReccond(
            out string out_Name_KeyField,
            out Fielddefinition out_FielddefinitionKey2,
            out string out_Value_Expected,
            List <Recordcondition> list_ChildReccond,
            Table_Humaninput tableH,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);

            log_Method.BeginMethod(Info_Expr.Name_Library, this, "GetFirstAwhrReccond", log_Reports);
            //
            //


            Recordcondition err_Recordcondition = null;

            if (0 < list_ChildReccond.Count)
            {
                Recordcondition recCond_First = list_ChildReccond[0];

                err_Recordcondition = recCond_First;

                //
                // 検索のキーとなるフィールドの定義を調べます。

                List <string> list_Name_KeyFld;
                {
                    // 要素数1個
                    list_Name_KeyFld = new List <string>();
                    list_Name_KeyFld.Add(recCond_First.Name_Field);
                }



                // 該当なしの場合、ヌルを返す。
                RecordFielddefinition recordFielddefinition;
                bool bHit = tableH.TryGetFieldDefinitionByName(
                    out recordFielddefinition,
                    list_Name_KeyFld,
                    true,// 必須指定。
                    log_Reports
                    );
                if (!log_Reports.Successful || !bHit)
                {
                    // エラー
                    out_Name_KeyField       = "";
                    out_FielddefinitionKey2 = null;
                    out_Value_Expected      = "";
                    goto gt_EndMethod;
                }

                //正常
                out_FielddefinitionKey2 = recordFielddefinition.ValueAt(0);
                out_Name_KeyField       = recCond_First.Name_Field;
                out_Value_Expected      = recCond_First.Value;
            }
            else
            {
                //正常
                out_Name_KeyField       = "";
                out_FielddefinitionKey2 = null;
                out_Value_Expected      = "";
            }

            goto gt_EndMethod;


            //
            //
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
示例#36
0
        //────────────────────────────────────────

        /// <summary>
        /// 「Aa_Files.csv」に書かれている「テーブル」と「スクリプト」を読取り、登録します。
        /// </summary>
        private void ReadAndRegisterFiles(
            Table_Humaninput xenonTable_Aafilescsv,
            Log_Reports log_Reports
            )
        {
            //
            //
            //
            //()メソッド開始
            //
            //
            //
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);

            log_Method.BeginMethod(Info_Functions.Name_Library, this, "ReadAndRegisterFiles", log_Reports);


            string err_STypedata;

            //
            //
            //
            // 「Aa_Files.csv」自身の絶対ファイルパス
            //
            //
            //
            string sFpatha_Aafilescsv;

            if (log_Reports.Successful)
            {
                sFpatha_Aafilescsv = xenonTable_Aafilescsv.Expression_Filepath_ConfigStack.Execute4_OnExpressionString(
                    EnumHitcount.Unconstraint, log_Reports);
                if (!log_Reports.Successful)
                {
                    // 既エラー。
                    goto gt_EndMethod;
                }
            }
            else
            {
                sFpatha_Aafilescsv = null;
            }


            //
            //
            //
            //「TYPE_DATA」というフィールドは必須です。
            //
            //
            //
            bool isExists_FieldTypedata;

            if (log_Reports.Successful)
            {
                if (xenonTable_Aafilescsv.DataTable.Columns.Contains(NamesFld.S_TYPE_DATA))
                {
                    isExists_FieldTypedata = true;
                }
                else
                {
                    isExists_FieldTypedata = false;
                }
            }
            else
            {
                isExists_FieldTypedata = false;
            }


            int err_NRow = 1;//行番号

            if (log_Reports.Successful)
            {
                //
                // テーブルを全て(読み込まないもの除く)読み取ります。
                //

                foreach (DataRow datarow in xenonTable_Aafilescsv.DataTable.Rows)
                {
                    Request_ReadsTable requestRead = this.CreateReadRequest(
                        datarow,
                        xenonTable_Aafilescsv,
                        log_Reports);

                    if (!log_Reports.Successful)
                    {
                        //既エラー時、ループ抜け。
                        break;
                    }

                    //
                    // テーブルを読み取るのか、XMLを読み取るのかの区別。
                    //
                    if (
                        ValuesTypeData.TestTable(requestRead.Typedata) ||
                        !isExists_FieldTypedata //TYPE_DATAフィールドそのものが無ければ、エラーとはせず、テーブルとして読み込みます。
                        )
                    {
                        //
                        // テーブルなら。
                        //

                        Format_Table_Humaninput forTable_format = this.Read_RequestPart_Table(
                            datarow, sFpatha_Aafilescsv, log_Reports);

                        Table_Humaninput oTable;
                        // テーブル読取の実行。(書き出し専用の場合は、登録だけする)
                        oTable = this.ReadTable(
                            requestRead,
                            forTable_format,
                            log_Reports
                            );

                        // テーブルは読み込まなくても、登録はする。
                        if (log_Reports.Successful)
                        {
                            // アプリケーション・モデルに、テーブルを登録
                            this.Owner_MemoryApplication.MemoryTables.AddTable_Humaninput(
                                oTable,
                                log_Reports
                                );
                        }
                        //
                    }
                    else if (
                        ValuesTypeData.TestCode(requestRead.Typedata)
                        )
                    {
                        //
                        // XMLなら。
                        //

                        MemoryCodefileinfo moScriptfileInfo = this.Read_RequestPart_Script(
                            datarow,
                            sFpatha_Aafilescsv,
                            xenonTable_Aafilescsv,
                            log_Reports
                            );

                        // 登録
                        if (log_Reports.Successful)
                        {
                            this.Owner_MemoryApplication.MemoryCodefiles.Add(
                                moScriptfileInfo,
                                log_Reports
                                );
                        }

                        //requestRead.
                        log_Method.WriteDebug_ToConsole("sTypeData=[" + requestRead.Typedata + "]");
                    }
                    else
                    {
                        //エラー。
                        err_STypedata = requestRead.Typedata;
                        goto gt_Error_TypeData;
                    }


                    //エラー報告用の行カウンター。
                    err_NRow++;
                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_TypeData:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, NamesFld.S_TYPE_DATA, log_Reports);              //フィールド名TYPE_DATA
                tmpl.SetParameter(2, err_STypedata, log_Reports);                     //TYPE_DATAフィールドの値
                tmpl.SetParameter(3, ValuesTypeData.Message_Allitems(), log_Reports); //TYPE_DATAフィールドに設定できる値のリスト

                Configurationtree_Node cf = new Configurationtree_NodeImpl("データ部" + err_NRow + "行", xenonTable_Aafilescsv.Parent);
                tmpl.SetParameter(4, Log_RecordReportsImpl.ToText_Configuration(cf), log_Reports);//設定位置パンくずリスト

                this.Owner_MemoryApplication.CreateErrorReport("Er:110011;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
示例#37
0
        //────────────────────────────────────────
        /// <summary>
        /// 
        /// </summary>
        /// <param name="out_sFieldListList"></param>
        /// <param name="out_O_NewFldDefList"></param>
        /// <param name="src_sNewFieldNameList"></param>
        /// <param name="e_Where"></param>
        /// <param name="tableH_Source"></param>
        /// <param name="log_Reports"></param>
        public static void SelectFieldListList(
            out List<List<string>> listList_SField_Out,
            out RecordFielddefinition out_RecordFielddefinition_New,
            EnumLogic enumWhereLogic,
            List<string> list_SName_NewField_Src,
            List<Recordcondition> list_Reccond,
            Table_Humaninput tableH_Source,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();
            log_Method.BeginMethod(Info_Table.Name_Library, "Util_Table", "SelectFieldListList",log_Reports);

            //

            RecordFielddefinition recordFielddefinition_New = new RecordFielddefinitionImpl();
            List<int> list_indexField = new List<int>();

            //
            // 新しい、列定義リストを作成します。
            //
            {
                // 最初の列は「NO」とします。
                list_SName_NewField_Src.Insert(0, Utility_Table.S_FIELD_NO);

                //fieldIndex
                int nFIx = 0;
                tableH_Source.RecordFielddefinition.ForEach(delegate(Fielddefinition fielddefinition, ref bool isBreak, Log_Reports log_Reports2)
                {
                    if (list_SName_NewField_Src.Contains(fielddefinition.Name_Humaninput))
                    {
                        // 選出されたフィールドだけでリストを作ります。
                        recordFielddefinition_New.Add(fielddefinition);
                        list_indexField.Add(nFIx);
                    }

                    nFIx++;
                }, log_Reports);
            }

            //
            // テーブルに列定義を設定した後で。
            // 移し替えたいデータ値の配列を作ります。
            listList_SField_Out = new List<List<string>>();
            //
            {
                int nEndover = list_indexField.Count;
                foreach (DataRow srcRow in tableH_Source.DataTable.Rows)
                {
                    List<string> sList_NewField = new List<string>();

                    //
                    // 「E■@where」属性を解析します。
                    //
                    // 該当しないレコードは除去していきます。
                    //
                    // 「E■@where」に logic属性が無い場合は logic="and" とします。
                    if (EnumLogic.None == enumWhereLogic)
                    {
                        enumWhereLogic = EnumLogic.And;
                    }
                    bool bHit = Utility_Table.ApplyReccond(srcRow, tableH_Source, enumWhereLogic, list_Reccond, 0, log_Reports);
                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.SelectFieldListList: (結果) [" + bHit + "]");

                    if (bHit)
                    {
                        for (int nA = 0; nA < nEndover; nA++)
                        {
                            // TODO:指定のフィールド・インデックスだけをピックアップしたい。
                            int nB = list_indexField[nA];
                            Value_Humaninput o_Value = (Value_Humaninput)srcRow[nB];

                            sList_NewField.Add(o_Value.Text);
                        }

                        listList_SField_Out.Add(sList_NewField);
                    }
                    //hit

                }

            }

            goto gt_EndMethod;

            //
            //
            //
            //
            gt_EndMethod:
            out_RecordFielddefinition_New = recordFielddefinition_New;
            log_Method.EndMethod(log_Reports);
        }
示例#38
0
        //────────────────────────────────────────

        /// <summary>
        /// 一覧系のテーブルの行を読み取り、テーブルを読み取る要求を作成します。
        /// </summary>
        /// <param name="dataRow"></param>
        /// <param name="o_IndexTable"></param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        private Request_ReadsTable CreateReadRequest(
            DataRow dataRow,
            Table_Humaninput o_Table_Aafiles,
            Log_Reports log_Reports
            )
        {
            //
            //
            //
            //()メソッド開始
            //
            //
            //
            Log_Method log_Method = new Log_MethodImpl(1);

            log_Method.BeginMethod(Info_Functions.Name_Library, this, "CreateReadRequest", log_Reports);


            //
            //

            Request_ReadsTable forTable_request = new Request_ReadsTableImpl();

            //
            // 「インデックス_テーブル」の絶対ファイルパス
            Expression_Node_Filepath ec_Fpath_Aafilescsv = o_Table_Aafiles.Expression_Filepath_ConfigStack;
            string sFpatha_Aafilescsv = ec_Fpath_Aafilescsv.Execute4_OnExpressionString(
                EnumHitcount.Unconstraint, log_Reports);

            //if (log_Method.CanDebug(1))
            //{
            //    log_Method.WriteDebug_ToConsole("「Aa_Files.csv」のファイルパス=[" + sFpatha_Aafilescsv + "]");
            //}

            if (!log_Reports.Successful)
            {
                // 既エラー。
                goto gt_EndMethod;
            }


            //
            // テーブル名
            {
                string sName_Field = NamesFld.S_NAME;
                string sTableName;
                if (String_HumaninputImpl.TryParse(
                        dataRow[sName_Field],
                        out sTableName,
                        o_Table_Aafiles.Name,
                        sName_Field,
                        log_Method,
                        log_Reports))
                {
                }

                if (!log_Reports.Successful)
                {
                    // エラー
                    goto gt_EndMethod;
                }


                forTable_request.Name_PutToTable = sTableName;
            }

            //
            // フォーム名
            {
                string sName_Field = NamesFld.S_NAME_FORM;
                string sTableUnit;
                if (dataRow.Table.Columns.Contains(sName_Field))
                {
                    bool bBool = String_HumaninputImpl.TryParse(
                        dataRow[sName_Field],
                        out sTableUnit,
                        o_Table_Aafiles.Name,
                        sName_Field,
                        log_Method,
                        log_Reports);

                    if (bBool)
                    {
                    }

                    if (!log_Reports.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }
                }
                else
                {
                    sTableUnit = "";
                }
                forTable_request.Tableunit = sTableUnit;
            }

            //
            // データ・タイプです。
            {
                string sName_Field = NamesFld.S_TYPE_DATA;
                string sValue;
                if (dataRow.Table.Columns.Contains(sName_Field))
                {
                    if (String_HumaninputImpl.TryParse(
                            dataRow[sName_Field],
                            out sValue,
                            o_Table_Aafiles.Name,
                            sName_Field,
                            log_Method,
                            log_Reports))
                    {
                    }

                    if (!log_Reports.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }
                }
                else
                {
                    sValue = "";
                }
                forTable_request.Typedata = sValue;
            }

            //
            // テーブルのファイルパス
            //
            Expression_Node_Filepath ec_Fpath;

            {
                this.Read_Folder_File(
                    out ec_Fpath,
                    forTable_request.Name_PutToTable,
                    sFpatha_Aafilescsv,
                    dataRow,
                    o_Table_Aafiles,
                    log_Reports
                    );

                if (log_Reports.Successful)
                {
                    forTable_request.Expression_Filepath = ec_Fpath;
                }
            }

            //
            // ファイルパスを変数にセット
            //
            {
                string sName_Field = NamesFld.S_SET_VAR_PATH;
                string sNamevar;
                if (dataRow.Table.Columns.Contains(sName_Field))
                {
                    if (String_HumaninputImpl.TryParse(
                            dataRow[sName_Field],
                            out sNamevar,
                            o_Table_Aafiles.Name,
                            sName_Field,
                            log_Method,
                            log_Reports))
                    {
                    }

                    if (!log_Reports.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }
                }
                else
                {
                    sNamevar = "";
                }

                if ("" != sNamevar && null != ec_Fpath)
                {
                    // 指定があれば、ファイルパスを変数にセット。
                    this.Owner_MemoryApplication.MemoryVariables.SetFilepathValue(
                        sNamevar, ec_Fpath, false, log_Reports);
                }
            }

            //
            // 「日別バックアップ」するなら真。
            //
            {
                string sName_Field = NamesFld.S_DATE_BACKUP;
                bool   bDateBackup;
                if (dataRow.Table.Columns.Contains(sName_Field))
                {
                    bool bParsedSuccessful = Bool_HumaninputImpl.TryParse(
                        dataRow[sName_Field],
                        out bDateBackup,
                        EnumOperationIfErrorvalue.Spaces_To_Alt_Value,
                        false,
                        log_Reports
                        );

                    if (!log_Reports.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }

                    if (bParsedSuccessful)
                    {
                    }
                }
                else
                {
                    bDateBackup = false;
                }

                forTable_request.IsDatebackupActivated = bDateBackup;
            }

            //
            // 用途。/「」指定なし。/「WriteOnly」データの読取を行わない。ログ出力先を登録しているだけなど。
            //
            {
                string sName_Field = NamesFld.S_USE;
                string sField;
                if (dataRow.Table.Columns.Contains(sName_Field))
                {
                    bool bParsedSuccessful = String_HumaninputImpl.TryParse(
                        dataRow[sName_Field],
                        out sField,
                        o_Table_Aafiles.Name,
                        sName_Field,
                        log_Method,
                        log_Reports
                        );

                    if (!log_Reports.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }

                    if (bParsedSuccessful)
                    {
                    }
                }
                else
                {
                    sField = "";//指定なし。
                }

                forTable_request.Use = sField;
            }

            goto gt_EndMethod;
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(forTable_request);
        }
示例#39
0
 public void RemoveFrom(Table_Humaninput tableH)
 {
     tableH.DataTable.Rows.Remove(this.DataRow);
 }
示例#40
0
        //────────────────────────────────────────

        /// <summary>
        /// Aa_Files.xmlの「FOLDER」「FILE」列を読取ります。
        /// </summary>
        /// <param name="ec_Fpath"></param>
        /// <param name="sTableNameToPuts"></param>
        /// <param name="sFpatha_Aafiles"></param>
        /// <param name="dataRow"></param>
        /// <param name="o_IndexTable"></param>
        /// <param name="log_Reports"></param>
        private void Read_Folder_File(
            out Expression_Node_Filepath ec_Fpath,
            string sTableNameToPuts,
            string sFpatha_Aafiles,
            DataRow dataRow,
            Table_Humaninput o_IndexTable,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);

            log_Method.BeginMethod(Info_Functions.Name_Library, this, "Read_Folder_File", log_Reports);


            string sFpath;   //バックアップ用に使い回す文字列。

            ec_Fpath = null; //セットパス用に使い回す。

            {
                //
                // フォルダー変数の指定の有無
                //
                string sNamevarFolder;
                {
                    string sFieldName2 = NamesFld.S_FOLDER;
                    if (String_HumaninputImpl.TryParse(
                            dataRow[sFieldName2],
                            out sNamevarFolder,
                            o_IndexTable.Name,
                            sFieldName2,
                            log_Method,
                            log_Reports))
                    {
                        // 正常、スルー。
                    }
                    else
                    {
                        sNamevarFolder = "";
                    }
                }


                // テーブルのファイルのパスを取得
                string sName_Field = NamesFld.S_FILE;
                if (String_HumaninputImpl.TryParse(
                        dataRow[sName_Field],
                        out sFpath,
                        o_IndexTable.Name,
                        sName_Field,
                        log_Method,
                        log_Reports))
                {
                    if ("" != sNamevarFolder.Trim())
                    {
                        // FOLDER列に、変数名が指定されているとき。

                        Expression_Node_String ec_Namevar_Folder = new Expression_Leaf_StringImpl(sNamevarFolder.Trim(), null, new Configurationtree_NodeImpl(o_IndexTable.Name, null));//todo:

                        log_Reports.Log_Callstack.Push(log_Method, "③");
                        Expression_Node_Filepath ec_Fopath = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(
                            ec_Namevar_Folder, true, log_Reports);
                        log_Reports.Log_Callstack.Pop(log_Method, "③");

                        if (null == ec_Fopath)
                        {
                            goto gt_Error_NullFolder;
                        }

                        //if (log_Method.CanDebug(1))
                        //{
                        //    log_Method.WriteDebug_ToConsole(".csvのFOLDER列に[" + sNamevarFolder + "]と指定されていました。");
                        //}

                        log_Reports.Log_Callstack.Push(log_Method, "⑧");
                        //bug:フォルダーパスだと Execute4_OnExpressionString は空白を返す??
                        string sFopath2 = ec_Fopath.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                        if ("" == sFopath2)
                        {
                            //bug:フォルダーパスだと Execute4_OnExpressionString は空白を返すようなので、入力値をそのまま返すことにした。
                            sFopath2 = ec_Fopath.Humaninput.Trim();
                        }
                        log_Reports.Log_Callstack.Pop(log_Method, "⑧");

                        //if (log_Method.CanDebug(1))
                        //{
                        //    log_Method.WriteDebug_ToConsole("[" + sNamevarFolder + "]変数の内容は["+sFopath2+"]");
                        //    //this.Owner_MemoryApplication.MemoryVariables.WriteDebug_ToConsole();
                        //}


                        // 「フォルダー」 + 「¥」 + 「相対パス」
                        sFpath = sFopath2 + System.IO.Path.DirectorySeparatorChar + sFpath;
                    }
                }

                //
                // ファイルパス
                //
                Configurationtree_NodeFilepath cf_Fpath1;
                {
                    StringBuilder s = new StringBuilder();
                    s.Append("L11_1[");
                    s.Append(NamesFile.S_AA_FILES_CSV);
                    s.Append("ファイルの");
                    s.Append(sTableNameToPuts);
                    s.Append("指定=");
                    s.Append(sFpath);
                    s.Append("]");
                    cf_Fpath1 = new Configurationtree_NodeFilepathImpl(s.ToString(), null);
                    //cf_Fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L11_1", new Configurationtree_NodeImpl(s.ToString(), null));
                }

                cf_Fpath1.InitPath(sFpath, log_Reports);

                if (!log_Reports.Successful)
                {
                    // エラー
                    goto gt_EndMethod;
                }

                ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath1);
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_NullFolder:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration), log_Reports);//設定位置パンくずリスト

                this.Owner_MemoryApplication.CreateErrorReport("Er:110009;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
示例#41
0
 //────────────────────────────────────────
 public void AddTo(Table_Humaninput tableH)
 {
     tableH.DataTable.Rows.Add(this.DataRow);
 }
示例#42
0
        //────────────────────────────────────────

        /// <summary>
        /// ファイルからテーブルを読み取り、モデルに内容を挿入します。
        /// </summary>
        /// <param name="moMre"></param>
        /// <param name="log_Reports"></param>
        public override string Execute5_Main(Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);

            log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute5_Main", log_Reports);

            string sFncName;

            this.TrySelectAttribute(out sFncName, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports);

            if (log_Reports.CanStopwatch)
            {
                log_Method.Log_Stopwatch.Message = "Nアクション[" + sFncName + "]実行";
                log_Method.Log_Stopwatch.Begin();
            }
            //
            //

            if (this.EnumEventhandler == EnumEventhandler.O_Lr)
            {
                //
                //
                //
                //()タスク・デスクリプション
                //
                //
                //
                if (this.Functionparameterset.Sender is Customcontrol)
                {
                    Customcontrol fcCc = (Customcontrol)this.Functionparameterset.Sender;

                    string sName_Usercontrol = fcCc.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(
                        EnumHitcount.Unconstraint,
                        log_Reports
                        );

                    log_Reports.Comment_EventCreationMe += "/追記:[" + sName_Usercontrol + "]コントロールが、[" + sFncName + "]アクションを実行。";
                }
                else
                {
                    log_Reports.Comment_EventCreationMe += "/追記:[" + sFncName + "]アクションを実行。";
                }

                //
                //
                //
                //

                //
                // 「バックアップ対象のファイルのパス一覧」の変数準備。
                //
                this.List_Expression_Filepath_BackupRequest_Out = new List <Expression_Node_Filepath>();


                //
                //
                //
                //「Aa_Files.csv」
                //
                //
                //
                string name_Table = this.GetSNameTableAafilescsv();
                if ("" == name_Table)
                {
                    goto gt_Error_EmptynameTable;
                }


                //
                //
                //
                //()テーブル読取り。
                //
                //
                //
                Table_Humaninput xenonTable_Aafilescsv;
                if (log_Reports.Successful)
                {
                    xenonTable_Aafilescsv = this.Read_AaFilesCsv(log_Reports);
                }
                else
                {
                    xenonTable_Aafilescsv = null;
                }


                //
                //
                //
                // 「Aa_Files.csv」を、アプリケーションにそのまま追加。
                //
                //
                //
                if (log_Reports.Successful)
                {
                    this.Owner_MemoryApplication.MemoryTables.AddTable_Humaninput(xenonTable_Aafilescsv, log_Reports);
                }


                //
                // 「Aa_Files.csvに書かれているテーブルと、スクリプトファイル」を読取り、登録。
                if (log_Reports.Successful)
                {
                    // 正常時

                    this.ReadAndRegisterFiles(xenonTable_Aafilescsv, log_Reports);
                }


                //
                // 日別バックアップ用の準備
                //
                if (log_Reports.Successful)
                {
                    // 正常時
                    this.RegisterDateBackup(log_Reports);
                }



                //
                // TODO:「フォーム一覧テーブル」を更に読取に行く。
                //
                if (this.Owner_MemoryApplication.MemoryTables.Dictionary_Table_Humaninput.ContainsKey(NamesVar.S_ST_AA_FORMS))
                {
                    //
                    // 「フォーム一覧テーブル」
                    Table_Humaninput o_Table_Aaformscsv = this.Owner_MemoryApplication.MemoryTables.Dictionary_Table_Humaninput[NamesVar.S_ST_AA_FORMS];

                    //
                    // 「テーブルに書かれているテーブル」を読取り、登録。
                    if (log_Reports.Successful)
                    {
                        // 正常時

                        this.ReadAndRegisterFiles(o_Table_Aaformscsv, log_Reports);
                    }
                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_EmptynameTable:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, PmNames.S_NAME_TABLE.Name_Pm, log_Reports);                                       //引数名
                tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration), log_Reports); //設定位置パンくずリスト

                this.Owner_MemoryApplication.CreateErrorReport("Er:110008;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return("");
        }
        //────────────────────────────────────────
        public string ToCsvText(
            Table_Humaninput tableH,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            log_Method.BeginMethod(Info_Table.Name_Library, this, "ToCsvText",log_Reports);

            Log_TextIndented result = new Log_TextIndentedImpl();

            RecordFielddefinition error_RecordFielddefinition;
            Exception err_Excep;
            int error_IndexColumn;
            Fielddefinition error_Fielddefinition;
            object error_Item;

            if (null == tableH)
            {
                // エラー
                goto gt_Error_NullTable;
            }

            CsvLineParserImpl csvParser = new CsvLineParserImpl();

            // フィールド名をカンマ区切りで出力します。最後にENDを付加します。

            // フィールド定義部
            if (tableH.RecordFielddefinition.Count < 1)
            {
                //エラー。
                error_RecordFielddefinition = tableH.RecordFielddefinition;
                goto gt_Error_FieldZero;
            }

            // フィールド定義部:名前
            tableH.RecordFielddefinition.ForEach(delegate(Fielddefinition fielddefinition, ref bool isBreak, Log_Reports log_Reports2)
            {
                if (this.ExceptedFields.TryExceptedField(fielddefinition.Name_Trimupper))
                {
                    // 出力しないフィールドの場合、無視します。
                }
                else
                {
                    result.Append(csvParser.EscapeCell(fielddefinition.Name_Humaninput));
                    result.Append(",");
                }
            }, log_Reports);
            result.Append(ToCsv_Table_Humaninput_RowColRegularImpl.S_END);
            result.Append(Environment.NewLine);//改行

            // フィールド定義部:型
            tableH.RecordFielddefinition.ForEach(delegate(Fielddefinition fielddefinition, ref bool isBreak, Log_Reports log_Reports2)
            {
                if (this.ExceptedFields.TryExceptedField(fielddefinition.Name_Trimupper))
                {
                    // 出力しないフィールドの場合、無視します。
                }
                else
                {
                    switch(fielddefinition.Type_Field)
                    {
                        case EnumTypeFielddefinition.String:
                            {
                                result.Append(FielddefinitionImpl.S_STRING);
                            }
                            break;
                        case EnumTypeFielddefinition.Int:
                            {
                                result.Append(FielddefinitionImpl.S_INT);
                            }
                            break;
                        case EnumTypeFielddefinition.Bool:
                            {
                                result.Append(FielddefinitionImpl.S_BOOL);
                            }
                            break;
                        default:
                            {
                                // TODO エラー対応。

                                // 未定義の型があった場合、そのまま出力します。
                                // C#のメッセージになるかと思います。
                                result.Append(fielddefinition.ToString_Type());
                            }
                            break;
                    }

                    result.Append(",");
                }
            }, log_Reports);
            result.Append(ToCsv_Table_Humaninput_RowColRegularImpl.S_END);
            result.Append(Environment.NewLine);//改行

            // フィールド定義部:コメント
            tableH.RecordFielddefinition.ForEach(delegate(Fielddefinition fielddefinition, ref bool isBreak, Log_Reports log_Reports2)
            {
                if (this.ExceptedFields.TryExceptedField(fielddefinition.Name_Trimupper))
                {
                    // 出力しないフィールドの場合、無視します。
                }
                else
                {
                    result.Append(csvParser.EscapeCell(fielddefinition.Comment));
                    result.Append(",");
                }
            }, log_Reports);
            result.Append(ToCsv_Table_Humaninput_RowColRegularImpl.S_END);
            result.Append(Environment.NewLine);//改行

            // 0行目から数えて3行目以降はデータ・テーブル部。

            // データ・テーブル部
            DataTable dataTable = tableH.DataTable;

            // 各行について
            for (int nRowIndex = 0; nRowIndex < dataTable.Rows.Count; nRowIndex++)
            {
                DataRow dataRow = dataTable.Rows[nRowIndex];

                //
                // 各フィールドについて
                //
                object[] itemArray = dataRow.ItemArray;// ItemArrayは1回の呼び出しが重い。
                for (int indexColumn = 0; indexColumn < itemArray.Length; indexColumn++)
                {

                    // TODO:範囲 リストサイズが0の時がある←プログラムミス?
                    Fielddefinition fielddefinition;
                    try
                    {
                        fielddefinition = tableH.RecordFielddefinition.ValueAt(indexColumn);
                    }
                    catch (Exception e)
                    {
                        // エラー。
                        err_Excep = e;
                        error_RecordFielddefinition = tableH.RecordFielddefinition;
                        error_IndexColumn = indexColumn;
                        goto gt_Error_OutOfIndex;
                    }

                    if (this.ExceptedFields.TryExceptedField(fielddefinition.Name_Trimupper))
                    {
                        // 出力しないフィールドの場合、無視します。
                    }
                    else
                    {
                        string value_Cell;
                        object item = itemArray[indexColumn];

                        if (item is Value_Humaninput)
                        {
                            value_Cell = ((Value_Humaninput)item).Text;
                        }
                        else if (item is string)
                        {
                            //フィールド定義部など。
                            value_Cell = (string)item;
                        }
                        else if (item is DBNull)
                        {
                            //空欄。
                            value_Cell = "";
                        }
                        else
                        {
                            // エラー
                            error_Item = item;
                            error_Fielddefinition = fielddefinition;
                            goto gt_Error_UndefinedFieldType;
                        }

                        result.Append(csvParser.EscapeCell(value_Cell));
                        result.Append(this.charSeparator);
                    }
                }
                result.Append(ToCsv_Table_Humaninput_RowColRegularImpl.S_END);
                result.Append(Environment.NewLine);//改行
            }
            result.Append(ToCsv_Table_Humaninput_RowColRegularImpl.S_EOF);
            // 最後に一応、改行を付けておきます。
            result.Append(Environment.NewLine);//改行

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_FieldZero:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー854!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.Append("(プログラム内部エラー)テーブルの列定義が0件です。 error_RecordFielddefinition.Count[");
                s.Append(error_RecordFielddefinition.Count);
                s.Append("] テーブル名=[");
                s.Append(tableH.Name);
                s.Append("]");
                s.Newline();

                // ヒント

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_OutOfIndex:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー853!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.Append("(プログラム内部エラー)err_NColIndex=[");
                s.Append(error_IndexColumn);
                s.Append("] error_RecordFielddefinition.Count[");
                s.Append(error_RecordFielddefinition.Count);
                s.Append("]");
                s.Newline();

                // ヒント
                s.Append(r.Message_SException(err_Excep));

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_UndefinedFieldType:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー855!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.Append("(プログラム内部エラー)CSVを出力しようとしたとき、未定義のフィールド型=[");
                s.Append(error_Fielddefinition.ToString_Type());
                s.Append("]がありました。");
                s.Newline();

                s.Append("型名=[");
                s.Append(error_Item.GetType().Name);
                s.Append("]");
                s.Newline();

                s.Append("型は[");
                s.Append(typeof(String_HumaninputImpl));
                s.Append("],[");
                s.Append(typeof(Int_HumaninputImpl));
                s.Append("],[");
                s.Append(typeof(Bool_HumaninputImpl));
                s.Append("]が使えます。");
                s.Newline();

                // ヒント

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_NullTable:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー852!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.Append("(プログラム内部エラー)tableがヌルでした。");
                s.Newline();

                // ヒント

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return result.ToString();
        }
示例#44
0
        //────────────────────────────────────────
        #endregion



        #region アクション
        //────────────────────────────────────────

        public string ToCsvText(
            Table_Humaninput xTable,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);

            log_Method.BeginMethod(Info_Table.Name_Library, this, "ToCsvText", log_Reports);

            Log_TextIndented result = new Log_TextIndentedImpl();

            RecordFielddef error_RecordFielddef;
            Exception      err_Excep;
            int            error_IndexColumn;
            Fielddef       error_Fielddef;
            object         error_Item;

            if (null == xTable)
            {
                // エラー
                goto gt_Error_NullTable;
            }

            CsvLineParserImpl csvParser = new CsvLineParserImpl();

            // フィールド名をカンマ区切りで出力します。最後にEOLを付加します。

            // フィールド定義部
            if (xTable.RecordFielddef.Count < 1)
            {
                //エラー。
                error_RecordFielddef = xTable.RecordFielddef;
                goto gt_Error_FieldZero;
            }


            // フィールド定義部:名前
            xTable.RecordFielddef.ForEach(delegate(Fielddef fielddefinition, ref bool isBreak, Log_Reports log_Reports2)
            {
                if (this.ExceptedFields.TryExceptedField(fielddefinition.Name_Trimupper))
                {
                    // 出力しないフィールドの場合、無視します。
                }
                else
                {
                    result.Append(CsvLineParserImpl.EscapeCell(fielddefinition.Name_Humaninput));
                    result.Append(",");
                }
            }, log_Reports);
            result.Append(
                ToCsv_Table_RowColRegularImpl_.S_EOL //ToCsv_Table_Humaninput_RowColRegularImpl.S_END
                );
            result.Append(Environment.NewLine);      //改行

            // フィールド定義部:型
            xTable.RecordFielddef.ForEach(delegate(Fielddef fielddefinition, ref bool isBreak, Log_Reports log_Reports2)
            {
                if (this.ExceptedFields.TryExceptedField(fielddefinition.Name_Trimupper))
                {
                    // 出力しないフィールドの場合、無視します。
                }
                else
                {
                    switch (fielddefinition.Type_Field)
                    {
                    case EnumTypeFielddef.String:
                        {
                            result.Append(FielddefImpl.S_STRING);
                        }
                        break;

                    case EnumTypeFielddef.Int:
                        {
                            result.Append(FielddefImpl.S_INT);
                        }
                        break;

                    case EnumTypeFielddef.Bool:
                        {
                            result.Append(FielddefImpl.S_BOOL);
                        }
                        break;

                    default:
                        {
                            // TODO エラー対応。

                            // 未定義の型があった場合、そのまま出力します。
                            // C#のメッセージになるかと思います。
                            result.Append(fielddefinition.ToString_Type());
                        }
                        break;
                    }

                    result.Append(",");
                }
            }, log_Reports);
            result.Append(
                ToCsv_Table_RowColRegularImpl_.S_EOL
                //ToCsv_Table_Humaninput_RowColRegularImpl.S_END
                );
            result.Append(Environment.NewLine);//改行

            // フィールド定義部:コメント
            xTable.RecordFielddef.ForEach(delegate(Fielddef fielddefinition, ref bool isBreak, Log_Reports log_Reports2)
            {
                if (this.ExceptedFields.TryExceptedField(fielddefinition.Name_Trimupper))
                {
                    // 出力しないフィールドの場合、無視します。
                }
                else
                {
                    result.Append(CsvLineParserImpl.EscapeCell(fielddefinition.Comment));
                    result.Append(",");
                }
            }, log_Reports);
            result.Append(
                ToCsv_Table_RowColRegularImpl_.S_EOL
                //ToCsv_Table_Humaninput_RowColRegularImpl.S_END
                );
            result.Append(Environment.NewLine);//改行

            // 0行目から数えて3行目以降はデータ・テーブル部。

            // データ・テーブル部
            DataTable dataTable = xTable.DataTable;

            // 各行について
            for (int nRowIndex = 0; nRowIndex < dataTable.Rows.Count; nRowIndex++)
            {
                DataRow dataRow = dataTable.Rows[nRowIndex];

                //
                // 各フィールドについて
                //
                object[] itemArray = dataRow.ItemArray;// ItemArrayは1回の呼び出しが重い。
                for (int indexColumn = 0; indexColumn < itemArray.Length; indexColumn++)
                {
                    // TODO:範囲 リストサイズが0の時がある←プログラムミス?
                    Fielddef fielddefinition;
                    try
                    {
                        fielddefinition = xTable.RecordFielddef.ValueAt(indexColumn);
                    }
                    catch (Exception e)
                    {
                        // エラー。
                        err_Excep            = e;
                        error_RecordFielddef = xTable.RecordFielddef;
                        error_IndexColumn    = indexColumn;
                        goto gt_Error_OutOfIndex;
                    }

                    if (this.ExceptedFields.TryExceptedField(fielddefinition.Name_Trimupper))
                    {
                        // 出力しないフィールドの場合、無視します。
                    }
                    else
                    {
                        string value_Cell;
                        object item = itemArray[indexColumn];

                        if (item is Cell)
                        {
                            value_Cell = ((Cell)item).Text;
                        }
                        else if (item is string)
                        {
                            //フィールド定義部など。
                            value_Cell = (string)item;
                        }
                        else if (item is DBNull)
                        {
                            //空欄。
                            value_Cell = "";
                        }
                        else
                        {
                            // エラー
                            error_Item     = item;
                            error_Fielddef = fielddefinition;
                            goto gt_Error_UndefinedFieldType;
                        }

                        result.Append(CsvLineParserImpl.EscapeCell(value_Cell));
                        result.Append(this.charSeparator);
                    }
                }
                result.Append(
                    ToCsv_Table_RowColRegularImpl_.S_EOL
                    //ToCsv_Table_Humaninput_RowColRegularImpl.S_END
                    );
                result.Append(Environment.NewLine);//改行
            }
            result.Append(ToCsv_Table_RowColRegularImpl_.S_EOF);
            // 最後に一応、改行を付けておきます。
            result.Append(Environment.NewLine);//改行

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_FieldZero:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー854!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.Append("(プログラム内部エラー)テーブルの列定義が0件です。 error_RecordFielddef.Count[");
                s.Append(error_RecordFielddef.Count);
                s.Append("] テーブル名=[");
                s.Append(xTable.Name);
                s.Append("]");
                s.Newline();

                // ヒント

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_OutOfIndex:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー853!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.Append("(プログラム内部エラー)err_NColIndex=[");
                s.Append(error_IndexColumn);
                s.Append("] error_RecordFielddef.Count[");
                s.Append(error_RecordFielddef.Count);
                s.Append("]");
                s.Newline();

                // ヒント
                s.Append(r.Message_SException(err_Excep));

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_UndefinedFieldType:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー855!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.Append("(プログラム内部エラー)CSVを出力しようとしたとき、未定義のフィールド型=[");
                s.Append(error_Fielddef.ToString_Type());
                s.Append("]がありました。");
                s.Newline();

                s.Append("型名=[");
                s.Append(error_Item.GetType().Name);
                s.Append("]");
                s.Newline();

                s.Append("型は[");
                s.Append(typeof(StringCellImpl));
                s.Append("],[");
                s.Append(typeof(IntCellImpl));
                s.Append("],[");
                s.Append(typeof(BoolCellImpl));
                s.Append("]が使えます。");
                s.Newline();

                // ヒント

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_NullTable:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー852!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.Append("(プログラム内部エラー)tableがヌルでした。");
                s.Newline();

                // ヒント

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(result.ToString());
        }
示例#45
0
        //────────────────────────────────────────
        #endregion



        #region アクション
        //────────────────────────────────────────

        /// <summary>
        /// スタイルシート設定ファイルを読み込んでおきます。
        /// </summary>
        /// <param name="moMre"></param>
        /// <param name="log_Reports"></param>
        public override string Execute5_Main(Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);

            log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute5_Main", log_Reports);

            string sFncName0;

            this.TrySelectAttribute(out sFncName0, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports);

            if (log_Reports.CanStopwatch)
            {
                log_Method.Log_Stopwatch.Message = "Nアクション[" + sFncName0 + "]実行";
                log_Method.Log_Stopwatch.Begin();
            }
            //
            //

            if (this.EnumEventhandler == EnumEventhandler.O_Lr)
            {
                if (this.Functionparameterset.Sender is Customcontrol)
                {
                    Customcontrol fcCc = (Customcontrol)this.Functionparameterset.Sender;

                    string sName_Usercontrol = fcCc.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);

                    log_Reports.Comment_EventCreationMe += "/追記:[" + sName_Usercontrol + "]コントロールが、[" + sFncName0 + "]アクションを実行。";
                }
                else
                {
                    log_Reports.Comment_EventCreationMe += "/追記:[" + sFncName0 + "]アクションを実行。";
                }

                //
                //
                //
                //
                string sStartupPath = Application.StartupPath;

                if (log_Reports.Successful)
                {
                    // 正常時

                    Expression_Node_String ec_ArgTableNameStylesheet;
                    this.TrySelectAttribute(out ec_ArgTableNameStylesheet, Expression_Node_Function19Impl.PM_NAME_TABLE_STYLESHEET, EnumHitcount.One_Or_Zero, log_Reports);

                    // スタイルシート・テーブル
                    Table_Humaninput o_Table_Stylesheet = this.Owner_MemoryApplication.MemoryTables.GetTable_HumaninputByName(
                        ec_ArgTableNameStylesheet,
                        true,
                        log_Reports
                        );

                    this.Owner_MemoryApplication.MemoryStyles.Clear(o_Table_Stylesheet, log_Reports);
                }
                else
                {
                    // 異常時

                    this.Owner_MemoryApplication.MemoryStyles.Clear(log_Reports);
                }
            }

            //
            //
            log_Method.EndMethod(log_Reports);
            return("");
        }
示例#46
0
        //────────────────────────────────────────
        /// <summary>
        /// 「変数設定ファイル」のテーブルを読み取り、変数を登録します。
        /// </summary>
        /// <param oVariableName="varOTable"></param>
        /// <param oVariableName="log_Reports"></param>
        public void Load(
            Table_Humaninput o_Table_Var,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(1, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "Load",log_Reports);
            //

            if (log_Method.CanDebug(1))
            {
                log_Method.WriteDebug_ToConsole("「変数登録ファイル」を Load します。");
            }

            //
            //
            //
            //

            if (null == o_Table_Var)
            {
                goto gt_Error_NullTable;
            }

            if (null != this.parent_Variablesconfig_Configurationtree)
            {
                goto gt_Error_DoubleLoad;
            }

            string err_SFolder;
            string err_SName;
            if (log_Reports.Successful)
            {
                this.parent_Variablesconfig_Configurationtree = new Configurationtree_NodeImpl(NamesNode.S_VARIABLE_CONFIG, o_Table_Var.Expression_Filepath_ConfigStack.Cur_Configuration);
                if (!log_Reports.Successful)
                {
                    // 既エラー。
                    goto gt_EndMethod;
                }

                foreach (DataRow dataRow in o_Table_Var.DataTable.Rows)
                {
                    string sStringValue;// = "";

                    // ソース情報として使うだけ。
                    Configurationtree_Node cf_VarRecord1 = new Configurationtree_NodeImpl(NamesNode.S_VARIABLE_RECORD, parent_Variablesconfig_Configurationtree);

                    // 注意: dataRow[]の連想配列は大文字・小文字を区別しないのが欠点。

                    //NAME列
                    {
                        string sFldName = NamesFld.S_NAME;//フィールド名。
                        if (o_Table_Var.ContainsField(sFldName,true,log_Reports))
                        {
                            if (String_HumaninputImpl.TryParse(
                                dataRow[sFldName],
                                out sStringValue,
                                o_Table_Var.Name,
                                sFldName,
                                log_Method,
                                log_Reports))
                            {
                            }
                            else
                            {
                                sStringValue = "";
                            }

                            if (!log_Reports.Successful)
                            {
                                // エラー
                                goto gt_EndMethod;
                            }

                            cf_VarRecord1.Dictionary_Attribute.Set(PmNames.S_NAME.Name_Pm, sStringValue, log_Reports);
                        }
                    }

                    // FOLDER列 (オプション)
                    {
                        string sFldName = NamesFld.S_FOLDER;
                        if (o_Table_Var.ContainsField(sFldName, false, log_Reports))
                        {
                            if (String_HumaninputImpl.TryParse(
                                dataRow[sFldName],
                                out sStringValue,
                                o_Table_Var.Name,
                                sFldName,
                                log_Method,
                                log_Reports))
                            {
                            }
                            else
                            {
                                sStringValue = "";
                            }

                            if (!log_Reports.Successful)
                            {
                                // エラー
                                goto gt_EndMethod;
                            }

                            //if (log_Method.CanDebug(1))
                            //{
                            //    log_Method.WriteDebug_ToConsole("「変数登録ファイル」FOLDER列=[" + sStringValue + "]");
                            //}
                            cf_VarRecord1.Dictionary_Attribute.Set(PmNames.S_FOLDER.Name_Pm, sStringValue, log_Reports);
                        }
                        else
                        {
                            //なければ無視。
                        }
                    }

                    // VALUE列
                    {
                        string sFldName = NamesFld.S_VALUE;//フィールド名。
                        if (o_Table_Var.ContainsField(sFldName, true, log_Reports))
                        {
                            if (String_HumaninputImpl.TryParse(
                                dataRow[sFldName],
                                out sStringValue,
                                o_Table_Var.Name,
                                sFldName,
                                log_Method,
                                log_Reports))
                            {
                            }
                            else
                            {
                                sStringValue = "";
                            }

                            if (!log_Reports.Successful)
                            {
                                // エラー
                                goto gt_EndMethod;
                            }

                            cf_VarRecord1.Dictionary_Attribute.Set(PmNames.S_VALUE.Name_Pm, sStringValue, log_Reports);
                        }
                    }

                    //
                    // 変数を登録。
                    //
                    if (log_Reports.Successful)
                    {
                        //NAME列
                        string sName;
                        cf_VarRecord1.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName, true, log_Reports);

                        //FOLDER列 (オプション)
                        string sFolder;
                        bool bExistsFolder = cf_VarRecord1.Dictionary_Attribute.TryGetValue(PmNames.S_FOLDER, out sFolder, false, log_Reports);

                        string sValue;
                        cf_VarRecord1.Dictionary_Attribute.TryGetValue(PmNames.S_VALUE, out sValue,
                            false, //空文字列でも可。
                            log_Reports);

                        if (NamesVar.Test_Filepath(sName))
                        {
                            //ファイルパス変数の場合。
                            Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("変数[" + sName + "]", this.parent_Variablesconfig_Configurationtree);
                            cf_Fpath.InitPath(
                                sValue,
                                log_Reports
                                );
                            if ("" != sFolder)
                            {
                                //if (log_Method.CanDebug(1))
                                //{
                                //    log_Method.WriteDebug_ToConsole("「変数登録ファイル」FOLDER列指定あり=[" + sFolder + "]");
                                //}

                                Expression_Node_String ec_Namevar_Folder = new Expression_Leaf_StringImpl(sFolder, null, this.parent_Variablesconfig_Configurationtree);
                                Expression_Node_Filepath ec_Fopath_Folder = this.GetExpressionfilepathByVariablename(
                                    ec_Namevar_Folder,
                                    true,
                                    log_Reports
                                    );
                                cf_Fpath.SetDirectory_Base(ec_Fopath_Folder.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));
                            }
                            //else
                            //{
                            //    if (log_Method.CanDebug(1))
                            //    {
                            //        log_Method.WriteDebug_ToConsole("「変数登録ファイル」FOLDER列指定なし");
                            //    }
                            //}

                            Expression_Node_Filepath ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath);

                            this.PutFilepath(
                                sName,
                                ec_Fpath,
                                true,
                                log_Reports
                                );

                            //if (log_Method.CanDebug(1))
                            //{
                            //    log_Method.WriteDebug_ToConsole("「変数登録ファイル」ファイルパス変数=[" + sName + "] 値=[" + ec_Fpath.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]");
                            //}
                        }
                        else
                        {
                            //ファイルパス以外の変数の場合。
                            //if (log_Method.CanDebug(1))
                            //{
                            //    log_Method.WriteDebug_ToConsole("「変数登録ファイル」ファイルパス以外の変数=[" + sName + "]");
                            //}

                            if (bExistsFolder && "" != sFolder)
                            {
                                //ファイルパス変数以外の変数で、FOLDER列値を指定しているのはエラーです。
                                //※FOLDER列が存在する場合だけエラーチェックします。FOLDER列値がない場合は、sFolderには"null"が入っているので無視します。

                                err_SName = sName;
                                err_SFolder = sFolder;
                                goto gt_Error_InputFolder;
                            }

                            this.PutString(
                                sName,
                                sValue,
                                log_Reports
                                );
                        }

                    }

                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_InputFolder:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("Er:402;", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append("[");
                s.Append(err_SName);
                s.Append("]変数に、");
                s.Append(PmNames.S_FOLDER.Name_Attribute);
                s.Append( "列値を指定しているのはエラーです。");
                s.Newline();
                s.Append( PmNames.S_FOLDER.Name_Attribute );
                s.Append("列値は、ファイルパス変数にしか書いてはいけません。");
                s.Newline();
                s.Append("ファイルパス変数は、「");
                s.Append(NamesVar.S_SP_);
                s.Append("」、「");
                s.Append(NamesVar.S_UP_);
                s.Append("」で始まる名前の変数です。");
                s.Newline();
                s.Newline();

                s.AppendI(1, PmNames.S_FOLDER.Name_Attribute);
                if (null == err_SFolder)
                {
                    s.Append("=ヌル。");
                }
                else
                {
                    s.Append("=[");
                    s.Append(err_SFolder);
                    s.Append("]");
                }
                s.Newline();
                s.Newline();

                // ヒント

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_NullTable:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー918!", log_Method);

                StringBuilder t = new StringBuilder();
                t.Append("指定されたテーブルは、ヌルでした。");
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);

                // ヒント

                r.Message = t.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_DoubleLoad:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー919!", log_Method);

                StringBuilder t = new StringBuilder();
                t.Append("既に「変数設定ファイル」はロードされているのに、");
                t.Append(Environment.NewLine);
                t.Append("また 「変数設定ファイル」をロードしようとしました。");
                t.Append(Environment.NewLine);
                t.Append(Environment.NewLine);

                // ヒント

                r.Message = t.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
示例#47
0
        //────────────────────────────────────────
        /// <summary>
        /// 「レイアウト_テーブル」のテーブルタイプが「Form」専用。
        /// </summary>
        /// <param name="fo_Record"></param>
        /// <param name="dataRow"></param>
        /// <param name="o_Table_Form"></param>
        /// <param name="ol_Config2"></param>
        /// <param name="pg_Logging"></param>
        /// <returns>0:正常終了、2:continue。</returns>
        private int Read_Form(
            RecordUserformconfig fo_Record,
            DataRow dataRow,
            Table_Humaninput o_Table_Form,
            TableUserformconfig fo_Config,
            MemoryApplication memoryApplication,
            Log_Reports pg_Logging
            )
        {
            Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            pg_Method.BeginMethod(Info_LayoutImpl.Name_Library, this, "Read_Layout",pg_Logging);
            //
            //

            int nResult = 0;

            int nIntValue;// = 0;
            string sValue;// = "";
            bool bValue;// = false;

            //
            // TREE (特殊判定)
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_TREE;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {
                    //フィールド有り

                    if (dataRow[sFieldName] is DBNull)// この連想配列は大文字・小文字を区別しないのが欠点。
                    {
                        // フィールドは有るが、未記入の時。

                        // TREEフィールドが未記入の場合は、空行と判断して、無視します。
                        nResult = 2;
                        goto gt_EndMethod;
                    }

                    //フィールドが有り、記入もあるとき。

                    pg_Logging.Log_Callstack.Push(pg_Method, "③");
                    bool bParsedSuccessful = Int_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out nIntValue,
                        EnumOperationIfErrorvalue.Spaces_To_Alt_Value, // 「値が空(-1)」は、空行としてよく使います。
                        -1,
                        pg_Logging
                        );
                    pg_Logging.Log_Callstack.Pop(pg_Method, "③");

                    if (!pg_Logging.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }

                    if (bParsedSuccessful)
                    {
                        fo_Record.Set(NamesFld.S_TREE, EnumTypedb.Int, nIntValue, pg_Logging);
                        //fo_Record.NTree = nIntValue;
                    }
                    else
                    {
                        // エラー時
                    }
                }

            }

            //
            // NO
            //
            {
                //必須フィールドではありません。
                string sFieldName = NamesFld.S_NO;

                bool bContained = o_Table_Form.ContainsField(sFieldName, false, pg_Logging);
                if (pg_Logging.Successful)
                {
                    if (bContained)
                    {
                        pg_Logging.Log_Callstack.Push(pg_Method, "④");
                        bool bParsedSuccessful = Int_HumaninputImpl.TryParse(
                            dataRow[sFieldName],
                            out nIntValue,
                            EnumOperationIfErrorvalue.Spaces_To_Alt_Value, // 空行追加時のエラー抑制のため。
                            -1,
                            pg_Logging
                            );
                        pg_Logging.Log_Callstack.Pop(pg_Method, "④");

                        if (!pg_Logging.Successful)
                        {
                            // エラー
                            goto gt_EndMethod;
                        }

                        if (bParsedSuccessful)
                        {
                            fo_Record.Set(NamesFld.S_NO, EnumTypedb.Int, nIntValue, pg_Logging);
                            //fo_Record.NNo = nIntValue;
                        }
                        else
                        {
                            fo_Record.Set(NamesFld.S_NO, EnumTypedb.Int, 0, pg_Logging);
                            //fo_Record.NNo = 0;
                        }
                    }
                    else
                    {
                        fo_Record.Set(NamesFld.S_NO, EnumTypedb.Int, 0, pg_Logging);
                        //fo_Record.NNo = 0;
                    }

                }
            }

            //
            // NAME
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_NAME;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {

                    pg_Logging.Log_Callstack.Push(pg_Method, "⑤");
                    bool bBool = String_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out sValue,
                        o_Table_Form.Name,
                        sFieldName,
                        pg_Method,
                        pg_Logging);
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑤");

                    if (bBool)
                    {
                        // コントロール名。
                        fo_Record.Set( NamesFld.S_NAME, EnumTypedb.String, sValue, pg_Logging);
                        //fo_Record.Name = sValue;
                    }
                    else
                    {
                        //
                        // NAME がエラー?
                        //

                        // コントロール名。
                        fo_Record.Set(NamesFld.S_NAME, EnumTypedb.String, "<エラー>", pg_Logging);
                        //fo_Record.Name = "<エラー>";
                    }

                    if (!pg_Logging.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }

                }
            }

            //
            // int型のTREEフィールドが-1の場合は、空行と判断します。
            //
            int nCurTree;
            fo_Record.TryGetInt(out nCurTree, NamesFld.S_TREE, true, -1, memoryApplication, pg_Logging);
            if (-1 == nCurTree)
            {
                nResult = 2;
                goto gt_EndMethod;
            }

            //
            // TYPE
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_TYPE;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {

                    pg_Logging.Log_Callstack.Push(pg_Method, "⑦");
                    bool bBool = String_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out sValue,
                        o_Table_Form.Name,
                        sFieldName,
                        pg_Method,
                        pg_Logging);
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑦");

                    if (bBool)
                    {
                        fo_Record.Set(NamesFld.S_TYPE, EnumTypedb.String, sValue, pg_Logging);
                        //fo_Record.SType = sValue;
                    }
                    else
                    {
                        fo_Record.Set(NamesFld.S_TYPE, EnumTypedb.String, "", pg_Logging);
                        //fo_Record.SType = "";
                    }

                    if (!pg_Logging.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }
                }
            }

            //
            // TEXT
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_TEXT;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {

                    pg_Logging.Log_Callstack.Push(pg_Method, "⑧");
                    bool bBool = String_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out sValue,
                        o_Table_Form.Name,
                        sFieldName,
                        pg_Method,
                        pg_Logging);
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑧");

                    if (bBool)
                    {
                        fo_Record.Set(NamesFld.S_TEXT, EnumTypedb.String, sValue, pg_Logging);
                        //fo_Record.SText = sValue;
                    }
                    else
                    {
                        fo_Record.Set(NamesFld.S_TEXT, EnumTypedb.String, "", pg_Logging);
                        //fo_Record.SText = "";
                    }

                    if (!pg_Logging.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }

                }
            }

            //
            // FILE
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_FILE;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "⑨");
                    bool bBool = String_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out sValue,
                        o_Table_Form.Name,
                        sFieldName,
                        pg_Method,
                        pg_Logging);
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑨");

                    if (bBool)
                    {
                        Configurationtree_NodeFilepath cf_Fpath_Control = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L10_1", o_Table_Form);
                        cf_Fpath_Control.InitPath(sValue, pg_Logging);
                        if (pg_Logging.Successful)
                        {
                            fo_Record.Set(NamesFld.S_FILE, EnumTypedb.ConfFilepath, cf_Fpath_Control, pg_Logging);
                            //fo_Record.Cf_File = cf_Fpath_Control;
                        }
                    }
                    else
                    {
                        Configurationtree_NodeFilepath cf_Fpath_Control = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L10_2", o_Table_Form);
                        cf_Fpath_Control.InitPath("", pg_Logging);
                        if (pg_Logging.Successful)
                        {
                            fo_Record.Set(NamesFld.S_FILE, EnumTypedb.ConfFilepath, cf_Fpath_Control, pg_Logging);
                            //fo_Record.Cf_File = cf_Fpath;
                        }
                    }

                    if (!pg_Logging.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }

                }
            }

            //
            // ENABLED
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_ENABLED;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {

                    pg_Logging.Log_Callstack.Push(pg_Method, "⑩");
                    bool bParseSuccessful = Bool_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out bValue,
                        EnumOperationIfErrorvalue.Spaces_To_Alt_Value, // 空行追加時のエラー抑制のため。
                        false,
                        pg_Logging
                        );
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑩");

                    if (!pg_Logging.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }

                    if (bParseSuccessful)
                    {
                        fo_Record.Set( NamesFld.S_ENABLED, EnumTypedb.Bool, bValue, pg_Logging);
                        //fo_Record.BEnabled = bValue;
                    }
                    else
                    {
                        fo_Record.Set(NamesFld.S_ENABLED, EnumTypedb.Bool, false, pg_Logging);
                        //fo_Record.BEnabled = false;
                    }
                }
            }

            //
            // VISIBLE
            //
            {
                //必須フィールドではありません。
                string sFieldName = NamesFld.S_VISIBLE;

                bool bContained = o_Table_Form.ContainsField(sFieldName, false, pg_Logging);
                if (bContained)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "⑪");
                    bool bParsedSuccessful = Bool_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out bValue,
                        EnumOperationIfErrorvalue.Spaces_To_Alt_Value, // 空行追加時のエラー抑制のため。
                        false,
                        pg_Logging
                        );
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑪");

                    if (!pg_Logging.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }

                    if (bParsedSuccessful)
                    {
                        fo_Record.Set(NamesFld.S_VISIBLE, EnumTypedb.Bool, bValue, pg_Logging);
                        //fo_Record.BVisible = bValue;
                    }
                    else
                    {
                        fo_Record.Set(NamesFld.S_VISIBLE, EnumTypedb.Bool, false, pg_Logging);
                        //fo_Record.BVisible = false;
                    }
                }
                else
                {
                    //
                    // VISIBLEフィールドがない場合、常に可視とします。
                    //

                    fo_Record.Set(NamesFld.S_VISIBLE, EnumTypedb.Bool, true, pg_Logging);
                    //fo_Record.BVisible = true;
                }
            }

            //
            // READ_ONLY
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_READ_ONLY;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "⑫");
                    bool bParsedSuccessful = Bool_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out bValue,
                        EnumOperationIfErrorvalue.Spaces_To_Alt_Value, // 空行追加時のエラー抑制のため。
                        false,
                        pg_Logging
                        );
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑫");

                    if (!pg_Logging.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }

                    if (bParsedSuccessful)
                    {
                        fo_Record.Set(NamesFld.S_READ_ONLY, EnumTypedb.Bool, bValue, pg_Logging);
                        //fo_Record.BReadOnly = bValue;
                    }
                    else
                    {
                        fo_Record.Set(NamesFld.S_READ_ONLY, EnumTypedb.Bool, false, pg_Logging);
                        //fo_Record.BReadOnly = false;
                    }
                }
            }

            //
            // WORD_WRAP
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_WORD_WRAP;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "⑬");
                    bool bParsedSuccessful = Bool_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out bValue,
                        EnumOperationIfErrorvalue.Spaces_To_Alt_Value, // 空行追加時のエラー抑制のため。
                        false,
                        pg_Logging
                        );
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑬");

                    if (!pg_Logging.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }

                    if (bParsedSuccessful)
                    {
                        fo_Record.Set(NamesFld.S_WORD_WRAP, EnumTypedb.Bool, bValue, pg_Logging);
                        //fo_Record.BWordWrap = bValue;
                    }
                    else
                    {
                        fo_Record.Set(NamesFld.S_WORD_WRAP, EnumTypedb.Bool, false, pg_Logging);
                        //fo_Record.BWordWrap = false;
                    }
                }
            }

            //
            // NEW_LINE
            //
            {
                //必須フィールドではありません。
                string sFieldName = NamesFld.S_NEW_LINE;

                bool bContained = o_Table_Form.ContainsField(sFieldName, false, pg_Logging);
                if (bContained)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "⑭");
                    bool bBool = String_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out sValue,
                        o_Table_Form.Name,
                        sFieldName,
                        pg_Method,
                        pg_Logging);
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑭");

                    if (bBool)
                    {
                        fo_Record.Set(NamesFld.S_NEW_LINE, EnumTypedb.String, sValue, pg_Logging);
                        //fo_Record.SNewLine = sValue;
                    }
                    else
                    {
                        fo_Record.Set(NamesFld.S_NEW_LINE, EnumTypedb.String, "", pg_Logging);
                        //fo_Record.SNewLine = "";
                    }

                    if (!pg_Logging.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }

                }
                else
                {
                    //
                    // VISIBLEフィールドがない場合、指定なしとします。
                    //

                    fo_Record.Set(NamesFld.S_NEW_LINE, EnumTypedb.String, "", pg_Logging);
                    //fo_Record.SNewLine = "";
                }
            }

            //
            // SCROLL_BARS
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_SCROLL_BARS;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "⑮");
                    bool bBool = String_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out sValue,
                        o_Table_Form.Name,
                        sFieldName,
                        pg_Method,
                        pg_Logging);
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑮");

                    if (bBool)
                    {
                        fo_Record.Set(NamesFld.S_SCROLL_BARS, EnumTypedb.String, sValue, pg_Logging);
                        //fo_Record.SScrollBars = sValue;
                    }
                    else
                    {
                        fo_Record.Set(NamesFld.S_SCROLL_BARS, EnumTypedb.String, "", pg_Logging);
                        //fo_Record.SScrollBars = "";
                    }

                    if (!pg_Logging.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }
                }
            }

            //
            // CHK_VALUE_TYPE
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_CHK_VALUE_TYPE;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "⑯");
                    bool bBool = String_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out sValue,
                        o_Table_Form.Name,
                        sFieldName,
                        pg_Method,
                        pg_Logging);
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑯");

                    if (bBool)
                    {
                        fo_Record.Set(NamesFld.S_CHK_VALUE_TYPE, EnumTypedb.String, sValue, pg_Logging);
                        //fo_Record.SChkValueType = sValue;
                    }
                    else
                    {
                        fo_Record.Set(NamesFld.S_CHK_VALUE_TYPE, EnumTypedb.String, "", pg_Logging);
                        //fo_Record.SChkValueType = "";
                    }

                    if (!pg_Logging.Successful)
                    {
                        goto gt_EndMethod;
                    }
                }
            }

            //
            // FONT_SIZE_PT
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_FONT_SIZE_PT;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "⑰");
                    bool bBool = String_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out sValue,
                        o_Table_Form.Name,
                        sFieldName,
                        pg_Method,
                        pg_Logging);
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑰");

                    if (bBool)
                    {
                        fo_Record.Set(NamesFld.S_FONT_SIZE_PT, EnumTypedb.String, sValue, pg_Logging);
                        //fo_Record.SFontSizePt = sValue;
                    }
                    else
                    {
                        fo_Record.Set(NamesFld.S_FONT_SIZE_PT, EnumTypedb.String, "", pg_Logging);
                        //fo_Record.SFontSizePt = "";
                    }

                    if (!pg_Logging.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }
                }
            }

            //
            // PIC_ZOOM
            //
            {
                //必須フィールドではありません。
                string sFieldName = NamesFld.S_PIC_ZOOM;

                bool bContained = o_Table_Form.ContainsField(sFieldName, false, pg_Logging);
                if (bContained)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "⑱");
                    bool bParsedSuccessful = Int_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out nIntValue,
                        EnumOperationIfErrorvalue.Spaces_To_Alt_Value, // 空行追加時のエラー抑制のため。
                        1000,// 等倍サイズ。千分率なので1000。
                        pg_Logging
                        );
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑱");

                    if (!pg_Logging.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }

                    if (bParsedSuccessful)
                    {
                        fo_Record.Set(NamesFld.S_PIC_ZOOM, EnumTypedb.Int, nIntValue, pg_Logging);
                        //fo_Record.NPicZoom = nIntValue;
                    }
                }
                else
                {
                    //
                    // フィールドが無かった場合。
                    //
                    fo_Record.Set(NamesFld.S_PIC_ZOOM, EnumTypedb.Int, 1000, pg_Logging);
                    //fo_Record.NPicZoom = 1000;// 等倍サイズ。千分率なので1000。
                }
            }

            //
            // X_LT
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_X_LT;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "⑲");
                    bool bParsedSuccessful = Int_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out nIntValue,
                        EnumOperationIfErrorvalue.Spaces_To_Alt_Value, // 空行追加時のエラー抑制のため。
                        -1,
                        pg_Logging
                        );
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑲");

                    if (!pg_Logging.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }

                    if (bParsedSuccessful)
                    {
                        fo_Record.Set(NamesFld.S_X_LT, EnumTypedb.Int, nIntValue, pg_Logging);
                        //fo_Record.NAbsXLt = nIntValue;
                    }
                }
            }

            //
            // Y_LT
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_Y_LT;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "⑳");
                    bool bParsedSuccessful = Int_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out nIntValue,
                        EnumOperationIfErrorvalue.Spaces_To_Alt_Value, // 空行追加時のエラー抑制のため。
                        -1,
                        pg_Logging
                        );
                    pg_Logging.Log_Callstack.Pop(pg_Method, "⑳");

                    if (!pg_Logging.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }

                    if (bParsedSuccessful)
                    {
                        fo_Record.Set(NamesFld.S_Y_LT, EnumTypedb.Int, nIntValue, pg_Logging);
                        //fo_Record.NAbsYLt = nIntValue;
                    }
                }
            }

            //
            // WIDTH
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_WIDTH;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "(21)");
                    bool bParsedSuccessful = Int_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out nIntValue,
                        EnumOperationIfErrorvalue.Spaces_To_Alt_Value, // 空行追加時のエラー抑制のため。
                        -1,
                        pg_Logging
                        );
                    pg_Logging.Log_Callstack.Pop(pg_Method, "(21)");

                    if (!pg_Logging.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }

                    if (bParsedSuccessful)
                    {
                        fo_Record.Set(NamesFld.S_WIDTH, EnumTypedb.Int, nIntValue, pg_Logging);
                        //fo_Record.NWidth = nIntValue;
                    }
                }
            }

            //
            // HEIGHT
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_HEIGHT;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "(22)");
                    bool bParsedSuccessful = Int_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out nIntValue,
                        EnumOperationIfErrorvalue.Spaces_To_Alt_Value, // 空行追加時のエラー抑制のため。
                        -1,
                        pg_Logging
                        );
                    pg_Logging.Log_Callstack.Pop(pg_Method, "(22)");

                    if (!pg_Logging.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }

                    if (bParsedSuccessful)
                    {
                        fo_Record.Set(NamesFld.S_HEIGHT, EnumTypedb.Int, nIntValue, pg_Logging);
                        //fo_Record.NHeight = nIntValue;
                    }
                }
            }

            //
            // TAB_INDEX
            //
            {
                //必須フィールドです。
                string sFieldName = NamesFld.S_TAB_INDEX;

                // フィールドが無ければ、その時点でエラー。
                o_Table_Form.ContainsField(sFieldName, true, pg_Logging);
                if (pg_Logging.Successful)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "(23)");
                    bool bParsedSuccessful = Int_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out nIntValue,
                        EnumOperationIfErrorvalue.Spaces_To_Alt_Value,//大したデータではないので、省略すると-1にする。
                        -1,
                        pg_Logging
                        );
                    pg_Logging.Log_Callstack.Pop(pg_Method, "(23)");

                    if (!pg_Logging.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }

                    if (bParsedSuccessful)
                    {
                        fo_Record.Set(NamesFld.S_TAB_INDEX, EnumTypedb.Int, nIntValue, pg_Logging);
                        //fo_Record.NTabIndex = nIntValue;
                    }
                }
            }

            //
            // BACK_COLOR
            //
            {
                //必須フィールドではありません。
                string sFieldName = NamesFld.S_BACK_COLOR;

                bool bContained = o_Table_Form.ContainsField(sFieldName, false, pg_Logging);
                if (bContained)
                {
                    pg_Logging.Log_Callstack.Push(pg_Method, "(24)");
                    bool bBool = String_HumaninputImpl.TryParse(
                        dataRow[sFieldName],
                        out sValue,
                        o_Table_Form.Name,
                        sFieldName,
                        pg_Method,
                        pg_Logging);
                    pg_Logging.Log_Callstack.Pop(pg_Method, "(24)");

                    if (bBool)
                    {
                        fo_Record.Set(NamesFld.S_BACK_COLOR, EnumTypedb.String, sValue, pg_Logging);
                        //fo_Record.SBackColor = sValue;
                    }
                    else
                    {
                        fo_Record.Set(NamesFld.S_BACK_COLOR, EnumTypedb.String, "", pg_Logging);
                        //fo_Record.SBackColor = "";
                    }

                    if (!pg_Logging.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }

                }
                else
                {
                    fo_Record.Set(NamesFld.S_BACK_COLOR, EnumTypedb.String, "", pg_Logging);
                    //fo_Record.SBackColor = "";
                }
            }

            this.Read_FormLst(
                false,
                fo_Record,
                dataRow,
                o_Table_Form,
                pg_Logging
                );

            //
            //
            //
            //
            gt_EndMethod:
            pg_Method.EndMethod(pg_Logging);
            return nResult;
        }
示例#48
0
        //────────────────────────────────────────

        /// <summary>
        ///
        /// </summary>
        /// <param name="out_sFieldListList"></param>
        /// <param name="out_O_NewFldDefList"></param>
        /// <param name="src_sNewFieldNameList"></param>
        /// <param name="e_Where"></param>
        /// <param name="tableH_Source"></param>
        /// <param name="log_Reports"></param>
        public static void SelectFieldListList(
            out List <List <string> > listList_SField_Out,
            out RecordFielddefinition out_RecordFielddefinition_New,
            EnumLogic enumWhereLogic,
            List <string> list_SName_NewField_Src,
            List <Recordcondition> list_Reccond,
            Table_Humaninput tableH_Source,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();

            log_Method.BeginMethod(Info_Table.Name_Library, "Util_Table", "SelectFieldListList", log_Reports);

            //

            RecordFielddefinition recordFielddefinition_New = new RecordFielddefinitionImpl();
            List <int>            list_indexField           = new List <int>();

            //
            // 新しい、列定義リストを作成します。
            //
            {
                // 最初の列は「NO」とします。
                list_SName_NewField_Src.Insert(0, Utility_Table.S_FIELD_NO);

                //fieldIndex
                int nFIx = 0;
                tableH_Source.RecordFielddefinition.ForEach(delegate(Fielddefinition fielddefinition, ref bool isBreak, Log_Reports log_Reports2)
                {
                    if (list_SName_NewField_Src.Contains(fielddefinition.Name_Humaninput))
                    {
                        // 選出されたフィールドだけでリストを作ります。
                        recordFielddefinition_New.Add(fielddefinition);
                        list_indexField.Add(nFIx);
                    }

                    nFIx++;
                }, log_Reports);
            }



            //
            // テーブルに列定義を設定した後で。
            // 移し替えたいデータ値の配列を作ります。
            listList_SField_Out = new List <List <string> >();
            //
            {
                int nEndover = list_indexField.Count;
                foreach (DataRow srcRow in tableH_Source.DataTable.Rows)
                {
                    List <string> sList_NewField = new List <string>();


                    //
                    // 「E■@where」属性を解析します。
                    //
                    // 該当しないレコードは除去していきます。
                    //
                    // 「E■@where」に logic属性が無い場合は logic="and" とします。
                    if (EnumLogic.None == enumWhereLogic)
                    {
                        enumWhereLogic = EnumLogic.And;
                    }
                    bool bHit = Utility_Table.ApplyReccond(srcRow, tableH_Source, enumWhereLogic, list_Reccond, 0, log_Reports);
                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.SelectFieldListList: (結果) [" + bHit + "]");

                    if (bHit)
                    {
                        for (int nA = 0; nA < nEndover; nA++)
                        {
                            // TODO:指定のフィールド・インデックスだけをピックアップしたい。
                            int nB = list_indexField[nA];
                            Value_Humaninput o_Value = (Value_Humaninput)srcRow[nB];

                            sList_NewField.Add(o_Value.Text);
                        }

                        listList_SField_Out.Add(sList_NewField);
                    }
                    //hit
                }
            }


            goto gt_EndMethod;

            //
            //
            //
            //
gt_EndMethod:
            out_RecordFielddefinition_New = recordFielddefinition_New;
            log_Method.EndMethod(log_Reports);
        }
示例#49
0
        //────────────────────────────────────────

        /// <summary>
        /// スタイルシート・テーブルは、最低限「NAME」「STYLE」の2つで構成されたテーブルです。
        /// </summary>
        /// <param name="oStyleSheetTable"></param>
        /// <returns></returns>
        public MemoryStyles Translate(
            Table_Humaninput xenonTable_Stylesheet,
            Log_Reports log_Reports
            )
        {
            Log_Method pg_Method = new Log_MethodImpl();

            pg_Method.BeginMethod(Info_Operating.Name_Library, this, "MToO", log_Reports);

            //
            //
            //
            //

            if (null == xenonTable_Stylesheet)
            {
                goto gt_Error_NullTable;
            }

            MemoryStyles oStyleAttrList = new MemoryStylesImpl();

            int nIndex = 0;

            foreach (DataRow dataRow in xenonTable_Stylesheet.DataTable.Rows)
            {
                string sId;
                if (log_Reports.Successful)
                {
                    // 正常時

                    Value_Humaninput valueH;
                    if (log_Reports.Successful)
                    {
                        // 正常時

                        valueH = Utility_Row.GetFieldvalue(
                            "NAME",
                            dataRow,
                            true,
                            log_Reports,
                            "スタイルシートテーブル(NAME検索時)"
                            );
                        if (!log_Reports.Successful)
                        {
                            // 既エラー。
                            goto gt_EndMethod;
                        }
                    }
                    else
                    {
                        valueH = null;
                    }

                    if (log_Reports.Successful)
                    {
                        // 正常時

                        sId = ((Value_Humaninput)valueH).Text;//"スタイルシートテーブルパーサーのID"
                    }
                    else
                    {
                        sId = "";
                    }
                }
                else
                {
                    sId = "";
                }

                string sStyle;
                if (log_Reports.Successful)
                {
                    // 正常時

                    Value_Humaninput valueH = Utility_Row.GetFieldvalue(
                        "STYLE",
                        dataRow,
                        true,
                        log_Reports,
                        "スタイルシートテーブル(STYLE検索時)"
                        );
                    if (!log_Reports.Successful)
                    {
                        // 既エラー。
                        goto gt_EndMethod;
                    }

                    sStyle = ((Value_Humaninput)valueH).Text;//"スタイルシートテーブルパーサーのSTYLE"
                }
                else
                {
                    sStyle = "";
                }

                RecordXenonStyle item = new RecordXenonStyleImpl();
                item.Id    = sId;
                item.Style = sStyle;
                oStyleAttrList.Dictionary_RecordStyle.Add(sId, item);

                nIndex++;
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_NullTable:
            {
                oStyleAttrList = null;

                if (log_Reports.CanCreateReport)
                {
                    Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                    r.SetTitle("▲エラー99999!", pg_Method);

                    StringBuilder t = new StringBuilder();
                    t.Append("テーブルがヌルでした。");
                    t.Append(Environment.NewLine);
                    t.Append(Environment.NewLine);

                    // ヒント

                    r.Message = t.ToString();
                    log_Reports.EndCreateReport();
                }
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            pg_Method.EndMethod(log_Reports);
            return(oStyleAttrList);
        }
示例#50
0
        //────────────────────────────────────────
        /// <summary>
        /// 「E■@where」属性を解析します。
        /// 
        /// 該当しないレコードは除去していきます。
        /// </summary>
        /// <param name="srcRow"></param>
        /// <param name="tableH_Source"></param>
        /// <param name="groupLogic"></param>
        /// <param name="reccondList"></param>
        /// <param name="log_Reports"></param>
        /// <returns>ロジックの真偽。</returns>
        private static bool ApplyReccond(
            DataRow srcRow,
            Table_Humaninput tableH_Source,
            EnumLogic parent_EnumLogic,
            List<Recordcondition> list_Reccond,//「E■@where」または「E■rec-cond」。子要素を持たないか、子要素に「E■rec-cond」を持つものとする。
            int nCount_Recursive_Debug,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();
            log_Method.BeginMethod(Info_Table.Name_Library, "Util_Table", "ApplyReccond",log_Reports);

            //
            //
            //
            //

            bool bResult;
            string err_SField;
            int nDebug_ChildIndex = 0;

            if (EnumLogic.Or == parent_EnumLogic)
            {
                // 1つも真がなければ、偽。
                bResult = false;
            }
            else if (EnumLogic.And == parent_EnumLogic)
            {
                // 1つも偽がなければ、真。
                bResult = true;
            }
            else
            {
                // 条件による。条件が1つもなければ真。
                bResult = true;
            }

            foreach (Recordcondition childReccond in list_Reccond)
            {

                //
                // "and" と有れば、条件に合わなかった場合 false。
                // "or" と有れば、
                //

                if (EnumLogic.None != childReccond.EnumLogic)
                {
                    // andグループ、orグループなら。

                    bool bChildHit = Utility_Table.ApplyReccond(srcRow, tableH_Source, childReccond.EnumLogic, childReccond.List_Child, nCount_Recursive_Debug + 1, log_Reports);

                    if (EnumLogic.And == parent_EnumLogic)
                    {
                        if (bChildHit)
                        {
                            // そのまま。
                            //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件内のグループで真 [" + bChildHit + "→真なのでそのまま " + bResult + "=True] Reccond=[" + childReccond.ToString() + "] 子が真なので変化なし。");
                        }
                        else
                        {
                            // 1つでも偽があれば、偽。
                            //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件内のグループで偽 [" + bChildHit + "→偽なので確定偽に " + bResult + "=False] Reccond=[" + childReccond.ToString() + "] 子に偽があるので偽。");
                            bResult = false;
                            goto gt_EndMethod;
                        }
                    }
                    else if (EnumLogic.Or == parent_EnumLogic)
                    {
                        if (bChildHit)
                        {
                            // 1つでも真があれば、真。
                            //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") OR条件内のグループで真 [" + bChildHit + "→真なので確定真に " + bResult + "=True] Reccond=[" + childReccond.ToString() + "] 子に真があるので真。");
                            bResult = true;
                            goto gt_EndMethod;
                        }
                        else
                        {
                            // そのまま。
                            //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") OR条件内のグループで偽 [" + bChildHit + "→偽なのでそのまま "+ bResult + "=False] Reccond=[" + childReccond.ToString() + "] 子が偽なので変化なし。");
                        }
                    }
                    else
                    {
                        // #TODO:エラー
                        System.Console.WriteLine(Info_Table.Name_Library + ":Util_Table.ApplyWhere: 不明ロジック[" + parent_EnumLogic + "]");
                    }

                }
                else
                {
                    // 条件なら。

                    // このレコードについて判定。
                    if (!tableH_Source.DataTable.Columns.Contains(childReccond.Name_Field))
                    {
                        // エラー
                        err_SField = childReccond.Name_Field;
                        goto gt_Error_MissField;
                    }

                    int nFieldIx = tableH_Source.DataTable.Columns.IndexOf(childReccond.Name_Field);
                    Fielddefinition o_FldDef = tableH_Source.RecordFielddefinition.ValueAt(nFieldIx);
                    Value_Humaninput o_Value = (Value_Humaninput)srcRow[nFieldIx];

                    // 型に合わせて値取得。
                    if (o_Value is Int_HumaninputImpl)
                    {
                        //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyWhere: intフィールド [" + sLogic + " " + sField + " " + sOpe + " " + sValue + "]");

                        int nFieldInt;
                        {
                            Int_HumaninputImpl.TryParse(
                                o_Value,
                                out nFieldInt,
                                EnumOperationIfErrorvalue.Spaces_To_Alt_Value,
                                -1,
                                log_Reports
                                );
                        }

                        int nExpectedInt;
                        {
                            bool bHit2 = int.TryParse(childReccond.Value, out nExpectedInt);
                            if (!bHit2 && log_Reports.CanCreateReport)
                            {
                                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                                r.SetTitle("▲エラー502!", log_Method);
                                r.Message = "int型に変換できませんでした。sValue=[" + childReccond.Value + "]";
                                log_Reports.EndCreateReport();
                            }
                        }

                        if (EnumLogic.Or == parent_EnumLogic)
                        {
                            switch (childReccond.EnumOpe)
                            {
                                case EnumOpe.Gteq:
                                    // 「>=」

                                    if (nFieldInt >= nExpectedInt)
                                    {
                                        // セーフ

                                        // 1つでも真が確定なら、真。
                                        bResult = true;
                                        //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "] 1つでも真なら真。");
                                        goto gt_EndMethod;
                                    }
                                    else
                                    {
                                        // アウト

                                        //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "]");
                                    }
                                    break;

                                case EnumOpe.Gt:
                                    // 「>」

                                    if (nFieldInt > nExpectedInt)
                                    {
                                        // セーフ

                                        // 1つでも真が確定なら、真。
                                        bResult = true;
                                        //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "] 1つでも真なら真。");
                                        goto gt_EndMethod;
                                    }
                                    else
                                    {
                                        //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "]");
                                    }
                                    break;

                                case EnumOpe.Lteq:
                                    // 「<=」

                                    if (nFieldInt <= nExpectedInt)
                                    {
                                        // セーフ

                                        // 1つでも真が確定なら、真。
                                        bResult = true;
                                        //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "] 1つでも真なら真。");
                                        goto gt_EndMethod;
                                    }
                                    else
                                    {
                                        // アウト

                                        //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "]");
                                    }
                                    break;

                                case EnumOpe.Lt:
                                    // 「<」

                                    if (nFieldInt < nExpectedInt)
                                    {
                                        // セーフ

                                        // 1つでも真が確定なら、真。
                                        bResult = true;
                                        //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "] 1つでも真なら真。");
                                        goto gt_EndMethod;
                                    }
                                    else
                                    {
                                        // アウト

                                        //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "]");
                                    }
                                    break;

                                case EnumOpe.Neq:
                                    // 「!=」

                                    if (nFieldInt != nExpectedInt)
                                    {
                                        // セーフ

                                        // 1つでも真が確定なら、真。
                                        bResult = true;
                                        //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "] 1つでも真なら真。");
                                        goto gt_EndMethod;
                                    }
                                    else
                                    {
                                        // アウト

                                        //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "]");
                                    }
                                    break;

                                case EnumOpe.Eq:
                                    // ""、"eq"、は eq扱い。

                                    // 「=」
                                    if (nFieldInt == nExpectedInt)
                                    {
                                        // セーフ

                                        // 1つでも真が確定なら、真。
                                        bResult = true;
                                        //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "] 1つでも真なら真。");
                                        goto gt_EndMethod;
                                    }
                                    else
                                    {
                                        // アウト

                                        //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "]");
                                    }
                                    break;
                            }

                        }
                        else if (EnumLogic.And == parent_EnumLogic)
                        {
                            switch (childReccond.EnumOpe)
                            {
                                case EnumOpe.Gteq:
                                    // 「>=」

                                    if (nFieldInt >= nExpectedInt)
                                    {
                                        // セーフ

                                        //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "]");
                                    }
                                    else
                                    {
                                        // アウト

                                        // 1つでも偽が確定なら、偽。
                                        bResult = false;
                                        //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "] 1つでも偽なら偽。");
                                        goto gt_EndMethod;
                                    }
                                    break;

                                case EnumOpe.Gt:
                                    // 「>」

                                    if (nFieldInt > nExpectedInt)
                                    {
                                        // セーフ

                                        //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "]");
                                    }
                                    else
                                    {
                                        // アウト

                                        // 1つでも偽が確定なら、偽。
                                        bResult = false;
                                        //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "] 1つでも偽なら偽。");
                                        goto gt_EndMethod;
                                    }
                                    break;

                                case EnumOpe.Lteq:
                                    // 「<=」

                                    if (nFieldInt <= nExpectedInt)
                                    {
                                        // セーフ

                                        //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "]");
                                    }
                                    else
                                    {
                                        // アウト

                                        // 1つでも偽が確定なら、偽。
                                        bResult = false;
                                        //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "] 1つでも偽なら偽。");
                                        goto gt_EndMethod;
                                    }
                                    break;

                                case EnumOpe.Lt:
                                    // 「<」

                                    if (nFieldInt < nExpectedInt)
                                    {
                                        // セーフ

                                        //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "]");
                                    }
                                    else
                                    {
                                        // アウト

                                        // 1つでも偽が確定なら、偽。
                                        bResult = false;
                                        //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "] 1つでも偽なら偽。");
                                        goto gt_EndMethod;
                                    }
                                    break;

                                case EnumOpe.Neq:
                                    // 「!=」

                                    if (nFieldInt != nExpectedInt)
                                    {
                                        // セーフ

                                        //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "]");
                                    }
                                    else
                                    {
                                        // アウト

                                        // 1つでも偽が確定なら、偽。
                                        bResult = false;
                                        //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "] 1つでも偽なら偽。");
                                        goto gt_EndMethod;
                                    }
                                    break;

                                case EnumOpe.Eq:
                                    // ""、"eq"、は eq扱い。

                                    // 「=」
                                    if (nFieldInt == nExpectedInt)
                                    {
                                        // セーフ

                                        //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "]");
                                    }
                                    else
                                    {
                                        // アウト

                                        // 1つでも偽が確定なら、偽。
                                        bResult = false;
                                        //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "] 1つでも偽なら偽。");
                                        goto gt_EndMethod;
                                    }
                                    break;
                            }
                        }
                        else
                        {
                            // #TODO:エラー
                            System.Console.WriteLine(Info_Table.Name_Library + ":Util_Table.ApplyWhere: 不明ロジック[" + parent_EnumLogic + "] nFieldIx=[" + nFieldIx + "] フィールド名=[" + o_FldDef.Name_Humaninput + "] [" + parent_EnumLogic + "][" + childReccond.Name_Field + " " + childReccond.EnumOpe + " " + childReccond.Value + "] objValueの型=[" + o_Value.GetType().Name + "]");
                        }

                    }
                    else
                    {
                        // #TODO:エラー
                        System.Console.WriteLine(Info_Table.Name_Library + ":Util_Table.ApplyWhere: 不明フィールド nFieldIx=[" + nFieldIx + "] フィールド名=[" + o_FldDef.Name_Humaninput + "] [" + parent_EnumLogic + "][" + childReccond.Name_Field + " " + childReccond.EnumOpe + " " + childReccond.Value + "] objValueの型=[" + o_Value.GetType().Name + "]");

                    }

                }//or,and,条件

                nDebug_ChildIndex++;
            }//for

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_MissField:
            if(log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー501!", log_Method);

                StringBuilder s = new StringBuilder();
                s.Append("<rec-cond>要素のfield属性エラー");
                s.Append(Environment.NewLine);
                s.Append("field=[");
                s.Append(err_SField);
                s.Append("]");

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return bResult;
        }
示例#51
0
        //────────────────────────────────────────

        public void AddTo(Table_Humaninput tableH)
        {
            tableH.DataTable.Rows.Add(this.DataRow);
        }
示例#52
0
        //────────────────────────────────────────

        private List <List <string> > ToModel(
            Table_Humaninput table,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);

            log_Method.BeginMethod(Info_Table.Name_Library, this, "ToModel", log_Reports);

            Fielddef err_FldDef;

            // 「フィールド定義部」「データ部」両方含むテーブル。
            List <List <string> > rsltTable = new List <List <string> >();

            // フィールド名をカンマ区切りで出力します。最後にENDを付加します。

            // フィールド定義部
            //List<Fielddef> list_FieldDefinition = table.List_Fielddef;

            // データ・テーブル部
            DataTable dataTable = table.DataTable;



            // 「END,END,END...」行を除く、行数。
            int nHorizontalCountExceptEnd = table.RecordFielddef.Count;
            //essageBox.Show("「END,END,END...」行を除く、行数=[" + horizontalCountExceptEnd + "]", this.GetType().Name + "#Textize_rowColReversed: (Table)");



            bool bAllIntFields = table.Format_Table_Humaninput.IsAllintfieldsActivated;

            DataRow dataRow;

            string sCellValue;



            //
            // フィールド名の行
            //
            {
                List <string> sList_FieldNameRow = new List <string>();

                table.RecordFielddef.ForEach(delegate(Fielddef fielddefinition, ref bool isBreak2, Log_Reports log_Reports2)
                {
                    if (this.O_ExceptedFields.TryExceptedField(fielddefinition.Name_Trimupper))
                    {
                        // 出力しないフィールドの場合、無視します。
                    }
                    else
                    {
                        sList_FieldNameRow.Add(fielddefinition.Name_Humaninput);
                    }
                }, log_Reports);

                rsltTable.Add(sList_FieldNameRow);
            }



            //
            // 型名の行
            //
            if (bAllIntFields)
            {
                //
                // 全部 int型フィールドなので、型名を記述しない場合。
                //
            }
            else
            {
                //
                // 型名を記述する場合。
                //

                List <string> sList_FieldTypeRow = new List <string>();

                table.RecordFielddef.ForEach(delegate(Fielddef fielddefinition, ref bool isBreak2, Log_Reports log_Reports2)
                {
                    if (this.O_ExceptedFields.TryExceptedField(fielddefinition.Name_Trimupper))
                    {
                        // 出力しないフィールドの場合、無視します。
                    }
                    else
                    {
                        switch (fielddefinition.Type_Field)
                        {
                        case EnumTypeFielddef.String:
                            {
                                sList_FieldTypeRow.Add(FielddefImpl.S_STRING);
                            }
                            break;

                        case EnumTypeFielddef.Int:
                            {
                                sList_FieldTypeRow.Add(FielddefImpl.S_INT);
                            }
                            break;

                        case EnumTypeFielddef.Bool:
                            {
                                sList_FieldTypeRow.Add(FielddefImpl.S_BOOL);
                            }
                            break;

                        default:
                            {
                                // TODO エラー対応。

                                // 未定義の型があった場合、そのまま出力します。
                                // C#のメッセージになるかと思います。
                                sList_FieldTypeRow.Add(fielddefinition.ToString_Type());
                            }
                            break;
                        }
                    }
                }, log_Reports);
            }



            //
            // コメント行
            //
            {
                List <string> sList_FieldNameRow = new List <string>();
                table.RecordFielddef.ForEach(delegate(Fielddef fielddefinition, ref bool isBreak2, Log_Reports log_Reports2)
                {
                    if (this.O_ExceptedFields.TryExceptedField(fielddefinition.Name_Trimupper))
                    {
                        // 出力しないフィールドの場合、無視します。
                    }
                    else
                    {
                        sList_FieldNameRow.Add(fielddefinition.Comment);
                    }
                }, log_Reports);
                rsltTable.Add(sList_FieldNameRow);
            }



            //
            // データ部(フィールド定義部の次の行から始まるテーブル)
            //
            {
                // 「列定義」「EOF」列を除く、「データ部」だけの列数。
                int nDataCount = dataTable.Rows.Count;

                for (int nR = 0; nR < nDataCount; nR++)
                {
                    dataRow = dataTable.Rows[nR];
                    object[] itemArray = dataRow.ItemArray;//ItemArrayは1回の呼び出しが重い。



                    List <string> sList_DtRow = new List <string>();
                    int           indexColumn = 0;
                    table.RecordFielddef.ForEach(delegate(Fielddef fielddefinition, ref bool isBreak2, Log_Reports log_Reports2)
                    {
                        if (this.O_ExceptedFields.TryExceptedField(fielddefinition.Name_Trimupper))
                        {
                            // 出力しないフィールドの場合、無視します。
                        }
                        else
                        {
                            if (itemArray[indexColumn] is Cell)
                            {
                                sCellValue = ((Cell)itemArray[indexColumn]).Text;
                            }
                            else
                            {
                                // (11)エラー
                                err_FldDef = fielddefinition;
                                isBreak2   = true;
                                goto gt_Error_UndefinedFieldType;
                            }

                            sList_DtRow.Add(sCellValue);
                        }

                        goto gt_EndInnermethod;
                        //
                        #region 異常系
                        //────────────────────────────────────────
                        gt_Error_UndefinedFieldType:
                        if (log_Reports.CanCreateReport)
                        {
                            Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                            r.SetTitle("▲エラー455!", log_Method);

                            Log_TextIndented s = new Log_TextIndentedImpl();

                            s.Append("(プログラム内部エラー)未定義のフィールド型=[");
                            s.Append(err_FldDef.ToString_Type());
                            s.Append("]");
                            s.Newline();

                            // ヒント

                            r.Message = s.ToString();
                            log_Reports.EndCreateReport();
                        }
                        goto gt_EndInnermethod;
                        //────────────────────────────────────────
                        #endregion
                        //
                        gt_EndInnermethod:
                        indexColumn++;
                    }, log_Reports);

                    rsltTable.Add(sList_DtRow);
                }
            }

            goto gt_EndMethod;
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(rsltTable);
        }
示例#53
0
        //────────────────────────────────────────
        public void TryGetTable_Variables(
            out Table_Humaninput out_xenonTable_Variables,
            String filepath_Startup,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "TryGetTable_Variables",log_Reports);

            out_xenonTable_Variables = null;

            //『Sp:Variables;』で指定されているテーブル
            XenonName xenonName_Variable = new XenonNameImpl(NamesVar.S_SP_VARIABLES, new Configurationtree_NodeImpl("!ハードコーディング_MoNorenImpl#LoadVariables", null));

            //
            // 「変数設定ファイル」のファイルパス。
            //
            log_Reports.Log_Callstack.Push(log_Method, "①");
            Expression_Node_Filepath ec_Fpath_Variables = this.Owner_MemoryApplication.MemoryVariables.GetExpressionfilepathByVariablename(
                new Expression_Leaf_StringImpl(xenonName_Variable.SValue, null, xenonName_Variable.Cur_Configuration),
                false,//必須ではありません。未該当であればヌルを返します。
                log_Reports
                );
            log_Reports.Log_Callstack.Pop(log_Method, "①");

            if (log_Reports.Successful)
            {
                if (null == ec_Fpath_Variables)
                {
                    //
                    // "Sp:Variables;" が未指定の場合、何もしません。
                    //
                    goto gt_EndMethod;
                }
            }

            //指定されていた場合。
            if (log_Reports.Successful)
            {
                //
                // CSVソースファイル読取
                //
                CsvTo_Table_HumaninputImpl reader = new CsvTo_Table_HumaninputImpl();

                Request_ReadsTable request_tblReads = new Request_ReadsTableImpl();
                Format_Table_Humaninput tblFormat_puts = new Format_Table_HumaninputImpl();
                request_tblReads.Name_PutToTable = NamesVar.S_ST_VARIABLES2;
                request_tblReads.Expression_Filepath = ec_Fpath_Variables;

                out_xenonTable_Variables = reader.Read(
                    request_tblReads,
                    tblFormat_puts,
                    true,
                    log_Reports
                    );
            }

            goto gt_EndMethod;
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
        //────────────────────────────────────────
        /// <summary>
        /// 一覧系のテーブルの行を読み取り、テーブルを読み取る要求を作成します。
        /// </summary>
        /// <param name="dataRow"></param>
        /// <param name="o_IndexTable"></param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        private Request_ReadsTable CreateReadRequest(
            DataRow dataRow,
            Table_Humaninput o_Table_Aafiles,
            Log_Reports log_Reports
            )
        {
            //
            //
            //
            //()メソッド開始
            //
            //
            //
            Log_Method log_Method = new Log_MethodImpl(1);
            log_Method.BeginMethod(Info_Functions.Name_Library, this, "CreateReadRequest",log_Reports);

            //
            //

            Request_ReadsTable forTable_request = new Request_ReadsTableImpl();

            //
            // 「インデックス_テーブル」の絶対ファイルパス
            Expression_Node_Filepath ec_Fpath_Aafilescsv = o_Table_Aafiles.Expression_Filepath_ConfigStack;
            string sFpatha_Aafilescsv = ec_Fpath_Aafilescsv.Execute4_OnExpressionString(
                EnumHitcount.Unconstraint, log_Reports);
            //if (log_Method.CanDebug(1))
            //{
            //    log_Method.WriteDebug_ToConsole("「Aa_Files.csv」のファイルパス=[" + sFpatha_Aafilescsv + "]");
            //}

            if (!log_Reports.Successful)
            {
                // 既エラー。
                goto gt_EndMethod;
            }

            //
            // テーブル名
            {
                string sName_Field = NamesFld.S_NAME;
                string sTableName;
                if (String_HumaninputImpl.TryParse(
                    dataRow[sName_Field],
                    out sTableName,
                    o_Table_Aafiles.Name,
                    sName_Field,
                    log_Method,
                    log_Reports))
                {

                }

                if (!log_Reports.Successful)
                {
                    // エラー
                    goto gt_EndMethod;
                }

                forTable_request.Name_PutToTable = sTableName;
            }

            //
            // フォーム名
            {
                string sName_Field = NamesFld.S_NAME_FORM;
                string sTableUnit;
                if (dataRow.Table.Columns.Contains(sName_Field))
                {
                    bool bBool = String_HumaninputImpl.TryParse(
                        dataRow[sName_Field],
                        out sTableUnit,
                        o_Table_Aafiles.Name,
                        sName_Field,
                        log_Method,
                        log_Reports);

                    if (bBool)
                    {

                    }

                    if (!log_Reports.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }
                }
                else
                {
                    sTableUnit = "";
                }
                forTable_request.Tableunit = sTableUnit;
            }

            //
            // データ・タイプです。
            {
                string sName_Field = NamesFld.S_TYPE_DATA;
                string sValue;
                if (dataRow.Table.Columns.Contains(sName_Field))
                {
                    if (String_HumaninputImpl.TryParse(
                        dataRow[sName_Field],
                        out sValue,
                        o_Table_Aafiles.Name,
                        sName_Field,
                        log_Method,
                        log_Reports))
                    {

                    }

                    if (!log_Reports.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }
                }
                else
                {
                    sValue = "";
                }
                forTable_request.Typedata = sValue;
            }

            //
            // テーブルのファイルパス
            //
            Expression_Node_Filepath ec_Fpath;
            {
                this.Read_Folder_File(
                    out ec_Fpath,
                    forTable_request.Name_PutToTable,
                    sFpatha_Aafilescsv,
                    dataRow,
                    o_Table_Aafiles,
                    log_Reports
                    );

                if (log_Reports.Successful)
                {
                    forTable_request.Expression_Filepath = ec_Fpath;
                }
            }

            //
            // ファイルパスを変数にセット
            //
            {
                string sName_Field = NamesFld.S_SET_VAR_PATH;
                string sNamevar;
                if (dataRow.Table.Columns.Contains(sName_Field))
                {
                    if (String_HumaninputImpl.TryParse(
                        dataRow[sName_Field],
                        out sNamevar,
                        o_Table_Aafiles.Name,
                        sName_Field,
                        log_Method,
                        log_Reports))
                    {

                    }

                    if (!log_Reports.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }
                }
                else
                {
                    sNamevar = "";
                }

                if ("" != sNamevar && null != ec_Fpath)
                {
                    // 指定があれば、ファイルパスを変数にセット。
                    this.Owner_MemoryApplication.MemoryVariables.SetFilepathValue(
                        sNamevar, ec_Fpath, false, log_Reports);

                }
            }

            //
            // 「日別バックアップ」するなら真。
            //
            {
                string sName_Field = NamesFld.S_DATE_BACKUP;
                bool bDateBackup;
                if (dataRow.Table.Columns.Contains(sName_Field))
                {
                    bool bParsedSuccessful = Bool_HumaninputImpl.TryParse(
                        dataRow[sName_Field],
                        out bDateBackup,
                        EnumOperationIfErrorvalue.Spaces_To_Alt_Value,
                        false,
                        log_Reports
                        );

                    if (!log_Reports.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }

                    if (bParsedSuccessful)
                    {

                    }
                }
                else
                {
                    bDateBackup = false;
                }

                forTable_request.IsDatebackupActivated = bDateBackup;
            }

            //
            // 用途。/「」指定なし。/「WriteOnly」データの読取を行わない。ログ出力先を登録しているだけなど。
            //
            {
                string sName_Field = NamesFld.S_USE;
                string sField;
                if (dataRow.Table.Columns.Contains(sName_Field))
                {
                    bool bParsedSuccessful = String_HumaninputImpl.TryParse(
                        dataRow[sName_Field],
                        out sField,
                        o_Table_Aafiles.Name,
                        sName_Field,
                        log_Method,
                        log_Reports
                        );

                    if (!log_Reports.Successful)
                    {
                        // エラー
                        goto gt_EndMethod;
                    }

                    if (bParsedSuccessful)
                    {

                    }
                }
                else
                {
                    sField = "";//指定なし。
                }

                forTable_request.Use = sField;
            }

            goto gt_EndMethod;
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return forTable_request;
        }
示例#55
0
        //────────────────────────────────────────

        /// <summary>
        /// 指定のフィールド名だけに絞り込んだサブテーブルを作って返します。
        /// </summary>
        /// <param name="sFieldNameList"></param>
        /// <returns></returns>
        public static Table_Humaninput CreateSubTableBySelect(
            string name_NewTable,
            List <string> list_Src_SNewFieldName,
            Expression_Node_Filepath expr_Fpath_NewTable,
            EnumLogic enumWhereLogic,
            List <Recordcondition> list_Reccond,
            Table_Humaninput src_XenonTable,
            Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl();

            log_Method.BeginMethod(Info_Table.Name_Library, "Util_Table", "CreateSubTableBySelect", log_Reports);

            //
            //
            //
            //



            Table_Humaninput tableH_New = new Table_HumaninputImpl(
                name_NewTable, expr_Fpath_NewTable, expr_Fpath_NewTable.Cur_Configuration);

            RecordFielddefinition recordFielddefinigion_New;
            List <List <string> > sFieldListList;

            Utility_Table.SelectFieldListList(
                out sFieldListList,
                out recordFielddefinigion_New,
                enumWhereLogic,
                list_Src_SNewFieldName,
                list_Reccond,
                src_XenonTable,
                log_Reports
                );



            //
            // 新しいテーブルを作成します。(列定義の追加)
            //
            tableH_New.CreateTable(recordFielddefinigion_New, log_Reports);

            if (tableH_New.DataTable.Columns.Count < 1)
            {
                // エラー。
                goto gt_Error_ZeroField;
            }
            else if (tableH_New.RecordFielddefinition.Count < 1)
            {
                // エラー。
                goto gt_Error_ZeroFieldDef;
            }



            // 不要なレコードを除去して絞り込んだ後で、
            // レコード追加。
            {
                tableH_New.AddRecordList(sFieldListList, recordFielddefinigion_New, log_Reports);
            }


            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_ZeroField:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー471!", log_Method);

                Log_TextIndented t = new Log_TextIndentedImpl();

                t.Append(" フィールドが0件のテーブルを作ることはできません。newFldDefList=[");
                t.Append(recordFielddefinigion_New.Count);
                t.Append("]");

                t.Newline();
                t.Newline();

                // ヒント

                r.Message = t.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_ZeroFieldDef:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー472!", log_Method);

                Log_TextIndented t = new Log_TextIndentedImpl();

                t.Append(" フィールド定義が0件のテーブルを作ることはできません。o_NewTable.FieldDefinitions.Count=[");
                t.Append(tableH_New.RecordFielddefinition.Count);
                t.Append("]");

                t.Newline();
                t.Newline();

                // ヒント

                r.Message = t.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(tableH_New);
        }
示例#56
0
        //────────────────────────────────────────
        /// <summary>
        /// リスト・ビューに、テーブルをセットします。
        /// </summary>
        public void SetDataSourceToListView(
            Table_Humaninput xenonTable, ListView listView, Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            log_Method.BeginMethod(Info_Table.Name_Library, this, "SetDataSourceToListView", log_Reports);

            DataTable dataTable = xenonTable.DataTable;

            listView.Clear();

            // リスト・ビューにフィールドを追加します。
            xenonTable.RecordFielddefinition.ForEach(delegate(Fielddefinition fielddefinition, ref bool isBreak2, Log_Reports log_Reports2)
            {
                // 列を追加します。見出しと幅も設定します。
                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append(fielddefinition.Name_Humaninput);

                if (this.IsVisibled_Fieldtype)
                {
                    // デバッグ用に、フィールドの型もヘッダーに表示する場合。
                    s.Append(":");
                    s.Append(fielddefinition.ToString_Type());
                }

                listView.Columns.Add(s.ToString(), 90);
            }, log_Reports);

            for (int index_Row = 0; index_Row < dataTable.Rows.Count; index_Row++)
            {
                DataRow row = dataTable.Rows[index_Row];

                ListViewItem item = null;

                object[] recordFields = row.ItemArray;//ItemArrayは1回の呼び出しが重い。
                for (int indexColumn = 0; indexColumn < recordFields.Length; indexColumn++)
                {
                    object columnObject = recordFields[indexColumn];

                    if (columnObject is Value_Humaninput)
                    {
                        Value_Humaninput valueH = (Value_Humaninput)columnObject;

                        string valueField = valueH.Text;

                        // レコードを作成します。
                        if (0 == indexColumn)
                        {
                            // 最初の列の場合は、行追加になります。

                            // 文字列を追加。
                            item = new ListViewItem(valueField);
                            listView.Items.Add(item);
                        }
                        else
                        {
                            // 最初の列より後ろは、列追加になります。

                            // 文字列を追加。
                            item.SubItems.Add(valueField);
                        }
                    }
                    else if (columnObject is DBNull)
                    {
                        // 空欄、または列データを未設定。
                        goto gt_Error_DBNull;
                    }
                    else
                    {
                        //エラー
                        goto gt_Error_UnknownType;
                    }

                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_DBNull:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー201!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Newline();
                s.Append("列が未設定(DBNull)。テーブル名=[" + xenonTable.Name + "]");

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_UnknownType:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー202!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Newline();
                s.Append("未定義の型の列。テーブル名=[" + xenonTable.Name + "]");

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return;
        }
示例#57
0
        //────────────────────────────────────────

        /// <summary>
        /// 「E■@where」属性を解析します。
        ///
        /// 該当しないレコードは除去していきます。
        /// </summary>
        /// <param name="srcRow"></param>
        /// <param name="tableH_Source"></param>
        /// <param name="groupLogic"></param>
        /// <param name="reccondList"></param>
        /// <param name="log_Reports"></param>
        /// <returns>ロジックの真偽。</returns>
        private static bool ApplyReccond(
            DataRow srcRow,
            Table_Humaninput tableH_Source,
            EnumLogic parent_EnumLogic,
            List <Recordcondition> list_Reccond,//「E■@where」または「E■rec-cond」。子要素を持たないか、子要素に「E■rec-cond」を持つものとする。
            int nCount_Recursive_Debug,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();

            log_Method.BeginMethod(Info_Table.Name_Library, "Util_Table", "ApplyReccond", log_Reports);

            //
            //
            //
            //

            bool   bResult;
            string err_SField;
            int    nDebug_ChildIndex = 0;

            if (EnumLogic.Or == parent_EnumLogic)
            {
                // 1つも真がなければ、偽。
                bResult = false;
            }
            else if (EnumLogic.And == parent_EnumLogic)
            {
                // 1つも偽がなければ、真。
                bResult = true;
            }
            else
            {
                // 条件による。条件が1つもなければ真。
                bResult = true;
            }

            foreach (Recordcondition childReccond in list_Reccond)
            {
                //
                // "and" と有れば、条件に合わなかった場合 false。
                // "or" と有れば、
                //

                if (EnumLogic.None != childReccond.EnumLogic)
                {
                    // andグループ、orグループなら。

                    bool bChildHit = Utility_Table.ApplyReccond(srcRow, tableH_Source, childReccond.EnumLogic, childReccond.List_Child, nCount_Recursive_Debug + 1, log_Reports);

                    if (EnumLogic.And == parent_EnumLogic)
                    {
                        if (bChildHit)
                        {
                            // そのまま。
                            //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件内のグループで真 [" + bChildHit + "→真なのでそのまま " + bResult + "=True] Reccond=[" + childReccond.ToString() + "] 子が真なので変化なし。");
                        }
                        else
                        {
                            // 1つでも偽があれば、偽。
                            //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件内のグループで偽 [" + bChildHit + "→偽なので確定偽に " + bResult + "=False] Reccond=[" + childReccond.ToString() + "] 子に偽があるので偽。");
                            bResult = false;
                            goto gt_EndMethod;
                        }
                    }
                    else if (EnumLogic.Or == parent_EnumLogic)
                    {
                        if (bChildHit)
                        {
                            // 1つでも真があれば、真。
                            //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") OR条件内のグループで真 [" + bChildHit + "→真なので確定真に " + bResult + "=True] Reccond=[" + childReccond.ToString() + "] 子に真があるので真。");
                            bResult = true;
                            goto gt_EndMethod;
                        }
                        else
                        {
                            // そのまま。
                            //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") OR条件内のグループで偽 [" + bChildHit + "→偽なのでそのまま "+ bResult + "=False] Reccond=[" + childReccond.ToString() + "] 子が偽なので変化なし。");
                        }
                    }
                    else
                    {
                        // #TODO:エラー
                        System.Console.WriteLine(Info_Table.Name_Library + ":Util_Table.ApplyWhere: 不明ロジック[" + parent_EnumLogic + "]");
                    }
                }
                else
                {
                    // 条件なら。



                    // このレコードについて判定。
                    if (!tableH_Source.DataTable.Columns.Contains(childReccond.Name_Field))
                    {
                        // エラー
                        err_SField = childReccond.Name_Field;
                        goto gt_Error_MissField;
                    }

                    int              nFieldIx = tableH_Source.DataTable.Columns.IndexOf(childReccond.Name_Field);
                    Fielddefinition  o_FldDef = tableH_Source.RecordFielddefinition.ValueAt(nFieldIx);
                    Value_Humaninput o_Value  = (Value_Humaninput)srcRow[nFieldIx];


                    // 型に合わせて値取得。
                    if (o_Value is Int_HumaninputImpl)
                    {
                        //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyWhere: intフィールド [" + sLogic + " " + sField + " " + sOpe + " " + sValue + "]");

                        int nFieldInt;
                        {
                            Int_HumaninputImpl.TryParse(
                                o_Value,
                                out nFieldInt,
                                EnumOperationIfErrorvalue.Spaces_To_Alt_Value,
                                -1,
                                log_Reports
                                );
                        }

                        int nExpectedInt;
                        {
                            bool bHit2 = int.TryParse(childReccond.Value, out nExpectedInt);
                            if (!bHit2 && log_Reports.CanCreateReport)
                            {
                                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                                r.SetTitle("▲エラー502!", log_Method);
                                r.Message = "int型に変換できませんでした。sValue=[" + childReccond.Value + "]";
                                log_Reports.EndCreateReport();
                            }
                        }


                        if (EnumLogic.Or == parent_EnumLogic)
                        {
                            switch (childReccond.EnumOpe)
                            {
                            case EnumOpe.Gteq:
                                // 「>=」

                                if (nFieldInt >= nExpectedInt)
                                {
                                    // セーフ

                                    // 1つでも真が確定なら、真。
                                    bResult = true;
                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "] 1つでも真なら真。");
                                    goto gt_EndMethod;
                                }
                                else
                                {
                                    // アウト

                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "]");
                                }
                                break;

                            case EnumOpe.Gt:
                                // 「>」

                                if (nFieldInt > nExpectedInt)
                                {
                                    // セーフ

                                    // 1つでも真が確定なら、真。
                                    bResult = true;
                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "] 1つでも真なら真。");
                                    goto gt_EndMethod;
                                }
                                else
                                {
                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "]");
                                }
                                break;

                            case EnumOpe.Lteq:
                                // 「<=」

                                if (nFieldInt <= nExpectedInt)
                                {
                                    // セーフ

                                    // 1つでも真が確定なら、真。
                                    bResult = true;
                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "] 1つでも真なら真。");
                                    goto gt_EndMethod;
                                }
                                else
                                {
                                    // アウト

                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "]");
                                }
                                break;

                            case EnumOpe.Lt:
                                // 「<」

                                if (nFieldInt < nExpectedInt)
                                {
                                    // セーフ

                                    // 1つでも真が確定なら、真。
                                    bResult = true;
                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "] 1つでも真なら真。");
                                    goto gt_EndMethod;
                                }
                                else
                                {
                                    // アウト

                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "]");
                                }
                                break;

                            case EnumOpe.Neq:
                                // 「!=」

                                if (nFieldInt != nExpectedInt)
                                {
                                    // セーフ

                                    // 1つでも真が確定なら、真。
                                    bResult = true;
                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "] 1つでも真なら真。");
                                    goto gt_EndMethod;
                                }
                                else
                                {
                                    // アウト

                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "]");
                                }
                                break;

                            case EnumOpe.Eq:
                                // ""、"eq"、は eq扱い。

                                // 「=」
                                if (nFieldInt == nExpectedInt)
                                {
                                    // セーフ

                                    // 1つでも真が確定なら、真。
                                    bResult = true;
                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "] 1つでも真なら真。");
                                    goto gt_EndMethod;
                                }
                                else
                                {
                                    // アウト

                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ")  OR条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "]");
                                }
                                break;
                            }
                        }
                        else if (EnumLogic.And == parent_EnumLogic)
                        {
                            switch (childReccond.EnumOpe)
                            {
                            case EnumOpe.Gteq:
                                // 「>=」

                                if (nFieldInt >= nExpectedInt)
                                {
                                    // セーフ

                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "]");
                                }
                                else
                                {
                                    // アウト

                                    // 1つでも偽が確定なら、偽。
                                    bResult = false;
                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "] 1つでも偽なら偽。");
                                    goto gt_EndMethod;
                                }
                                break;

                            case EnumOpe.Gt:
                                // 「>」

                                if (nFieldInt > nExpectedInt)
                                {
                                    // セーフ

                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "]");
                                }
                                else
                                {
                                    // アウト

                                    // 1つでも偽が確定なら、偽。
                                    bResult = false;
                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "] 1つでも偽なら偽。");
                                    goto gt_EndMethod;
                                }
                                break;

                            case EnumOpe.Lteq:
                                // 「<=」

                                if (nFieldInt <= nExpectedInt)
                                {
                                    // セーフ

                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "]");
                                }
                                else
                                {
                                    // アウト

                                    // 1つでも偽が確定なら、偽。
                                    bResult = false;
                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "] 1つでも偽なら偽。");
                                    goto gt_EndMethod;
                                }
                                break;

                            case EnumOpe.Lt:
                                // 「<」

                                if (nFieldInt < nExpectedInt)
                                {
                                    // セーフ

                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "]");
                                }
                                else
                                {
                                    // アウト

                                    // 1つでも偽が確定なら、偽。
                                    bResult = false;
                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "] 1つでも偽なら偽。");
                                    goto gt_EndMethod;
                                }
                                break;

                            case EnumOpe.Neq:
                                // 「!=」

                                if (nFieldInt != nExpectedInt)
                                {
                                    // セーフ

                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "]");
                                }
                                else
                                {
                                    // アウト

                                    // 1つでも偽が確定なら、偽。
                                    bResult = false;
                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "] 1つでも偽なら偽。");
                                    goto gt_EndMethod;
                                }
                                break;

                            case EnumOpe.Eq:
                                // ""、"eq"、は eq扱い。

                                // 「=」
                                if (nFieldInt == nExpectedInt)
                                {
                                    // セーフ

                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=True] Reccond=[" + childReccond.ToString() + "]");
                                }
                                else
                                {
                                    // アウト

                                    // 1つでも偽が確定なら、偽。
                                    bResult = false;
                                    //ystem.Console.WriteLine(InfxenonTable.LibraryName + ":Util_Table.ApplyRecord: (" + debug_RecursiveCount + "." + debug_ChildIndex + ") AND条件[" + bResult + "=False] Reccond=[" + childReccond.ToString() + "] 1つでも偽なら偽。");
                                    goto gt_EndMethod;
                                }
                                break;
                            }
                        }
                        else
                        {
                            // #TODO:エラー
                            System.Console.WriteLine(Info_Table.Name_Library + ":Util_Table.ApplyWhere: 不明ロジック[" + parent_EnumLogic + "] nFieldIx=[" + nFieldIx + "] フィールド名=[" + o_FldDef.Name_Humaninput + "] [" + parent_EnumLogic + "][" + childReccond.Name_Field + " " + childReccond.EnumOpe + " " + childReccond.Value + "] objValueの型=[" + o_Value.GetType().Name + "]");
                        }
                    }
                    else
                    {
                        // #TODO:エラー
                        System.Console.WriteLine(Info_Table.Name_Library + ":Util_Table.ApplyWhere: 不明フィールド nFieldIx=[" + nFieldIx + "] フィールド名=[" + o_FldDef.Name_Humaninput + "] [" + parent_EnumLogic + "][" + childReccond.Name_Field + " " + childReccond.EnumOpe + " " + childReccond.Value + "] objValueの型=[" + o_Value.GetType().Name + "]");
                    }
                }//or,and,条件


                nDebug_ChildIndex++;
            }//for


            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_MissField:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー501!", log_Method);

                StringBuilder s = new StringBuilder();
                s.Append("<rec-cond>要素のfield属性エラー");
                s.Append(Environment.NewLine);
                s.Append("field=[");
                s.Append(err_SField);
                s.Append("]");

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(bResult);
        }
示例#58
0
        //────────────────────────────────────────

        /// <summary>
        /// リスト・ビューに、テーブルをセットします。
        /// </summary>
        public void SetDataSourceToListView(
            Table_Humaninput xenonTable, ListView listView, Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0);

            log_Method.BeginMethod(Info_Table.Name_Library, this, "SetDataSourceToListView", log_Reports);

            DataTable dataTable = xenonTable.DataTable;

            listView.Clear();

            // リスト・ビューにフィールドを追加します。
            xenonTable.RecordFielddefinition.ForEach(delegate(Fielddefinition fielddefinition, ref bool isBreak2, Log_Reports log_Reports2)
            {
                // 列を追加します。見出しと幅も設定します。
                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append(fielddefinition.Name_Humaninput);

                if (this.IsVisibled_Fieldtype)
                {
                    // デバッグ用に、フィールドの型もヘッダーに表示する場合。
                    s.Append(":");
                    s.Append(fielddefinition.ToString_Type());
                }

                listView.Columns.Add(s.ToString(), 90);
            }, log_Reports);


            for (int index_Row = 0; index_Row < dataTable.Rows.Count; index_Row++)
            {
                DataRow row = dataTable.Rows[index_Row];

                ListViewItem item = null;

                object[] recordFields = row.ItemArray;//ItemArrayは1回の呼び出しが重い。
                for (int indexColumn = 0; indexColumn < recordFields.Length; indexColumn++)
                {
                    object columnObject = recordFields[indexColumn];

                    if (columnObject is Value_Humaninput)
                    {
                        Value_Humaninput valueH = (Value_Humaninput)columnObject;

                        string valueField = valueH.Text;

                        // レコードを作成します。
                        if (0 == indexColumn)
                        {
                            // 最初の列の場合は、行追加になります。

                            // 文字列を追加。
                            item = new ListViewItem(valueField);
                            listView.Items.Add(item);
                        }
                        else
                        {
                            // 最初の列より後ろは、列追加になります。

                            // 文字列を追加。
                            item.SubItems.Add(valueField);
                        }
                    }
                    else if (columnObject is DBNull)
                    {
                        // 空欄、または列データを未設定。
                        goto gt_Error_DBNull;
                    }
                    else
                    {
                        //エラー
                        goto gt_Error_UnknownType;
                    }
                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_DBNull:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー201!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Newline();
                s.Append("列が未設定(DBNull)。テーブル名=[" + xenonTable.Name + "]");

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_UnknownType:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー202!", log_Method);

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Newline();
                s.Append("未定義の型の列。テーブル名=[" + xenonTable.Name + "]");

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return;
        }
示例#59
0
        // ──────────────────────────────

        public void Perform(
            ref Builder_TexttemplateP1pImpl ref_FormatString,
            DataRowView dataRowView,
            Table_Humaninput xenonTable,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);

            log_Method.BeginMethod(Info_Table.Name_Library, this, "Perform", log_Reports);

            // TODO IDは「前ゼロ付き文字列」または「int型」なので、念のため一度文字列に変換。
            int nP1pNumber = 1;

            foreach (Fieldkey fieldKey in list_FieldKeies)
            {
                //"[" + oTable.Name + "]テーブルの或る行の[" + fieldKey.Name + "]フィールド値。"//valueOTable.SourceFilePath.HumanInputText

                Value_Humaninput valueH = Utility_Row.GetFieldvalue(
                    fieldKey.Name,
                    dataRowView.Row,
                    true,
                    log_Reports,
                    fieldKey.Description
                    );
                if (!log_Reports.Successful)
                {
                    // 既エラー。
                    goto gt_EndMethod;
                }


                // 正常時
                EnumTypeFielddefinition typeFd = FielddefinitionImpl.TypefieldFromString(fieldKey.Name_Type, true, log_Reports);
                switch (typeFd)
                {
                case EnumTypeFielddefinition.String:
                {
                    ref_FormatString.Dictionary_NumberAndValue_Parameter.Add(
                        nP1pNumber,
                        valueH.Text        // String_HumaninputImpl.ParseString(valueH)
                        );
                }
                break;

                case EnumTypeFielddefinition.Int:
                {
                    ref_FormatString.Dictionary_NumberAndValue_Parameter.Add(
                        nP1pNumber,
                        valueH.Text        // Int_HumaninputImpl.ParseString(valueH)
                        );
                }
                break;

                case EnumTypeFielddefinition.Bool:
                {
                    ref_FormatString.Dictionary_NumberAndValue_Parameter.Add(
                        nP1pNumber,
                        valueH.Text        // Bool_HumaninputImpl.ParseString(valueH)
                        );
                }
                break;

                default:
                {
                    // 未定義の型は、string扱い。
                    ref_FormatString.Dictionary_NumberAndValue_Parameter.Add(
                        nP1pNumber,
                        valueH.Text        // String_HumaninputImpl.ParseString(valueH)
                        );
                }
                break;
                }

                nP1pNumber++;
            }//foreach

            // 正常
            goto gt_EndMethod;
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return;
        }
示例#60
0
        //────────────────────────────────────────

        public RecordSetImpl(Table_Humaninput xenonTable)
        {
            this.xenonTable = xenonTable;

            this.list_Field = new List <Dictionary <string, Value_Humaninput> >();
        }