Ejemplo n.º 1
0
        //────────────────────────────────────────
        /// <summary>
        /// レコードセットの追加。
        /// </summary>
        /// <param name="eName"></param>
        /// <param name="recordSet"></param>
        /// <param name="log_Reports"></param>
        public void Add(
            Expression_Node_String ec_Name, RecordSet recordSet,
            MemoryApplication memoryApplication,
            Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Expr.Name_Library, this, "Add",log_Reports);
            //
            //

            string sName = ec_Name.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports).Trim();

            try
            {
                this.dictionary_Recordset.Add(sName, recordSet);

                //// debug: 追加したレコードセットの内容。
                //{
                //    ystem.Console.WriteLine(Info_N.LibraryName + ":" + this.GetType().Name + "#Add: 追加したレコードセットの内容"+
                //        " fld=["+oRecordSet.NField.E_Execute(EnumHitcount.Unconstraint, log_Reports)+"]" +
                //        " lookup-value=["+oRecordSet.NLookupValue.E_Execute(EnumHitcount.Unconstraint, log_Reports)+"]" +
                //        " required=[" + oRecordSet.NRequired.E_Execute(EnumHitcount.Unconstraint, log_Reports) + "]" +
                //        " from=[" + oRecordSet.NFrom.E_Execute(EnumHitcount.Unconstraint, log_Reports) + "]" +
                //        " description=[" + oRecordSet.NDescription.E_Execute(EnumHitcount.Unconstraint, log_Reports) + "]" +
                //        " Storage=[" + oRecordSet.NStorage.E_Execute(EnumHitcount.Unconstraint, log_Reports) + "]"
                //        );

                //}
            }
            catch (ArgumentException ex)
            {
                //return;

                {
                    Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                    tmpl.SetParameter(1, sName, log_Reports);//名前
                    tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(ec_Name.Cur_Configuration), log_Reports);//設定位置パンくずリスト
                    tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Exception(ex), log_Reports);//例外メッセージ

                    memoryApplication.CreateErrorReport("Er:6042;", tmpl, log_Reports);
                }
            }

            //
            //
            //
            //

            log_Method.EndMethod(log_Reports);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 制約の判定。
        /// </summary>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        private void E_Execute_P4(
            int nHitsCount,//eRecordList.Count
            EnumHitcount hits,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Expr.Name_Library, this, "E_Execute_P4",log_Reports);
            //
            //

            switch (hits)
            {
                case EnumHitcount.One:
                    if (1 != nHitsCount)
                    {
                        //
                        // エラー。
                        goto gt_Error_NotOne;
                        // オブジェクトに設定されているプロパティーが想定しない操作と判断。
                    }
                    break;

                case EnumHitcount.One_Or_Zero:
                    if (!(1 == nHitsCount || 0 == nHitsCount))
                    {
                        //
                        // エラー。
                        goto gt_Error_NotOneOrZero;
                        // オブジェクトに設定されているプロパティーが想定しない操作と判断。
                    }
                    break;

                case EnumHitcount.First_Exist_Or_Zero:
                    {
                        //
                        // 特にエラーとなる条件はありません。
                    }
                    break;

                case EnumHitcount.Exists:
                    if (nHitsCount < 1)
                    {
                        //
                        // エラー。
                        goto gt_Error_NotExists;
                        // オブジェクトに設定されているプロパティーが想定しない操作と判断。
                    }
                    break;

                case EnumHitcount.Unconstraint:
                    {
                        //
                        // 特にエラーとなる条件はありません。
                    }
                    break;

                default:
                    {
                        //
                        // エラー。
                        goto gt_Error_UndefinedEnum;
                        // オブジェクトに設定されているプロパティーが想定しない操作と判断。
                    }
                //break;
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_NotOne:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, nHitsCount.ToString(), log_Reports);//検索ヒット数

                this.Owner_MemoryApplication.CreateErrorReport("Er:6020;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_NotOneOrZero:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, nHitsCount.ToString(), log_Reports);//検索ヒット数

                this.Owner_MemoryApplication.CreateErrorReport("Er:6021;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_NotExists:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, nHitsCount.ToString(), log_Reports);//検索ヒット数

                this.Owner_MemoryApplication.CreateErrorReport("Er:6022;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_UndefinedEnum:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, hits.ToString(), log_Reports);//要求した検索ヒット区分

                this.Owner_MemoryApplication.CreateErrorReport("Er:6023;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return;
        }
        //────────────────────────────────────────
        public override void XmlToConfigurationtree(
            XmlElement cur_X,//<event>
            Configurationtree_Node parent_Cf,//<control>
            MemoryApplication memoryApplication,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_XmlToConf.Name_Library, this, "XmlToConfigurationtree", log_Reports);
            //
            //

            //
            //
            //
            // 自
            //
            //
            //
            Configurationtree_Node cur_Cf = this.CreateMyself(cur_X, parent_Cf, memoryApplication, log_Reports);

            //
            //
            //
            // 属性
            //
            //
            //
            this.Parse_SAttribute(cur_X, cur_Cf, memoryApplication, log_Reports);

            //
            //
            //
            // 子
            //
            //
            //
            XmlElement err_XAction;
            Exception err_Excp;
            if (log_Reports.Successful)
            {

                //
                //
                // actionノードを列挙
                //
                XmlNodeList child_XNl = cur_X.ChildNodes;
                foreach(XmlNode xChild in child_XNl)
                {

                    if (XmlNodeType.Element == xChild.NodeType)
                    {
                        XmlElement xAction = (XmlElement)xChild;

                        try
                        {
                            XmlToConfigurationtree_C15_Elm to = this.Dic_XmlToConfigurationtree[xChild.Name];
                            to.XmlToConfigurationtree(
                                xAction,
                                cur_Cf,
                                memoryApplication,
                                log_Reports
                                );
                        }
                        catch(KeyNotFoundException e)
                        {
                            err_XAction = xAction;
                            err_Excp = e;
                            goto gt_Error_NotFound;
                        }
                        catch (Exception e)
                        {
                            err_Excp = e;
                            goto gt_Error_Excp;
                        }
                    }

                }

            }

            //
            //
            //
            // 親へ連結
            //
            //
            //
            if (log_Reports.Successful)
            {
                parent_Cf.List_Child.Add(cur_Cf, log_Reports);
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_NotFound:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, err_XAction.Name, log_Reports);//ノード名
                tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(cur_Cf), log_Reports);//設定位置パンくずリスト
                tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports);//例外メッセージ

                memoryApplication.CreateErrorReport("Er:8023;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_Excp:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(cur_Cf), log_Reports);//設定位置パンくずリスト
                tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports);//例外メッセージ

                memoryApplication.CreateErrorReport("Er:8024;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
Ejemplo n.º 4
0
        //────────────────────────────────────────
        /// <summary>
        /// データ・ターゲットへの出力を行います。
        /// </summary>
        public void UsercontrolToMemory(
            Log_Reports log_Reports
            )
        {
            Log_Method pg_Method = new Log_MethodImpl();
            pg_Method.BeginMethod(Info_Controls.Name_Library, this, "UsercontrolToMemory",log_Reports);
            //
            //

            if (null == this.ControlCommon.Expression_Control)
            {
                // このコントロールに対応づくテーブル等の設定がなく、ただの空箱の場合。
                // Visual Studio のビジュアルエディターで直接置いただけの時は、ここに来ます。

                // 何もせず終了。
                goto gt_EndMethod;
            }

            List<Expression_Node_String> ecList_Data = this.ControlCommon.Expression_Control.SelectDirectchildByNodename(NamesNode.S_DATA, false, EnumHitcount.Unconstraint, log_Reports);
            List<Expression_Node_String> ecList_DataTarget = Utility_Expression_NodeImpl.SelectItemsByPmAsCsv(ecList_Data, PmNames.S_ACCESS.Name_Pm, ValuesAttr.S_TO, false, EnumHitcount.First_Exist, log_Reports);
            if (!log_Reports.Successful)
            {
                goto gt_EndMethod;
            }
            Expression_Node_String ec_DataTarget = ecList_DataTarget[0];

            if (null == ec_DataTarget)
            {
                // エラー:     データターゲットが未設定のとき
                goto gt_Error_NullDatatarget;
            }

            if (log_Reports.Successful)
            {

                //this……イベントハンドラーのsender引数と一致すること。

                // TODO 数値型テキストボックスで空白を出力しようとしたときにエラーになるのはバグなので修正したい。

                // 特にトリムは行いません。
                string sText = this.Text;
                //
                // 改行文字を、改行に変換。
                //
                if ("" != this.SNewline)
                {
                    sText = sText.Replace(Environment.NewLine, this.SNewline);
                }

                //
                // テーブルにデータを書き出す方法。
                {
                    ToMemory_Performer toM = new ExpressionDataTargetUpdaterImpl();
                    toM.ToMemory(
                        sText,
                        this.ControlCommon.Expression_Control,
                        this.ControlCommon.Owner_MemoryApplication,
                        log_Reports
                        );
                }

                if (log_Reports.Successful)
                {
                    // 成功時
                    this.BackColor = System.Drawing.SystemColors.Window;
                }
                else
                {
                    // 設定失敗時。
                    this.BackColor = Color.Yellow;
                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_NullDatatarget:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, this.Name, log_Reports);//コントロール名

                this.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:513;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            pg_Method.EndMethod(log_Reports);
        }
Ejemplo n.º 5
0
        public void TryGetString(out string out_SValue, string sName, bool bRequired, string sAlt,
            MemoryApplication memoryApplication,
            Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Expr.Name_Library, this, "TryGetString",log_Reports);
            //

            if (!this.Dictionary_Field.ContainsKey(sName))
            {
                //該当なし。

                if (bRequired)
                {
                    out_SValue = "";
                    goto gt_Error_NotFound;
                }
                else
                {
                    out_SValue = sAlt;
                    goto gt_EndMethod;
                }
            }

            FieldUserformtable fo_Field = this.Dictionary_Field[sName];

            if (EnumTypedb.String != fo_Field.EnumTypedb)
            {
                //型が異なる。

                if (bRequired)
                {
                    out_SValue = "";
                    goto gt_Error_Type;
                }
                else
                {
                    out_SValue = sAlt;
                    goto gt_EndMethod;
                }
            }
            out_SValue = (string)fo_Field.Data;

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_NotFound:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, sName, log_Reports);//フィールド名

                memoryApplication.CreateErrorReport("Er:6003;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_Type:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, sName, log_Reports);//フィールド名
                tmpl.SetParameter(2, fo_Field.EnumTypedb.ToString(), log_Reports);//フィールドの型名

                memoryApplication.CreateErrorReport("Er:6004;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
Ejemplo n.º 6
0
        //────────────────────────────────────────
        protected virtual string E_Execute_NoUse(
            Expression_Node_Function ec_CommonFunction,
            string sLibraryName,
            string sClassName,
            string sMethodName,
            EnumEventhandler enumEH,
            Configuration_Node conf_Node,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Expr.Name_Library, this, "E_Execute_NoUse",log_Reports);
            //
            //

            string sResult = "";

            //#このルートはエラー
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, log_Method.Fullname, log_Reports);//問題の起こったメソッド
                tmpl.SetParameter(2, enumEH.ToString(), log_Reports);//イベントハンドラー

                string sFncName0;
                ec_CommonFunction.TrySelectAttribute(out sFncName0, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports);
                tmpl.SetParameter(3, sFncName0, log_Reports);//関数名
                tmpl.SetParameter(4, Log_RecordReportsImpl.ToText_Configuration(conf_Node), log_Reports);//設定位置パンくずリスト

                this.Owner_MemoryApplication.CreateErrorReport("Er:6039;", tmpl, log_Reports);
            }

            //            ((E_SysFncAbstract)this.E_SystemAction).EventMonitor.BNowActionWorking = false;

            //
            //
            log_Method.EndMethod(log_Reports);
            return sResult;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// レコードセットの取得。
        /// </summary>
        /// <param name="eName"></param>
        /// <param name="log_Reports"></param>
        /// <returns>該当がなければヌル。</returns>
        public RecordSet Get(Expression_Node_String ec_Name,
            MemoryApplication memoryApplication,
            Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Expr.Name_Library, this, "Get",log_Reports);
            //
            //

            string sName = ec_Name.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports).Trim();

            RecordSet nResult;

            try
            {
                //ystem.Console.WriteLine(Info_N.LibraryName + ":" + this.GetType().Name + "#Remove: 【レコードセット削除】sName=[" + sName + "]");
                nResult = this.dictionary_Recordset[sName];
            }
            catch (KeyNotFoundException ex)
            {
                nResult = null;

                {
                    Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                    tmpl.SetParameter(1, sName, log_Reports);//名前
                    tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(ec_Name.Cur_Configuration), log_Reports);//設定位置パンくずリスト
                    tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Exception(ex), log_Reports);//例外メッセージ

                    memoryApplication.CreateErrorReport("Er:6043;", tmpl, log_Reports);
                }
            }
            catch (Exception ex)
            {
                nResult = null;

                {
                    Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                    tmpl.SetParameter(1, sName, log_Reports);//名前
                    tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(ec_Name.Cur_Configuration), log_Reports);//設定位置パンくずリスト
                    tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Exception(ex), log_Reports);//例外メッセージ

                    memoryApplication.CreateErrorReport("Er:6044;", tmpl, log_Reports);
                }
            }

            //
            //
            //
            //

            log_Method.EndMethod(log_Reports);
            return nResult;
        }
Ejemplo n.º 8
0
        //────────────────────────────────────────
        #endregion



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

        /// <summary>
        /// イベント アクション リストを作成します。
        /// </summary>
        /// <param nFcName="eventName"></param>
        /// <param nFcName="nActionSuper"></param>
        /// <param nFcName="log_Reports"></param>
        public Functionlist CreateFunctionlist(
            ConfigurationtreeToExpression_Event sToE_Event,
            MemoryApplication owner_MemoryApplication,
            Log_Reports log_Reports
            )
        {
            Log_Method pg_Method = new Log_MethodImpl();
            pg_Method.BeginMethod(Info_Controls.Name_Library, this, "CreateFunctionlist",log_Reports);
            //
            //
            Functionlist fw_Result = null;

            //.WriteLine(this.GetType().Name + "#CreateEventActionList: <構築>【開始】 イベントに対応ついたアクションリストを追加します。 (ピクチャー)");

            switch (sToE_Event.Name)
            {
                case NamesSe.S_LOAD:
                    {
                        //
                        // このコントロールの「アプリケーション起動時」。
                        //
                        //  (NActionPerformEnum.O_EA)
                        //

                        //
                        // 無視します。
                        //
                    }
                    break;

                default:
                    goto gt_Error_NotSupportEvent;
            }


            goto gt_EndMethod;
        //
        //
            #region 異常系
        //────────────────────────────────────────
        gt_Error_NotSupportEvent:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, this.GetType().Name, log_Reports);//クラス名
                tmpl.SetParameter(2, sToE_Event.Name, log_Reports);//イベント名
                tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Configuration(sToE_Event.Configurationtree_Event), log_Reports);//位置パンくずリスト

                owner_MemoryApplication.CreateErrorReport("Er:525;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
        //────────────────────────────────────────
            #endregion
        //
        //
        gt_EndMethod:
            pg_Method.EndMethod(log_Reports);
            return fw_Result;

        }
        //────────────────────────────────────────
        /// <summary>
        /// 実行。
        /// 
        /// 指定のコントロールの、指定のイベントを実行します。
        /// </summary>
        /// <param name="oEventName"></param>
        /// <param name="oEventName"></param>
        /// <param name="log_Reports"></param>
        private void Execute1b(
            object sender,
            string name_ExpectedUsercontrol,
            string sEventName,
            MemoryApplication owner_MemoryApplication,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute2", log_Reports);
            //
            //

            Usercontrol foundUsercontrol = null;

            owner_MemoryApplication.MemoryForms.ForEach_Children(delegate(string sKey, Usercontrol curUsercontrol, ref bool bRemove, ref bool bBreak)
            {
                string name_CurUsercontrol = curUsercontrol.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(
                    EnumHitcount.Unconstraint,
                    log_Reports
                    );

                //.WriteLine(this.GetType().Name + "#: ■■コントロール=[" + fcUc.ControlCommon.Name.Value + "] イベント数=[" + fcUc.ControlCommon.OEvents.Items.Count + "]");

                if (name_ExpectedUsercontrol == name_CurUsercontrol)
                {
                    foundUsercontrol = curUsercontrol;

                    //.WriteLine(this.GetType().Name + "#: ■■コントロール=[" + fcNameStr2 + "] イベント数=[" + fcUc.ControlCommon.OFcnfControl.OEvents.Count + "]");

                    Configurationtree_Node hitEvent_Cnf = null;
                    List<Configurationtree_Node> list_EventCnf = curUsercontrol.ControlCommon.Configurationtree_Control.GetChildrenByNodename(NamesNode.S_EVENT, false, log_Reports);
                    foreach (Configurationtree_Node event_Cnf in list_EventCnf)
                    {
                        string name_Fnc;
                        event_Cnf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out name_Fnc, false, log_Reports);

                        if (name_Fnc == sEventName)
                        {
                            hitEvent_Cnf = event_Cnf;
                        }
                    }

                    if (null != hitEvent_Cnf)
                    {
                        //
                        // 最初の<event>要素
                        //
                        Executer2_EventImpl exe1 = new Executer2_EventImpl();
                        exe1.Execute2_Event(
                            sender,
                            hitEvent_Cnf,
                            owner_MemoryApplication,
                            log_Reports
                            );
                    }
                    else
                    {
                        string sFcName3 = curUsercontrol.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(
                            EnumHitcount.Unconstraint,
                            log_Reports
                            );

                        {
                            Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                            tmpl.SetParameter(1, sFcName3, log_Reports);//コントロール名
                            tmpl.SetParameter(2, sEventName, log_Reports);//イベント名

                            owner_MemoryApplication.CreateErrorReport("Er:110027;", tmpl, log_Reports);
                        }
                    }

                }//nFcName_prm
            });

            //loop_end:
            //.WriteLine(this.GetType().Name + "#: 【アクション_パフォーマー終了】");

            if (null == foundUsercontrol)
            {
                goto gt_Error_NotFoundUsercontrol;
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_NotFoundUsercontrol:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, name_ExpectedUsercontrol, log_Reports);//コントロール名

                owner_MemoryApplication.CreateErrorReport("Er:110028;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
        //────────────────────────────────────────
        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();
            }

            //
            //

            Expression_Node_String err_Ec_FcName1;
            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 + "]アクションを実行。";
                }

                //
                //
                //
                //

                //
                // このNAction29を含んでいるcontrol要素から
                // コントロールの名前を取得。
                Expression_Node_String ec_FcName1;

                //
                // このNAction29要素を含んでいる control要素から、コントロールの名前を取得。
                List<Usercontrol> list_FcUc;
                if (log_Reports.Successful)
                {
                    // 正常時

                    Configuration_Node cf_Event = this.Cur_Configuration.GetParentByNodename(
                        NamesNode.S_EVENT, EnumConfiguration.Unknown, false, log_Reports);

                    if (null != cf_Event)
                    {
                        Configuration_Node owner_Configurationtree_Control = cf_Event.GetParentByNodename(
                            NamesNode.S_CONTROL1, EnumConfiguration.Tree, true, log_Reports);

                        if (null != owner_Configurationtree_Control)
                        {
                            string sName_Usercontrol;
                            ((Configurationtree_Node)owner_Configurationtree_Control).Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_Usercontrol, true, log_Reports);

                            Expression_Node_StringImpl ec_Str = new Expression_Node_StringImpl(this, this.Cur_Configuration);
                            ec_Str.AppendTextNode(
                                sName_Usercontrol,
                                this.Cur_Configuration,
                                log_Reports
                                );

                            ec_FcName1 = ec_Str;
                        }
                        else
                        {
                            ec_FcName1 = null;
                        }

                    }
                    else
                    {
                        ec_FcName1 = null;
                    }

                    //
                    // 指定のコントロール
                    //
                    list_FcUc = this.Owner_MemoryApplication.MemoryForms.GetUsercontrolsByName(
                        ec_FcName1,
                        true,
                        log_Reports
                        );
                }
                else
                {
                    //
                    // エラー。
                    ec_FcName1 = null;
                    list_FcUc = null;
                    err_Ec_FcName1 = ec_FcName1;
                    goto gt_Error_NullFcUc;
                }
                // ここで、fcUc は必ずある。
                Usercontrol fct = list_FcUc[0];

                //
                //
                //
                // View
                //
                //
                //

                // 最初の1個のみ有効。必ずあるとする。
                List<Expression_Node_String> ecList_View = fct.ControlCommon.Expression_Control.SelectDirectchildByNodename(NamesNode.S_VIEW, false, EnumHitcount.One, log_Reports);
                if (!log_Reports.Successful)
                {
                    goto gt_EndMethod;
                }
                Expression_Node_StringImpl ec_View = (Expression_Node_StringImpl)ecList_View[0];

                //
                // O → N は、Fcnfをロードした時点で実行済み。
                if (ec_View.List_Expression_Child.Count < 1)
                {
                    //
                    // エラー。
                    //
                    // このアクションを使うからには、
                    // 必ず<view>の中に子要素がないといけない。
                    err_Ec_FcName1 = ec_FcName1;
                    goto gt_Error_EmptyView;
                }

                object errorRule = null;
                Expression_Node_String err_Ec_DataTarget = null;
                if (log_Reports.Successful)
                {
                    // 正常時

                    ec_View.List_Expression_Child.ForEach(delegate(Expression_Node_String ec_Child, ref bool bRemove, ref bool bBreak)
                    {
                        string sFncName;
                        ec_Child.TrySelectAttribute(out sFncName, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports);

                        if (
                            NamesNode.S_FNC == ec_Child.Cur_Configuration.Name &&
                            NamesFnc.S_LISTBOX_LABELS == sFncName
                            )
                        {
                            // <f-list-box-labels>

                            //
                            // fcUc は、必ずリストボックス。
                            if (!(fct is UsercontrolListbox))
                            {
                                //
                                // エラー。
                                goto gt_Error_NotListbox;
                            }

                            UsercontrolListbox uctLst = (UsercontrolListbox)fct;

                            //
                            // リストボックスの表示を自作します。項目の高さが固定の場合。
                            uctLst.DrawMode = DrawMode.OwnerDrawFixed;

                            //
                            // N → Uc

                            //
                            // 描画プログラムの作成。
                            ListboxItemDrawer_02Impl drawer = new ListboxItemDrawer_02Impl(
                                this.Owner_MemoryApplication);

                            //
                            // item-valur-to-variable="" 属性
                            //
                            //if (null == nF11.E_ItemValueToVariable)
                            {
                                // <データ access="to">から取りたい。
                                Expression_Node_String ec_ItemValueToVariable = null;//ソース情報利用

                                List<Expression_Node_String> ecList_DataTarget;
                                {
                                    List<Expression_Node_String> ecList_Data = uctLst.ControlCommon.Expression_Control.SelectDirectchildByNodename( NamesNode.S_DATA, false, EnumHitcount.Unconstraint, log_Reports);
                                    ecList_DataTarget = Utility_Expression_NodeImpl.SelectItemsByPmAsCsv(ecList_Data, PmNames.S_ACCESS.Name_Pm, ValuesAttr.S_TO, false, EnumHitcount.First_Exist, log_Reports);
                                }

                                if (!log_Reports.Successful)
                                {
                                    goto gt_EndMethod2;
                                }
                                Expression_Node_String ec_DataTarget = ecList_DataTarget[0];
                                err_Ec_DataTarget = ec_DataTarget;

                                if (null != ec_DataTarget)
                                {
                                    bool bHit = ec_DataTarget.TrySelectAttribute(
                                        out ec_ItemValueToVariable, PmNames.S_NAME_VAR.Name_Pm, EnumHitcount.One, log_Reports);
                                    if (bHit)
                                    {
                                        drawer.Expression_ValueVariableName = ec_ItemValueToVariable;
                                    }
                                    else
                                    {
                                        // エラー。
                                        goto gt_Error_NullItemValueToVariable;
                                    }
                                }
                                else
                                {
                                    // エラー。
                                    goto gt_Error_NotFoundDataTarget;
                                }
                            }
                            //else
                            //{
                            //    //
                            //    // 変数名設定。
                            //    drawer.Ec_ValueVariableName = nF11.E_ItemValueToVariable;
                            //}

                            //
                            // <fnc name=”Sf:item-label;”>
                            List<Expression_Node_String> ecList_Fnc = ec_Child.SelectDirectchildByNodename(NamesNode.S_FNC, false, EnumHitcount.Unconstraint, log_Reports);
                            ecList_Fnc = Utility_Expression_NodeImpl.SelectItemsByPmAsCsv(ecList_Fnc, PmNames.S_NAME.Name_Pm, NamesFnc.S_ITEM_LABEL2, false, EnumHitcount.First_Exist, log_Reports);
                            if (!log_Reports.Successful)
                            {
                                // エラー。
                                goto gt_EndMethod2;
                            }

                            drawer.Expression_ItemLabel = ecList_Fnc[0];

                            if (log_Reports.Successful)
                            {
                                //
                                // 描画プログラムの変更。
                                uctLst.ListboxItemDrawer = drawer;
                            }

                        }
                        else
                        {
                            errorRule = ec_Child;

                            //
                            // エラー。未定義の<view>。
                            goto gt_Error_UndefinedView;
                        }

                        goto gt_EndMethod2;

                        //
                        //
                        //
                        //

            //
                    // エラー。
                    gt_Error_NotListbox:
                        {
                            Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                            tmpl.SetParameter(1, ec_FcName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), log_Reports);//コントロール名
                            tmpl.SetParameter(2, fct.GetType().Name, log_Reports);//コントロールのクラス名

                            this.Owner_MemoryApplication.CreateErrorReport("Er:110019;", tmpl, log_Reports);
                        }
                        goto gt_EndMethod2;

                    //
                    // エラー。
                    gt_Error_NotFoundDataTarget:
                        {
                            Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                            tmpl.SetParameter(1, ec_FcName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), log_Reports);//コントロール名

                            this.Owner_MemoryApplication.CreateErrorReport("Er:110020;", tmpl, log_Reports);
                        }
                        goto gt_EndMethod2;

                    //
                    // エラー。
                    gt_Error_NullItemValueToVariable:
                        {
                            Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                            tmpl.SetParameter(1, PmNames.S_NAME_VAR.Name_Pm, log_Reports);//引数名NameVar
                            tmpl.SetParameter(2, ec_FcName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), log_Reports);//コントロール名

                            //
                            // 「access="to"」要素を取得しているような。
                            //
                            Log_TextIndented s1 = new Log_TextIndentedImpl();
                            err_Ec_DataTarget.ToText_Snapshot(s1);
                            tmpl.SetParameter(3, s1.ToString(), log_Reports);//データターゲットの変数の中身

                            Log_TextIndented s2 = new Log_TextIndentedImpl();
                            err_Ec_DataTarget.Cur_Configuration.ToText_Content(s2);
                            tmpl.SetParameter(4, s2.ToString(), log_Reports);//データターゲットの設定の中身

                            this.Owner_MemoryApplication.CreateErrorReport("Er:110021;", tmpl, log_Reports);
                        }
                        goto gt_EndMethod2;

            //
                    // エラー。
                    gt_Error_UndefinedView:
                        {
                            Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                            tmpl.SetParameter(1, errorRule.GetType().Name, log_Reports);//要素のクラス名
                            tmpl.SetParameter(2, ec_Child.Cur_Configuration.Name, log_Reports);//設定の子要素のノード名
                            tmpl.SetParameter(3, sFncName, log_Reports);//設定の子要素の関数名

                            this.Owner_MemoryApplication.CreateErrorReport("Er:110022;", tmpl, log_Reports);
                        }
                        goto gt_EndMethod2;

                    gt_EndMethod2:
                        ;
                    });

                    //
                    // 「表示プログラム」を作成、
                    // リストボックスにその「リスト作成プログラム」を渡す。
                    // リストボックスは再表示されるたびに、
                    // その「リスト作成プログラム」を実行。

                    // 以下、その「表示プログラム」の内容。

                    //
                    // ループカウンタの回数だけ、リストに項目を追加。

                    //
                    // その内容は、値が<a-item-value>から取得。

                    //
                    // その内容は、表示ラベルが<a-item-label>から取得。

                    //
                    // その表示ラベルは、次の条件に一致した時、グレー色にする。
                    //
                    // <a-item-gray-out>
                    // <f-all-true>
                    // <a-empty-field>
                }
                goto gt_EndMethod;
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_NullFcUc:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, err_Ec_FcName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), log_Reports);//コントロール名

                this.Owner_MemoryApplication.CreateErrorReport("Er:110023;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_EmptyView:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, err_Ec_FcName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), log_Reports);//検索ヒット数

                this.Owner_MemoryApplication.CreateErrorReport("Er:110024;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return "";
        }
        //────────────────────────────────────────
        public void ConfigurationtreeToUsercontrol(
            Configurationtree_Node cur_Cf,//Sv_3Validator <validator>
            Usercontrol ucontrol,
            Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "SToFc",log_Reports);

            if (log_Method.CanDebug(1))
            {
                pg_ParsingLog.Increment("(41)" + cur_Cf.Name);
            }

            //
            //
            //
            //

            string err_SParameterValue = null;
            Exception err_Excp = null;
            string err_SValue = null;
            string err_SName_Validator = null;

            EnumValidation_Old enumResult = EnumValidation_Old.Thru;

            if (cur_Cf.Dictionary_Attribute.ContainsKey(PmNames.S_VALUE_RESULT.Name_Pm))
            {
                string sValue_Parameter;
                cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_VALUE_RESULT, out sValue_Parameter, true, log_Reports);
                switch (sValue_Parameter)
                {
                    case "OK":
                        enumResult = EnumValidation_Old.Ok;
                        break;
                    case "NG":
                        enumResult = EnumValidation_Old.Ng;
                        break;
                    case "THRU":
                        enumResult = EnumValidation_Old.Thru;
                        break;
                    default:
                        //
                        // エラー。
                        goto gt_Error_UndefinedValidator02;
                }
            }

            string sName;
            string sName_ValidatorTrim;
            {
                PmName pmName = PmNames.S_NAME;
                if (cur_Cf.Dictionary_Attribute.ContainsKey(pmName.Name_Pm))
                {
                    cur_Cf.Dictionary_Attribute.TryGetValue(pmName, out sName, true, log_Reports);
                    sName_ValidatorTrim = sName.Trim();
                }
                else
                {
                    sName = "";
                    sName_ValidatorTrim = "";
                }
            }

            //
            // バリデーターの選択
            switch (sName_ValidatorTrim)
            {
                case NamesFnc.S_VLD_SPACES:
                    {
                        // SToE:
                        Expressionv_SpacesTextValidator_Old nValidator = new Expressionv_SpacesTextValidator_Old(enumResult);

                        ucontrol.AddValidator(
                            nValidator,
                            log_Reports
                            );
                    }
                    break;

                case NamesFnc.S_VLD_MATCH:
                    {
                        string sValue_Parameter;
                        cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_EXPECTED, out sValue_Parameter, false, log_Reports);
                        err_SParameterValue = sValue_Parameter;

                        // SToE:
                        Expressionv_MatchTextValidator_Old ecv_Validator = new Expressionv_MatchTextValidator_Old(sValue_Parameter);

                        ucontrol.AddValidator(
                            ecv_Validator,
                            log_Reports
                            );
                    }
                    break;

                case NamesFnc.S_VLD_INT_RANGE:
                    {
                        bool bSuccessful = true;
                        int nBeginValue = 0;
                        if (bSuccessful)
                        {
                            string sBegin;
                            cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_BEGIN, out sBegin, false, log_Reports);

                            if (!int.TryParse(sBegin, out nBeginValue))
                            {
                                // エラー。
                                err_Excp = null;
                                err_SValue = sBegin;
                                goto gt_Error_InvalidatedBegin02;
                            }
                        }

                        int nEndValue = 0;
                        if (bSuccessful)
                        {
                            string sEnd;
                            cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_END, out sEnd, false, log_Reports);

                            if (!int.TryParse(sEnd, out nEndValue))
                            {
                                // エラー。
                                err_Excp = null;
                                err_SValue = sEnd;
                                goto gt_Error_InvalidatedEnd02;
                            }
                        }

                        if (bSuccessful)
                        {
                            // SToE:
                            Expressionv_IntRangeTextValidator_Old nValidator = new Expressionv_IntRangeTextValidator_Old(nBeginValue, nEndValue);

                            ucontrol.AddValidator(
                                nValidator,
                                log_Reports
                                );
                        }
                    }
                    break;

                case NamesFnc.S_VLD_ALL:
                    {
                        // SToE:
                        Expressionv_AllTextValidator_Old ecv_Validator = new Expressionv_AllTextValidator_Old(enumResult);

                        ucontrol.AddValidator(
                            ecv_Validator,
                            log_Reports
                            );
                    }
                    break;

                default:
                    //
                    // エラー。
                    err_SName_Validator = sName;
                    goto gt_Error_UndefinedValidator03;
            }//switch

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_UndefinedValidator02:
            // TODO 未定義のバリデーターの場合。
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, PmNames.S_VALUE_RESULT.Name_Pm, log_Reports);//引数名
                tmpl.SetParameter(2, err_SParameterValue, log_Reports);//バリデーター名

                ucontrol.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:7012;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_InvalidatedBegin02:
            // 設定エラー
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, PmNames.S_BEGIN.Name_Pm, log_Reports);//属性名
                tmpl.SetParameter(2, err_SValue, log_Reports);//属性値
                tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports);//例外メッセージ

                ucontrol.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:7013;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_InvalidatedEnd02:
            // 設定エラー
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, PmNames.S_END.Name_Pm, log_Reports);//属性名
                tmpl.SetParameter(2, err_SValue, log_Reports);//属性値
                tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports);//例外メッセージ

                ucontrol.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:7014;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_UndefinedValidator03:
            // TODO 未定義のバリデーターの場合。
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, err_SName_Validator, log_Reports);//バリデーター名

                ucontrol.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:7015;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            if (Log_ReportsImpl.BDebugmode_Static)
            {
                pg_ParsingLog.Decrement(cur_Cf.Name);
            }
            log_Method.EndMethod(log_Reports);
        }
Ejemplo n.º 12
0
        //────────────────────────────────────────
        /// <summary>
        /// ユーザー定義プログラムの実行。
        /// </summary>
        /// <returns></returns>
        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_Expr.Name_Library, this, "Execute5_Main", log_Reports);
            //
            //

            //
            //
            // 「this」は、<f-cell>に当たる。
            //
            // record-set-load-from などを使っている場合は、keyFldName等の情報が足りなくなる場合がある。
            //
            //

            string sResult;

            if (!log_Reports.Successful)
            {
                // エラーが出ていたら、さっさと抜ける。
                sResult = "<「E■f-cell」エラー101>";
                goto gt_EndMethod;
            }

            //
            // (102)セレクト文の作成。
            //
            Selectstatement selectSt;
            bool bOneCellSelectCondition;//「フィールド名 = 値」の形のみ true。
            bool bExists_Awhr;
            if (log_Reports.Successful)
            {
                this.E_Execute_P1_CleateSelect(
                    out bOneCellSelectCondition,
                    out selectSt,
                    out bExists_Awhr,
                    this.Cur_Configuration,
                    log_Reports
                    );
            }
            else
            {
                // エラーが出ていたら、さっさと抜ける。
                sResult = "<「E■f-cell」エラー102a>";
                goto gt_EndMethod;
            }

            bool bExists_Into;
            if (log_Reports.Successful)
            {
                // into属性の有無。
                if ("" != selectSt.Expression_Into.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports).Trim())
                {
                    bExists_Into = true;
                }
                else
                {
                    bExists_Into = false;
                }
            }
            else
            {
                // エラーが出ていたら、さっさと抜ける。
                sResult = "<「E■f-cell」エラー102b>";
                goto gt_EndMethod;
            }

            if (!log_Reports.Successful)
            {
                // エラーが出ていたら、さっさと抜ける。
                sResult = "<「E■f-cell」エラー103>";
                goto gt_EndMethod;
            }

            // from句のテーブルを読み込みます。
            Table_Humaninput o_FromTable = this.Owner_MemoryApplication.MemoryTables.GetTable_HumaninputByName(selectSt.Expression_From, true, log_Reports);

            if (!log_Reports.Successful)
            {
                // エラーが出ていたら、さっさと抜ける。
                sResult = "<「E■f-cell」エラー104>";
                goto gt_EndMethod;
            }

            //
            // (105)セレクト文を指定して、レコードセットの絞り込み。
            //
            RecordSet recordSet;
            // 行リスト<列リスト>
            List<List<string>> sFieldListList;
            if (
                bOneCellSelectCondition || //「フィールド名=値」の検索条件があり、セル1件を絞り込む場合。
                selectSt.List_Recordcondition.Count < 1 //無条件な場合。
                )
            {
                // セレクト文を指定することで、レコードセットを取得。
                recordSet = this.E_Execute_P2_Select(
                    bExists_Awhr,
                    selectSt,
                    this.Cur_Configuration,
                    log_Reports
                    );

                if (!log_Reports.Successful)
                {
                    // エラーが出ていたら、さっさと抜ける。
                    sResult = "<「E■f-cell」エラー105>";
                    goto gt_EndMethod;
                }
                else if (null == recordSet)
                {
                    //
                    // エラー。
                    goto gt_Error_NotFoundRecordSet;
                }

                // (1)「E■rec-cond」が1つだけ入っている形式

                // (300)フィールドから値を取得。
                P5_CellsSelecterImpl sel5 = new P5_CellsSelecterImpl(this.Owner_MemoryApplication);
                sFieldListList = sel5.P5_Select_CellType(
                    recordSet,
                    selectSt,
                    null,//eWhere_recordSetSaveTo,
                    this.Cur_Configuration,
                    log_Reports
                    );

                if (!log_Reports.Successful)
                {
                    // エラーが出ていたら、さっさと抜ける。
                    sResult = "<「E■f-cell」エラー106>";
                    goto gt_EndMethod;
                }

            }
            else
            {
                // TODO:それ以外のタイプにも対応したい。
                sFieldListList = new List<List<string>>();

                // (2)「E■rec-cond」が1つ以上入っている形式
                // TODO: 対応したい。現状、into属性が付いている場合、結果を返していない。
                if (bExists_Into)
                {
                }
                else
                {
                    // 仮。動かないと思う。
                    //List<Fielddefinition> out_O_NewFldDefList_Dammy = new List<Fielddefinition>();
                    //TableUtil.SelectFieldListList(
                    //    out sFieldListList,
                    //    out out_O_NewFldDefList_Dammy,
                    //    selectSt.List_SName_SelectField,//                        sNewFieldNameList,
                    //    selectSt.E_Where,
                    //    o_FromTable,
                    //    log_Reports
                    //    );
                }
            }

            //
            // (400)制約の判定
            //
            this.E_Execute_P4(
                sFieldListList.Count,
                this.EnumHitcount,
                log_Reports
                );
            if (!log_Reports.Successful)
            {
                // エラーが出ていたら、さっさと抜ける。
                sResult = "<「E■f-cell」エラー401>";
                goto gt_EndMethod;
            }

            //
            // (500)結果
            StringBuilder sb = new StringBuilder();
            foreach (List<string> sList_Field in sFieldListList)
            {
                // 先頭フィールド
                if (0 < sList_Field.Count)
                {
                    string sChild = sList_Field[0];

                    // TODO:制約を付けたい。
                    //eChild.SetValidation(this.requestItems);

                    sb.Append(sChild);
                }
                else
                {
                    // エラー
                    sResult = "<「E■f-cell」エラー501:該当レコードなし>";
                    goto gt_Error_ZeroField;
                }
            }
            sResult = sb.ToString();

            // into="" 属性が指定されていれば、結果をテーブルとして保持したい。
            if (bExists_Into)
            {

                // into句のテーブルの、情報を読み込みます。
                Table_Humaninput o_IntoTableInfoOnly;
                //ystem.Console.WriteLine(Info_E.LibraryName + ":E_FcellImpl#Execute5_Main: into属性が指定されています。e_Into=[" + selectSt.Expression_Into.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]");
                o_IntoTableInfoOnly = this.Owner_MemoryApplication.MemoryTables.GetTable_HumaninputByName(selectSt.Expression_Into, true, log_Reports);

                if (!log_Reports.Successful)
                {
                    // エラーが出ていたら、さっさと抜ける。
                    sResult = "<「E■f-cell」エラー601>";
                    goto gt_EndMethod;
                }

                // テーブルから、指定の列だけを抽出したサブ・テーブルを作ります。
                Table_Humaninput o_NewTable = Utility_Table.CreateSubTableBySelect(
                    o_FromTable.Name + "のサブテーブル<E_FcellImpl.cs>",
                    selectSt.List_SName_SelectField,
                    o_IntoTableInfoOnly.Expression_Filepath_ConfigStack,
                    selectSt.EnumWherelogic,
                    selectSt.List_Recordcondition,
                    o_FromTable,
                    log_Reports
                    );

                if (!log_Reports.Successful)
                {
                    // エラーが出ていたら、さっさと抜ける。
                    sResult = "<「E■f-cell」エラー602>";
                    goto gt_EndMethod;
                }

                // 作ったテーブルをセット。
                //
                // 新規なら追加、既存なら上書き。
                this.Owner_MemoryApplication.MemoryTables.Dictionary_Table_Humaninput[selectSt.Expression_Into.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)] = o_NewTable;

                if (!log_Reports.Successful)
                {
                    // エラーが出ていたら、さっさと抜ける。
                    sResult = "<「E■f-cell」エラー603>";
                    goto gt_EndMethod;
                }

            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_NotFoundRecordSet:
            sResult = "<「E■f-cell」エラー192:該当レコードなし>";
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration), log_Reports);//設定位置パンくずリスト

                this.Owner_MemoryApplication.CreateErrorReport("Er:6012;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_ZeroField:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, sFieldListList.Count.ToString(), log_Reports);//行数
                tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration), log_Reports);//設定位置パンくずリスト

                this.Owner_MemoryApplication.CreateErrorReport("Er:6013;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return sResult;
        }
Ejemplo n.º 13
0
        /// <summary>
        /// セレクト文を作成します。
        /// </summary>
        /// <param name="out_bOneCellSelectCondition"></param>
        /// <param name="selectSt"></param>
        /// <param name="out_bExists_Awhr"></param>
        /// <param name="s_Fcell"></param>
        /// <param name="log_Reports"></param>
        private void E_Execute_P1_CleateSelect(
            out bool bOneCellSelectCondition_Out,//「フィールド名 = 値」の形のみ true。 エラー時もfalse。
            out Selectstatement selectSt,
            out bool bExists_Awhr_Out,//@whereの有無を返します。エラー時はfalse。
            Configuration_Node cf_Fcell,//「S■f-cell」。
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Expr.Name_Library, this, "E_Execute_P1_CleateSelect",log_Reports);
            //
            //

            //
            // 空っぽのセレクト文。
            //
            bExists_Awhr_Out = false;
            bOneCellSelectCondition_Out = false;
            selectSt = new SelectstatementImpl(this, cf_Fcell);
            Expression_Node_StringImpl ec_Awhr_Src = null;//子「E■where」

            //
            // (1)select=”☆”
            //    抽出する列名のリスト。
            //
            Expression_Node_String ec_Aselect = null;//ソース情報利用のE
            if (log_Reports.Successful)
            {
                this.TrySelectAttribute(out ec_Aselect, PmNames.S_SELECT.Name_Pm, EnumHitcount.One, log_Reports);
            }

            if (log_Reports.Successful)
            {
                selectSt.List_SName_SelectField = new CsvTo_ListImpl().Read(ec_Aselect.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));
            }

            //
            // (2)into 属性
            //
            if (log_Reports.Successful)
            {
                Expression_Node_String ec_Into;//ソース情報利用のE
                bool bHit = this.TrySelectAttribute(out ec_Into, "into", EnumHitcount.One_Or_Zero, log_Reports);
                if (bHit)
                {
                    selectSt.Expression_Into = ec_Into;
                }
            }

            //
            // (3)「E■@where」。無いものもある。
            //
            if (log_Reports.Successful)
            {
                Expression_Node_String ec_Awhr1_Src;
                this.List_Expression_Child.ForEach(delegate(Expression_Node_String e_Child, ref bool bRemove, ref bool bBreak)
                {
                    string sValue;
                    e_Child.TrySelectAttribute(out sValue, PmNames.S_NAME.Name_Pm, EnumHitcount.One, log_Reports);

                    if (NamesNode.S_FNC == e_Child.Cur_Configuration.Name &&
                        NamesFnc.S_WHERE == sValue)
                    {
                        ec_Awhr1_Src = e_Child;// Expression_Node_StringImpl である必要がある。E_String_AtomImplではダメ。

                        if (ec_Awhr1_Src is Expression_Node_StringImpl)
                        {
                            ec_Awhr_Src = (Expression_Node_StringImpl)ec_Awhr1_Src;
                        }
                        else
                        {
                            // エラー。
                            goto gt_Error_AtomWhr2;
                        }

                        bBreak = true;
                    }

                    goto gt_EndMethod2;

                // エラー。
                gt_Error_AtomWhr2:
                    {
                        Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();

                        Expression_Leaf_StringImpl ec_Leaf = (Expression_Leaf_StringImpl)ec_Awhr1_Src;
                        tmpl.SetParameter(1, ec_Leaf.List_Expression_Child.Count.ToString(), log_Reports);//子要素の数

                        tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration), log_Reports);//設定位置パンくずリスト

                        this.Owner_MemoryApplication.CreateErrorReport("Er:6015;", tmpl, log_Reports);
                    }
                    goto gt_EndMethod2;

                    //
                gt_EndMethod2:
                    ;
                });

                if (null != ec_Awhr_Src)
                {
                    // 子「E■where」あり。
                    bExists_Awhr_Out = true;
                }
                else
                {
                    // 正常。無いこともあります。
                    bExists_Awhr_Out = false;
                    Configurationtree_Node cf_Node = new Configurationtree_NodeImpl(this + ":Where属性該当なし", null);
                    ec_Awhr_Src = new Expression_Node_StringImpl(this, cf_Node);
                }
            }
            else
            {
                // エラーがあるのでさっさと抜ける。
                bOneCellSelectCondition_Out = false;
                bExists_Awhr_Out = false;
                goto gt_EndMethod;
            }

            //
            // (3)required=”★”
            //    レコードが1件以上ヒットすることが必須か。"true","TRUE"等。
            //
            if (log_Reports.Successful)
            {
                // <f-cell required=”☆”>を使う。

                //
                // <f-cell>は required属性を持たないはず。
                // <fnc name=”Sf:where;”>のrequired引数が登録される?
                //
                //

                string sRequired;
                bool bHit = this.TrySelectAttribute(out sRequired, PmNames.S_REQUIRED.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports);
                if (bHit)
                {
                    selectSt.Required = sRequired;
                }
                else
                {
                    //
                    // <f-cell>が required属性を持っていないとき。
                    //
                    //ystem.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#E_Execute_P1_CleateSelect: <f-cell>が required属性を持っていないとき。");

                    //
                    // where属性で「E■where」(fnc)を持っているはず。(無条件のときは持っていない)
                    //
                    Expression_Node_String ec_Whr;//属性利用
                    bool bHit2 = this.TrySelectAttribute(out ec_Whr, PmNames.S_WHERE.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports);
                    if (bHit2)
                    {
                        bool bHit3 = ec_Whr.TrySelectAttribute(out sRequired, PmNames.S_REQUIRED.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports);
                        if (bHit3)
                        {
                            selectSt.Required = sRequired;
                            //ystem.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#E_Execute_P1_CleateSelect: <f-cell>が required属性を持っていなかったので、whereのrequired属性から取得した。[" + selectSt.Required + "]");
                        }
                        else
                        {
                            // whereのrequired設定が未指定。

                            // #エラー
                            System.Console.WriteLine(Info_Expr.Name_Library + ":" + this.GetType().Name + "#E_Execute_P1_CleateSelect: <f-cell>が required属性を持っていなかったので、whereのrequired属性から取得しようとしたが、whereのrequiredは未設定だった。[" + selectSt.Required + "]");
                        }
                    }
                    else
                    {
                        //
                        // <f-cell>が、where属性を持っていない。 【正常】
                        //

                        //// required設定が未指定。

                        //// #エラー
                        //System.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#E_Execute_P1_CleateSelect: <f-cell>が required属性を持っていなかったので、whereのrequired属性から取得しようとしたが、whereは未設定だった。[" + selectSt.Required + "]");

                        //if (bDbg1)
                        //{
                        //    System.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#E_Execute_P1_CleateSelect:┌────────┐this.E_AttrDic.Count=[" + this.E_AttrDic.Count + "]");
                        //    this.E_AttrDic.Each_E_Nodes(delegate(string sName, Expression_Node_String e_Child, ref bool bBreak)
                        //    {
                        //        System.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#E_Execute_P1_CleateSelect: [" + sName + "]=[" + e_Child.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]");
                        //    });
                        //    System.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#E_Execute_P1_CleateSelect:└────────┘");
                        //}
                    }
                }
            }

            //
            // (4)テーブル名。"Ut:モンスター表"等。
            //
            if (log_Reports.Successful)
            {
                // <f-cell from=”☆”>を使う。
                Expression_Node_String ec_From;//ソース情報利用
                bool bHit = this.TrySelectAttribute(out ec_From, PmNames.S_FROM.Name_Pm, EnumHitcount.One, log_Reports);
                if (bHit)
                {
                    selectSt.Expression_From = ec_From;
                }

                // テーブル名は必須。
                if ("" == selectSt.Expression_From.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports).Trim())
                {
                    //
                    // エラー。
                    //dst_Rs = null;
                    goto gt_Error_EmptyTableName;
                }
            }

            //
            // 「E■f-cell」は、子要素を持たない。
            //
            // 「E■f-cell」には、次の属性がある。
            // (1)「E■@where」
            //
            //
            // 「E■@where」は、次の子要素のリストがある。
            // ・「E■fnc name=”Sf:rec-cond;”」
            //

            //
            // f-cellの子要素の数は、where要素1つ、または 0 が正しい。
            //
            if (log_Reports.Successful)
            {
                // 子要素。
                List<Expression_Node_String> ecList = this.List_Expression_Child.SelectList(EnumHitcount.Unconstraint, log_Reports);
                //if (0 < e_List.Count)
                if (1 < ecList.Count)
                {
                    goto gt_Error_ExistsFcellChild;
                }
            }

            //
            // (2)探したいキー値の有無。"1000"等。
            if (log_Reports.Successful)
            {

                // key属性(@where)、record-set-load-from属性のどちらかが書かれているはず。

                if (
                    bExists_Awhr_Out ||
                    "" != selectSt.Expression_Where_RecordSetLoadFrom.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports).Trim()
                    )
                {
                    //ystem.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#E_Execute_PP1_FcellToSelectSt: 「E■a-where keyField=”☆”」は無かったが、「子E■rec-cond」要素はあった場合。");

                    // 次へ進む。
                }
                else
                {
                    // エラー。key値(@where)も、record-set-load-from属性もない。
                    goto gt_Error_EmptyKey;
                }
            }

            //
            // <f-cell>が、keyField=”★”属性("ID"などの値)を持つのは、R4-100版で廃止されました。
            //

            //
            // (5)あれば、「E■@where」の解析。(2012-02-07)
            //
            if (log_Reports.Successful)
            {
                if (bExists_Awhr_Out)
                {
                    // 「E■@where」条件が付いているとき。

                    // 「E■@where」の logic属性を取得しておく。
                    {
                        string sLogic;
                        bool bHit = ec_Awhr_Src.TrySelectAttribute(out sLogic, PmNames.S_LOGIC.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports);
                        if (bHit)
                        {
                            selectSt.EnumWherelogic = Utility_Table.LogicStringToEnum(sLogic);
                            //ystem.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#E_Execute_P1_SelectSt: where要素のlogic属性もきちんと読み取り。[" + sAwhrLogic + "]");
                        }
                    }

                    this.Execute_ParseChildRecordconditionList(
                        selectSt.List_Recordcondition,
                        ec_Awhr_Src,
                        log_Reports
                        );
                }
                else
                {
                    // 「E■@where」条件が無い場合。

                    // #警告。正常。
                    System.Console.WriteLine(Info_Expr.Name_Library + ":" + this.GetType().Name + "#E_Execute_P1_SelectSt: 条件がないタイプ(whereを持たない)です。親ノード=" + this.Cur_Configuration.Parent);
                }
            }

            //
            // 「E■@where」は、2種類に判別。
            // (1)「E■rec-cond」が1つだけ入っている形式
            // (2)「E■rec-cond」が1つ以上入っている形式
            //
            if (log_Reports.Successful)
            {
                if (0 == selectSt.List_Recordcondition.Count())
                {
                    //
                    // 0個なら、無条件。
                    //
                }
                else if (1 == selectSt.List_Recordcondition.Count())
                {
                    //
                    // 「フィールド値=値」の形の条件式かどうかを調べます。
                    //

                    // ・<rec-cond>が1つ
                    Recordcondition firstReccond = selectSt.List_Recordcondition[0];
                    if (null == firstReccond)
                    {
                        // #エラー? TODO:エラー?
                        System.Console.WriteLine(Info_Expr.Name_Library + ":" + this.GetType().Name + "#E_Execute_P1_SelectSt: rec-condリストにヌルが入っていた。エラー?");

                        // 条件ハズレ。
                        goto end_conditionSpec;
                    }

                    // ・その<rec-cond>は logic属性を持たない。
                    if (EnumLogic.None != firstReccond.EnumLogic)
                    {
                        // 条件ハズレ。
                        goto end_conditionSpec;
                    }

                    // field属性には1つのフィールド名が書かれている。(selectではないので、そうでなければエラー)
                    List<string> sList_FieldName = new CsvTo_ListImpl().Read(firstReccond.Name_Field);
                    if (1 != sList_FieldName.Count)
                    {
                        // 条件ハズレ。
                        goto end_conditionSpec;
                    }

                    // valueを持つ。
                    if ("" == firstReccond.Value.Trim())
                    {
                        // 条件ハズレ。
                        goto end_conditionSpec;
                    }

                    //「=」で結ばれている条件のもの。
                    if (EnumOpe.Eq != firstReccond.EnumOpe)
                    {
                        // 条件ハズレ。
                        goto end_conditionSpec;
                    }

                    // 適合。「フィールド名=値」の形の条件式。セル1つが選ばれる。
                    bOneCellSelectCondition_Out = true;
                }
                else
                {
                    // 条件ハズレ。
                }
            }

            end_conditionSpec:

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_ExistsFcellChild:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, this.Cur_Configuration.Name, log_Reports);//設定ノード名

                List<Expression_Node_String> e_List = this.List_Expression_Child.SelectList(EnumHitcount.Unconstraint, log_Reports);
                tmpl.SetParameter(2, e_List.Count.ToString(), log_Reports);//子要素の数

                Log_TextIndented s = new Log_TextIndentedImpl();
                foreach (Expression_Node_String ec_Child in e_List)
                {
                    s.Append("Expr[" + ec_Child.Cur_Configuration.Name + "]");
                    s.Newline();
                }
                tmpl.SetParameter(3, s.ToString(), log_Reports);//要素のリスト

                tmpl.SetParameter(4, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration), log_Reports);//設定位置パンくずリスト

                this.Owner_MemoryApplication.CreateErrorReport("Er:6016;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_EmptyKey:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, bExists_Awhr_Out.ToString(), log_Reports);//Where句の有無
                tmpl.SetParameter(2, selectSt.Expression_Where_RecordSetLoadFrom.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports).Trim(), log_Reports);//RecordSetLoadFrom属性
                tmpl.SetParameter(3, this.Dictionary_Expression_Attribute.Count.ToString(), log_Reports);//属性の数

                Log_TextIndented s1 = new Log_TextIndentedImpl();
                this.Dictionary_Expression_Attribute.ForEach(delegate(string sName3, Expression_Node_String e_Attr3, ref bool bBreak)
                {
                    s1.Append("Attribute[" + sName3 + "]=Expr[" + e_Attr3.Cur_Configuration.Name + "] 値=[" + e_Attr3.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]");
                    s1.Newline();
                });
                tmpl.SetParameter(4, s1.ToString(), log_Reports);//属性リスト

                tmpl.SetParameter(5, this.Dictionary_Expression_Attribute.Count.ToString(), log_Reports);//子要素の数

                Log_TextIndented s2 = new Log_TextIndentedImpl();
                this.List_Expression_Child.ForEach(delegate(Expression_Node_String e_Child, ref bool bRemove, ref bool bBreak)
                {
                    s2.Append("子 [" + e_Child.Cur_Configuration.Name + "]=[" + e_Child.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]");
                    s2.Newline();
                });
                tmpl.SetParameter(6, s2.ToString(), log_Reports);//子要素リスト

                tmpl.SetParameter(7, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration), log_Reports);//設定位置パンくずリスト

                this.Owner_MemoryApplication.CreateErrorReport("Er:6017;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_EmptyTableName:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(cf_Fcell), log_Reports);//設定位置パンくずリスト

                this.Owner_MemoryApplication.CreateErrorReport("Er:6018;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 再帰関数。
        /// 
        /// (A)「E■@where」のrec-condリストを抽出。
        /// (B)「E■fnc name=”Sf:rec-cond;”」のrec-condリストを抽出。
        /// </summary>
        /// <param name="dst_Recordcondition"></param>
        /// <param name="src_E_ReccondParent"></param>
        /// <param name="log_Reports"></param>
        private void Execute_ParseChildRecordconditionList(
            List<Recordcondition> list_Reccond_Dst,
            Expression_Node_StringImpl parent_Expression_ReccondList_Src,//「E■@where」か、「E■fnc name=”Sf:rec-cond;”」。子に「E■rec-cond」のリストを持つもの。
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Expr.Name_Library, this, "Execute_ParseChildReccndList",log_Reports);
            //
            //

            string err_SOpe;

            // 「E■@where」の子要素<rec-cond>。
            //ystem.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#Execute_ParseChildReccndList: src_E_ReccondParent=[" + src_E_ReccondListParent.Cur_Configurationtree.Name_Node + "] 属性数=[" + src_E_ReccondListParent.E_AttrDic.Count + "] 子要素数=[" + src_E_ReccondListParent.CountChildNodes + "]");
            foreach (Expression_Node_String ec_Reccond_Src in parent_Expression_ReccondList_Src.List_Expression_Child.SelectList(EnumHitcount.Unconstraint, log_Reports))
            {
                // logic属性=""
                EnumLogic enumLogic = EnumLogic.None;
                // field属性="" (logic属性の指定がない場合、必須)
                string sField = "";
                // ope属性=""
                string sOpe = "";
                // value属性=""
                string sValue = "";
                // 属性
                Expression_Node_String ec_Description = null;

                //
                //
                //
                //

                bool bRead_Logic = false;
                bool bRead_Field = false;
                bool bRead_Ope = false;
                bool bRead_Value = false;
                bool bRead_Description = false;

                if (NamesNode.S_FNC == ec_Reccond_Src.Cur_Configuration.Name)
                {
                    string sFncName;
                    ec_Reccond_Src.TrySelectAttribute(out sFncName, PmNames.S_NAME.Name_Pm, EnumHitcount.One, log_Reports);
                    if (sFncName == NamesFnc.S_REC_COND)
                    {
                        //
                        // 【2012-05-30】
                        // <fnc name=”Sf:rec-cond;”>
                        //

                        //ystem.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#Execute_ParseChildReccndList: 「E■fnc name=”Sf:rec-cond;”」を解析したい。 子要素数=[" + src_E_Reccond.CountChildNodes + "] 属性数=[" + src_E_Reccond.E_AttrDic.Count + "]");

                        //
                        //
                        ec_Reccond_Src.Dictionary_Expression_Attribute.ForEach(
                            delegate(string sPmName, Expression_Node_String ec_Attr2, ref bool bBreak)
                            {
                                //ystem.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#Execute_ParseChildReccndList: [属性] " + sAttrName + "=”" + e_Attr.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "”");

                                if (sPmName == PmNames.S_LOGIC.Name_Pm)
                                {
                                    // 「@logic」値
                                    enumLogic = Utility_Table.LogicStringToEnum(ec_Attr2.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));
                                    bRead_Logic = true;
                                }
                                else if (sPmName == PmNames.S_FIELD.Name_Pm)
                                {
                                    // field属性="" (logic属性がない場合は必須)
                                    sField = ec_Attr2.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                                    bRead_Field = true;
                                }
                                else if (sPmName == PmNames.S_OPE.Name_Pm)
                                {
                                    // ope属性=""
                                    sOpe = ec_Attr2.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                                    bRead_Ope = true;
                                }
                                else if (sPmName == PmNames.S_VALUE.Name_Pm)
                                {
                                    // #エラー? todo: valueは属性にせず、子要素にしたい。
                                    throw new Exception("※valueは属性にせず、子要素にしたい。★★★★★★★★★☆★★★★★★★★★☆★★★★★★★★★☆");
                                    System.Console.WriteLine(Info_Expr.Name_Library + ":" + this.GetType().Name + "#Execute_ParseChildReccndList: ※valueは属性にせず、子要素にしたい。★★★★★★★★★☆★★★★★★★★★☆★★★★★★★★★☆");

                                    // value属性=""
                                    sValue = ec_Attr2.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                                    bRead_Value = true;
                                }
                                else if (sPmName == PmNames.S_DESCRIPTION.Name_Pm)
                                {
                                    throw new Exception("使ってる?");
                                    ec_Description = ec_Attr2;
                                    bRead_Description = true;
                                }
                                else
                                {
                                    // todo:未定義の属性
                                }

                            });

                        // 「E■fnc」の子要素。
                        //ystem.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#Execute_ParseChildReccndList: 「E■fnc」の子要素数=[" + src_E_Reccond.CountChildNodes + "]");
                        ec_Reccond_Src.List_Expression_Child.ForEach(
                            delegate(Expression_Node_String ec_Child, ref bool bRemove, ref bool bBreak)
                            {
                                //
                                // 「E■fnc」の子要素は、次の4種類。
                                //
                                //━━━━━
                                //f-str
                                //f-var
                                //fnc
                                //━━━━━
                                //
                                //
                                if (
                                    NamesNode.S_F_STR == ec_Child.Cur_Configuration.Name ||
                                    NamesNode.S_F_VAR == ec_Child.Cur_Configuration.Name ||
                                    NamesNode.S_FNC == ec_Child.Cur_Configuration.Name
                                    )
                                {
                                    sValue = ec_Child.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                                    bRead_Value = true;
                                    //ystem.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#Execute_ParseChildReccndList: 「E■fnc」の子要素=[" + e_Child.Cur_Configurationtree.Name_Node + "] sValue=[" + sValue + "]");
                                }
                                else
                                {
                                    // #エラー? todo:未定義の子要素。
                                    System.Console.WriteLine(Info_Expr.Name_Library + ":" + this.GetType().Name + "#Execute_ParseChildReccndList: 「E■fnc」の未定義の子要素=[" + ec_Child.Cur_Configuration.Name + "]");
                                }
                            }
                        );
                    }
                    else
                    {
                        // #エラー? todo:エラー
                        System.Console.WriteLine(Info_Expr.Name_Library + ":" + this.GetType().Name + "#Execute_ParseChildReccndList: <fnc>だったが、「Sf:rec-cond;」ではなかった。");
                    }
                }
                else
                {
                    // #エラー todo:エラー
                    System.Console.WriteLine(Info_Expr.Name_Library + ":" + this.GetType().Name + "#Execute_ParseChildReccndList: 「E■fnc」でも、「E■rec-cond」でもなかった。 未定義の子要素<" + ec_Reccond_Src.Cur_Configuration.Name + ">。");
                }

                Recordcondition dst_Recordcondition = null;

                //
                //
                //

                if (bRead_Logic)
                {
                    if (EnumLogic.None != enumLogic)
                    {
                        // logic属性がある場合
                        //ystem.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#Execute_ParseChildReccndList: rec-condに、logic属性が指定されています。解析。[" + logic.ToString() + "]★★★★★★★★★☆★★★★★★★★★☆★★★★★★★★★☆★★★★★★★★★☆");

                        bool bSuccessful = RecordconditionImpl.TryBuild(
                            out dst_Recordcondition,//作られるオブジェクト
                            enumLogic,//andとかorとか。
                            "",//フィールドID指定なし。
                            this.Cur_Configuration.Parent,
                            log_Reports
                            );

                        // 再帰。
                        //
                        // 子要素に<fnc name=”Sf:rec-cond;”>がある。
                        this.Execute_ParseChildRecordconditionList(
                            dst_Recordcondition.List_Child,
                            (Expression_Node_StringImpl)ec_Reccond_Src,
                            log_Reports
                            );

                        //
                        // rec-condの子要素化を終えます。
                        //
                        goto end_recCond;
                    }
                }

                bool bSuccessful2 = false;
                if (bRead_Field)
                {
                    bSuccessful2 = RecordconditionImpl.TryBuild(out dst_Recordcondition, EnumLogic.None, sField, this.Cur_Configuration.Parent, log_Reports);
                }

                if (bSuccessful2)
                {

                    if (bRead_Ope)
                    {
                        // ope属性=""
                        //ystem.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#Execute_ParseChildReccndList: ope解析。[" + sOpe + "]");

                        switch (sOpe)
                        {
                            case Expression_SfcellImpl.S_EQ:
                                dst_Recordcondition.EnumOpe = EnumOpe.Eq;
                                break;

                            case Expression_SfcellImpl.S_NEQ:
                                dst_Recordcondition.EnumOpe = EnumOpe.Neq;
                                break;

                            case Expression_SfcellImpl.S_LT:
                                dst_Recordcondition.EnumOpe = EnumOpe.Lt;
                                break;

                            case Expression_SfcellImpl.S_LTEQ:
                                dst_Recordcondition.EnumOpe = EnumOpe.Lteq;
                                break;

                            case Expression_SfcellImpl.S_GT:
                                dst_Recordcondition.EnumOpe = EnumOpe.Gt;
                                break;

                            case Expression_SfcellImpl.S_GTEQ:
                                dst_Recordcondition.EnumOpe = EnumOpe.Gteq;
                                break;

                            default:
                                // エラー
                                err_SOpe = sOpe;
                                goto gt_Error_UndefinedOpe;
                        }
                    }

                    if (bRead_Value)
                    {
                        // value属性="" TODO:子要素としてのvalue値もあるはず。
                        //ystem.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#Execute_ParseChildReccndList: value解析。["+sValue+"]");

                        dst_Recordcondition.Value = sValue;
                    }

                    if (bRead_Description)
                    {
                        dst_Recordcondition.Expression_Description = ec_Description;
                    }
                }

                //
                // rec-condの解析終わり、次は親要素の子要素リストに追加するか否か。
                //
            end_recCond:

                // 親要素に、この要素を追加。
                if (
                    bRead_Logic ||
                    bRead_Field ||
                    bRead_Ope ||
                    bRead_Value ||
                    bRead_Description
                    )
                {
                    if (dst_Recordcondition != null)
                    {
                        // 条件指定がある場合。
                        //ystem.Console.WriteLine(Info_E.LibraryName + ":" + this.GetType().Name + "#Execute_ParseChildReccndList: ★★親要素に、この要素を追加します。");
                        list_Reccond_Dst.Add(dst_Recordcondition);
                    }
                    else
                    {
                        // #エラー?
                        System.Console.WriteLine(Info_Expr.Name_Library + ":" + this.GetType().Name + "#Execute_ParseChildReccndList: 親要素に、この要素できませんでした。");
                    }
                }
                else
                {
                    // #エラー?
                    System.Console.WriteLine(Info_Expr.Name_Library + ":" + this.GetType().Name + "#Execute_ParseChildReccndList: 親要素に、この要素は追加しません。 bRead_Logic=[" + bRead_Logic + "] bRead_Field=[" + bRead_Field + "] bRead_Ope=[" + bRead_Ope + "] bRead_Value=[" + bRead_Value + "] bRead_Description=[" + bRead_Description + "]");
                }
            }//foreach

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

                this.Owner_MemoryApplication.CreateErrorReport("Er:6014;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
Ejemplo n.º 15
0
        //────────────────────────────────────────
        #endregion



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

        /// <summary>
        /// イベント アクション リストを作成します。
        /// </summary>
        /// <param nFcName="eventName"></param>
        /// <param nFcName="nActionSuper"></param>
        /// <param nFcName="log_Reports"></param>
        public Functionlist CreateFunctionlist(
            ConfigurationtreeToExpression_Event sToE_Event,
            MemoryApplication owner_MemoryApplication,
            Log_Reports log_Reports
            )
        {
            Log_Method pg_Method = new Log_MethodImpl();
            pg_Method.BeginMethod(Info_Controls.Name_Library, this, "CreateFunctionlist",log_Reports);
            //
            //
            Functionlist fc_Result = null;

            switch (sToE_Event.Name)
            {
                case NamesSe.S_LOAD:
                    {
                        //
                        // このコントロールの「アプリケーション起動時」。
                        //
                        //  (NActionPerformEnum.O_EA)
                        //

                        //
                        // 無視します。
                        //
                    }
                    break;

                default:
                    goto gt_Error_NotSupportedEvent;
            }

            //.WriteLine(this.GetType().NFcName + "#CreateEventActionList: ■■■■■■■■■■未実装です。無視されます。rEvent.NFcName=[" + rEvent.NFcName + "]■■■■■■■■■■");

            goto gt_EndMethod;
        //
        //
            #region 異常系
        //────────────────────────────────────────
        gt_Error_NotSupportedEvent:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, this.GetType().Name, log_Reports);//クラス名
                tmpl.SetParameter(1, sToE_Event.Name, log_Reports);//イベント名
                tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(sToE_Event.Configurationtree_Event), log_Reports);//設定位置パンくずリスト

                this.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:533;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
        //────────────────────────────────────────
            #endregion
        //
        //
        gt_EndMethod:
            pg_Method.EndMethod(log_Reports);
            return fc_Result;
        }
        //────────────────────────────────────────
        public void Translate(
            Configurationtree_Node cur_Cf,
            Expressionv_3FListboxValidationImpl parent_Exprv,
            UsercontrolListbox uctLst,
            MemoryApplication memoryApplication,
            Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "SToE",log_Reports);

            if (log_Method.CanDebug(1))
            {
                pg_ParsingLog.Increment("(35)" + cur_Cf.Name);
            }

            //
            //

            string err_Child_SName_Node = "";
            string err_Parent_SName_Node = "";
            Configurationtree_Node err_Child_CfNode = null;

            //
            //
            //
            // 自
            //
            //
            //
            Expressionv_4ADisplayImpl cur_Exprv = new Expressionv_4ADisplayImpl(parent_Exprv, cur_Cf, memoryApplication);

            //
            //
            //
            // 属性
            //
            //
            //
            {
                {
                    PmName pmName = PmNames.S_TYPE;
                    string sValue;
                    bool bHit = cur_Cf.Dictionary_Attribute.TryGetValue(pmName, out sValue, false, log_Reports);
                    if (bHit)
                    {
                        cur_Exprv.Dictionary_SAttribute.Add(pmName.Name_Pm, sValue);
                    }
                }

                {
                    PmName pmName = PmNames.S_DESCRIPTION;
                    string sValue;
                    bool bHit = cur_Cf.Dictionary_Attribute.TryGetValue(pmName, out sValue, false, log_Reports);
                    if (bHit)
                    {
                        cur_Exprv.Dictionary_SAttribute.Add(pmName.Name_Pm, sValue);
                    }
                }
            }

            parent_Exprv.List_Expressionv_ADisplay.Add(cur_Exprv);
            uctLst.AddValidator_FListboxForItems(parent_Exprv, log_Reports);

            // #デバッグ中
            if (log_Method.CanDebug(1))
            {
                log_Method.WriteDebug_ToConsole(" 子<f-●●>数=[" + cur_Cf.List_Child.Count + "]");
            }

            //
            //
            //
            // 子
            //
            //
            //
            cur_Cf.List_Child.ForEach(delegate(Configurationtree_Node child_Cf, ref bool bBreak)
            {
                if (child_Cf is Configurationtree_Node)
                {
                    Configurationtree_Node child_Configurationtree_Node = (Configurationtree_Node)child_Cf;

                    string sName_Fnc;
                    child_Configurationtree_Node.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_Fnc, false, log_Reports);

                    if (NamesFnc.S_VLD_ALL_FIELDS_IS_EMPTY == sName_Fnc)
                    {
                        //
                        // <f-all-fields-is-empty>要素
                        ConfigurationtreeToExpression_V54_FAllFieldsIsEmptyImpl_ to = new ConfigurationtreeToExpression_V54_FAllFieldsIsEmptyImpl_();
                        to.Translate(
                            child_Configurationtree_Node,
                            cur_Exprv,
                            memoryApplication,
                            pg_ParsingLog,
                            log_Reports
                            );
                    }
                    else if (NamesFnc.S_ALL_TRUE == sName_Fnc)
                    {
                        //
                        // <f-all-true>要素
                        ConfigurationtreeToExpression_V54_FAllTrueImpl_ to = new ConfigurationtreeToExpression_V54_FAllTrueImpl_();
                        to.Translate(
                            child_Configurationtree_Node,
                            cur_Exprv,
                            memoryApplication,
                            pg_ParsingLog,
                            log_Reports
                            );

                    }
                    else
                    {
                        //
                        // エラー。
                        err_Child_SName_Node = child_Configurationtree_Node.Name;
                        err_Parent_SName_Node = cur_Cf.Name;
                        err_Child_CfNode = child_Configurationtree_Node;
                        bBreak = true;
                    }
                }
            });
            if (null != err_Child_SName_Node)
            {
                goto undefined_element;
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            undefined_element:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, err_Child_SName_Node, log_Reports);//子設定ノード名
                tmpl.SetParameter(2, err_Parent_SName_Node, log_Reports);//親設定ノード名
                tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Configuration(err_Child_CfNode), log_Reports);//設定位置パンくずリスト

                memoryApplication.CreateErrorReport("Er:7020;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            if (Log_ReportsImpl.BDebugmode_Static)
            {
                pg_ParsingLog.Decrement(cur_Cf.Name);
            }
            log_Method.EndMethod(log_Reports);
        }
Ejemplo n.º 17
0
        //────────────────────────────────────────
        /// <summary>
        /// データ・ターゲットへの出力を行います。
        /// 
        /// イベント・ハンドラー以外でも、直接、データターゲットへの出力を行うことができます。
        /// </summary>
        public void UsercontrolToMemory(
            Log_Reports log_Reports
            )
        {
            //
            // ボタン → エラー。

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

            //#このルートはエラー
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                //%N%なし

                this.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:538;", tmpl, log_Reports);
            }

            //
            //
            pg_Method.EndMethod(log_Reports);
        }
        //────────────────────────────────────────
        protected void Execute6_Sub(
            object sender,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute6_Sub", log_Reports);

            if (log_Reports.CanStopwatch)
            {
                string sFncName;
                this.TrySelectAttribute(out sFncName, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports);
                log_Method.Log_Stopwatch.Message = "Nアクション[" + sFncName + "]実行";
                log_Method.Log_Stopwatch.Begin();
            }

            string err_SFcName;
            string err_SFcTypeName;
            if (log_Reports.Successful)
            {
                // 変数名が入っているはず。
                Expression_Node_String ec_ArgNameVariable;
                this.TrySelectAttribute(out ec_ArgNameVariable, Expression_Node_Function43Impl.PM_NAME_VAR, EnumHitcount.One_Or_Zero, log_Reports);
                string sVariableName = ec_ArgNameVariable.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);

                Expression_Node_String ec_ArgFcName;
                this.TrySelectAttribute(out ec_ArgFcName, Expression_Node_Function43Impl.PM_NAME_CONTROL, EnumHitcount.One_Or_Zero, log_Reports);
                List<Usercontrol> list_UcFc = this.Owner_MemoryApplication.MemoryForms.GetUsercontrolsByName(ec_ArgFcName, true, log_Reports);
                foreach (Usercontrol uct in list_UcFc)
                {
                    if (uct is UsercontrolCheckbox)
                    {
                        // チェックボックスの場合。
                        CustomcontrolCheckbox ccChk = ((UsercontrolCheckbox)uct).CustomcontrolCheckbox1;
                        string sBool = ccChk.Checked.ToString();//TRUE or FALSE

                        XenonName o_VariableName = new XenonNameImpl(sVariableName, this.Cur_Configuration);

                        // 変数を上書き。
                        this.Owner_MemoryApplication.MemoryVariables.SetStringValue(
                            o_VariableName,
                            sBool,
                            true,
                            log_Reports
                            );
                    }
                    else
                    {
                        // エラー
                        err_SFcName = uct.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                        err_SFcTypeName = uct.GetType().Name;
                        goto gt_Error_UndefinedUc;
                    }

                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_UndefinedUc:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, err_SFcName, log_Reports);//コントロール名
                tmpl.SetParameter(2, err_SFcTypeName, log_Reports);//コントロールの型名

                this.Owner_MemoryApplication.CreateErrorReport("Er:110026;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
        //────────────────────────────────────────
        public override void XmlToConfigurationtree(
            XmlElement cur_X,//<key-event>
            Configurationtree_Node parent_Cf,//<control>
            MemoryApplication memoryApplication,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_XmlToConf.Name_Library, this, "XmlToConfigurationtree", log_Reports);
            //
            //

            //
            //
            //
            // 自
            //
            //
            //
            Configurationtree_Node cur_Cf = this.CreateMyself(cur_X, parent_Cf, memoryApplication, log_Reports);

            //
            //
            //
            // 属性
            //
            //
            //
            this.Parse_SAttribute(cur_X, cur_Cf, memoryApplication, log_Reports);

            //
            // コントロールの、key-eventリストに、S_KeyEventを追加。
            //
            if (log_Reports.Successful)
            {
                XmlToConfigurationtree_C15_Elm to = XmlToConfigurationtree_Collection.GetTranslatorByNodeName(NamesNode.S_KEY_ACTION, log_Reports);

                //List<string> li = new List<string>();
                //li.Add(PmNames.TYPE.Name_Pm);
                //li.Add(PmNames.S_DESCRIPTION.Name_Attribute);
                //xToS.List_AttrName = li;

                //
                //
                // fncノードを列挙
                //
                XmlNodeList child_XNl = cur_X.ChildNodes;
                foreach(XmlNode xChild in child_XNl)
                {

                    if (XmlNodeType.Element == xChild.NodeType)
                    {
                        if (NamesNode.S_FNC == xChild.Name)
                        {
                            XmlElement xFnc = (XmlElement)xChild;

                            to.XmlToConfigurationtree(
                                xFnc,
                                cur_Cf,
                                memoryApplication,
                                log_Reports
                                );
                        }
                        else
                        {
                            //#連続エラー
                            {
                                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                                tmpl.SetParameter(1, xChild.Name, log_Reports);//ノード名
                                tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(cur_Cf), log_Reports);//設定位置パンくずリスト

                                memoryApplication.CreateErrorReport("Er:8025;", tmpl, log_Reports);
                            }
                        }
                    }

                }

            }

            //
            //
            //
            // 親へ連結
            //
            //
            //
            if (log_Reports.Successful)
            {
                parent_Cf.List_Child.Add(cur_Cf,log_Reports);
            }

            //
            //
            //
            //
            log_Method.EndMethod(log_Reports);
        }
        //────────────────────────────────────────
        public void ParseChild_InConfigurationtreeToExpression(
            Configurationtree_Node cur_Conf,//S_NodeList s_curNodeList,
            Expression_Node_String parent_Expr,//nAcase,nFelemの両方の場合がある。
            MemoryApplication memoryApplication,
            Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "ParseChild_InSToE",log_Reports);
            //
            //

            if (null == parent_Expr)
            {
                goto gt_Error_NullNFAelem;
            }

            //
            // 親ノード名、親ファンク名
            //
            string parent_SName_Node = parent_Expr.Cur_Configuration.Name;
            string parent_SName_Fnc = "";
            {
                EnumHitcount enumHitcount;
                if (NamesNode.S_FNC == parent_SName_Node)
                {
                    //todo: enumHitcount = EnumHitcount.One;
                    enumHitcount = EnumHitcount.One_Or_Zero;
                }
                else
                {
                    enumHitcount = EnumHitcount.One_Or_Zero;
                }

                log_Reports.Log_Callstack.Push(log_Method, "①");
                bool bHit = parent_Expr.TrySelectAttribute(out parent_SName_Fnc, PmNames.S_NAME.Name_Pm, enumHitcount, log_Reports);
                log_Reports.Log_Callstack.Pop(log_Method, "①");
            }

            if (log_Method.CanDebug(1))
            {
                log_Method.WriteDebug_ToConsole( "開始┌──┐ s_Curノード名=[" + cur_Conf.Name + "] 子要素数=[" + cur_Conf.List_Child.Count + "]");
            }

            //
            //
            //
            // 子
            //
            //
            //
            Configurationtree_Node err_Configurationtree_Node2 = null;
            cur_Conf.List_Child.ForEach(delegate(Configurationtree_Node s_Child, ref bool bBreak)
            {

                if (!log_Reports.Successful)
                {
                    // 強制終了。
                    bBreak = true;
                    return;
                }

                string sName_MyNode = s_Child.Name;
                string sName_MyFnc = "";
                {
                    bool bRequired;

                    if (NamesNode.S_ARG == sName_MyNode)
                    {
                        bRequired = true;
                    }
                    else
                    {
                        bRequired = false;
                    }

                    log_Reports.Log_Callstack.Push(log_Method, "②");
                    s_Child.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_MyFnc, bRequired, log_Reports);
                    log_Reports.Log_Callstack.Pop(log_Method, "②");
                }

                if (this.Dictionary_ConfigurationtreeToExpression.ContainsKey(sName_MyNode))
                {
                    if (log_Method.CanDebug(1))
                    {
                        log_Method.WriteDebug_ToConsole( "親「S■[" + parent_SName_Fnc + "] name=”[" + parent_SName_Fnc + "]”」 自「S■[" + sName_MyNode + "] name=”[" + sName_MyFnc + "]”」");
                    }

                    this.Dictionary_ConfigurationtreeToExpression[sName_MyNode].Translate(
                        s_Child,
                        parent_Expr,
                        memoryApplication,
                        pg_ParsingLog,
                        log_Reports
                        );

                }
                else
                {
                    //
                    // それ以外、エラー。
                    //
                    err_Configurationtree_Node2 = s_Child;
                    bBreak = true;
                }
            });
            //
            if (null != err_Configurationtree_Node2)
            {
                goto gt_Error_UndefinedElement;
            }

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

                memoryApplication.CreateErrorReport("Er:7010;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_UndefinedElement:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, err_Configurationtree_Node2.Name, log_Reports);//設定ノード名
                tmpl.SetParameter(2, err_Configurationtree_Node2.GetType().Name, log_Reports);//設定ノードのクラス名
                tmpl.SetParameter(3, this.Dictionary_ConfigurationtreeToExpression.Count.ToString(), log_Reports);//キーの個数

                StringBuilder s1 = new StringBuilder();
                foreach (string sKey in this.Dictionary_ConfigurationtreeToExpression.Keys)
                {
                    s1.Append(sKey);
                    s1.Append(System.Environment.NewLine);
                }
                tmpl.SetParameter(4, s1.ToString(), log_Reports);//キーのリスト

                //設定親ノード名
                if (null != parent_Expr)
                {
                    tmpl.SetParameter(5, parent_Expr.Cur_Configuration.Name, log_Reports);
                }
                else
                {
                    tmpl.SetParameter(5, "ヌル", log_Reports);
                }

                tmpl.SetParameter(6, Log_RecordReportsImpl.ToText_Configuration(err_Configurationtree_Node2), log_Reports);//設定位置パンくずリスト

                memoryApplication.CreateErrorReport("Er:7011;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            gt_EndMethod:
            if (Log_ReportsImpl.BDebugmode_Static)
            {
                //d_ParsingLog.Decrement(s_Cur.Name_Node);
            }
            log_Method.EndMethod(log_Reports);

            if (log_Method.CanDebug(1))
            {
                log_Method.WriteDebug_ToConsole( "終了└──┘");
            }
        }
Ejemplo n.º 21
0
        /// <summary>
        /// レコードセットの削除。
        /// </summary>
        /// <param name="eStorage"></param>
        /// <param name="log_Reports"></param>
        public void Remove(Expression_Node_String ec_Storage,
            MemoryApplication memoryApplication,
            Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Expr.Name_Library, this, "Remove",log_Reports);
            //
            //

            string sStorage = ec_Storage.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports).Trim();

            Exception err_Excp;
            try
            {
                this.dictionary_Recordset.Remove(sStorage);

                // #デバッグ中
                System.Console.WriteLine(Info_Expr.Name_Library + ":" + this.GetType().Name + "#Remove: 【レコードセット削除】sName=[" + sStorage + "]");

            }
            catch (Exception ex)
            {
                err_Excp = ex;
                goto gt_Error_Exception;
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_Exception:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, sStorage, log_Reports);//名前
                tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(ec_Storage.Cur_Configuration), log_Reports);//設定位置パンくずリスト
                tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports);//例外メッセージ

                memoryApplication.CreateErrorReport("Er:6045;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
        //────────────────────────────────────────
        protected void TestExists_String(
            string sArgName_Display,
            string sValue,
            string sFpath_SelectedProject,
            Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0);
            log_Method.BeginMethod(Info_Functions.Name_Library, this, "TestExists_String",log_Reports);

            if ("" == sValue)
            {
                goto gt_Error_NoData;
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_NoData:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, sFpath_SelectedProject, log_Reports);//選択したエディター・フォルダーのファイルパス
                tmpl.SetParameter(2, sArgName_Display, log_Reports);//表示名

                this.Owner_MemoryApplication.CreateErrorReport("Er:110004;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
Ejemplo n.º 23
0
        public void TryGetFilepath_Configurationtree(out Configurationtree_NodeFilepath out_Value, string sName, bool bRequired,
            MemoryApplication memoryApplication,
            Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Expr.Name_Library, this, "TryGetFilepath_Configurationtree", log_Reports);
            //

            if (!this.Dictionary_Field.ContainsKey(sName))
            {
                //該当なし。

                if (bRequired)
                {
                    out_Value = new Configurationtree_NodeFilepathImpl(log_Method.Fullname,null);//ヌル・オブジェクト。
                    goto gt_Error_NotFound;
                }
                else
                {
                    out_Value = new Configurationtree_NodeFilepathImpl(log_Method.Fullname, null);//ヌル・オブジェクト。
                    goto gt_EndMethod;
                }
            }

            FieldUserformtable fo_Field = this.Dictionary_Field[sName];

            if (EnumTypedb.ConfFilepath != fo_Field.EnumTypedb)
            {
                //型が異なる。

                if (bRequired)
                {
                    out_Value = new Configurationtree_NodeFilepathImpl(log_Method.Fullname, null);//ヌル・オブジェクト。
                    goto gt_Error_Type;
                }
                else
                {
                    out_Value = new Configurationtree_NodeFilepathImpl(log_Method.Fullname, null);//ヌル・オブジェクト。
                    goto gt_EndMethod;
                }
            }
            out_Value = (Configurationtree_NodeFilepath)fo_Field.Data;

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_NotFound:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, sName, log_Reports);//フィールド名

                memoryApplication.CreateErrorReport("Er:6007;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_Type:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, sName, log_Reports);//フィールド名
                tmpl.SetParameter(2, fo_Field.EnumTypedb.ToString(), log_Reports);//フィールドの型名

                memoryApplication.CreateErrorReport("Er:6008;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
        //────────────────────────────────────────
        /// <summary>
        /// プロジェクト読取り時の定形アクション実行。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="st_PrevProjectElm_OrNull"></param>
        /// <param name="bProjectValid"></param>
        /// <param name="log_Reports"></param>
        public override string Execute5_Main(Log_Reports log_Reports)
        {
            //()メソッド開始
            Log_Method log_Method = new Log_MethodImpl(1);
            log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute5_Main",log_Reports);

            //
            if (log_Method.CanDebug(1))
            {
                log_Method.WriteDebug_ToConsole("「プロジェクト選択時」用のイベントハンドラーを実行します。");
            }

            //()タスク_デスクリプション
            {
                string sFncName0;
                this.TrySelectAttribute(out sFncName0, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports);
                if (this.Functionparameterset.Sender is Customcontrol)
                {
                    Customcontrol ccFc = (Customcontrol)this.Functionparameterset.Sender;
                    string sName_Usercontrol = ccFc.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                    log_Reports.Comment_EventCreationMe += "/追加:[" + sName_Usercontrol + "]コントロールが、[" + sFncName0 + "]アクションを実行。";
                }
                else
                {
                    log_Reports.Comment_EventCreationMe += "/追加:[" + sFncName0 + "]アクションを実行。";
                }
            }

            Configurationtree_Node conf_ThisMethod = new Configurationtree_NodeImpl(log_Method.Fullname, null);

            if (this.EnumEventhandler == EnumEventhandler.Editor_B_Lr)
            {
                //(4)独自モデルの取得
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(4)独自モデルの取得");
                }
                //
                this.On_P04_ReadNewModel(log_Reports);

                //(5)エディター名。ツール設定ファイルに記載されている方。
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(5)エディター名。ツール設定ファイルに記載されている方。");
                }

                // 表示用の名称。
                string sName_SelectingEditor;
                if (this.Functionparameterset.SelectedProjectElement_Configurationtree == null)
                {
                    //
                    // 切り替えるプロジェクトが判明していない場合は、空文字列。
                    //
                    sName_SelectingEditor = "";
                }
                else
                {
                    //
                    // todo: エディター設定ファイルの方のエディター名を入れても意味ないのでは?
                    //
                    sName_SelectingEditor = ((MemoryAatoolxml_Editor)this.Functionparameterset.SelectedProjectElement_Configurationtree).Name;
                }

                //(6)まず、きれいさっぱり プロジェクトをクリアーします。(切替用)
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(6)まず、きれいさっぱり プロジェクトをクリアーします。(切替用)");
                }
                // todo:イベントハンドラーを外してから、フォームを外すこと。リストボックスが誤挙動を起こしている。
                this.On_P06_ClearProject(this.Functionparameterset.Sender, log_Reports);

                //(7)「Aa_Editor.xml」読取。
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(7)「Aa_Editor.xml」読取。");
                }
                //
                if (!this.Functionparameterset.IsProjectValid || this.Functionparameterset.SelectedProjectElement_Configurationtree == null)
                {
                    MemoryAatoolxml_Editor moAatoolxml_PrevEditorElm_OrNull = null;

                    //
                    //
                    //
                    // デフォルト・プロジェクト名が指定されていない場合、
                    // ツール設定ファイルの最初に記述されているプロジェクトを選択します。
                    //
                    //
                    //
                    if (log_Reports.Successful)
                    {
                        if ("" == sName_SelectingEditor)
                        {
                            //
                            // デフォルト・エディター名が未指定の場合。
                            //
                            MemoryAatoolxml_Editor moAatoolxml_DefaultEditor = this.Owner_MemoryApplication.MemoryAatoolxml.GetDefaultEditor(true, log_Reports);
                            if (!log_Reports.Successful)
                            {
                                // 既エラー。
                                goto gt_EndMethod;
                            }

                            // ↓これ要る?
                            sName_SelectingEditor = moAatoolxml_DefaultEditor.Name;
                        }
                    }

                    this.On_P07_SelectDefaultProject(ref sName_SelectingEditor, ref moAatoolxml_PrevEditorElm_OrNull, this.Functionparameterset.IsProjectValid, log_Reports);

                    this.Functionparameterset.SelectedProjectElement_Configurationtree = moAatoolxml_PrevEditorElm_OrNull;

                    //
                    //
                    //
                    //「プロジェクトを開いた時の初期化」イベントハンドラーで使うために、ここで設定します。
                    //
                    //
                    //
                    this.Functionparameterset.SelectedProjectElement_Configurationtree = this.Owner_MemoryApplication.MemoryAatoolxml.GetEditorByName(sName_SelectingEditor, true, log_Reports);
                    if (!log_Reports.Successful)
                    {
                        // 既エラー。
                        goto gt_EndMethod;
                    }
                }

                // ↓追加
                if (null == this.Functionparameterset.SelectedProjectElement_Configurationtree)
                {
                    {
                        Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                        tmpl.SetParameter(1, sName_SelectingEditor, log_Reports);//エディター名

                        this.Owner_MemoryApplication.CreateErrorReport("Er:110003;", tmpl, log_Reports);
                    }
                }
                // ↑追加

                //(13a)エディター・フォルダー。
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(13a)エディター・フォルダーパス類推。");
                }
                //
                //
                //
                Expression_Node_Filepath ec_Fopath_Editor;
                if (log_Reports.Successful)
                {
                    MemoryAatoolxml_Editor moAatoolxml_SelectedEditor = (MemoryAatoolxml_Editor)this.Functionparameterset.SelectedProjectElement_Configurationtree;
                    ec_Fopath_Editor = moAatoolxml_SelectedEditor.GetFilepathByFsetvarname(
                        NamesVar.S_SP_EDITOR,
                        this.Owner_MemoryApplication.MemoryVariables,
                        true,
                        log_Reports
                        );
                }
                else
                {
                    ec_Fopath_Editor = null;
                }

                //(13b)「Aa_Editor.xml」読取。
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(13b)「Aa_Editor.xml」ファイルパス類推。");
                }
                //
                Expression_Node_Filepath ec_Fpath_AaEditorXml;
                if (log_Reports.Successful)
                {

                    //
                    // ツール設定ファイルで指定された値から、自動類推で設定されているはず。
                    //
                    Configurationtree_NodeFilepath cf_Fpath_EditorXml = new Configurationtree_NodeFilepathImpl(
                        "ツール設定ファイル[" + Application.StartupPath + System.IO.Path.DirectorySeparatorChar + ValuesAttr.S_FPATHR_AATOOLXML + "]の中の[" + sName_SelectingEditor + "]エディターへの指定から自動類推",
                        null);

                    // フォルダーパス + \Aa_Editor.xml
                    string sFpatha_Aaeditorxml = ec_Fopath_Editor.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + System.IO.Path.DirectorySeparatorChar + NamesFile.S_AA_EDITOR_XML;

                    // プロジェクト起動時に。
                    cf_Fpath_EditorXml.InitPath(
                        sFpatha_Aaeditorxml,
                        log_Reports
                        );
                    ec_Fpath_AaEditorXml = new Expression_Node_FilepathImpl(cf_Fpath_EditorXml);
                }
                else
                {
                    ec_Fpath_AaEditorXml = null;
                }

                //(8)「エディター設定ファイル」に記述されている<f-set-var>要素を、「エディター設定ファイル・モデル」に格納。Cf→M
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(8)「エディター設定ファイル」に記述されている<f-set-var>要素を、「エディター設定ファイル・モデル」に格納。Cf→M。この時点で「Sp:Engine;」といったシステム変数は自動類推が終わっている必要があります。");
                }
                //
                MemoryAaeditorxml_Editor moAaeditorxml_Editor = null;
                if (log_Reports.Successful)
                {
                    this.On_P08_SpToVar_(
                        out moAaeditorxml_Editor,
                        ec_Fpath_AaEditorXml,
                        ec_Fopath_Editor,
                        (MemoryAatoolxml_Editor)this.Functionparameterset.SelectedProjectElement_Configurationtree,
                        log_Reports
                        );
                }

                //
                //
                //
                // ここで「Aa_Files.csv」を読み込みたい。
                //
                //
                //

                if (log_Reports.Successful)
                {
                    //(9)変数ファイル読取
                    if (log_Method.CanDebug(1))
                    {
                        log_Method.WriteDebug_ToConsole("(9)変数ファイル読取");
                    }
                    //
                    this.Owner_MemoryApplication.MemoryVariables.LoadVariables(
                        Application.StartupPath,
                        log_Reports
                        );
                }

                if (log_Reports.Successful)
                {
                    //(10)プログラマー用・デバッグモードのON/OFF。
                    if (log_Method.CanDebug(1))
                    {
                        log_Method.WriteDebug_ToConsole("(10)プログラマー用・デバッグモードのON/OFF。");
                    }
                    //
                    //mainWndの作成より先に設定する必要がある。ステータスバーを出す、出さないについて。
                    {
                        Expression_Leaf_StringImpl ec_Varname = new Expression_Leaf_StringImpl(this, this.Cur_Configuration.Parent);
                        ec_Varname.SetString(NamesVar.S_SS_DEBUGMODE_PROGRAMMER, log_Reports);
                        string sValue = this.Owner_MemoryApplication.MemoryVariables.GetStringByVariablename(ec_Varname, false, log_Reports);
                        if (ValuesAttr.S_ON == sValue)
                        {
                            Log_ReportsImpl.BDebugmode_Static = true;
                        }
                        else if (ValuesAttr.S_OFF == sValue)
                        {
                            Log_ReportsImpl.BDebugmode_Static = false;
                        }
                        else if (ValuesAttr.S_EMPTY == sValue)
                        {
                            // 無視
                        }
                        else
                        {
                            // TODO:エラー
                        }
                    }
                }

                if (log_Reports.Successful)
                {
                    //(11)画面レイアウト・デバッグモードのON/OFF。
                    if (log_Method.CanDebug(1))
                    {
                        log_Method.WriteDebug_ToConsole("(11)フォーム・デバッグモードのON/OFF。");
                    }
                    //
                    Expression_Leaf_StringImpl ec_Varname = new Expression_Leaf_StringImpl(this, this.Cur_Configuration.Parent);
                    ec_Varname.SetString(NamesVar.S_SS_DEBUGMODE_FORM, log_Reports);
                    string sValue = this.Owner_MemoryApplication.MemoryVariables.GetStringByVariablename(ec_Varname, false, log_Reports);
                    if (ValuesAttr.S_ON == sValue)
                    {
                        Log_ReportsImpl.BDebugmode_Form = true;
                    }
                    else if (ValuesAttr.S_OFF == sValue)
                    {
                        Log_ReportsImpl.BDebugmode_Form = false;
                    }
                    else if (ValuesAttr.S_EMPTY == sValue)
                    {
                        // 無視
                    }
                    else
                    {
                        // TODO:エラー
                    }
                }

                //(14)「Aa_Files.csv」読取。
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(14)「Aa_Files.csv」読取。");
                }
                //
                List<Expression_Node_Filepath> ecList_Fpath_BackupRequest;
                {
                    if (log_Reports.Successful)
                    {
                        // 正常時

                        Expression_Node_Function function_Expr = Collection_Function.NewFunction2(
                                Expression_Node_Function22Impl.NAME_FUNCTION, this, this.Cur_Configuration,
                                this.Owner_MemoryApplication, log_Reports);

                        // 実行
                        function_Expr.Execute4_OnLr(this.Functionparameterset.Sender, log_Reports);

                        // 実行後
                        ecList_Fpath_BackupRequest = ((Expression_Node_Function22Impl)function_Expr).List_Expression_Filepath_BackupRequest_Out;
                    }
                    else
                    {
                        //
                        // エラー
                        //

                        ecList_Fpath_BackupRequest = null;
                    }
                }

                //(14b)ユーザー定義関数設定ファイル読取【2012-03-30追加】
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(14b)ユーザー定義関数設定ファイル読取【2012-03-30追加】");
                }
                //
                if (log_Reports.Successful)
                {
                    // タイプデータ値。
                    Expression_Leaf_StringImpl ec_NameVariable = new Expression_Leaf_StringImpl(this, new Configurationtree_NodeImpl("!ハードコーディング",null));
                    ec_NameVariable.SetString(ValuesTypeData.S_CODE_FUNCTIONS, log_Reports);

                    List<MemoryCodefileinfo> listInfo = null;
                    if (log_Reports.Successful)
                    {
                        listInfo = this.Owner_MemoryApplication.MemoryCodefiles.GetCodefileinfoByTypedata(ec_NameVariable, true, log_Reports);
                    }

                    if (log_Reports.Successful)
                    {
                        foreach (MemoryCodefileinfo scriptfile in listInfo)
                        {
                            if (log_Reports.Successful)
                            {
                                this.Owner_MemoryApplication.MemoryFunctions.LoadFile(
                                    scriptfile.Expression_Filepath,
                                    log_Reports);

                            }
                            else
                            {
                                break;
                            }
                        }
                    }

                }

                //(16)『スタイルシート設定ファイル』読取
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(16)『スタイルシート設定ファイル』読取");
                }
                //
                if (log_Reports.Successful)
                {
                    Expression_Node_Function expr_Func = Collection_Function.NewFunction2(
                        Expression_Node_Function19Impl.NAME_FUNCTION, this, this.Cur_Configuration,
                        this.Owner_MemoryApplication, log_Reports);

                    Expression_Node_StringImpl ec_Str = new Expression_Node_StringImpl(this, conf_ThisMethod);
                    ec_Str.AppendTextNode(NamesVar.S_ST_STYLESHEET, this.Cur_Configuration, log_Reports);

                    expr_Func.SetAttribute(Expression_Node_Function19Impl.PM_NAME_TABLE_STYLESHEET, ec_Str, log_Reports);

                    expr_Func.Execute4_OnLr(
                        this.Functionparameterset.Sender,
                        log_Reports
                        );
                }

                //(17a)「バックアップを取る」前にしておく独自実装をするタイミング。
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(17a)「バックアップを取る」前にしておく独自実装をするタイミング。");
                }
                //
                this.On_P17a_PreviousBackup(
                    this.Functionparameterset.Sender,
                    moAaeditorxml_Editor,
                    ec_Fpath_AaEditorXml,
                    ec_Fopath_Editor,
                    (MemoryAatoolxml_Editor)this.Functionparameterset.SelectedProjectElement_Configurationtree,
                    log_Reports);

                //(17b)今日の分のバックアップを取ります。
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(17b)今日の分のバックアップを取ります。");
                }
                //
                this.On_P17b_DateBackup(ecList_Fpath_BackupRequest, this.Functionparameterset.Sender, log_Reports);

                //(17c)「新規ウィンドウを開く」前にしておく独自実装をするタイミング。
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(17c)「新規ウィンドウを開く」前にしておく独自実装をするタイミング。");
                }
                //
                this.On_P17c_PreviousOpenWindow(
                    this.Functionparameterset.Sender,
                    moAaeditorxml_Editor,
                    ec_Fpath_AaEditorXml,
                    ec_Fopath_Editor,
                    (MemoryAatoolxml_Editor)this.Functionparameterset.SelectedProjectElement_Configurationtree,
                    log_Reports);

                //(18)関数30「新規ウィンドウを開く」実行。引数には関数を2つ指定できる。
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(18)関数30「新規ウィンドウを開く」実行。引数には関数を2つ指定できる。");
                }
                //
                {

                    Expression_Node_Function expr_Func = Collection_Function.NewFunction2(
                            Expression_Node_Function30Impl.NAME_FUNCTION, this, this.Cur_Configuration,
                            this.Owner_MemoryApplication, log_Reports);

                    {
                        //Expression_Node_Function30Impl f1 =

                        {
                            Expression_Node_StringImpl ec_FormStart;
                            {
                                Expression_FvarImpl ec_Fvar = new Expression_FvarImpl(this, this.Cur_Configuration, this.Owner_MemoryApplication);
                                ec_Fvar.AppendTextNode(NamesVar.S_SS_FORM_START, this.Cur_Configuration, log_Reports);

                                ec_FormStart = new Expression_Node_StringImpl(this, this.Cur_Configuration);
                                ec_FormStart.List_Expression_Child.Add(ec_Fvar, log_Reports);
                            }
                            ((Expression_Node_Function30Impl)expr_Func).SetAttribute(Expression_Node_Function30Impl.PM_NAME_FORM, ec_FormStart, log_Reports);
                        }

                        ((Expression_Node_Function30Impl)expr_Func).In_Subroutine_Function30_1 = this.In_Subroutine_Function30_1_OrNull;
                        ((Expression_Node_Function30Impl)expr_Func).In_Subroutine_Function30_2 = this.In_Subroutine_Function30_2_OrNull;
                        ((Expression_Node_Function30Impl)expr_Func).SetAttribute(
                            Expression_Node_Function30Impl.PM_NAME_TOGETHER,
                            new Expression_Leaf_StringImpl(NamesStg.S_STG_BEGIN_APPLICATION, null, conf_ThisMethod), log_Reports);
                    }

                    expr_Func.Execute4_OnLr(
                        this.Functionparameterset.Sender,
                        log_Reports
                        );
                }

                //(19)最後に
                if (log_Method.CanDebug(1))
                {
                    log_Method.WriteDebug_ToConsole("(19)最後に");
                }
                //
                this.On_P19_AtLast(
                    this.Functionparameterset.Sender,
                    (MemoryAatoolxml_Editor)this.Functionparameterset.SelectedProjectElement_Configurationtree,
                    this.Functionparameterset.IsProjectValid,
                    log_Reports);

                //
                // 「S」と「E」を出力したい。
                if (false)
                {
                    // 「S」全てのコントロールと、ユーザー定義関数について。

                    log_Method.WriteInfo_ToConsole("┌──────────┐「S」全てのコントロールについて。");
                    this.Owner_MemoryApplication.MemoryForms.ForEach_Children(delegate(string sKey, Usercontrol fcUc, ref bool bRemove, ref bool bBreak)
                    {
                        Log_TextIndented s = new Log_TextIndentedImpl();
                        s.Append("[" + sKey + "]");
                        s.Newline();
                        fcUc.ControlCommon.Expression_Control.Cur_Configuration.ToText_Content(s);
                        log_Method.WriteInfo_ToConsole(s.ToString());
                    });
                    log_Method.WriteInfo_ToConsole("└──────────┘");

                    log_Method.WriteInfo_ToConsole("┌──────────┐「S」全てのユーザー定義関数について。");
                    this.Owner_MemoryApplication.MemoryFunctions.ForEach_Children(delegate(string sKey, Expression_Node_Function ec_CommonFunction, ref bool bRemove, ref bool bBreak)
                    {
                        Log_TextIndented s = new Log_TextIndentedImpl();
                        s.Append("[" + sKey + "]");
                        s.Newline();
                        ec_CommonFunction.Cur_Configuration.ToText_Content(s);
                        log_Method.WriteInfo_ToConsole(s.ToString());
                    });
                    log_Method.WriteInfo_ToConsole("└──────────┘");

                    // 「E」全てのコントロールと、ユーザー定義関数について。

                    log_Method.WriteInfo_ToConsole("┌──────────┐「E」全てのコントロールについて。");
                    this.Owner_MemoryApplication.MemoryForms.ForEach_Children(delegate(string sKey, Usercontrol fcUc, ref bool bRemove, ref bool bBreak)
                    {
                        Log_TextIndented s = new Log_TextIndentedImpl();
                        s.Append("[" + sKey + "]");
                        s.Newline();
                        fcUc.ControlCommon.Expression_Control.ToText_Snapshot(s);
                        log_Method.WriteInfo_ToConsole(s.ToString());
                    });
                    log_Method.WriteInfo_ToConsole("└──────────┘");

                    log_Method.WriteInfo_ToConsole("┌──────────┐「E」全てのユーザー定義関数について。");
                    this.Owner_MemoryApplication.MemoryFunctions.ForEach_Children(delegate(string sKey, Expression_Node_Function ec_CommonFunction, ref bool bRemove, ref bool bBreak)
                    {
                        Log_TextIndented s = new Log_TextIndentedImpl();
                        s.Append("[" + sKey + "]");
                        s.Newline();
                        ec_CommonFunction.ToText_Snapshot(s);
                        log_Method.WriteInfo_ToConsole(s.ToString());
                    });
                    log_Method.WriteInfo_ToConsole("└──────────┘");

                }
                log_Method.WriteInfo_ToConsole("◆起動終了");

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

            return "";
        }
Ejemplo n.º 25
0
        //────────────────────────────────────────

        /// <summary>
        /// イベント アクション リストを作成します。
        /// </summary>
        /// <param nFcName="eventName"></param>
        /// <param nFcName="nActionSuper"></param>
        /// <param nFcName="log_Reports"></param>
        public Functionlist CreateFunctionlist(
            ConfigurationtreeToExpression_Event sToE_Event,
            MemoryApplication owner_MemoryApplication,
            Log_Reports log_Reports
            )
        {
            Log_Method pg_Method = new Log_MethodImpl();
            pg_Method.BeginMethod(Info_Controls.Name_Library, this, "CreateFunctionlist",log_Reports);
            //
            //
            Functionlist result_Felist = null;

            switch (sToE_Event.Name)
            {
                case NamesSe.S_LOAD:
                    {
                        //
                        // このコントロールの「アプリケーション起動時」。
                        //
                        //  (NActionPerformEnum.O_EA)
                        //

                        //
                        // 無視します。
                        //
                    }
                    break;

                case NamesSe.S_VALUE_CHANGED:
                    {
                        //
                        // テキストボックスの内容変更時。
                        //

                        if (null == this.functionlist_Event_ValueChanged)
                        {
                            result_Felist = new Functionlist_FormImpl(
                                //EnumEventhandler.O_Ea,
                                sToE_Event,
                                owner_MemoryApplication
                                );
                            this.functionlist_Event_ValueChanged = result_Felist;
                            ((Functionlist_FormImpl)this.functionlist_Event_ValueChanged).InitializeBeforeUse();


                            this.customcontrolTextbox1.TextChanged += new System.EventHandler(this.functionlist_Event_ValueChanged.Execute4_OnOEa);

                        }
                    }
                    break;

                default:
                    goto gt_Error_NotSupportedEvent;
            }


            goto gt_EndMethod;
        //
        //
            #region 異常系
        //────────────────────────────────────────
        gt_Error_NotSupportedEvent:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, this.GetType().Name, log_Reports);//クラス名
                tmpl.SetParameter(2, sToE_Event.Name, log_Reports);//イベント名
                tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Configuration(sToE_Event.Configurationtree_Event), log_Reports);//設定位置パンくずリスト

                this.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:516;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
        //────────────────────────────────────────
            #endregion
        //
        //
        gt_EndMethod:
            pg_Method.EndMethod(log_Reports);
            return result_Felist;
        }
        //────────────────────────────────────────
        protected void TestExists_EmptyFilePath(
            string sArgName,
            Expression_Node_Filepath ec_Fpath,
            string sFpath_SelectedProject,
            Log_Reports log_Reports)
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Functions.Name_Library, this, "TestExists_EmptyFilePath",log_Reports);
            //
            //

            if (null == ec_Fpath)
            {
                goto gt_Error_NullFpath;
            }
            else if ("" == ec_Fpath.Humaninput)
            {
                goto gt_Error_NoData;
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_NullFpath:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, sFpath_SelectedProject, log_Reports);//選択したエディター・フォルダーのファイルパス
                tmpl.SetParameter(2, sArgName, log_Reports);//引数名

                this.Owner_MemoryApplication.CreateErrorReport("Er:110005;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_NoData:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, sArgName, log_Reports);//引数名
                tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(ec_Fpath.Cur_Configuration), log_Reports);//設定位置パンくずリスト

                this.Owner_MemoryApplication.CreateErrorReport("Er:110006;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
        }
        //────────────────────────────────────────
        /// <summary>
        /// 読取。
        /// </summary>
        /// <param name="s_View"></param>
        /// <param name="ef_View"></param>
        /// <param name="moOpyopyo"></param>
        /// <param name="log_Reports"></param>
        public void Translate(
            Configurationtree_Node cur_Cf,//<view>
            Expression_Node_String parent_Ec,//「E■form-component」
            MemoryApplication memoryApplication,
            Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "SToE",log_Reports);

            if (log_Method.CanDebug(1))
            {
                pg_ParsingLog.Increment("(3)"+cur_Cf.Name);
            }

            //
            //
            //
            //

            //
            //
            //
            // 自
            //
            //
            //

            Expression_Node_StringImpl cur_Ec = new Expression_Node_StringImpl(parent_Ec, cur_Cf);

            //
            //
            //
            // 子
            //
            //
            //
            {
                //<●●>要素を全検索。<f-list-box-labels>があることが期待されます。

                cur_Cf.List_Child.ForEach(delegate(Configurationtree_Node cf_Child, ref bool bBreak)
                {
                    if (cf_Child is Configurationtree_Node)
                    {
                        Configurationtree_Node cf_Node = (Configurationtree_Node)cf_Child;

                        string sName_Node = cf_Node.Name;
                        string sName_Fnc = "";
                        {
                            bool bRequired;

                            if (NamesNode.S_FNC == sName_Node)
                            {
                                bRequired = true;
                            }
                            else
                            {
                                bRequired = false;
                            }

                            // todo; 子要素のnameも取りたい。
                            cf_Node.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_Fnc, bRequired, log_Reports);
                        }

                        if (NamesNode.S_FNC == sName_Node && NamesFnc.S_LISTBOX_LABELS == sName_Fnc)
                        {
                            // 「S■fnc name=”Sf:f-listbox-labels;”」

                            ConfigurationtreeToExpression_F91_FListboxLabelsImpl_ to = new ConfigurationtreeToExpression_F91_FListboxLabelsImpl_();
                            to.Translate(
                                cf_Child,
                                cur_Ec,
                                memoryApplication,
                                pg_ParsingLog,
                                log_Reports
                                );
                        }
                        else
                        {
                            // エラー
                            {
                                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                                tmpl.SetParameter(1, sName_Node, log_Reports);//設定ノード名
                                tmpl.SetParameter(2, sName_Fnc, log_Reports);//関数名

                                memoryApplication.CreateErrorReport("Er:7003;", tmpl, log_Reports);
                            }

                            bBreak = true;
                        }
                    }
                });
            }

            //
            //
            //
            // 親へ連結
            //
            //
            //
            {
                parent_Ec.List_Expression_Child.Add(cur_Ec, log_Reports);
            }

            goto gt_EndMethod;
            //
            //

            gt_EndMethod:
            if (Log_ReportsImpl.BDebugmode_Static)
            {
                pg_ParsingLog.Decrement(cur_Cf.Name);
            }
            log_Method.EndMethod(log_Reports);
        }
        //────────────────────────────────────────
        /// <summary>
        /// ユーザー定義プログラムの実行。
        /// </summary>
        /// <param name="hits"></param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        public override string Execute4_OnExpressionString(
            EnumHitcount hits,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Expr.Name_Library, this, "Execute4_OnExpressionString",log_Reports);
            //
            //

            Expression_Node_String err_Ev11;
            bool bAllFldsIsEmpty = true;

            Expression_Node_String ec_RecordSetLoadFrom;//ソース情報利用
            bool bHit = this.TrySelectAttribute(out ec_RecordSetLoadFrom, NamesNode.S_RECORD_SET_LOAD_FROM, EnumHitcount.One, log_Reports);

            //
            // 一時記憶に記憶されているレコードセットのコピー内容。
            RecordSet recordSet;
            if (log_Reports.Successful)
            {
                string sRecordSetLoadFrom = ec_RecordSetLoadFrom.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                // #デバッグ中
                System.Console.WriteLine(Info_Expr.Name_Library + ":" + this.GetType().Name + "#E_Execute: ★★ record-set-load-from=[" + sRecordSetLoadFrom + "]");

                recordSet = this.Owner_MemoryApplication.MemoryRecordset.RecordsetStorage.Get(ec_RecordSetLoadFrom,
                    this.Owner_MemoryApplication,
                    log_Reports);
            }
            else
            {
                recordSet = null;
            }

            Value_Humaninput err_OValue;
            string err_SFldName;
            Exception err_Excp;
            string err_SCsv;
            List<string> err_SList;
            if (log_Reports.Successful)
            {
                //
                // 子<f-●●>要素を実行し、文字列連結。
                // 「SK10,LV10,OP10,COND10,COND10x,COND10y,COND10z,PRI10,RATE10,PER10」といった文字列が取得できることを期待。
                StringBuilder sb_Csv = new StringBuilder();
                {
                    List<Expression_Node_String> ecList_Child = this.List_Expression_Child.SelectList(
                        EnumHitcount.Unconstraint,
                        log_Reports
                        );

                    foreach (Expression_Node_String ec_11 in ecList_Child)
                    {
                        if (ec_11 is Expressionv_Elem99)
                        {
                            Expressionv_Elem99 ev_elem = (Expressionv_Elem99)ec_11;
                            ev_elem.SetDataRow(this.DataRow);
                            sb_Csv.Append(ev_elem.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));
                        }
                        else if (ec_11 is Expression_Node_StringImpl)
                        {
                            sb_Csv.Append(ec_11.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));
                        }
                        else
                        {
                            err_Ev11 = ec_11;
                            bAllFldsIsEmpty = false;
                            goto gt_Error_UndefinedElementClass;
                        }
                    }
                }

                //
                // コンマ区切り文字列を、リスト化。
                List<string> sList;
                {
                    CsvTo_ListImpl csvTo = new CsvTo_ListImpl();
                    sList = csvTo.Read(sb_Csv.ToString());
                }

                //
                // 全部真なら真、1つでも偽なら偽。
                foreach (string sFldName in sList)
                {
                    // bug: argumentException
                    Value_Humaninput oValue;
                    try
                    {
                        // レコードセットの1件目だけをとりあえず確認。TODO:
                        oValue = recordSet.List_Field[0][sFldName.ToUpper()];
                        //oValue = (OValue)dataRow[fldName];
                    }
                    catch (KeyNotFoundException ex)
                    {
                        err_Excp = ex;
                        err_SFldName = sFldName;
                        err_SCsv = sb_Csv.ToString();
                        err_SList = sList;
                        goto gt_Error_UndefinedFld;
                    }

                    // #デバッグ中
                    System.Console.WriteLine(Info_Expr.Name_Library + ":" + this.GetType().Name + "#E_Execute: oValue.Text=[" + oValue.Text + "]");

                    if (oValue is Int_HumaninputImpl)
                    {
                        Int_HumaninputImpl oInt = (Int_HumaninputImpl)oValue;

                        if ("" != oInt.Text)
                        {
                            bAllFldsIsEmpty = false;
                        }
                    }
                    else if (oValue is String_HumaninputImpl)
                    {
                        String_HumaninputImpl oString = (String_HumaninputImpl)oValue;

                        if ("" != oString.Text)
                        {
                            bAllFldsIsEmpty = false;
                        }
                    }
                    else if (oValue is Bool_HumaninputImpl)
                    {
                        Bool_HumaninputImpl oBool = (Bool_HumaninputImpl)oValue;

                        if ("" != oBool.Text)
                        {
                            bAllFldsIsEmpty = false;
                        }

                        //
                        // TODO: false/trueタイプ、0/1タイプにも対応したい。
                        //
                    }
                    else
                    {
                        //
                        // エラー。
                        err_OValue = oValue;
                        goto gt_Error_UndefinedType;
                    }
                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_UndefinedType:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, err_OValue.GetType().Name, log_Reports);//値の型名
                tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration), log_Reports);//設定位置パンくずリスト

                this.Owner_MemoryApplication.CreateErrorReport("Er:6032;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_UndefinedElementClass:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, err_Ev11.GetType().Name, log_Reports);//クラス名
                tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration), log_Reports);//設定位置パンくずリスト

                this.Owner_MemoryApplication.CreateErrorReport("Er:6033;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_UndefinedFld:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, err_SFldName.ToUpper(), log_Reports);//フィールド名大文字化
                tmpl.SetParameter(2, err_SCsv, log_Reports);//指定されたフィールド名の文字列

                StringBuilder s1 = new StringBuilder();
                foreach (string str in err_SList)
                {
                    s1.Append("[");
                    s1.Append(str);
                    s1.Append("]");
                    s1.Append(Environment.NewLine);
                }
                tmpl.SetParameter(3, s1.ToString(), log_Reports);//指定されたフィールド名の文字列

                StringBuilder s2 = new StringBuilder();
                // あるフィールド名の一覧
                foreach (DataColumn dataColumn in this.DataRow.Table.Columns)
                {
                    s2.Append("[");
                    s2.Append(dataColumn.ColumnName);
                    s2.Append("]");
                    s2.Append(Environment.NewLine);
                }
                tmpl.SetParameter(4, s1.ToString(), log_Reports);//指定されたフィールド名の文字列

                tmpl.SetParameter(5, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration), log_Reports);//設定位置パンくずリスト
                tmpl.SetParameter(6, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports);//例外メッセージ

                this.Owner_MemoryApplication.CreateErrorReport("Er:6034;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return bAllFldsIsEmpty.ToString();
        }
Ejemplo n.º 29
0
        //────────────────────────────────────────
        public void UsercontrolToMemory(
            Log_Reports log_Reports
            )
        {
            Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            pg_Method.BeginMethod(Info_Controls.Name_Library, this, "UsercontrolToMemory",log_Reports);
            //
            //

            if (null == this.ControlCommon.Expression_Control)
            {
                // このコントロールに対応づくテーブル等の設定がなく、ただの空箱の場合。
                // Visual Studio のビジュアルエディターで直接置いただけの時は、ここに来ます。

                // 何もせず終了。
                goto gt_EndMethod;
            }

            List<Expression_Node_String> ecList_Data = this.ControlCommon.Expression_Control.SelectDirectchildByNodename(NamesNode.S_DATA, false, EnumHitcount.Unconstraint, log_Reports);
            List<Expression_Node_String> ecList_DataTarget = Utility_Expression_NodeImpl.SelectItemsByPmAsCsv(ecList_Data, PmNames.S_ACCESS.Name_Pm, ValuesAttr.S_TO, false, EnumHitcount.First_Exist, log_Reports);
            if (!log_Reports.Successful)
            {
                goto gt_EndMethod;
            }
            Expression_Node_String ec_DataTarget = ecList_DataTarget[0];

            if (null == ec_DataTarget)
            {
                // エラー:     データターゲットが未設定のとき
                goto gt_Error_Datatarget;
            }
            else
            {
                //
                // データターゲットが設定されているとき
                //

                //
                // 未実装 TODO: 実装すること。
                //
                {
                    Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                    tmpl.SetParameter(1, this.Name, log_Reports);//コントロール名

                    this.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:537;", tmpl, log_Reports);
                }
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_Datatarget:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, this.Name, log_Reports);//コントロール名

                this.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:504;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            pg_Method.EndMethod(log_Reports);
        }
Ejemplo n.º 30
0
        /// <summary>
        /// セレクト文を指定することで、レコードセットを取得。
        /// </summary>
        /// <param name="log_Reports"></param>
        /// <returns>該当がなければヌル。</returns>
        private RecordSet E_Execute_P2_Select(
            bool isExists_Awhr,
            Selectstatement selectSt,
            Configuration_Node parent_Conf_Query,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_Expr.Name_Library, this, "E_Execute_P2_Select",log_Reports);
            //
            //

            RecordSet reslt_Rs;

            bool bLoad = false;

            // 一時記憶から、レコードセットのロードをするか否か。
            {
                {
                    Expression_Node_String ec_Awhr_RecordSetLoadFrom;//ソース情報利用
                    bool bHit = this.TrySelectAttribute(
                         out ec_Awhr_RecordSetLoadFrom,
                        NamesNode.S_RECORD_SET_LOAD_FROM,
                        EnumHitcount.One_Or_Zero,
                        log_Reports //null
                        );

                    selectSt.Expression_Where_RecordSetLoadFrom = ec_Awhr_RecordSetLoadFrom;
                }

                if ("" != selectSt.Expression_Where_RecordSetLoadFrom.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports).Trim())
                {
                    bLoad = true;
                }
            }

            // レコードセットの取得。
            if (bLoad)
            {
                // 一時記憶からロード。
                P1_RecordSetLoader sel1 = new P1_RecordSetLoader(this.Owner_MemoryApplication);
                reslt_Rs = sel1.P1_Load(
                    selectSt.Expression_Where_RecordSetLoadFrom,
                    this.Cur_Configuration,
                    log_Reports
                    );

                // ★空になってる。一時記憶から取り出したい。★★★★★★★★★★★★★★★★★★★★
                //p3_Selectstatement = recordSet.Selectstatement;
                // new SelectStateImpl(s_ParentNode);

                //
                // データベースからレコード検索。
                //p3_Selectstatement = this.E_Execute_P0(
                //    nWhere_recordSetLoadFrom,
                //    s_ParentNode,
                //    log_Reports
                //    );

                // debug: 一時記憶から読み取った、レコードセットの内容。
                //if (false)
                //{
                //    StringBuilder txt = new StringBuilder();

                //    txt.Append(Info_E.LibraryName + ":" + this.GetType().Name + "#E_Execute: (30_<f-cell>)【一時記憶から読み取った、レコードセットの内容(A)】");
                //    txt.Append(" fld=[" + recordSet.Selectstatement.E_Field.E_Execute( log_Reports) + "]");
                //    txt.Append(" lookup-value=[" + recordSet.Selectstatement.E_Value.E_Execute( log_Reports) + "]");
                //    txt.Append(" required=[" + recordSet.Selectstatement.E_Required.E_Execute( log_Reports) + "]");
                //    txt.Append(" from=[" + recordSet.Selectstatement.Expression_From.E_Execute( log_Reports) + "]");
                //    txt.Append(" description=[" + recordSet.Selectstatement.Expression_Description.E_Execute( log_Reports) + "]");
                //    txt.Append(" Storage=[" + recordSet.Selectstatement.Expression_Storage.E_Execute( log_Reports) + "]");
                //    txt.Append(" ヒット件数=[" + recordSet.O_Items.Count + "]");

                //    // レコードの内容
                //    foreach (Dictionary<string, Value_Humaninput> oRecord in recordSet.O_Items)
                //    {
                //        txt.Append(" フィールド数=[" + oRecord.Count + "]");
                //        foreach (string sKey in oRecord.Keys)
                //        {
                //            Value_Humaninput oValue = oRecord[sKey];
                //            txt.Append(" 要素=[" + sKey + ":"+ oValue.Humaninput + "]");
                //        }
                //    }

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

            }
            else
            {
                Table_Humaninput tableH = this.Owner_MemoryApplication.MemoryTables.GetTable_HumaninputByName(selectSt.Expression_From, true, log_Reports);
                if (null == tableH)
                {
                    // エラー。
                    reslt_Rs = null;
                    goto gt_Error_NullTable;
                }
                // レコードセットを用意。
                reslt_Rs = new RecordSetImpl(tableH);

                bool isRequired_ExpectedValue;
                {
                    bool parseSuccessful = bool.TryParse(selectSt.Required, out isRequired_ExpectedValue);
                }

                //
                // 検索実行。
                {
                    List<DataRow> dst_Row = new List<DataRow>();

                    //
                    // 条件
                    //
                    if (0 < selectSt.List_Recordcondition.Count)
                    {
                        // 条件が指定されている場合。

                        string name_KeyField;
                        Fielddefinition fielddefinition_Key;
                        string value_Expected;
                        P2_ReccondImpl sel2 = new P2_ReccondImpl();
                        sel2.GetFirstAwhrReccond(
                            out name_KeyField,
                            out fielddefinition_Key,
                            out value_Expected,
                            selectSt.List_Recordcondition,
                            tableH,
                            log_Reports
                            );

                        if (log_Reports.Successful)
                        {
                            // TODO:セル型でない場合、キーフィールド名がないこともある。

                            SelectPerformerImpl sp = new SelectPerformerImpl();
                            sp.Select(
                                out dst_Row,
                                name_KeyField,
                                value_Expected,
                                isRequired_ExpectedValue,
                                fielddefinition_Key,
                                tableH.DataTable,
                                parent_Conf_Query,
                                log_Reports
                                );
                        }
                    }
                    else
                    {
                        // 条件が指定されていない場合。

                        SelectPerformerImpl sp = new SelectPerformerImpl();
                        sp.Select(
                            out dst_Row,
                            isRequired_ExpectedValue,
                            tableH.DataTable,
                            parent_Conf_Query,
                            log_Reports
                            );
                    }

                    if (log_Reports.Successful)
                    {
                        reslt_Rs.AddList(dst_Row, log_Reports);
                    }

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

                }
            }

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

                this.Owner_MemoryApplication.CreateErrorReport("Er:6019;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            log_Method.EndMethod(log_Reports);
            return reslt_Rs;
        }