コード例 #1
0
        //────────────────────────────────────────

        private void Execute6_Sub(Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0);

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


            string sFlowSkip;

            this.TrySelectAttribute(out sFlowSkip, Expression_Node_Function04Impl.PM_FLOWSKIP, EnumHitcount.One_Or_Zero, log_Reports);
            if ("" != sFlowSkip.Trim())
            {
                // 処理をスキップします。
                goto gt_EndMethod;
            }


            //
            //
            //
            // テーブル名
            //
            //
            //
            List <string> sList_TableName = new List <string>();

            {
                string sTableNames;
                this.TrySelectAttribute(out sTableNames, Expression_Node_Function04Impl.PM_NAME_TABLE, EnumHitcount.One_Or_Zero, log_Reports);

                CsvTo_DataTableImpl reader        = new CsvTo_DataTableImpl();
                DataTable           tblNamesTable = reader.Read(
                    sTableNames
                    );

                foreach (DataRow row in tblNamesTable.Rows)
                {
                    foreach (string column in row.ItemArray)
                    {
                        sList_TableName.Add(column);
                    }
                }
            }

            foreach (string sTableName in sList_TableName)
            {
                Table_Humaninput o_Table;
                if (log_Reports.Successful)
                {
                    Expression_Node_String ec_ArgTableName;
                    this.TrySelectAttribute(out ec_ArgTableName, Expression_Node_Function04Impl.PM_NAME_TABLE, EnumHitcount.One_Or_Zero, log_Reports);

                    Expression_Node_StringImpl ec_TableName = new Expression_Node_StringImpl(this, ec_ArgTableName.Cur_Configuration);
                    ec_TableName.AppendTextNode(
                        sTableName,
                        this.Cur_Configuration,
                        log_Reports
                        );

                    // テーブル
                    o_Table = this.Owner_MemoryApplication.MemoryTables.GetTable_HumaninputByName(
                        ec_TableName,
                        true,
                        log_Reports
                        );
                }
                else
                {
                    o_Table = null;
                }

                string sCsvText;
                if (log_Reports.Successful)
                {
                    ToCsv_Table_Humaninput_Impl textizer = new ToCsv_Table_Humaninput_Impl();
                    sCsvText = textizer.ToCsvText(o_Table, log_Reports);
                    if (!log_Reports.Successful)
                    {
                        // 既エラー。
                        goto gt_EndMethod;
                    }
                }
                else
                {
                    sCsvText = null;
                }

                string sFpatha;//絶対ファイルパス
                if (log_Reports.Successful)
                {
                    // 正常時

                    //essageBox.Show("テーブルのtext=[" + csvText + "]", "デバッグ");

                    // TODO ファイルパスの妥当性判定も欲しい
                    sFpatha = o_Table.Expression_Filepath_ConfigStack.Execute4_OnExpressionString(
                        EnumHitcount.Unconstraint, log_Reports);
                    if (!log_Reports.Successful)
                    {
                        // 既エラー。
                        goto gt_EndMethod;
                    }
                }
                else
                {
                    sFpatha = "";
                }

                if (log_Reports.Successful)
                {
                    bool   bPopup;
                    string sPopup;
                    this.TrySelectAttribute(out sPopup, Expression_Node_Function04Impl.PM_POPUP, EnumHitcount.One_Or_Zero, log_Reports);

                    if ("block" == sPopup.Trim())
                    {
                        log_Method.WriteInfo_ToConsole("sPopup=[" + sPopup + "] ポップアップしません。");
                        bPopup = false;
                    }
                    else
                    {
                        bPopup = true;
                    }

                    CsvWriterImpl writer = new CsvWriterImpl();
                    writer.Write(
                        sCsvText, sFpatha, bPopup);
                }
            }

gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
コード例 #2
0
        //────────────────────────────────────────
        #endregion



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

        /// <summary>
        /// アクション実行。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public override string Execute5_Main(Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0);

            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_Ea)
            {
                if (this.Functionparameterset.Sender is Customcontrol)
                {
                    Customcontrol fcCc = (Customcontrol)this.Functionparameterset.Sender;

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

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



                // テーブル
                Table_Humaninput o_Table_Src;
                {
                    Expression_Node_String ec_ArgTableName;
                    this.TrySelectAttribute(out ec_ArgTableName, Expression_Node_Function05Impl.PM_NAME_TABLE_SOURCE, EnumHitcount.One_Or_Zero, log_Reports);

                    o_Table_Src = this.Owner_MemoryApplication.MemoryTables.GetTable_HumaninputByName(
                        ec_ArgTableName,
                        true,
                        log_Reports
                        );
                }

                //
                // 書き出すテキスト
                //
                string sCsvText;
                {
                    ToCsv_Table_Humaninput_Impl toCsv = new ToCsv_Table_Humaninput_Impl();

                    //
                    // 出力しないフィールド名(英字は、大文字にして入れること)
                    //
                    toCsv.ExceptedFields.List_SExceptedFields_Starts_Upper.Add("Expl".ToUpper());

                    //
                    // 一時的にプロパティー変更
                    //
                    bool bOldRowColRev = o_Table_Src.Format_Table_Humaninput.IsRowcolumnreverse;
                    o_Table_Src.Format_Table_Humaninput.IsRowcolumnreverse = false;//行と列を、ひっくり返さずに書きだす。

                    sCsvText = toCsv.ToCsvText(o_Table_Src, log_Reports);
                    if (!log_Reports.Successful)
                    {
                        // 既エラー。
                        goto gt_EndMethod;
                    }

                    //
                    // 元に戻す。
                    //
                    o_Table_Src.Format_Table_Humaninput.IsRowcolumnreverse = bOldRowColRev;
                }

                //
                // 書き出し先のテーブル
                //
                Table_Humaninput o_Table_Dst;
                if (log_Reports.Successful)
                {
                    Expression_Node_String ec_ArgTableName;
                    this.TrySelectAttribute(out ec_ArgTableName, Expression_Node_Function05Impl.PM_NAME_TABLE_DESTINATION, EnumHitcount.One_Or_Zero, log_Reports);

                    o_Table_Dst = this.Owner_MemoryApplication.MemoryTables.GetTable_HumaninputByName(
                        ec_ArgTableName,
                        true,
                        log_Reports
                        );
                }
                else
                {
                    o_Table_Dst = null;
                }

                //
                // 書き出し先ファイルへのパス
                //
                string sFpatha_Dst;//絶対ファイルパス
                if (log_Reports.Successful)
                {
                    sFpatha_Dst = o_Table_Dst.Expression_Filepath_ConfigStack.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                }
                else
                {
                    sFpatha_Dst = null;
                }


                //
                // ファイルの書き出し
                //
                if (log_Reports.Successful)
                {
                    // 正常時

                    CsvWriterImpl writer = new CsvWriterImpl();
                    writer.Write(sCsvText, sFpatha_Dst, true);
                }
            }


            goto gt_EndMethod;
            //
            //
gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return("");
        }