public override Expression_Node_Function NewInstance( Expression_Node_String parent_Expression, Configuration_Node cur_Conf, object owner_MemoryApplication, Log_Reports pg_Logging) { Log_Method pg_Method = new Log_MethodImpl(0); pg_Method.BeginMethod(Info_CSVEditorImpl.Name_Library, this, "NewInstance",pg_Logging); // Expression_Node_Function f0 = new Expression_Node_Function_BootCsvEditorExImpl(this.EnumEventhandler,this.List_NameArgumentInitializer,this.Functiontranslatoritem); f0.Parent_Expression = parent_Expression; f0.Cur_Configuration = cur_Conf; ((Expression_Node_FunctionAbstract)f0).Owner_MemoryApplication = (MemoryApplication)owner_MemoryApplication; //関数名初期化 f0.Dictionary_Expression_Attribute.Set(PmNames.S_NAME.Name_Pm, new Expression_Leaf_StringImpl(NAME_FUNCTION, null, cur_Conf), pg_Logging); //「プロジェクト選択時」のイベントハンドラーを上書き要求。 { Expression_Node_Function expr_Func2 = Collection_Function.NewFunction2( Expression_Node_Function_OnEditorSelected_Impl.NAME_FUNCTION, f0, cur_Conf, //EnumEventhandler.Tp_B_Wr_Rhn, owner_MemoryApplication, pg_Logging); ((Expression_Node_Function_BootCsvEditorExImpl)f0).Functionitem_OnProjectSelected = expr_Func2; } // pg_Method.EndMethod(pg_Logging); return f0; }
//──────────────────────────────────────── public FunctionexecutableAbstract( Expression_Node_String parent_Expression, Configuration_Node cur_Conf ) : base(parent_Expression,cur_Conf) { }
//──────────────────────────────────────── /// <summary> /// 無条件で、全てのレコードを返す。 /// </summary> /// <param name="dst_Row"></param> /// <param name="isRequired_ExpectedValue"></param> /// <param name="dataTable"></param> /// <param name="s_ParentNode_query"></param> /// <param name="log_Reports"></param> public void Select( out List<DataRow> out_List_DstRow, bool isRequired_ExpectedValue, DataTable dataTable, Configuration_Node parent_Conf, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(); log_Method.BeginMethod(Info_Table.Name_Library, this, "Select",log_Reports); // // // // out_List_DstRow = new List<DataRow>(); foreach (DataRow row in dataTable.Rows) { out_List_DstRow.Add(row); } goto gt_EndMethod; // // // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// コンストラクター。 /// </summary> /// <param name="name_Node"></param> /// <param name="parent_Conf_OrNull"></param> public Configurationtree_NodeImpl(string name_Node, Configuration_Node parent_Conf_OrNull) : base(name_Node, parent_Conf_OrNull) { this.list_Child = new List_Configurationtree_NodeImpl(this); this.dictionary_Attribute = new Dictionary_Configurationtree_StringImpl(this); }
//──────────────────────────────────────── /// <summary> /// コンストラクター。 /// </summary> /// <param name="s_ParentNode"></param> /// <param name="moOpyopyo"></param> public Expression_FvarImpl( Expression_Node_String parent_Expression_Node, Configuration_Node parent_Configuration_Node, MemoryApplication owner_MemoryApplication ) : base(parent_Expression_Node, parent_Configuration_Node, owner_MemoryApplication) { }
//──────────────────────────────────────── /// <summary> /// コンストラクター。 /// </summary> /// <param name="parent_Expression"></param> /// <param name="cur_Conf">生成時に指定できないものもある。</param> public Expression_Node_StringImpl(Expression_Node_String parent_Expression, Configuration_Node cur_Conf) { this.parent_Expression = parent_Expression; this.cur_Configuration = cur_Conf; enumHitcount = EnumHitcount.Unconstraint; this.ecList_Child = new List_Expression_Node_StringImpl(this); this.dictionary_Expression_Attribute = new Dictionary_Expression_Node_StringImpl(this.Cur_Configuration); }
//──────────────────────────────────────── /// <summary> /// コンストラクター。 /// </summary> /// <param name="form"></param> public ConfigurationtreeToFunction_ListImpl( Expression_Node_String parent_Expression, Configuration_Node cur_Conf, MemoryApplication owner_MemoryApplication, Log_Reports log_Reports ) { this.owner_MemoryApplication = owner_MemoryApplication; }
/// <summary> /// コンストラクター。 /// </summary> public Expression_Leaf_StringImpl(string sHumanInput, Expression_Node_String parent_Expression, Configuration_Node cur_Conf) { this.sHumanInput = sHumanInput; this.parent_Expression = parent_Expression; this.cur_Configuration = cur_Conf; this.enumHitcount = EnumHitcount.Unconstraint; this.dictionary_Expression_Attribute = new Dictionary_Expression_Node_StringImpl(this.Cur_Configuration); }
//──────────────────────────────────────── /// <summary> /// コンストラクター。 /// </summary> /// <param name="s_ParentNode"></param> private RecordconditionImpl(Configuration_Node parent_Conf) { this.parent = parent_Conf; this.list_Child = new List<Recordcondition>(); this.enumLogic = EnumLogic.None; this.sField = "(▲未初期化102!)"; this.enumOpe = EnumOpe.Eq; this.sValue = ""; }
//──────────────────────────────────────── /// <summary> /// コンストラクター。 /// </summary> public Expression_TexttemplateP1pImpl(Expression_Node_String parent_Expr, Configurationtree_Node cur_Conf) { this.parent_Expression = parent_Expr; this.cur_Configurationtree = cur_Conf; this.requestItems = EnumHitcount.Unconstraint; this.dictionary_P1p = new Dictionary<int, string>(); this.list_Expression_Child = new List_Expression_Node_StringImpl(this);//使いません。 this.dictionary_Expression_Attribute = new Dictionary_Expression_Node_StringImpl(this.Cur_Configuration); }
//──────────────────────────────────────── public static string Format_StopwatchComment( Expression_Node_FunctionAbstract ec_Sa, Configuration_Node cf_ThisAction, Log_Reports log_Reports ) { string sControl = ""; { Configuration_Node cf_Event = cf_ThisAction.GetParentByNodename( NamesNode.S_EVENT, EnumConfiguration.Unknown, true, log_Reports); if (log_Reports.Successful) { Configuration_Node owner_Configurationtree_Control = cf_Event.GetParentByNodename( NamesNode.S_CONTROL1, EnumConfiguration.Tree, true, log_Reports); ((Configurationtree_Node)owner_Configurationtree_Control).Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sControl, false, log_Reports); } } string sEventName = ""; { Configuration_Node cf_Event = cf_ThisAction.GetParentByNodename(NamesNode.S_EVENT, EnumConfiguration.Tree, true, log_Reports); if (log_Reports.Successful) { ((Configurationtree_Node)cf_Event).Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sEventName, false, log_Reports); } } string sActionType = ""; { string sFncName0; ec_Sa.TrySelectAttribute(out sFncName0, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); sActionType = sFncName0; } StringBuilder sb = new StringBuilder(); { if ("" != sActionType) { sb.Append(" Nアクション=["); sb.Append(sActionType); sb.Append("]"); } sb.Append(" FC["); sb.Append(sControl); sb.Append("].EV["); sb.Append(sEventName); sb.Append("]"); } return sb.ToString(); }
//──────────────────────────────────────── /// <summary> /// コンストラクター。 /// </summary> /// <param name="parent_Expression">生成時はヌルを入れておいて、#NewInstanceで後から設定することもできます。</param> /// <param name="cur_Conf">生成時はヌルを入れておいて、#NewInstanceで後から設定することもできます。</param> public Expression_Node_FunctionImpl( Expression_Node_String parent_Expression, Configuration_Node cur_Conf, List<string> list_NameArgumentInitializer ) : base(parent_Expression, cur_Conf) { this.dictionary_Expression_Parameter = new Dictionary_Expression_Node_StringImpl(cur_Conf); this.functionparameterset = new FunctionparametersetImpl(); this.list_NameArgumentInitializer = list_NameArgumentInitializer;// new List<string>(); }
//──────────────────────────────────────── public SelectstatementImpl(Expression_Node_String parent_Expr, Configuration_Node parent_Conf) { this.parent = parent_Conf; this.List_SName_SelectField = new List<string>(); this.Expression_From = new Expression_Node_StringImpl(parent_Expr, parent_Conf); this.Expression_Into = new Expression_Node_StringImpl(parent_Expr, parent_Conf); this.Expression_Where_RecordSetLoadFrom = new Expression_Node_StringImpl(parent_Expr, parent_Conf); this.EnumWherelogic = EnumLogic.And;//whereのlogic属性のデフォルト。 this.list_Recordcondition = new List<Recordcondition>(); this.Required = ""; this.Storage = ""; this.Description = ""; }
public override Expression_Node_Function NewInstance( Expression_Node_String parent_Expression, Configuration_Node cur_Conf, object/*MemoryApplication*/ owner_MemoryApplication, Log_Reports log_Reports) { Expression_Node_Function f0 = new Expression_Node_Function11Impl(this.EnumEventhandler,this.List_NameArgumentInitializer,this.Functiontranslatoritem); f0.Parent_Expression = parent_Expression; f0.Cur_Configuration = cur_Conf; ((Expression_Node_FunctionAbstract)f0).Owner_MemoryApplication = (MemoryApplication)owner_MemoryApplication; //関数名初期値 f0.SetAttribute(PmNames.S_NAME.Name_Pm, new Expression_Leaf_StringImpl(NAME_FUNCTION, null, cur_Conf), log_Reports); return f0; }
//"ノード名未指定" //──────────────────────────────────────── /// <summary> /// コンストラクター。 /// </summary> /// <param name="e_Fpath_ConfigStack"></param> public Table_HumaninputImpl( string name_Table, Expression_Node_Filepath filepath_Nodeconfigtree_Expr, Configuration_Node cur_Conf ) : base(name_Table, cur_Conf) { this.expression_Filepath_ConfigStack = filepath_Nodeconfigtree_Expr; this.dataTable = new DataTable(); this.name_Table = name_Table; this.format_Table_Humaninput = new Format_Table_HumaninputImpl(); this.recordFielddefinition_ = new RecordFielddefinitionImpl();//暫定 }
//──────────────────────────────────────── /// <summary> /// 一時記憶から、レコードセット取得。 /// </summary> /// <param name="RecordSetLoadFrom"></param> /// <param name="s_ParentNode"></param> /// <param name="log_Reports"></param> /// <returns>該当がなければヌル。</returns> public RecordSet P1_Load( Expression_Node_String ec_RecordSetLoadFrom,//Where Configuration_Node parent_Conf, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Expr.Name_Library, this, "P1_Load",log_Reports); // // // // レコードセットを求めます。 RecordSet recordSet; if (null != ec_RecordSetLoadFrom) { string sRecordSetLoadFrom = ec_RecordSetLoadFrom.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports).Trim(); if ("" != sRecordSetLoadFrom) { // // レコードセットを取得。 recordSet = this.Owner_MemoryApplication.MemoryRecordset.RecordsetStorage.Get( ec_RecordSetLoadFrom, this.Owner_MemoryApplication, log_Reports); } else { recordSet = null; } } else { recordSet = null; } goto gt_EndMethod; // // // // gt_EndMethod: log_Method.EndMethod(log_Reports); return recordSet; }
public override Expression_Node_Function NewInstance( Expression_Node_String parent_Expression, Configuration_Node cur_Conf, object/*MemoryApplication*/ owner_MemoryApplication, Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_Functions.Name_Library, this, "NewInstance",log_Reports); // Expression_Node_Function f0 = new Expression_Node_Function46Impl(this.EnumEventhandler,this.List_NameArgumentInitializer,this.Functiontranslatoritem); f0.Parent_Expression = parent_Expression; f0.Cur_Configuration = cur_Conf; ((Expression_Node_FunctionAbstract)f0).Owner_MemoryApplication = (MemoryApplication)owner_MemoryApplication; //関数名初期化 f0.SetAttribute(PmNames.S_NAME.Name_Pm, new Expression_Leaf_StringImpl(NAME_FUNCTION, null, cur_Conf), log_Reports); f0.SetAttribute(Expression_Node_Function46Impl.PM_MESSAGE, new Expression_Node_StringImpl(this, cur_Conf), log_Reports); // log_Method.EndMethod(log_Reports); return f0; }
//──────────────────────────────────────── public void Judge( out bool isJudge, string name_KeyField, string value_Expected, bool isRequired_ExpectedValue, DataRow row, Configuration_Node parent_Query, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(); log_Method.BeginMethod(Info_Table.Name_Library, this, "Judge",log_Reports); // // // // try { Value_Humaninput valueH = (Value_Humaninput)row[name_KeyField]; // (5)キーが空欄で、検索ヒット必須でなければ、無視します。【bool型フィールドの場合】 if (Bool_HumaninputImpl.IsSpaces(valueH)) { isJudge = false; goto gt_EndMethod; } // // (6)この行の、キー_フィールドの値を取得。 // bool isKeyValue; bool isParsedSuccessful = Bool_HumaninputImpl.TryParse( valueH, out isKeyValue, EnumOperationIfErrorvalue.Error, null, log_Reports ); if (log_Reports.Successful) { if (!isParsedSuccessful) { // エラー。 isJudge = false; if (log_Reports.CanCreateReport) { Log_RecordReports d_Report = log_Reports.BeginCreateReport(EnumReport.Error); d_Report.SetTitle("▲エラー699!", log_Method); d_Report.Message = "bool型パース失敗。"; log_Reports.EndCreateReport(); } goto gt_EndMethod; } } bool isExpectedValue; if (log_Reports.Successful) { // (8)キー値をbool型に変換します。 bool isParseSuccessful2 = bool.TryParse(value_Expected, out isExpectedValue); if (!isParseSuccessful2) { isJudge = false; if (isRequired_ExpectedValue) { // 空値ではダメという設定の場合。 goto gt_Error_Parse; } goto gt_EndMethod; } } else { isExpectedValue = false; } // (8)該当行をレコードセットに追加。 if (log_Reports.Successful) { if (isKeyValue == isExpectedValue) { isJudge = true; } else { isJudge = false; } } else { isJudge = false; } } catch (RowNotInTableException) { // (9)指定行がなかった場合は、スルー。 isJudge = false; // // 指定の行は、テーブルの中にありませんでした。 // 再描画と、行の削除が被ったのかもしれません。 // いわゆる「処理中」です。 // //.WriteLine(this.GetType().Name+"#GetValueStringList: ["+refTable.Name+"]テーブルには、["+ttbwIndex+"]行が存在しませんでした。もしかすると、削除されたのかもしれません。エラー:"+e.Message); } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_Parse: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー286!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.AppendI(0, "<Select_KeyBoolImplクラス>"); s.Append(Environment.NewLine); s.AppendI(1, "これはbool型値のプログラムです。他の型のプログラムを使ってください。"); s.Append(Environment.NewLine); s.AppendI(1, "sExpectedValue=["); s.Append(value_Expected); s.Append("]"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // ヒント parent_Query.ToText_Locationbreadcrumbs(s); s.AppendI(0, "</Select_KeyBoolImplクラス>"); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// UsercontrolPerformerImpl#Perform_FcImpl で使用。 /// UsercontrolPerformerImpl#Perform で使用。 /// /// cf_Eventは、ucFc.ControlCommon.Configurationtree_Control.SDic_Event から取っている。 /// </summary> /// <param name="sender"></param> /// <param name="event_Conf"></param> /// <param name="moWorkbench"></param> /// <param name="log_Reports"></param> public void Execute2_Event( object sender, Configurationtree_Node event_Conf, MemoryApplication owner_MemoryApplication, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(1, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute2_Event", log_Reports); Configurationtree_Node cf_ThisMethod = new Configurationtree_NodeImpl("<" + log_Method.Fullname + ":>", null); if (log_Reports.CanStopwatch) { // コメント作成 { StringBuilder sb = new StringBuilder(); string sName_Control; { Configuration_Node owner_Configurationtree_Control = event_Conf.GetParentByNodename( NamesNode.S_CONTROL1, EnumConfiguration.Tree, true, log_Reports); ((Configurationtree_Node)owner_Configurationtree_Control).Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_Control, false, log_Reports); } string sEventName; { event_Conf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sEventName, false, log_Reports); } int nActionCount; { nActionCount = event_Conf.List_Child.Count; } sb.Append(Info_Functions.Name_Library); sb.Append(":"); sb.Append(this.GetType().Name); sb.Append("#ToString: イベント計測 "); sb.Append(" FC["); sb.Append(sName_Control); sb.Append("].EV["); sb.Append(sEventName); sb.Append("]"); if (0 < nActionCount) { sb.Append("アクション数=["); sb.Append(nActionCount); sb.Append("]"); } log_Method.Log_Stopwatch.Message = sb.ToString(); log_Method.Log_Stopwatch.Begin(); } } // ステータスバーに表示する文字列。 { if (sender is Customcontrol) { Customcontrol ccFc = (Customcontrol)sender; if (null == ccFc.ControlCommon.Owner_MemoryApplication) { log_Method.WriteDebug_ToConsole("null==ccFc.ControlCommon.Owner_MemoryApplication がヌルでした。"); } else { ccFc.ControlCommon.Owner_MemoryApplication.MemoryForms.AddStatus_ActionUsercontrolNameBegin(log_Reports); string sName_Usercontrol = sName_Usercontrol = ccFc.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); ccFc.ControlCommon.Owner_MemoryApplication.MemoryForms.AddStatus_ActionUsercontrolName(sName_Usercontrol, log_Reports); } } } event_Conf.List_Child.ForEach(delegate(Configurationtree_Node s_Action, ref bool bBreak) { Executer3_FunctionImpl exe2 = new Executer3_FunctionImpl(); // イベントハンドラーの作成 Expression_Node_Function expr_Func = exe2.ConfigurationtreeToFunction( s_Action, owner_MemoryApplication, log_Reports ); // システム定義関数の実行 exe2.Execute3_Function( expr_Func, sender, owner_MemoryApplication, log_Reports ); // 他の待機スレッドに、実行順番を譲る。 //TODO: System.Threading.Thread.Sleep(0); //if (Log_ReportsImpl.BDebugmode_Static) //{ // //.WriteLine(this.GetType().Name + "#:\n│\n│\n│\n│"); //} }); log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// attr系要素の追加。 /// /// 既に追加されている要素は、追加できない。 /// </summary> public void Add( string sKey, string sValue, Configuration_Node conf_Value, bool bRequired, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_Syntax.Name_Library, this, "Add",log_Reports); // // if (!this.dictionary_Attribute.ContainsKey(sKey)) { this.dictionary_Attribute.Add(sKey, sValue); } else { if (bRequired) { // エラー goto gt_Error_Duplicate; } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_Duplicate: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー345!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("要素<"); s.Append(this.owner.Name); s.Append(">に、同じ名前の属性が重複していました。"); s.Newline(); s.Append("入れようとした要素の名前=["); s.Append(sKey); s.Append("]"); s.Newline(); // ヒント s.Append(r.Message_Configuration(conf_Value)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
/// <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); }
//──────────────────────────────────────── protected void Execute6_Sub( Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute6_Sub", log_Reports); string 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(); } // // 指定された引数から、または、 // このNAction29要素を含んでいる control要素から、コントロールの名前を取得。 List <Usercontrol> list_Usercontrol; if (log_Reports.Successful) { // 正常時 Expression_Node_String ec_Name_Control; // // コントロール名が指定されていれば、そのコントロール名。 // this.TrySelectAttribute(out ec_Name_Control, Expression_Node_Function29Impl.PM_NAME_CONTROL, EnumHitcount.One_Or_Zero, log_Reports); string sName_Control = ec_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); if ("" == sName_Control.Trim()) { //コントロール名が指定されていない場合。 // // ・このシステム関数を含んでいるイベント要素→コントロール要素と辿り、コントロール名を取得。 Configuration_Node cf_Event = this.Cur_Configuration.GetParentByNodename( NamesNode.S_EVENT, EnumConfiguration.Unknown, false, log_Reports); if (null != cf_Event) { Configuration_Node owner_Configuration_Control = cf_Event.GetParentByNodename( NamesNode.S_CONTROL1, EnumConfiguration.Tree, true, log_Reports); if (null != (Configurationtree_Node)owner_Configuration_Control) { bool bHit = ((Configurationtree_Node)owner_Configuration_Control).Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_Control, false, log_Reports); if (bHit) { ec_Name_Control = new Expression_Node_StringImpl(this, this.Cur_Configuration); ec_Name_Control.AppendTextNode( sName_Control, this.Cur_Configuration, log_Reports ); } } else { //nFcName_prm = null; } } else { //nFcName_prm = null; } } // // 指定のコントロール // list_Usercontrol = this.Owner_MemoryApplication.MemoryForms.GetUsercontrolsByName( ec_Name_Control, true, log_Reports ); } else { list_Usercontrol = new List <Usercontrol>(); } // // 妥当性判定を行います。 // if (log_Reports.Successful) { if (0 < list_Usercontrol.Count) { Usercontrol uct = list_Usercontrol[0]; uct.JudgeValidity(log_Reports); } //.WriteLine(this.GetType().Name + "#: ◆ 妥当性判定を行った。"); } if (log_Reports.Successful) { // // 指定のコントロールの内容を、データ・ソースから読取り直して最新表示します。 // if (0 < list_Usercontrol.Count) { Usercontrol uct = list_Usercontrol[0]; //.WriteLine(this.GetType().Name + "#: ◆ 指定のコントロールに、データのアップデートを指示。"); if (uct.ControlCommon.BAutomaticinputting) { // コンピューターにより自動入力されたとき。 //essageBox.Show("コンピュータによって自動入力されました。 コントロールID=[" + this.FormObjectId + "]", "デバッグ"); } else { // 手入力による更新。 uct.UsercontrolToMemory(log_Reports); } } //.WriteLine(this.GetType().Name + "#: ◆ 指示終了。"); } // // log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── public Record_HumaninputImpl(string config, DataRow dataRow, Configuration_Node parent_ConfigurationNode) : base(config, parent_ConfigurationNode) { this.dataRow = dataRow; //this.configuration_Node = configuration_Node; }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// インスタンスを作ります。 /// </summary> /// <param name="out_recCond"></param> /// <param name="logic"></param> /// <param name="sField"></param> /// <param name="s_ParentNode"></param> /// <returns></returns> public static bool TryBuild( out Recordcondition out_RecCond, EnumLogic enumLogic, string sField, Configuration_Node parent_Conf, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_Table.Name_Library, "RecCondImpl", "TryBuild", log_Reports); bool bSuccessful; sField = sField.Trim(); if (EnumLogic.None == enumLogic && "" != sField) { // 条件式 RecordconditionImpl rc = new RecordconditionImpl(parent_Conf); rc.sField = sField; out_RecCond = rc; bSuccessful = true; } else if (EnumLogic.None != enumLogic && "" == sField) { // グループ RecordconditionImpl rc = new RecordconditionImpl(parent_Conf); rc.sField = "(▲グループにフィールド属性無し103![" + enumLogic + "])"; rc.enumLogic = enumLogic; out_RecCond = rc; bSuccessful = true; } else { out_RecCond = null; bSuccessful = false; goto gt_Error_Attribute; } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_Attribute: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー101!", log_Method); StringBuilder s = new StringBuilder(); s.Append("<rec-cond>インスタンスを作成する引数にエラー。"); s.Append(Environment.NewLine); s.Append("logic=["); s.Append(enumLogic); s.Append("] sField=["); s.Append(sField); s.Append("]"); s.Append(Environment.NewLine); s.Append(r.Message_Configuration(parent_Conf)); r.Message = s.ToString(); log_Reports.EndCreateReport(); //throw new Exception(s.ToString()); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return(bSuccessful); }
//──────────────────────────────────────── /// <summary> /// コンストラクター。 /// </summary> /// <param name="parent_Cf">親ソース。</param> public MemoryAaeditorxml_EditorImpl(Configuration_Node parent_Cf) : base(parent_Cf) { this.name_Editor = ""; }
//──────────────────────────────────────── 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; }
//──────────────────────────────────────── /// <summary> /// トゥゲザー名で指定しなかった場合。 /// /// (1)「コントロール設定ファイル(Fcnf)」の<refresher>を読みにいく。 /// (2)なければ「トゥゲザー設定ファイル(Frfr)」の<refresher>を読みにいく。 /// </summary> /// <param name="log_Reports"></param> private void Execute6_ByNoName( out Configurationtree_Node cf_TgTogether, Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute6_ByNoName", log_Reports); if (log_Reports.CanStopwatch) { log_Method.Log_Stopwatch.Message = Utility_Textformat.Format_StopwatchComment( this, this.Cur_Configuration, log_Reports ); log_Method.Log_Stopwatch.Begin(); } // // string sFncName0; this.TrySelectAttribute(out sFncName0, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); if (null != this.Cur_Configuration) { Configuration_Node cf_Event = this.Cur_Configuration.GetParentByNodename( NamesNode.S_EVENT, EnumConfiguration.Tree, 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) { // // (1)「コントロール設定ファイル(Fcnf)」の<refresher>を読みにいく。 // this.Execute3b_ByNoName_1Fcnf( out cf_TgTogether, (Configurationtree_Node)owner_Configurationtree_Control, (Configurationtree_Node)cf_Event, log_Reports); if (null == cf_TgTogether) { // // (2)「トゥゲザー設定ファイル(Frfr)」の<refresher>を読みにいく。 // this.Execute3b_ByNoName_2Frfr( out cf_TgTogether, (Configurationtree_Node)owner_Configurationtree_Control, (Configurationtree_Node)cf_Event, log_Reports ); } // // // 13:トゥゲザーの実行 // 所要時間目安[1]~[4343]ミリ秒ほど // // // 指定のコントロールの内容を、データ・ソースから読取り直して最新表示します。 if (log_Reports.Successful) { // // トゥゲザー<together>を使います。 // this.Owner_MemoryApplication.MemoryTogethers.RefreshDataByTogether( cf_TgTogether, log_Reports ); } } else { cf_TgTogether = null; goto gt_Error_NullParentControl; } } else { cf_TgTogether = null; goto gt_Error_NullParentEvent; } } else { cf_TgTogether = null; goto gt_Error_NullTogetherName; } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NullParentControl: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sFncName0, log_Reports); //関数名 tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration), log_Reports); //設定位置パンくずリスト this.Owner_MemoryApplication.CreateErrorReport("Er:110012;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_NullParentEvent: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sFncName0, log_Reports); //関数名 tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration), log_Reports); //設定位置パンくずリスト this.Owner_MemoryApplication.CreateErrorReport("Er:110013;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_NullTogetherName: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sFncName0, log_Reports); //関数名 tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration), log_Reports); //設定位置パンくずリスト this.Owner_MemoryApplication.CreateErrorReport("Er:110014;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── public Configuration_NodeImpl(string name_Node, Configuration_Node parent_Conf_OrNull) { this.name = name_Node; this.parent = parent_Conf_OrNull; }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <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); // // Configuration_Node parent_Configurationtree_Node_Query = this.Cur_Configuration; StringBuilder sb_Result = new StringBuilder(); // // 外観 // // <f-text-template table="Ut:条件テーブル" lookup-id="100"> // // ・lookup-id は、lookup-value という名前の方が良かった。 // // // 指定のテーブルの ID列を指定して、TEXT列の内容を取得。 Builder_TexttemplateP1pImpl p1pText = new Builder_TexttemplateP1pImpl(); { // <f-text-template>要素。 Selectstatement selectSt = new SelectstatementImpl(this, this.Cur_Configuration); // TODO: logic属性がある版も要るはず。 Recordcondition recCond1; bool bSuccessful = RecordconditionImpl.TryBuild(out recCond1, EnumLogic.None, Expression_SftextTemplate.S_FIELD_ID, parent_Configurationtree_Node_Query, log_Reports); selectSt.List_Recordcondition.Add(recCond1); //// //// (1)キー_フィールド名 //{ // recCond1.Name_Field = "ID"; //} // // (2)探したいキー値 { // // thisは、<f-text-template>。 // string sLookupId; bool bHit = this.TrySelectAttribute(out sLookupId, PmNames.S_LOOKUP_ID.Name_Pm, EnumHitcount.One, log_Reports); if (bHit) { recCond1.Value = sLookupId; } string sLookupValue; if (log_Reports.Successful) { sLookupValue = recCond1.Value; } else { // エラー goto gt_Error_NotFoundVariable; } // bug: if ("" == sLookupValue.Trim()) { // // 検索キーが空欄の場合。 sb_Result.Length = 0; //空文字列にする。 goto gt_EndMethod; } } // // (3)検索ヒットの必須の有無 { // 必須指定。 selectSt.Required = Expression_SftextTemplate.S_TRUE; } // // (4)テーブル名 { Expression_Node_String ec_Result;//ソース情報利用 bool bHit = this.TrySelectAttribute(out ec_Result, PmNames.S_TABLE.Name_Pm, EnumHitcount.One, log_Reports); selectSt.Expression_From = ec_Result; } // // (5)欲しいデータのあるフィールド名 selectSt.List_SName_SelectField.Add(Expression_SftextTemplate.S_FIELD_TEXT); // // (1)レコードセットの絞り込み。 RecordSet dst_Rs; { Table_Humaninput o_Tbl = this.Owner_MemoryApplication.MemoryTables.GetTable_HumaninputByName( selectSt.Expression_From,//これが空文字列の場合がある?? true, log_Reports ); dst_Rs = new RecordSetImpl(o_Tbl); } //dst_Rs.Selectstatement = selectSt;//★ { // テーブル名。 if ("" == selectSt.Expression_From.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports).Trim()) { // // エラー。 goto gt_Error_EmptyTableName; } Table_Humaninput o_Table = this.Owner_MemoryApplication.MemoryTables.GetTable_HumaninputByName(selectSt.Expression_From, true, log_Reports); if (null == o_Table) { goto gt_Error_NullTable; } bool isRequired_ExpectedValue; { bool parseSuccessful = bool.TryParse(selectSt.Required, out isRequired_ExpectedValue); } // // // // 条件 // // // 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, o_Table, log_Reports ); List <DataRow> dst_Row = new List <DataRow>(); if (log_Reports.Successful) { SelectPerformerImpl sp = new SelectPerformerImpl(); sp.Select( out dst_Row, name_KeyField, value_Expected, isRequired_ExpectedValue, fielddefinition_Key, o_Table.DataTable, parent_Configurationtree_Node_Query, log_Reports ); } if (log_Reports.Successful) { dst_Rs.AddList(dst_Row, log_Reports); } if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } } if (!log_Reports.Successful) { // // エラーが出ていたら、さっさと抜ける。 //sResult = ""; goto gt_EndMethod; } // // フィールド値の取得。 P5_CellsSelecterImpl sel5 = new P5_CellsSelecterImpl(this.Owner_MemoryApplication); List <List <string> > sListList_reslt = sel5.P5_Select_CellType( dst_Rs, selectSt, null,//nwhere_recordSetSaveTo, this.Cur_Configuration, log_Reports ); if (0 < sListList_reslt.Count) { // 先頭行の、 List <string> sList_Fld = sListList_reslt[0]; // 先頭フィールドの値。 string sString = sList_Fld[0]; //e_string.SetValidation(...); p1pText.Text = sString; } else { // エラー Log_TextIndented txt = new Log_TextIndentedImpl(); txt.Append(this.GetType().Name); txt.Append("#GetString:(" + Info_Expr.Name_Library + ") エラー。該当なし。"); txt.Append(" 選択フィールド=["); txt.Append(selectSt.ToSelectFieldNameListCsv()); txt.Append("]"); txt.Append(" テーブル=["); txt.Append(selectSt.Expression_From.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); txt.Append("]"); // キーフィールド txt.Append(" ["); txt.Append(recCond1.Name_Field); txt.Append("]が"); // 探す値。 txt.Append("["); txt.Append(recCond1.Value); txt.Append("]のとき"); p1pText.Text = txt.ToString(); } } List <int> nList_P1p = p1pText.ExistsP1pNumbers( this.Dictionary_Expression_Attribute, log_Reports ); foreach (int n_P1p in nList_P1p) { string p1pValue; { bool bHit = this.TrySelectAttribute( out p1pValue, "p" + n_P1p + "p", EnumHitcount.One, log_Reports ); if (log_Reports.Successful) { } else { p1pValue = null; } p1pText.Dictionary_NumberAndValue_Parameter.Add(n_P1p, p1pValue); } } Expression_Node_String ec_TextTemplate = p1pText.Compile( log_Reports ); sb_Result.Append(ec_TextTemplate.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); // // // // TODO: 制約の判定 // // // goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NotFoundVariable: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(parent_Configurationtree_Node_Query), log_Reports);//設定位置パンくずリスト this.Owner_MemoryApplication.CreateErrorReport("Er:6009;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_EmptyTableName: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(parent_Configurationtree_Node_Query), log_Reports);//設定位置パンくずリスト this.Owner_MemoryApplication.CreateErrorReport("Er:6010;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_NullTable: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(parent_Configurationtree_Node_Query), log_Reports);//設定位置パンくずリスト this.Owner_MemoryApplication.CreateErrorReport("Er:6011;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return(sb_Result.ToString()); }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// レコードセットを、名前を付けて一時記憶します。 /// </summary> public void Execute_SaveRecordset(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_SaveRecordset", log_Reports); // // // // 既に、一時記憶に同名のレコードセットがないか検索。 string sStorage = this.Expression_Storage.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); if (!this.Owner_MemoryApplication.MemoryRecordset.RecordsetStorage.Contains(this.Expression_Storage, log_Reports)) { RecordSet dst_Rs_ToSave; Selectstatement selectSt_ToSave; { if ("" == this.Expression_From.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports).Trim()) { // // エラー。 goto gt_Error_EmptyTableName; } Table_Humaninput oTable = this.Owner_MemoryApplication.MemoryTables.GetTable_HumaninputByName( this.Expression_From,//これが空文字列の場合がある?? true, log_Reports ); dst_Rs_ToSave = new RecordSetImpl(oTable); // // 要求の作成。 { // <startup-special-rule>の中で使う子要素。 selectSt_ToSave = new SelectstatementImpl(this, this.Cur_Configuration); { Recordcondition recCond1;// = new RecordconditionImpl(s_ParentNode); // TODO: logic要素がある版も要るはず。 bool bSuccessful = RecordconditionImpl.TryBuild( out recCond1, EnumLogic.None, this.Expression_Field.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), this.Cur_Configuration.Parent, log_Reports ); recCond1.Value = this.Expression_LookupVal.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); selectSt_ToSave.List_Recordcondition.Add(recCond1); } selectSt_ToSave.Required = this.Expression_Required.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); selectSt_ToSave.Expression_From = this.Expression_From; selectSt_ToSave.Storage = this.Expression_Storage.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); } } // // レコードの検索。 { //Configurationtree_Node Configuration_Node parent_Cf_Query = this.Cur_Configuration.Parent; // テーブル名。 if ("" == selectSt_ToSave.Expression_From.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports).Trim()) { // // エラー。 goto gt_Error_EmptyTableName; } Table_Humaninput o_Table = this.Owner_MemoryApplication.MemoryTables.GetTable_HumaninputByName(selectSt_ToSave.Expression_From, true, log_Reports); if (null == o_Table) { goto gt_Error_NullTable; } bool bExpectedValueRequired; { bool parseSuccessful = bool.TryParse(selectSt_ToSave.Required, out bExpectedValueRequired); } // // // // 条件 // // // 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_ToSave.List_Recordcondition, o_Table, log_Reports ); List <DataRow> dst_Row = new List <DataRow>(); SelectPerformerImpl sp = new SelectPerformerImpl(); sp.Select( out dst_Row, name_KeyField, value_Expected, bExpectedValueRequired, fielddefinition_Key, o_Table.DataTable, parent_Cf_Query, log_Reports ); dst_Rs_ToSave.AddList(dst_Row, log_Reports); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } //P2_SelectCellImpl sel2 = new P2_SelectCellImpl(this.MoOpyopyo); //sel2.P2_Select( // ref dst_Rs_ToSave, // selectSt_ToSave, // this.Parent, // log_Reports // ); } // debug: //if (false) //{ // StringBuilder txt = new StringBuilder(); // txt.Append(Info_E.LibraryName + ":" + this.GetType().Name + "#SaveRecordSet: 【検索してきたレコードセット】ここで内容消えてない?(2)?"); // txt.Append(" fld=[" + recordSet_toSave.Selectstatement.E_Field.E_Execute(log_Reports) + "]"); // txt.Append(" lookup-value=[" + recordSet_toSave.Selectstatement.E_Value.E_Execute( log_Reports) + "]"); // txt.Append(" description=[" + recordSet_toSave.Selectstatement.Expression_Description.E_Execute( log_Reports) + "]"); // txt.Append(" from=[" + recordSet_toSave.Selectstatement.Expression_From.E_Execute( log_Reports) + "]"); // txt.Append(" required=[" + recordSet_toSave.Selectstatement.E_Required.E_Execute( log_Reports) + "]"); // txt.Append(" Storage=[" + recordSet_toSave.Selectstatement.Expression_Storage.E_Execute( log_Reports) + "]"); // //txt.Append(" this.NFld=[" + RecordSet_toSave.NField.E_Execute(EnumHitcount.Unconstraint, log_Reports) + "]"); // //txt.Append(" this.NLookupValue=[" + RecordSet_toSave.NLookupValue.E_Execute(EnumHitcount.Unconstraint, log_Reports) + "]"); // //txt.Append(" this.NRequired=[" + RecordSet_toSave.NRequired.E_Execute(EnumHitcount.Unconstraint, log_Reports) + "]"); // //txt.Append(" this.NFrom=[" + RecordSet_toSave.NFrom.E_Execute(EnumHitcount.Unconstraint, log_Reports) + "]"); // //txt.Append(" ヒット件数=[" + RecordSet_toSave.O_Items.Count + "]"); // txt.Append(" ヒット件数=[" + recordSet.Count + "]"); // // レコードの内容 // //foreach (Dictionary<string, OValue> oRecord in RecordSet_toSave.O_Items) // //{ // // txt.Append(" フィールド数=[" + oRecord.Count + "]"); // // foreach (string sKey in oRecord.Keys) // // { // // OValue oValue = oRecord[sKey]; // // txt.Append(" 要素=[" + sKey + ":" + oValue.HumanInputString + "]"); // // } // //} // foreach (DataRow record in recordSet) // { // txt.Append(" フィールド数=[" + record.Table.Columns.Count + "]"); // foreach (DataColumn column in record.Table.Columns) // { // Value_Humaninput oValue = (Value_Humaninput)record[column.ColumnName]; // txt.Append(" ★" + column.ColumnName + "=[" + oValue.Humaninput + "]"); // } // } // //ystem.Console.WriteLine(txt.ToString()); //} // debug: //if (false) //{ // StringBuilder txt = new StringBuilder(); // txt.Append(Info_E.LibraryName + ":" + this.GetType().Name + "#SaveRecordSet: 【検索してきたレコードセット】内容入っていますか(3)?"); // txt.Append(" ヒット件数=[" + recordSet_toSave.O_Items.Count + "]←検索後"); // // レコードの内容 // foreach (Dictionary<string, Value_Humaninput> oRecord in recordSet_toSave.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()); //} // // レコードの一時保存。 P4_RecordSetSaverImpl sel4 = new P4_RecordSetSaverImpl(this.Owner_MemoryApplication); sel4.P4_Save( dst_Rs_ToSave, this, log_Reports ); } else { //ystem.Console.WriteLine(this.GetType().Name + "#SaveRecordSet: レコードセットは既に登録済みです。"); } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_EmptyTableName: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration.Parent), log_Reports);//設定位置パンくずリスト this.Owner_MemoryApplication.CreateErrorReport("Er:6030;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_NullTable: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(this.Cur_Configuration.Parent), log_Reports);//設定位置パンくずリスト this.Owner_MemoryApplication.CreateErrorReport("Er:6031;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── 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(""); }
//──────────────────────────────────────── /// <summary> /// コンストラクター。 /// </summary> /// <param name="parent_Cf">親設定。</param> public MemorySetverContainerImpl(Configuration_Node parent_Cf) { this.parent = parent_Cf; this.dictionary_Fsetvar_Configurationtree = new Dictionary_Fsetvar_ConfigurationtreeImpl(); }
public abstract override Expression_Node_Function NewInstance( Expression_Node_String parent_Expression, Configuration_Node cur_Conf, object /*MemoryApplication*/ owner_MemoryApplication, Log_Reports log_Reports);
//──────────────────────────────────────── protected override void Parse_ChildNodes( XmlElement cur_X, Configurationtree_Node cur_Cf, 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, "Parse_ChildNodes", log_Reports); // XmlElement err_XADisplay = null; Usercontrol uct = null; if (log_Reports.Successful) { Configuration_Node cf_Control = cur_Cf.GetParentByNodename( NamesNode.S_CONTROL1, EnumConfiguration.Tree, true, log_Reports); if (log_Reports.Successful) { uct = Utility_XmlToConfigurationtree_NodeImpl.GetUsercontrol( (Configurationtree_Node)cf_Control, memoryApplication, log_Reports); } } if (log_Reports.Successful) { if (uct is UsercontrolListbox) { // // リストボックスなら。 UsercontrolListbox uctLst = (UsercontrolListbox)uct; // // <a-select-record>、<a-display>要素 // XmlNodeList child_XNl = cur_X.ChildNodes; foreach (XmlNode x_childNode in child_XNl) { if (XmlNodeType.Element == x_childNode.NodeType) { XmlElement xChild = (XmlElement)x_childNode; err_XADisplay = xChild; string child_SName_Fnc = xChild.GetAttribute(PmNames.S_NAME.Name_Attribute); // // if (NamesFnc.S_VLD_DISPLAY == child_SName_Fnc)//【変更 2012-07-19】 { XmlToConfigurationtree_C15_Elm to = XmlToConfigurationtree_Collection.GetTranslatorByFncName(child_SName_Fnc, log_Reports); to.XmlToConfigurationtree( xChild, cur_Cf, memoryApplication, log_Reports ); } else if (NamesFnc.S_VLD_SELECT_RECORD == child_SName_Fnc) { // Sf:Vld-SelectRecord; XmlToConfigurationtree_C15_Elm to = XmlToConfigurationtree_Collection.GetTranslatorByFncName(child_SName_Fnc, log_Reports); to.XmlToConfigurationtree( xChild, cur_Cf, memoryApplication, log_Reports ); } else { // // エラー。 goto gt_Error_UndefinedChild11; } } } } } goto gt_EndMethod; // #region 異常系 //──────────────────────────────────────── gt_Error_UndefinedChild11: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー385!", log_Method); StringBuilder s = new StringBuilder(); s.Append("<f-list-box-validation>要素に、<a-display><a-select-record>要素以外の要素"); s.Append(Environment.NewLine); s.Append("["); s.Append(err_XADisplay.Name); s.Append("]が含まれていました。"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // ヒント r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_UndefinedClass: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー386!", log_Method); StringBuilder s = new StringBuilder(); s.Append("なんらかのエラー。"); s.Append(Environment.NewLine); // ヒント r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── public void Judge( out bool isJudge, string name_KeyField, string value_Expected, bool isRequired_ExpectedValue, DataRow row, Configuration_Node parent_Query, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(); log_Method.BeginMethod(Info_Table.Name_Library, this, "Judge",log_Reports); // try { object obj = row[name_KeyField]; if (obj is DBNull) { isJudge = false; goto gt_Error_DBNull; } Value_Humaninput valueH = (Value_Humaninput)obj; // (5)キーが空欄で、検索ヒット必須でなければ、無視します。【int型フィールドの場合】 if (Int_HumaninputImpl.IsSpaces(valueH)) { isJudge = false; goto gt_EndMethod; } // (6)この行の、キー_フィールドの値を取得。 int keyValue; bool bParsedSuccessful = Int_HumaninputImpl.TryParse( valueH, out keyValue, EnumOperationIfErrorvalue.Error, null, log_Reports ); if (log_Reports.Successful) { if (!bParsedSuccessful) { isJudge = false; if (log_Reports.CanCreateReport) { Log_RecordReports d_Report = log_Reports.BeginCreateReport(EnumReport.Error); d_Report.SetTitle("▲エラー698!", log_Method); d_Report.Message = "int型パース失敗。"; log_Reports.EndCreateReport(); } goto gt_EndMethod; } } // (7)キー値をint型に変換します。 int expectedValue; if (log_Reports.Successful) { bool bParseSuccessful2 = int.TryParse(value_Expected, out expectedValue); if (!bParseSuccessful2) { isJudge = false; if (isRequired_ExpectedValue) { goto gt_Error_Parse; } goto gt_EndMethod; } } else { expectedValue = 0; } if (log_Reports.Successful) { // (8)該当行をレコードセットに追加。 if (keyValue == expectedValue) { // // 該当行なら。 isJudge = true; } else { isJudge = false; } } else { isJudge = false; } } catch (RowNotInTableException) { // (9)指定行がなかった場合は、スルー。 isJudge = false; // // 指定の行は、テーブルの中にありませんでした。 // 再描画と、行の削除が被ったのかもしれません。 // いわゆる「処理中」です。 // //.WriteLine(this.GetType().Name+"#GetValueStringList: ["+refTable.Name+"]テーブルには、["+ttbwIndex+"]行が存在しませんでした。もしかすると、削除されたのかもしれません。エラー:"+e.Message); } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_DBNull: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー244!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("検索キーに指定した["); s.Append(name_KeyField); s.Append("]というフィールドは無いです。"); s.Newline(); // ヒント parent_Query.ToText_Locationbreadcrumbs(s); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_Parse: // 空値ではダメという設定の場合。 if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー287!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.AppendI(0, "<Select_KeyIntImplクラス>"); s.Newline(); s.AppendI(1, "これはint型値のプログラムです。他の型のプログラムを使ってください。"); s.Newline(); s.AppendI(1, "・ヒント:変数が見つからなかった場合もここに来ます。例えば、変数名「$aaa」を書こうとして、「aaa」と書いていませんか?"); s.Newline(); s.AppendI(1, "・ヒント:数値が大きすぎた場合もここに来ます。"); s.Newline(); s.AppendI(1, "sExpectedValue=["); s.Append(value_Expected); s.Append("]"); s.Newline(); s.Newline(); // // ヒント parent_Query.ToText_Locationbreadcrumbs(s); s.AppendI(0, "</Select_KeyIntImplクラス>"); s.Newline(); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
/// <summary> /// /// </summary> /// <param select="nValue"></param> /// <param select="s_OwnerNode"></param> public XenonNameImpl(string sValue, Configuration_Node owner_Configuration) { this.sValue = sValue; this.cur_Configuration = owner_Configuration; }
/// <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; }
//──────────────────────────────────────── public void Judge( out bool isJudge, string name_KeyField, string value_Expected, bool isRequired_ExpectedValue,//使ってない。 DataRow row, Configuration_Node parent_Query, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(); log_Method.BeginMethod(Info_Table.Name_Library, this, "Judge", log_Reports); // try { // 無い列名を指定した場合。 if (!row.Table.Columns.Contains(name_KeyField)) { // エラー isJudge = false; goto gt_Error_NothingKeyField; } Value_Humaninput valueH = (Value_Humaninput)row[name_KeyField]; // // (5)キーが空欄なら、無視します。【文字列型フィールドのみ】 // if (String_HumaninputImpl.IsSpaces(valueH)) { isJudge = false; goto gt_EndMethod; } // // (6)この行の、キー_フィールドの値を取得。 // string keyValue; bool isParsedSuccessful = String_HumaninputImpl.TryParse( valueH, out keyValue, parent_Query.ToString(),//TODO:本当はテーブル名がいい。 xenonTable.SName, name_KeyField, log_Method, log_Reports); if (!log_Reports.Successful) { // 既エラー isJudge = false; goto gt_EndMethod; } if (!isParsedSuccessful) { // エラー isJudge = false; if (log_Reports.CanCreateReport) { Log_RecordReports d_Report = log_Reports.BeginCreateReport(EnumReport.Error); d_Report.SetTitle("▲エラー697!", log_Method); d_Report.Message = "string型パース失敗。"; log_Reports.EndCreateReport(); } goto gt_EndMethod; } // (8)該当行をレコードセットに追加。 if (keyValue == value_Expected) { isJudge = true; } else { isJudge = false; } } catch (RowNotInTableException) { // (9)指定行がなかった場合は、スルー。 isJudge = false; // // 指定の行は、テーブルの中にありませんでした。 // 再描画と、行の削除が被ったのかもしれません。 // いわゆる「処理中」です。 // //.WriteLine(this.GetType().Name+"#GetValueStringList: ["+refTable.Name+"]テーブルには、["+ttbwIndex+"]行が存在しませんでした。もしかすると、削除されたのかもしれません。エラー:"+e.Message); } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NothingKeyField: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー611!", log_Method); StringBuilder s = new StringBuilder(); s.Append("無い列名が指定されました。 sKeyFieldName=[" + name_KeyField + "]"); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// /// </summary> public XenonNameImpl(Configuration_Node owner_Configuration) { this.sValue = ""; this.cur_Configuration = owner_Configuration; }
//──────────────────────────────────────── public void Judge( out bool isJudge, string name_KeyField, string value_Expected, bool isRequired_ExpectedValue, DataRow row, Configuration_Node parent_Query, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(); log_Method.BeginMethod(Info_Table.Name_Library, this, "Judge", log_Reports); // try { object obj = row[name_KeyField]; if (obj is DBNull) { isJudge = false; goto gt_Error_DBNull; } Value_Humaninput valueH = (Value_Humaninput)obj; // (5)キーが空欄で、検索ヒット必須でなければ、無視します。【int型フィールドの場合】 if (Int_HumaninputImpl.IsSpaces(valueH)) { isJudge = false; goto gt_EndMethod; } // (6)この行の、キー_フィールドの値を取得。 int keyValue; bool bParsedSuccessful = Int_HumaninputImpl.TryParse( valueH, out keyValue, EnumOperationIfErrorvalue.Error, null, log_Reports ); if (log_Reports.Successful) { if (!bParsedSuccessful) { isJudge = false; if (log_Reports.CanCreateReport) { Log_RecordReports d_Report = log_Reports.BeginCreateReport(EnumReport.Error); d_Report.SetTitle("▲エラー698!", log_Method); d_Report.Message = "int型パース失敗。"; log_Reports.EndCreateReport(); } goto gt_EndMethod; } } // (7)キー値をint型に変換します。 int expectedValue; if (log_Reports.Successful) { bool bParseSuccessful2 = int.TryParse(value_Expected, out expectedValue); if (!bParseSuccessful2) { isJudge = false; if (isRequired_ExpectedValue) { goto gt_Error_Parse; } goto gt_EndMethod; } } else { expectedValue = 0; } if (log_Reports.Successful) { // (8)該当行をレコードセットに追加。 if (keyValue == expectedValue) { // // 該当行なら。 isJudge = true; } else { isJudge = false; } } else { isJudge = false; } } catch (RowNotInTableException) { // (9)指定行がなかった場合は、スルー。 isJudge = false; // // 指定の行は、テーブルの中にありませんでした。 // 再描画と、行の削除が被ったのかもしれません。 // いわゆる「処理中」です。 // //.WriteLine(this.GetType().Name+"#GetValueStringList: ["+refTable.Name+"]テーブルには、["+ttbwIndex+"]行が存在しませんでした。もしかすると、削除されたのかもしれません。エラー:"+e.Message); } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_DBNull: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー244!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("検索キーに指定した["); s.Append(name_KeyField); s.Append("]というフィールドは無いです。"); s.Newline(); // ヒント parent_Query.ToText_Locationbreadcrumbs(s); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_Parse: // 空値ではダメという設定の場合。 if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー287!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.AppendI(0, "<Select_KeyIntImplクラス>"); s.Newline(); s.AppendI(1, "これはint型値のプログラムです。他の型のプログラムを使ってください。"); s.Newline(); s.AppendI(1, "・ヒント:変数が見つからなかった場合もここに来ます。例えば、変数名「$aaa」を書こうとして、「aaa」と書いていませんか?"); s.Newline(); s.AppendI(1, "・ヒント:数値が大きすぎた場合もここに来ます。"); s.Newline(); s.AppendI(1, "sExpectedValue=["); s.Append(value_Expected); s.Append("]"); s.Newline(); s.Newline(); // // ヒント parent_Query.ToText_Locationbreadcrumbs(s); s.AppendI(0, "</Select_KeyIntImplクラス>"); s.Newline(); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// コンストラクター。 /// </summary> public Dictionary_Expression_Node_StringImpl(Configuration_Node owner_Conf) { this.Owner_Conf = owner_Conf; this.dicExpression_Item = new Dictionary <string, Expression_Node_String>(); }
//──────────────────────────────────────── /// <summary> /// 「フィールド名=値」という条件1つで検索。該当するレコード0~N件を返す。 /// </summary> /// <param name="dst_Row"></param> /// <param name="name_KeyField"></param> /// <param name="value_Expected"></param> /// <param name="isRequired_ExpectedValue"></param> /// <param name="fielddefinition_Key"></param> /// <param name="dataTable"></param> /// <param name="s_ParentNode_query"></param> /// <param name="log_Reports"></param> public void Select( out List <DataRow> out_List_DstRow, string name_KeyField, string value_Expected, bool isRequired_ExpectedValue, Fielddefinition fielddefinition_Key, DataTable dataTable, Configuration_Node parent_Query, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(); log_Method.BeginMethod(Info_Table.Name_Library, this, "Select", log_Reports); // // // // out_List_DstRow = new List <DataRow>(); Judge_FieldBoolImpl judgeB = new Judge_FieldBoolImpl(); Judge_FieldIntImpl judgeI = new Judge_FieldIntImpl(); Judge_FieldStringImpl judgeS = new Judge_FieldStringImpl(); foreach (DataRow row in dataTable.Rows) { bool bJudge; switch (fielddefinition_Key.Type_Field) { case EnumTypeFielddefinition.String: { // string型フィールドなら judgeS.Judge( out bJudge, name_KeyField, value_Expected, isRequired_ExpectedValue, row, parent_Query, log_Reports ); } break; case EnumTypeFielddefinition.Int: { // int型フィールドなら judgeI.Judge( out bJudge, name_KeyField, value_Expected, isRequired_ExpectedValue, row, parent_Query, log_Reports ); } break; case EnumTypeFielddefinition.Bool: { // bool型フィールドなら judgeB.Judge( out bJudge, name_KeyField, value_Expected, isRequired_ExpectedValue, row, parent_Query, log_Reports ); } break; default: { // エラー。 goto gt_Error_UndefinedClass; } break; } if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } if (bJudge) { out_List_DstRow.Add(row); } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_UndefinedClass: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー899", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.AppendI(0, "<NFuncCellUpdaterImplクラス>"); s.Append(Environment.NewLine); s.AppendI(1, "予期しない型です。"); s.Append(Environment.NewLine); s.AppendI(1, "keyFldDefinition.Type=["); s.Append(fielddefinition_Key.ToString_Type()); s.Append("]"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // ヒント s.AppendI(1, r.Message_Configuration(parent_Query)); s.AppendI(0, "</NFuncCellUpdaterImplクラス>"); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// 新しいインスタンスを作ります。 /// </summary> /// <param name="log_Reports"></param> /// <returns></returns> public Expression_Leaf_String NewInstance( Configuration_Node parent_Expression, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(); log_Method.BeginMethod(Info_Syntax.Name_Library, this, "NewInstance",log_Reports); // // // // Expression_Leaf_StringImpl result = new Expression_Leaf_StringImpl(null, parent_Expression); result.SetString( this.sHumanInput, log_Reports ); // // log_Method.EndMethod(log_Reports); return result; }
//──────────────────────────────────────── /// <summary> /// 「ディレクトリー」と「入力値」の2つを入力すると、「絶対パス」を返します。 /// /// ────────── /// /// 未設定の場合は、空文字列を返します。 /// ※bug:フォルダーパスの場合も空文字列になる?? /// /// ・ファイルパスとして利用できない文字や、予約語が含まれていると例外を投げます。 /// ・絶対パスの文字列の長さが、ファイルシステムで使える制限を越えると例外を投げます。 /// /// もし、設定されたパスが相対パスだった場合に、ベース・パスが設定されていなければ、 /// 起動「.exe」のあったパスが頭に付く。 /// </summary> /// <param name="baseDirectory"></param> /// <param name="humanInputText"></param> /// <param name="flagCheckPathTooLong">絶対パスの文字列の長さが、ファイルシステムで使える上限を超えていた場合に真、そうでない場合 偽にセットされます。</param> /// <param name="okPathTooLong">絶対パスの文字列の長さが、ファイルシステムで使える上限を超えていた場合に、「正常扱いにするなら」真、「エラー扱いにするなら」偽。</param> /// <param name="cur_Conf">デバッグ用情報。人間オペレーターが修正するべき箇所などの情報。</param> /// <returns></returns> public static string ToFilepathabsolute( string directory_Base, string humaninput, ref bool ref_IsTooLong_Path, bool isSafe_TooLong_Path, Log_Reports log_Reports, Configuration_Node cur_Conf ) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_Syntax.Name_Library, "Utility_Configurationtree_Filepath", "ToFilepathabsolute②", log_Reports); // // // // 修正履歴(2009-12-02) // // ・カレント・ディレクトリの移動を使ったコードを書いてはいけない。 // MS-DOSの名残り? // // ・起動「.exe」のディレクトリは Application.StartupPath で取得できる。 // // ・備考: // System.IO.Directory.GetCurrentDirectory()は、 // 「プロセスが開始されたディレクトリ」を返すので、 // openFileDialogで開いたディレクトリを返すこともある。 // // System.IO.Path.GetFullPath(path)も同じ。 Exception err_Excp; string result_Filepath;//ファイルパス // フラグのクリアー。 ref_IsTooLong_Path = false; // // 人間がCSVファイルに記述しているファイル・パス。 // // 「絶対パス」「相対パス」のどちらでも指定されます。 // string filepath_Source = humaninput.Trim(); if ("" == filepath_Source) { // 未設定の場合。 result_Filepath = "";//ファイルパスとしては使えない文字列。 goto gt_EndMethod; } // 「絶対パス」か、「相対パス」かを判断します。 bool isRooted_Path = Utility_Configurationtree_Filepath.IsRooted_Path( filepath_Source, log_Reports ); if (!log_Reports.Successful) { // 既エラー。 result_Filepath = "";//ファイルパスとしては使えない文字列。 goto gt_EndMethod; } if (!isRooted_Path) { // 相対パスの場合 // 「相対パス」に「ベース・ディレクトリー文字列」を連結して、「絶対パス」に変換します。 if ("" != directory_Base) { // 相対パスの相対元となるディレクトリーが設定されていれば。 if (!directory_Base.EndsWith(Path.DirectorySeparatorChar.ToString())) { filepath_Source = directory_Base + Path.DirectorySeparatorChar + filepath_Source; } else { filepath_Source = directory_Base + filepath_Source; } } else { // 起動「.exe」のあったパスを、相対の元となるディレクトリーとします。 if (!directory_Base.EndsWith(Path.DirectorySeparatorChar.ToString())) { filepath_Source = Application.StartupPath + Path.DirectorySeparatorChar + filepath_Source; } else { filepath_Source = Application.StartupPath + filepath_Source; } } } // ここで、パスは 絶対パスに変換されています。 try { // カレントディレクトリは使わない。 // 絶対パスの場合、GetFullPathを通す必要はないが、 // ファイルパスに使えない文字列を判定するために、 // 例外を返すメソッドを使っています。 result_Filepath = System.IO.Path.GetFullPath(filepath_Source); } catch (ArgumentException e) { // 指定のファイルパスに「*」など、ファイルパスとして使えない文字列が含まれていた場合など。 result_Filepath = "";//ファイルパスとしては使えない文字列。 err_Excp = e; goto gt_Error_ArgumentException; } catch (PathTooLongException e) { // ディレクトリーの文字数が、制限数を超えた場合などのエラー。 result_Filepath = "";//ファイルパスとしては使えない文字列。 if (isSafe_TooLong_Path) { // 正常処理扱いとします。 } else { // 異常扱いとします。 err_Excp = e; goto gt_Error_PathTooLongException; } ref_IsTooLong_Path = true; } catch (NotSupportedException e) { //パスのフォーマットが間違っているなどのエラー。 result_Filepath = "";//ファイルパスとしては使えない文字列。 err_Excp = e; goto gt_Error_NotSupportedException; } catch (Exception e) { // それ以外のエラー。 result_Filepath = "";//ファイルパスとしては使えない文字列。 err_Excp = e; goto gt_Error_Exception; } goto gt_EndMethod; // #region 異常系 //──────────────────────────────────────── gt_Error_ArgumentException: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー107!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append(Environment.NewLine); s.Append("使えないファイルパスです。["); s.Append(filepath_Source); s.Append("] :"); s.Append(err_Excp.Message); cur_Conf.ToText_Locationbreadcrumbs(s); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_PathTooLongException: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー108!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append(Environment.NewLine); s.Append("エラー 入力パス=[" + filepath_Source + "]:(" + err_Excp.GetType().Name + ") "); s.Append(err_Excp.Message); cur_Conf.ToText_Locationbreadcrumbs(s); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_NotSupportedException: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー109!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append(Environment.NewLine); s.Append("ファイルパスが間違っているかもしれません。"); s.Newline(); s.AppendI(1,"入力パス=[" + filepath_Source + "]"); s.Newline(); // ヒント s.Append(r.Message_SException(err_Excp)); cur_Conf.ToText_Locationbreadcrumbs(s); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_Exception: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー109!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append(Environment.NewLine); s.Append("エラー 入力パス=[" + filepath_Source + "]"); s.Newline(); // ヒント s.Append(r.Message_SException(err_Excp)); cur_Conf.ToText_Locationbreadcrumbs(s); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // gt_EndMethod: log_Method.EndMethod(log_Reports); return result_Filepath; }
//──────────────────────────────────────── /// <summary> /// コンストラクター。 /// </summary> public Expression_Leaf_StringImpl(Expression_Node_String parent_Expression, Configuration_Node cur_Conf) : this("", parent_Expression, cur_Conf) { }
/// <summary> /// 警告メッセージの定型文を作ります。 /// </summary> /// <returns></returns> public string Message_Configuration( Configuration_Node parent_Cnf ) { return(Log_RecordReportsImpl.ToText_Configuration(parent_Cnf)); }
/// <summary> /// 込み入った処理が必要なこともあるので、コンストラクターとは分けています。 /// </summary> /// <param name="parent_Expression"></param> /// <param name="cur_Conf"></param> /// <param name="owner_MemoryApplication"></param> /// <param name="log_Reports"></param> /// <returns></returns> public virtual Expression_Node_Function NewInstance( Expression_Node_String parent_Expression, Configuration_Node cur_Conf, object/*MemoryApplication*/ owner_MemoryApplication, Log_Reports log_Reports) { Expression_Node_FunctionImpl expr_Func = new Expression_Node_FunctionImpl(parent_Expression, cur_Conf, this.List_NameArgumentInitializer); expr_Func.Owner_MemoryApplication = (MemoryApplication)owner_MemoryApplication; return expr_Func; }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// attr系要素の追加。 /// /// 既に追加されている要素は、追加できない。 /// </summary> public void Add( string sKey, string sValue, Configuration_Node conf_Value, bool bRequired, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_Syntax.Name_Library, this, "Add", log_Reports); // // if (!this.dictionary_Attribute.ContainsKey(sKey)) { this.dictionary_Attribute.Add(sKey, sValue); } else { if (bRequired) { // エラー goto gt_Error_Duplicate; } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_Duplicate: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー345!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("要素<"); s.Append(this.owner.Name); s.Append(">に、同じ名前の属性が重複していました。"); s.Newline(); s.Append("入れようとした要素の名前=["); s.Append(sKey); s.Append("]"); s.Newline(); // ヒント s.Append(r.Message_Configuration(conf_Value)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// 文字列を、子要素として追加。 /// </summary> /// <param name="sHumanInput"></param> /// <param name="s_ParentNode"></param> /// <param name="log_Reports"></param> public void AppendTextNode( string sHumanInput, Configuration_Node parent_Conf, Log_Reports log_Reports ) { Expression_Leaf_StringImpl ec_Child = new Expression_Leaf_StringImpl(null, parent_Conf); ec_Child.SetString(sHumanInput, log_Reports); this.List_Expression_Child.Add(ec_Child, log_Reports); }
//──────────────────────────────────────── public void Judge( out bool isJudge, string name_KeyField, string value_Expected, bool isRequired_ExpectedValue, DataRow row, Configuration_Node parent_Query, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(); log_Method.BeginMethod(Info_Table.Name_Library, this, "Judge", log_Reports); // // // // try { Value_Humaninput valueH = (Value_Humaninput)row[name_KeyField]; // (5)キーが空欄で、検索ヒット必須でなければ、無視します。【bool型フィールドの場合】 if (Bool_HumaninputImpl.IsSpaces(valueH)) { isJudge = false; goto gt_EndMethod; } // // (6)この行の、キー_フィールドの値を取得。 // bool isKeyValue; bool isParsedSuccessful = Bool_HumaninputImpl.TryParse( valueH, out isKeyValue, EnumOperationIfErrorvalue.Error, null, log_Reports ); if (log_Reports.Successful) { if (!isParsedSuccessful) { // エラー。 isJudge = false; if (log_Reports.CanCreateReport) { Log_RecordReports d_Report = log_Reports.BeginCreateReport(EnumReport.Error); d_Report.SetTitle("▲エラー699!", log_Method); d_Report.Message = "bool型パース失敗。"; log_Reports.EndCreateReport(); } goto gt_EndMethod; } } bool isExpectedValue; if (log_Reports.Successful) { // (8)キー値をbool型に変換します。 bool isParseSuccessful2 = bool.TryParse(value_Expected, out isExpectedValue); if (!isParseSuccessful2) { isJudge = false; if (isRequired_ExpectedValue) { // 空値ではダメという設定の場合。 goto gt_Error_Parse; } goto gt_EndMethod; } } else { isExpectedValue = false; } // (8)該当行をレコードセットに追加。 if (log_Reports.Successful) { if (isKeyValue == isExpectedValue) { isJudge = true; } else { isJudge = false; } } else { isJudge = false; } } catch (RowNotInTableException) { // (9)指定行がなかった場合は、スルー。 isJudge = false; // // 指定の行は、テーブルの中にありませんでした。 // 再描画と、行の削除が被ったのかもしれません。 // いわゆる「処理中」です。 // //.WriteLine(this.GetType().Name+"#GetValueStringList: ["+refTable.Name+"]テーブルには、["+ttbwIndex+"]行が存在しませんでした。もしかすると、削除されたのかもしれません。エラー:"+e.Message); } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_Parse: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー286!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.AppendI(0, "<Select_KeyBoolImplクラス>"); s.Append(Environment.NewLine); s.AppendI(1, "これはbool型値のプログラムです。他の型のプログラムを使ってください。"); s.Append(Environment.NewLine); s.AppendI(1, "sExpectedValue=["); s.Append(value_Expected); s.Append("]"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // ヒント parent_Query.ToText_Locationbreadcrumbs(s); s.AppendI(0, "</Select_KeyBoolImplクラス>"); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// コンストラクターで指定していれば、必要ない。 /// </summary> /// <param name="cur_Cf"></param> public void InitializeBeforeuse(Configurationtree_Node cur_Cf) { this.cur_Configuration = cur_Cf; }
//──────────────────────────────────────── /// <summary> /// コンストラクター。 /// </summary> /// <param oVariableName="moOpyopyo"></param> public Expression_NodeImpl(Expression_Node_String e_ParentNode, Configuration_Node parent_Conf, MemoryApplication owner_MemoryApplication) : base(e_ParentNode, parent_Conf) { this.owner_MemoryApplication = owner_MemoryApplication; }