示例#1
0
        //────────────────────────────────────────
        #endregion



        #region 判定
        //────────────────────────────────────────

        public override bool Equals(System.Object obj)
        {
            // 引数がヌルの場合は、偽です。
            if (obj == null)
            {
                return(false);
            }

            // 型が違えば偽です。
            String_HumaninputImpl stringH = obj as String_HumaninputImpl;

            if (null != stringH)
            {
                // 文字列の比較。
                return(this.Text == stringH.Text);
            }

            string str = obj as string;

            if (null != str)
            {
                // 文字列の比較。
                return(this.Text == str);
            }

            return(false);
        }
示例#2
0
        //────────────────────────────────────────

        /// <summary>
        /// O_TableImpl#AddRecordListで使います。
        /// </summary>
        /// <param name="columnIndex"></param>
        /// <param name="value"></param>
        /// <param name="oTable"></param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        public static Value_Humaninput ConfigurationTo_Field(
            int index_Column,
            string value,
            RecordFielddefinition recordFielddefinition,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();

            log_Method.BeginMethod(Info_Table.Name_Library, "Utility_Row", "ConfigurationTo_Field", log_Reports);
            //

            //
            // セルのソースヒント名
            string nodeConfigtree;

            try
            {
                nodeConfigtree = recordFielddefinition.ValueAt(index_Column).Name_Humaninput;
            }
            catch (ArgumentOutOfRangeException)
            {
                // エラー
                goto gt_Error_Index;
            }

            Value_Humaninput result;

            // 型毎に処理を分けます。
            switch (recordFielddefinition.ValueAt(index_Column).Type_Field)
            {
            case EnumTypeFielddefinition.Int:
            {
                // 空白データも自動処理
                Int_HumaninputImpl cellData = new Int_HumaninputImpl(nodeConfigtree);
                cellData.Text = value;
                result        = cellData;
            }
            break;

            case EnumTypeFielddefinition.Bool:
            {
                // 空白データも自動処理
                Bool_HumaninputImpl cellData = new Bool_HumaninputImpl(nodeConfigtree);
                cellData.Text = value;
                result        = cellData;
            }
            break;

            default:
            {
                String_HumaninputImpl cellData = new String_HumaninputImpl(nodeConfigtree);
                cellData.Text = value;
                result        = cellData;
            }
            break;
            }

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

                Log_TextIndented t = new Log_TextIndentedImpl();

                t.Append("列インデックス[" + index_Column + "](0スタート)が指定されましたが、");
                t.Newline();
                t.Append("列は[" + recordFielddefinition.Count + "]個しかありません。(列定義リストは、絞りこまれている場合もあります)");
                t.Newline();

                // ヒント

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

        public static Value_Humaninput NewInstance(
            object value,
            bool isRequired,
            string nodeConfigtree,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);

            log_Method.BeginMethod(Info_Table.Name_Library, "Utility_HumaninputValue", "NewInstance", log_Reports);

            Value_Humaninput result;

            if (value is String_HumaninputImpl)
            {
                result = new String_HumaninputImpl(nodeConfigtree);
            }
            else if (value is Int_HumaninputImpl)
            {
                result = new Int_HumaninputImpl(nodeConfigtree);
            }
            else if (value is Bool_HumaninputImpl)
            {
                result = new Bool_HumaninputImpl(nodeConfigtree);
            }
            else
            {
                result = null;

                if (isRequired)
                {
                    //エラー
                    goto gt_Error_AnotherType;
                }
            }

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

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append("▲エラー201!(" + Info_Table.Name_Library + ")");
                s.Newline();
                s.Append("string,int,boolセルデータクラス以外のオブジェクトが指定されました。");
                s.Newline();

                s.Append("指定された値のクラス=[");
                s.Append(value.GetType().Name);
                s.Append("]");

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(result);
        }
示例#4
0
        //────────────────────────────────────────
        public static Value_Humaninput NewInstance(
            object value,
            bool isRequired,
            string nodeConfigtree,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            log_Method.BeginMethod(Info_Table.Name_Library, "Utility_HumaninputValue", "NewInstance", log_Reports);

            Value_Humaninput result;

            if(value is String_HumaninputImpl)
            {
                result = new String_HumaninputImpl(nodeConfigtree);
            }
            else if(value is Int_HumaninputImpl)
            {
                result = new Int_HumaninputImpl(nodeConfigtree);
            }
            else if(value is Bool_HumaninputImpl)
            {
                result = new Bool_HumaninputImpl(nodeConfigtree);
            }
            else
            {
                result = null;

                if (isRequired)
                {
                    //エラー
                    goto gt_Error_AnotherType;
                }
            }

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

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append("▲エラー201!(" + Info_Table.Name_Library + ")");
                s.Newline();
                s.Append("string,int,boolセルデータクラス以外のオブジェクトが指定されました。");
                s.Newline();

                s.Append("指定された値のクラス=[");
                s.Append(value.GetType().Name);
                s.Append("]");

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return result;
        }
示例#5
0
        //────────────────────────────────────────
        /// <summary>
        /// DataRow → Dictionary
        /// </summary>
        /// <param name="row"></param>
        /// <param name="log_Reports"></param>
        public void Add(DataRow row, Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            log_Method.BeginMethod(Info_Table.Name_Library, this, "Add",log_Reports);

            Dictionary<string, Value_Humaninput> record = new Dictionary<string, Value_Humaninput>();

            int nFieldCount = row.ItemArray.Length;
            for (int nFieldIndex = 0; nFieldIndex < nFieldCount; nFieldIndex++)
            {
                // フィールド名
                string sFieldName = xenonTable.RecordFielddefinition.ValueAt(nFieldIndex).Name_Trimupper;

                // 値
                Value_Humaninput oValue;
                if (row[nFieldIndex] is DBNull)
                {
                    //// デバッグ
                    //if (true)
                    //{
                    //Log_TextIndented txt = new Log_TextIndentedImpl();

                    //    txt.Append(InfxenonTable.LibraryName + ":" + this.GetType().Name + "#Add:【ヌル】");
                    //    txt.Append(" field=[" + sFieldName + "]");

                    //    ystem.Console.WriteLine(txt.ToString());
                    //}

                    String sConfigStack = xenonTable.Expression_Filepath_ConfigStack.Execute4_OnExpressionString(
                        EnumHitcount.Unconstraint, log_Reports);
                    if (!log_Reports.Successful)
                    {
                        // 既エラー。
                        goto gt_EndMethod;
                    }

                    EnumTypeFielddefinition typeField = xenonTable.RecordFielddefinition.ValueAt(nFieldIndex).Type_Field;
                    switch (typeField)
                    {
                        case EnumTypeFielddefinition.String:
                            oValue = new String_HumaninputImpl(sConfigStack);
                            break;
                        case EnumTypeFielddefinition.Int:
                            oValue = new Int_HumaninputImpl(sConfigStack);
                            break;
                        case EnumTypeFielddefinition.Bool:
                            oValue = new Bool_HumaninputImpl(sConfigStack);
                            break;
                        default:
                            // エラー。
                            goto gt_Error_UndefinedType;
                    }
                }
                else
                {
                    oValue = (Value_Humaninput)row[nFieldIndex];

                    //// デバッグ
                    //if (true)
                    //{
                    //Log_TextIndented txt = new Log_TextIndentedImpl();

                    //    txt.Append(InfxenonTable.LibraryName + ":" + this.GetType().Name + "#Add:【○】");
                    //    txt.Append(" 値=[" + oValue.HumanInputString + "]");

                    //    ystem.Console.WriteLine(txt.ToString());
                    //}
                }

                record.Add(sFieldName, oValue);
            }

            this.List_Field.Add(record);

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

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append(" 未定義の型です。プログラムのミスの可能性があります。");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

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

        public void Judge(
            out bool isJudge,
            string name_KeyField,
            string value_Expected,
            bool isRequired_ExpectedValue,//使ってない。
            DataRow row,
            Configuration_Node parent_Query,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();

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

            //

            try
            {
                // 無い列名を指定した場合。
                if (!row.Table.Columns.Contains(name_KeyField))
                {
                    // エラー
                    isJudge = false;
                    goto gt_Error_NothingKeyField;
                }

                Value_Humaninput valueH = (Value_Humaninput)row[name_KeyField];


                //
                // (5)キーが空欄なら、無視します。【文字列型フィールドのみ】
                //
                if (String_HumaninputImpl.IsSpaces(valueH))
                {
                    isJudge = false;
                    goto gt_EndMethod;
                }


                //
                // (6)この行の、キー_フィールドの値を取得。
                //
                string keyValue;
                bool   isParsedSuccessful = String_HumaninputImpl.TryParse(
                    valueH,
                    out keyValue,
                    parent_Query.ToString(),//TODO:本当はテーブル名がいい。 xenonTable.SName,
                    name_KeyField,
                    log_Method,
                    log_Reports);
                if (!log_Reports.Successful)
                {
                    // 既エラー
                    isJudge = false;
                    goto gt_EndMethod;
                }

                if (!isParsedSuccessful)
                {
                    // エラー
                    isJudge = false;
                    if (log_Reports.CanCreateReport)
                    {
                        Log_RecordReports d_Report = log_Reports.BeginCreateReport(EnumReport.Error);
                        d_Report.SetTitle("▲エラー697!", log_Method);
                        d_Report.Message = "string型パース失敗。";
                        log_Reports.EndCreateReport();
                    }
                    goto gt_EndMethod;
                }



                // (8)該当行をレコードセットに追加。
                if (keyValue == value_Expected)
                {
                    isJudge = true;
                }
                else
                {
                    isJudge = false;
                }
            }
            catch (RowNotInTableException)
            {
                // (9)指定行がなかった場合は、スルー。
                isJudge = false;

                //
                // 指定の行は、テーブルの中にありませんでした。
                // 再描画と、行の削除が被ったのかもしれません。
                // いわゆる「処理中」です。
                //

                //.WriteLine(this.GetType().Name+"#GetValueStringList: ["+refTable.Name+"]テーブルには、["+ttbwIndex+"]行が存在しませんでした。もしかすると、削除されたのかもしれません。エラー:"+e.Message);
            }

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

                StringBuilder s = new StringBuilder();
                s.Append("無い列名が指定されました。 sKeyFieldName=[" + name_KeyField + "]");
                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
示例#7
0
        //────────────────────────────────────────
        #endregion



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

        /// <summary>
        /// DataRow → Dictionary
        /// </summary>
        /// <param name="row"></param>
        /// <param name="log_Reports"></param>
        public void Add(DataRow row, Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0);

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

            Dictionary <string, Value_Humaninput> record = new Dictionary <string, Value_Humaninput>();

            int nFieldCount = row.ItemArray.Length;

            for (int nFieldIndex = 0; nFieldIndex < nFieldCount; nFieldIndex++)
            {
                // フィールド名
                string sFieldName = xenonTable.RecordFielddefinition.ValueAt(nFieldIndex).Name_Trimupper;

                // 値
                Value_Humaninput oValue;
                if (row[nFieldIndex] is DBNull)
                {
                    //// デバッグ
                    //if (true)
                    //{
                    //Log_TextIndented txt = new Log_TextIndentedImpl();

                    //    txt.Append(InfxenonTable.LibraryName + ":" + this.GetType().Name + "#Add:【ヌル】");
                    //    txt.Append(" field=[" + sFieldName + "]");

                    //    ystem.Console.WriteLine(txt.ToString());
                    //}

                    String sConfigStack = xenonTable.Expression_Filepath_ConfigStack.Execute4_OnExpressionString(
                        EnumHitcount.Unconstraint, log_Reports);
                    if (!log_Reports.Successful)
                    {
                        // 既エラー。
                        goto gt_EndMethod;
                    }

                    EnumTypeFielddefinition typeField = xenonTable.RecordFielddefinition.ValueAt(nFieldIndex).Type_Field;
                    switch (typeField)
                    {
                    case EnumTypeFielddefinition.String:
                        oValue = new String_HumaninputImpl(sConfigStack);
                        break;

                    case EnumTypeFielddefinition.Int:
                        oValue = new Int_HumaninputImpl(sConfigStack);
                        break;

                    case EnumTypeFielddefinition.Bool:
                        oValue = new Bool_HumaninputImpl(sConfigStack);
                        break;

                    default:
                        // エラー。
                        goto gt_Error_UndefinedType;
                    }
                }
                else
                {
                    oValue = (Value_Humaninput)row[nFieldIndex];

                    //// デバッグ
                    //if (true)
                    //{
                    //Log_TextIndented txt = new Log_TextIndentedImpl();

                    //    txt.Append(InfxenonTable.LibraryName + ":" + this.GetType().Name + "#Add:【○】");
                    //    txt.Append(" 値=[" + oValue.HumanInputString + "]");

                    //    ystem.Console.WriteLine(txt.ToString());
                    //}
                }

                record.Add(sFieldName, oValue);
            }

            this.List_Field.Add(record);

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

                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append(" 未定義の型です。プログラムのミスの可能性があります。");
                s.Append(Environment.NewLine);
                s.Append(Environment.NewLine);

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return;
        }
        //────────────────────────────────────────
        protected void Execute6_Sub(
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute6_Sub", log_Reports);

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

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

            Exception error_Exception;
            string error_Filepath_Export;

            Expression_Node_Filepath pm_FileImportListfile_Expr;
            this.TrySelectAttribute_ExpressionFilepath(out pm_FileImportListfile_Expr, Expression_Node_Function49Impl.PM_FILE_IMPORT_LISTFILE, EnumHitcount.One_Or_Zero, log_Reports);

            Expression_Node_String pm_FieldImportListfile_Expr;
            this.TrySelectAttribute(out pm_FieldImportListfile_Expr, Expression_Node_Function49Impl.PM_FIELD_IMPORT_LISTFILE, EnumHitcount.One, log_Reports);

            Expression_Node_String pm_FilterExtensionImport_Expr;
            this.TrySelectAttribute(out pm_FilterExtensionImport_Expr, Expression_Node_Function49Impl.PM_FILTER_EXTENSION_IMPORT, EnumHitcount.One, log_Reports);

            Expression_Node_Filepath pm_FileExportListfile_Expr;
            this.TrySelectAttribute_ExpressionFilepath(out pm_FileExportListfile_Expr, Expression_Node_Function49Impl.PM_FILE_EXPORT_LISTFILE, EnumHitcount.One_Or_Zero, log_Reports);

            Expression_Node_String pm_FieldExportListfile_Expr;
            this.TrySelectAttribute(out pm_FieldExportListfile_Expr, Expression_Node_Function49Impl.PM_FIELD_EXPORT_LISTFILE, EnumHitcount.One, log_Reports);

            Expression_Node_String pm_TypefieldExportListfile_Expr;
            this.TrySelectAttribute(out pm_TypefieldExportListfile_Expr, Expression_Node_Function49Impl.PM_TYPEFIELD_EXPORT_LISTFILE, EnumHitcount.One, log_Reports);

            Expression_Node_String pm_CommentfieldExportListfile_Expr;
            this.TrySelectAttribute(out pm_CommentfieldExportListfile_Expr, Expression_Node_Function49Impl.PM_COMMENTFIELD_EXPORT_LISTFILE, EnumHitcount.One, log_Reports);

            Expression_Node_String pm_RegularexpressionReplacebeforeNamefileexport_Expr;
            this.TrySelectAttribute(out pm_RegularexpressionReplacebeforeNamefileexport_Expr, Expression_Node_Function49Impl.PM_REGULAREXPRESSION_REPLACEBEFORE_NAMEFILEEXPORT, EnumHitcount.One_Or_Zero, log_Reports);

            Expression_Node_String pm_RegularexpressionReplaceafterNamefileexport_Expr;
            this.TrySelectAttribute(out pm_RegularexpressionReplaceafterNamefileexport_Expr, Expression_Node_Function49Impl.PM_REGULAREXPRESSION_REPLACEAFTER_NAMEFILEEXPORT, EnumHitcount.One_Or_Zero, log_Reports);

            Expression_Node_Filepath pm_FolderSource_Expr;
            this.TrySelectAttribute_ExpressionFilepath(out pm_FolderSource_Expr, Expression_Node_Function49Impl.PM_FOLDER_SOURCE, EnumHitcount.One_Or_Zero, log_Reports);

            Expression_Node_Filepath pm_FolderDestination_Expr;
            this.TrySelectAttribute_ExpressionFilepath(out pm_FolderDestination_Expr, Expression_Node_Function49Impl.PM_FOLDER_DESTINATION, EnumHitcount.One_Or_Zero, log_Reports);

            //ポップアップ指定
            string pm_Popup;
            this.TrySelectAttribute(out pm_Popup, Expression_Node_Function49Impl.PM_POPUP, EnumHitcount.One_Or_Zero, log_Reports);
            pm_Popup = pm_Popup.Trim();

            // メッセージボックスの表示。
            {
                Log_TextIndented str_Messagebox = new Log_TextIndentedImpl();
                str_Messagebox.Append(log_Method.Fullname);
                str_Messagebox.Append(":");
                str_Messagebox.Append(Environment.NewLine);

                this.Dictionary_Expression_Attribute.ToText_Debug(str_Messagebox, log_Reports);

                str_Messagebox.Append(
                    "file-import-listfile=[" + pm_FileImportListfile_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]\n\n" +
                    "field-import-listfile=[" + pm_FieldImportListfile_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]\n\n" +
                    "filter-extension-import=[" + pm_FilterExtensionImport_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]\n\n" +

                    "file-export-listfile=[" + pm_FileExportListfile_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]\n\n" +
                    "field-export-listfile=[" + pm_FieldExportListfile_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]\n\n" +
                    "typefield-export-listfile=[" + pm_TypefieldExportListfile_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]\n\n" +
                    "commentfield-export-listfile=[" + pm_CommentfieldExportListfile_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]\n\n" +

                    "regularexpression-replacebefore-namefileexport=[" + pm_RegularexpressionReplacebeforeNamefileexport_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]\n\n" +
                    "regularexpression-replaceafter-namefileexport=[" + pm_RegularexpressionReplaceafterNamefileexport_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]\n\n" +

                    "folder-source=[" + pm_FolderSource_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]\n\n" +
                    "folder-destination=[" + pm_FolderDestination_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]\n\n" +
                    "pm_Popup=[" + pm_Popup + "]\n\n"
                    );

                MessageBox.Show(str_Messagebox.ToString(), "デバッグ表示");
            }

            //書出し先ファイルパス。
            string filepath_Export = "";
            try
            {
                filepath_Export = pm_FileExportListfile_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);

                if ("" == filepath_Export)
                {
                    //エラー
                    error_Exception = null;
                    error_Filepath_Export = filepath_Export;
                    goto gt_Error_FilepathExport;
                }

            }
            catch (Exception ex)
            {
                //エラー
                error_Exception = ex;
                error_Filepath_Export = filepath_Export;
                goto gt_Error_FilepathExport;
            }

            // 「ファイル・リスト」CSVファイル読取り
            Table_Humaninput tableH;
            if (log_Reports.Successful)
            {
                CsvTo_Table_HumaninputImpl reader = new CsvTo_Table_HumaninputImpl();

                Request_ReadsTable request_Reads = new Request_ReadsTableImpl();
                Format_Table_Humaninput tblFormat_puts = new Format_Table_HumaninputImpl();
                request_Reads.Name_PutToTable = log_Method.Fullname;//暫定
                request_Reads.Expression_Filepath = pm_FileImportListfile_Expr;

                tableH = reader.Read(
                    request_Reads,
                    tblFormat_puts,
                    true,
                    log_Reports
                    );
            }
            else
            {
                tableH = null;
            }

            // CSVに列追加。
            string name_FieldNew;
            int index_FieldNew;
            if (log_Reports.Successful)
            {
                name_FieldNew = pm_FieldExportListfile_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                string name_Typefield = pm_TypefieldExportListfile_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                Fielddefinition fielddefinition_New = new FielddefinitionImpl(name_FieldNew, FielddefinitionImpl.TypefieldFromString(name_Typefield, true, log_Reports));
                fielddefinition_New.Comment = pm_CommentfieldExportListfile_Expr.Execute4_OnExpressionString(Syntax.EnumHitcount.Unconstraint, log_Reports);
                tableH.AddField(fielddefinition_New, true, log_Reports);

                index_FieldNew = tableH.RecordFielddefinition.ColumnIndexOf_Trimupper(name_FieldNew);
            }
            else
            {
                index_FieldNew = -1;
            }

            string regularexpression_Replacebefore_Namefileexport = pm_RegularexpressionReplacebeforeNamefileexport_Expr.Execute4_OnExpressionString(Syntax.EnumHitcount.Unconstraint, log_Reports);
            string regularexpression_Replaceafter_Namefileexport = pm_RegularexpressionReplaceafterNamefileexport_Expr.Execute4_OnExpressionString(Syntax.EnumHitcount.Unconstraint, log_Reports);
            string name_FieldSource = pm_FieldImportListfile_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);// "FILE"
            if (log_Reports.Successful)
            {
                //
                // CSVソースファイル読取
                //

                int rowNumber = 1;
                tableH.ForEach_Datapart(delegate(Record_Humaninput recordH, ref bool isBreak2, Log_Reports log_Reports2)
                {
                    //記述されているファイルパス
                    string filepath_Source_Cur;
                    if (log_Reports.Successful)
                    {
                        String_HumaninputImpl.TryParse(
                            recordH.ValueAt(name_FieldSource),
                            out filepath_Source_Cur, "", "", log_Method, log_Reports);
                    }
                    else
                    {
                        filepath_Source_Cur = "";
                    }

                    if ("" == filepath_Source_Cur)
                    {
                        //空欄なら無視。
                        goto gt_EndInnermethod;
                    }

                    Configurationtree_NodeFilepath filepathCur_Conf;
                    if (log_Reports.Successful)
                    {
                        filepathCur_Conf = new Configurationtree_NodeFilepathImpl(log_Method.Fullname, null);
                        filepathCur_Conf.InitPath(filepath_Source_Cur, log_Reports);
                    }
                    else
                    {
                        filepathCur_Conf = null;
                    }

                    Expression_Node_Filepath filepathCur_Expr;
                    if (log_Reports.Successful)
                    {
                        filepathCur_Expr = new Expression_Node_FilepathImpl(filepathCur_Conf);
                    }
                    else
                    {
                        filepathCur_Expr = null;
                    }

                    //頭をカットする
                    Expression_Node_Filepath fileDestination_Expr;
                    if (log_Reports.Successful)
                    {
                        string filepath_Destination_New1;
                        filepathCur_Expr.TryCutFolderpath(out filepath_Destination_New1, pm_FolderSource_Expr, true, log_Reports);

                        //転送先パスの作成
                        Configurationtree_NodeFilepath fileDestination_Conf = new Configurationtree_NodeFilepathImpl(log_Method.Fullname, null);
                        fileDestination_Conf.InitPath(pm_FolderDestination_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), filepath_Destination_New1, log_Reports);

                        fileDestination_Expr = new Expression_Node_FilepathImpl(fileDestination_Conf);
                    }
                    else
                    {
                        fileDestination_Expr = null;
                    }

                    if (!log_Reports.Successful)
                    {
                        //エラー
                        isBreak2 = true;
                        goto gt_EndInnermethod;
                    }

                    //
                    //ソース側の拡張子を確認したい。
                    //
                    string extension;
                    string filterExtension = pm_FilterExtensionImport_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint,log_Reports);
                    List<string> list_FilterExtension = new CsvTo_ListImpl().Read(filterExtension);
                    fileDestination_Expr.TryGetExtension(out extension,log_Reports);
                    //log_Method.WriteDebug_ToConsole("拡張子=[" + extension + "](要素数=" + list_FilterExtension.Count + ") フィルター=[" + filterExtension + "] 含まれる?=[" + list_FilterExtension.Contains(extension) + "]");

                    if (list_FilterExtension.Contains(extension))
                    {
                        //フィルターに含まれる

                        //出力側のファイルパス
                        Value_Humaninput valueH_New = new String_HumaninputImpl(log_Method.Fullname);
                        valueH_New.Text = fileDestination_Expr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);

                        //ファイル名を正規表現で置換をするか否か
                        if("" != regularexpression_Replacebefore_Namefileexport)
                        {
                            Match m1 = Regex.Match(valueH_New.Text, regularexpression_Replacebefore_Namefileexport);
                            if (m1.Success)
                            {
                                //ファイルパスを正規表現で置換します。
                                valueH_New.Text = System.Text.RegularExpressions.Regex.Replace(
                                    valueH_New.Text,
                                    regularexpression_Replacebefore_Namefileexport,
                                    regularexpression_Replaceafter_Namefileexport
                                    );
                            }
                            else
                            {
                                //【2012-10-24 追加】
                                //置換が指定されているのに置換ができなかった場合は、空文字列に変換します。
                                valueH_New.Text = "";
                            }

                        }

                        //
                        // レコードの追加列に値セット。
                        //
                        recordH.SetValueAt(index_FieldNew, valueH_New, log_Reports);
                    }
                    else
                    {
                    }

                    //
                gt_EndInnermethod:
                    rowNumber++;
                }, log_Reports);
            }

            //自動連番を振ります。
            if (log_Reports.Successful)
            {
                tableH.RenumberingNoField();
            }

            //CSVファイルの書出し
            if (log_Reports.Successful)
            {
                string text_Csv = new ToCsv_Table_Humaninput_Impl().ToCsvText(tableH, log_Reports);

                try
                {

                    System.IO.File.WriteAllText(
                        filepath_Export,
                        text_Csv,
                        Global.ENCODING_CSV
                        );

                    if (pm_Popup != S_BLOCK)
                    {
                        Log_TextIndented s = new Log_TextIndentedImpl();

                        s.Append("ファイルに書き込みました。");
                        s.Newline();
                        s.Append("[");
                        s.Append(filepath_Export);
                        s.Append("]");
                        s.Newline();
                        s.Newline();

                        MessageBox.Show(s.ToString(), "▲実行結果!(L02)");
                    }
                }
                catch (Exception ex)
                {
                    //エラー
                    error_Exception = ex;
                    error_Filepath_Export = filepath_Export;
                    goto gt_Error_Exception;
                }
            }

            goto gt_EndMethod;
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_FilepathExport:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Exception(error_Exception), log_Reports);//例外メッセージ
                tmpl.SetParameter(2, error_Filepath_Export, log_Reports);//出力先ファイルパス

                this.Owner_MemoryApplication.CreateErrorReport("Er:110031;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_Exception:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Exception(error_Exception), log_Reports);//例外メッセージ
                tmpl.SetParameter(2, error_Filepath_Export, log_Reports);//出力先ファイルパス

                this.Owner_MemoryApplication.CreateErrorReport("Er:110032;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
示例#9
0
        //────────────────────────────────────────

        public Value_Humaninput NewField(string nodeConfigtree, Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0);

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

            Value_Humaninput result;

            switch (this.Type_Field)
            {
            case EnumTypeFielddefinition.String:
            {
                result = new String_HumaninputImpl(nodeConfigtree);
            }
            break;

            case EnumTypeFielddefinition.Int:
            {
                result = new Int_HumaninputImpl(nodeConfigtree);
            }
            break;

            case EnumTypeFielddefinition.Bool:
            {
                result = new Bool_HumaninputImpl(nodeConfigtree);
            }
            break;

            default:
            {
                // 未該当
                result = null;
                goto gt_Error_Unspported;
            }
            }

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

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.Append("フィールド定義を元にして、フィールド値を用意しようとしましたが、未定義のフィールド型でした。");
                s.Newline();

                s.Append("this.Type.ToString()=[");
                s.Append(this.ToString_Type());
                s.Append("]");
                s.Newline();

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return(result);
        }
示例#10
0
        //────────────────────────────────────────
        /// <summary>
        /// 選択されているセルに、指定の値を上書きします。
        /// </summary>
        /// <param nFcName="outputValueStr"></param>
        /// <param nFcName="row"></param>
        /// <param nFcName="selFldDefinition">選択フィールド</param>
        /// <param nFcName="log_Reports"></param>
        public void ToMemory_ToSelectedField(
            string sValue_Output,
            Expression_Node_String ec_Fcell,
            DataRow row,
            Fielddefinition selFldDefinition,//選択したフィールド定義
            Log_Reports log_Reports
            )
        {
            //essageBox.Show("アップデートデータ【開始】 outputValueStr=[" + outputValueStr + "]\n", "(FormsImpl)" + this.GetType().NFcName );

            //.WriteLine(this.GetType().NFcName + "#: 【開始】データのアップデートを始める。");

            Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            pg_Method.BeginMethod(Info_Controls.Name_Library, this, "ToM_ToSelectedField",log_Reports);
            //
            //

            string sName_SelectedFld;
            {
                bool bHit = ec_Fcell.TrySelectAttribute(
                    out sName_SelectedFld,
                    PmNames.S_SELECT.Name_Pm,
                    EnumHitcount.One,
                    log_Reports
                    );
            }

            string sConfigStack_StringOfCell = sName_SelectedFld;

            switch (selFldDefinition.Type_Field)
            {
                case EnumTypeFielddefinition.String:
                    {
                        // 空欄も自動処理
                        String_HumaninputImpl cellData = new String_HumaninputImpl(sConfigStack_StringOfCell);
                        cellData.Text = sValue_Output;

                        row[sName_SelectedFld] = cellData;
                    }
                    break;
                case EnumTypeFielddefinition.Int:
                    {
                        // 空欄も自動処理
                        Int_HumaninputImpl cellData = new Int_HumaninputImpl(sConfigStack_StringOfCell);
                        cellData.Text = sValue_Output;
                        row[sName_SelectedFld] = cellData;
                    }
                    break;
                case EnumTypeFielddefinition.Bool:
                    {
                        // 空欄も自動処理
                        Bool_HumaninputImpl cellData = new Bool_HumaninputImpl(sConfigStack_StringOfCell);
                        cellData.Text = sValue_Output;
                        row[sName_SelectedFld] = cellData;
                    }
                    break;
                default:
                    {
                        if (log_Reports.CanCreateReport)
                        {
                            Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                            r.SetTitle("▲エラー398!", pg_Method);

                            StringBuilder t = new StringBuilder();

                            t.Append("予期しない、フィールドの型です。");
                            t.Append(Environment.NewLine);
                            t.Append("selFldDefinition.Type=[");
                            t.Append(selFldDefinition.ToString_Type());
                            t.Append("]");
                            t.Append(Environment.NewLine);
                            t.Append(Environment.NewLine);

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

                            r.Message = t.ToString();
                            log_Reports.EndCreateReport();
                        }
                    }
                    break;
            }

            //
            pg_Method.EndMethod(log_Reports);
        }
示例#11
0
        //────────────────────────────────────────
        public Value_Humaninput NewField(string nodeConfigtree, Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            log_Method.BeginMethod(Info_Table.Name_Library, this, "NewField", log_Reports);

            Value_Humaninput result;

            switch (this.Type_Field)
            {
                case EnumTypeFielddefinition.String:
                    {
                        result = new String_HumaninputImpl(nodeConfigtree);
                    }
                    break;
                case EnumTypeFielddefinition.Int:
                    {
                        result = new Int_HumaninputImpl(nodeConfigtree);
                    }
                    break;
                case EnumTypeFielddefinition.Bool:
                    {
                        result = new Bool_HumaninputImpl(nodeConfigtree);
                    }
                    break;
                default:
                    {
                        // 未該当
                        result = null;
                        goto gt_Error_Unspported;
                    }
            }

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

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.Append("フィールド定義を元にして、フィールド値を用意しようとしましたが、未定義のフィールド型でした。");
                s.Newline();

                s.Append("this.Type.ToString()=[");
                s.Append(this.ToString_Type());
                s.Append("]");
                s.Newline();

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return result;
        }
示例#12
0
        /// <summary>
        /// 空行を作成します。
        /// </summary>
        /// <returns></returns>
        public Record_Humaninput CreateNewRecord(string config, Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            log_Method.BeginMethod(Info_Table.Name_Library, this, "CreateNewRecord", log_Reports);

            // 新しいレコードを1つ作ります。
            DataRow newDataRow = this.DataTable.NewRow();
            // 全ての列は現在、DBNullになっています。

            // ひとまず、全ての列に有効なインスタンスを設定します。

            int indexColumn = 0;
            this.RecordFielddefinition.ForEach(delegate(Fielddefinition fielddefinition, ref bool isBreak2, Log_Reports log_Reports2)
            {
                // 列の型を調べます。

                // セルのソースヒント名
                string nodeConfigtree_NameOfCell;
                if ("" == fielddefinition.Name_Trimupper)
                {
                    // 名無しフィールド

                    // フィールド名がないので、インデックスで指定します。
                    Log_TextIndented s = new Log_TextIndentedImpl();
                    s.Append("(");
                    s.Append(indexColumn);
                    s.Append(")番フィールド");
                    nodeConfigtree_NameOfCell = s.ToString();
                }
                else
                {
                    nodeConfigtree_NameOfCell = fielddefinition.Name_Humaninput;
                }

                switch (fielddefinition.Type_Field)
                {
                    case EnumTypeFielddefinition.String:
                        {
                            String_HumaninputImpl stringH = new String_HumaninputImpl(nodeConfigtree_NameOfCell);
                            stringH.Text = "";

                            if ("" == fielddefinition.Name_Trimupper)
                            {
                                // 名無しフィールド
                                // フィールド名がないので、インデックスで指定します。
                                newDataRow[indexColumn] = stringH;
                            }
                            else
                            {
                                newDataRow[fielddefinition.Name_Trimupper] = stringH;
                            }
                        }
                        break;
                    case EnumTypeFielddefinition.Int:
                        {
                            Int_HumaninputImpl intH = new Int_HumaninputImpl(nodeConfigtree_NameOfCell);
                            intH.Text = "";

                            if ("" == fielddefinition.Name_Trimupper)
                            {
                                // 名無しフィールド
                                // フィールド名がないので、インデックスで指定します。
                                newDataRow[indexColumn] = intH;
                            }
                            else
                            {
                                newDataRow[fielddefinition.Name_Trimupper] = intH;
                            }
                        }
                        break;
                    case EnumTypeFielddefinition.Bool:
                        {
                            Bool_HumaninputImpl boolH = new Bool_HumaninputImpl(nodeConfigtree_NameOfCell);
                            boolH.Text = "";

                            if ("" == fielddefinition.Name_Trimupper)
                            {
                                // 名無しフィールド
                                // フィールド名がないので、インデックスで指定します。
                                newDataRow[indexColumn] = boolH;
                            }
                            else
                            {
                                newDataRow[fielddefinition.Name_Trimupper] = boolH;
                            }
                        }
                        break;
                    default:
                        {
                            // 正常(警告は出したい)

                            if (log_Reports.CanCreateReport)
                            {
                                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Warning);
                                r.SetTitle("▲エラー431!", log_Method);

                                Log_TextIndented s = new Log_TextIndentedImpl();
                                s.Newline();
                                s.Append("この列は、未定義の型です。[" + fielddefinition.ToString_Type() + "]");
                                r.Message = s.ToString();

                                log_Reports.EndCreateReport();
                            }

                            // 文字列型を入れる。
                            String_HumaninputImpl stringH = new String_HumaninputImpl(nodeConfigtree_NameOfCell);
                            stringH.Text = "";

                            if ("" == fielddefinition.Name_Trimupper)
                            {
                                // 名無しフィールド
                                // フィールド名がないので、インデックスで指定します。
                                newDataRow[indexColumn] = stringH;
                            }
                            else
                            {
                                newDataRow[fielddefinition.Name_Trimupper] = stringH;
                            }
                        }
                        break;
                }

                indexColumn++;
            }, log_Reports);

            goto gt_EndMethod;
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return new Record_HumaninputImpl(config, newDataRow, this);
        }
示例#13
0
        /// <summary>
        /// データを渡すことで、テーブルを作成します。
        /// テーブルの型定義と、データを渡します。
        /// 
        /// TODO:データテーブルによって新行を作成するので、データテーブルの列定義と、列定義リストは合わせて置かなければならない。
        /// 
        /// </summary>
        /// <param name="rows"></param>
        /// <param name="fldDefList">列定義は絞りこまれている場合もあります。</param>
        /// <param name="d_Logging_OrNull"></param>
        public void AddRecordList(
            List<List<string>> rows, RecordFielddefinition recordFielddefinition, Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl();
            log_Method.BeginMethod(Info_Table.Name_Library, this, "AddRecordList",log_Reports);
            //

            string error_NameColumn_TrimUpper;
            Exception error_Excep;
            DataRow error_DataRow;
            List<string> error_List_NameColumn;
            int error_indexColumn;

            // テーブルデータを作成します。
            for (int indexRow = 0; indexRow < rows.Count; indexRow++)
            {
                List<string> list_NameColumn = rows[indexRow];

                // 行オブジェクトを作成。
                DataRow dataRow = this.dataTable.NewRow();

                // TODO:これで合ってる? 入力テーブルの行数と、列定義の列数、小さい方に合わせます。(2012-02-11/仕様変更)
                int indexEndover;
                if (list_NameColumn.Count < recordFielddefinition.Count)
                {
                    indexEndover = list_NameColumn.Count;
                }
                else
                {
                    indexEndover = recordFielddefinition.Count;
                }

                // 行の列数ではなく、列定義の列数でループを回します。
                // 絞りこまれていることがあるからです。
                for (int indexColumn = 0; indexColumn < indexEndover; indexColumn++)
                {
                    // 引き渡されたデータを、行オブジェクトにセット
                    string nameColumn_TrimUpper = recordFielddefinition.ValueAt(indexColumn).Name_Trimupper;
                    if ("" == nameColumn_TrimUpper)
                    {
                        // 列定義になく、データ領域に溢れていたので追加された列か、
                        // 列名なしの列。

                        if (recordFielddefinition.Count <= indexColumn)
                        {
                            // フィールドを追加。
                            // 列名: 空文字列
                            // 値の型:OValue_StringImpl
                            this.dataTable.Columns.Add("", typeof(String_HumaninputImpl));
                        }

                        // セルのソースヒント名
                        string nodeConfigtreeOfCell;
                        {
                            // フィールド名がないので、インデックスで指定します。
                            Log_TextIndented s = new Log_TextIndentedImpl();
                            s.Append("(");
                            s.Append(indexColumn);
                            s.Append(")番フィールド");
                            nodeConfigtreeOfCell = s.ToString();
                        }

                        // 列名がないので、列インデックスで指定して、データを追加。
                        // 値の型:OValue_StringImpl
                        String_HumaninputImpl stringH = new String_HumaninputImpl(nodeConfigtreeOfCell);
                        stringH.Text = list_NameColumn[indexColumn];
                        dataRow[indexColumn] = stringH;
                    }
                    else
                    {
                        if (list_NameColumn.Count <= indexColumn)
                        {
                            // エラー
                            error_DataRow = dataRow;
                            error_List_NameColumn = list_NameColumn;
                            error_indexColumn = indexColumn;
                            goto gt_Error_ColumnIndexOver;
                        }

                        // 値を格納。
                        Value_Humaninput valueH = Utility_Row.ConfigurationTo_Field(//TODO:
                            indexColumn,
                            list_NameColumn[indexColumn],
                            recordFielddefinition,
                            log_Reports
                            );

                        try
                        {
                            dataRow[nameColumn_TrimUpper] = valueH;
                        }
                        catch (ArgumentException e)
                        {
                            error_DataRow = dataRow;
                            error_NameColumn_TrimUpper = nameColumn_TrimUpper;
                            error_Excep = e;
                            goto gt_Error_Field;
                        }
                    }
                }

                // テーブルに行オブジェクトをセット
                this.dataTable.Rows.Add(dataRow);
            }

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

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.Append("列定義の個数より フィールド数の少ない入力テーブルが指定されました。");
                s.Newline();

                s.Append("実データのこの行の列数[");
                s.Append(error_List_NameColumn.Count);
                s.Append("] 指定した列インデックス=[");
                s.Append(error_indexColumn);
                s.Append("] フィールド定義の個数=[");
                s.Append(recordFielddefinition.Count);
                s.Append("]");
                s.Newline();

                s.Append("──────────────────────────────テーブルに存在する列名");
                s.Newline();
                foreach (DataColumn col in error_DataRow.Table.Columns)
                {
                    s.Append("実列名=[" + col.ColumnName + "]");
                    s.Newline();
                }
                s.Append("──────────────────────────────");
                s.Newline();

                s.Append("──────────────────────────────定義に存在する列名");
                s.Newline();
                s.Append("定義列名=[" + recordFielddefinition.ToString_DebugDump() + "]");
                s.Newline();
                s.Append("──────────────────────────────");
                s.Newline();

                // ヒント

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

                Log_TextIndented s = new Log_TextIndentedImpl();

                s.Append("フィールド名[" + error_NameColumn_TrimUpper + "]が指定されましたが、ありません。");
                s.Newline();

                s.Append("──────────────────────────────テーブルに存在する列名");
                s.Newline();
                foreach (DataColumn col in error_DataRow.Table.Columns)
                {
                    s.Append("実列名=[" + col.ColumnName + "]");
                    s.Newline();
                }
                s.Append("──────────────────────────────");
                s.Newline();

                s.Append("──────────────────────────────定義に存在する列名");
                s.Newline();
                s.Append("定義列名=[" + recordFielddefinition.ToString_DebugDump() + "]");
                s.Newline();
                s.Append("──────────────────────────────");
                s.Newline();

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

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
示例#14
0
        //────────────────────────────────────────
        /// <summary>
        /// 指定のstring型フィールドの値で指定したレコードを返します。なければヌルです。
        /// </summary>
        /// <param name="fieldName"></param>
        /// <param name="expectedInt"></param>
        /// <returns>一致しなければヌル。</returns>
        public List<Record_Humaninput> SelectByString(
            string name_Field,
            String_HumaninputImpl valuestring_Expected,
            EnumHitcount hits,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();
            log_Method.BeginMethod(Info_Table.Name_Library, this, "SelectByString", log_Reports);
            //

            List<Record_Humaninput> list_Result = new List<Record_Humaninput>();

            string string_Expected;

            bool isParsed = String_HumaninputImpl.TryParse(
                valuestring_Expected,
                out string_Expected,
                "",
                "",
                log_Method,
                log_Reports
                );
            if (!log_Reports.Successful || !isParsed)
            {
                // 既エラー
                goto gt_EndMethod;
            }

            Exception error_Excp;
            try
            {
                foreach (DataRow dataRow in this.DataTable.Rows)
                {

                    Value_Humaninput valueH = (Value_Humaninput)dataRow[name_Field];

                    if (valueH is String_HumaninputImpl)
                    {
                        String_HumaninputImpl stringH = (String_HumaninputImpl)valueH;

                        if (!stringH.IsValidated)
                        {
                            // エラーデータなら無視
                        }
                        else
                        {
                            string exists;

                            bool isParsed2 = String_HumaninputImpl.TryParse(
                                stringH,
                                out exists,
                                "",
                                "",
                                log_Method,
                                log_Reports
                                );
                            if (!log_Reports.Successful)
                            {
                                // 既エラー
                                goto gt_EndMethod;
                            }

                            if (isParsed2)
                            {
                                if (string_Expected == exists)
                                {
                                    // 一致すれば。
                                    list_Result.Add(new Record_HumaninputImpl( log_Method.Fullname, dataRow, this));

                                    if (hits == EnumHitcount.First_Exist)
                                    {
                                        // 正常
                                        goto gt_EndMethod;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                // ArgumentException: 指定した名前の列がなかった場合など。
                error_Excp = e;
                goto gt_Error_Exception;
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_Exception:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー653!", log_Method);
                Log_TextIndented s = new Log_TextIndentedImpl();
                s.Append(r.Message_SException(error_Excp));

                r.Message = s.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            if (hits == EnumHitcount.First_Exist && list_Result.Count != 1)
            {
                // 必ず存在する最初の1件を返さなければなりませんが、そうではありませんでした。
                if (log_Reports.CanCreateReport)
                {
                    Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                    r.SetTitle("▲エラー654!", log_Method);

                    Log_TextIndented s = new Log_TextIndentedImpl();
                    s.Append("必ず存在する最初の1件を返さなければなりませんが、そうではありませんでした。");
                    s.Newline();
                    s.Append("count=[");
                    s.Append(list_Result.Count);
                    s.Append("]");

                    r.Message = s.ToString();
                    log_Reports.EndCreateReport();
                }
            }
            log_Method.EndMethod(log_Reports);
            return list_Result;
        }
示例#15
0
        //────────────────────────────────────────
        /// <summary>
        /// O_TableImpl#AddRecordListで使います。
        /// </summary>
        /// <param name="columnIndex"></param>
        /// <param name="value"></param>
        /// <param name="oTable"></param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        public static Value_Humaninput ConfigurationTo_Field(
            int index_Column,
            string value,
            RecordFielddefinition recordFielddefinition,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl();
            log_Method.BeginMethod(Info_Table.Name_Library, "Utility_Row", "ConfigurationTo_Field", log_Reports);
            //

            //
            // セルのソースヒント名
            string nodeConfigtree;
            try
            {
                nodeConfigtree = recordFielddefinition.ValueAt(index_Column).Name_Humaninput;
            }
            catch (ArgumentOutOfRangeException)
            {
                // エラー
                goto gt_Error_Index;
            }

            Value_Humaninput result;

            // 型毎に処理を分けます。
            switch (recordFielddefinition.ValueAt(index_Column).Type_Field)
            {
                case EnumTypeFielddefinition.Int:
                    {
                        // 空白データも自動処理
                        Int_HumaninputImpl cellData = new Int_HumaninputImpl(nodeConfigtree);
                        cellData.Text = value;
                        result = cellData;
                    }
                    break;
                case EnumTypeFielddefinition.Bool:
                    {
                        // 空白データも自動処理
                        Bool_HumaninputImpl cellData = new Bool_HumaninputImpl(nodeConfigtree);
                        cellData.Text = value;
                        result = cellData;
                    }
                    break;
                default:
                    {
                        String_HumaninputImpl cellData = new String_HumaninputImpl(nodeConfigtree);
                        cellData.Text = value;
                        result = cellData;
                    }
                    break;
            }

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

                Log_TextIndented t = new Log_TextIndentedImpl();

                t.Append("列インデックス[" + index_Column + "](0スタート)が指定されましたが、");
                t.Newline();
                t.Append("列は[" + recordFielddefinition.Count + "]個しかありません。(列定義リストは、絞りこまれている場合もあります)");
                t.Newline();

                // ヒント

                r.Message = t.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return result;
        }