//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// 実行。 /// /// 指定のコントロールの、指定のイベントを実行します。 /// /// todo:どこで利用されている? /// </summary> /// <param name="sender"></param> /// <param name="nFcName">コントロール名。</param> /// <param name="oEventName"></param> /// <param name="log_Reports"></param> public void Execute1_Usercontrol( object sender, Expression_Node_String ec_FcName, XenonName o_Name_Event, MemoryApplication owner_MemoryApplication, Log_Reports log_Reports ) { //.WriteLine(this.GetType().Name + "#PerformFc: 【アクション_パフォーマー開始】"); Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute1_Usercontrol", log_Reports); // // Usercontrol ucFc = null; string sFcName1 = ec_FcName.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); owner_MemoryApplication.MemoryForms.ForEach_Children(delegate(string sKey, Usercontrol ucFc2, ref bool bRemove, ref bool bBreak) { string sFcName2 = ucFc2.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); if (sFcName2 == sFcName1) { ucFc = ucFc2; } }); if (null != ucFc) { // 一致したfcUcがあれば、一致した最後のfcUcを。 this.Execute1_UsercontrolImpl( sender, ucFc, o_Name_Event, owner_MemoryApplication, log_Reports ); } else { // // // //.WriteLine(this.GetType().Name + "#PerformFc: ■[" + sFcName_prm + "]という名前のコントロールはありませんでした。"); } // // log_Method.EndMethod(log_Reports); //.WriteLine(this.GetType().Name + "#PerformFc: 【アクション_パフォーマー終了】"); }
/// <summary> /// レコードセットの取得。 /// </summary> /// <param name="eName"></param> /// <param name="log_Reports"></param> /// <returns>該当がなければヌル。</returns> public RecordSet Get(Expression_Node_String ec_Name, MemoryApplication memoryApplication, Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Expr.Name_Library, this, "Get", log_Reports); // // string sName = ec_Name.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports).Trim(); RecordSet nResult; try { //ystem.Console.WriteLine(Info_N.LibraryName + ":" + this.GetType().Name + "#Remove: 【レコードセット削除】sName=[" + sName + "]"); nResult = this.dictionary_Recordset[sName]; } catch (KeyNotFoundException ex) { nResult = null; { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sName, log_Reports); //名前 tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(ec_Name.Cur_Configuration), log_Reports); //設定位置パンくずリスト tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Exception(ex), log_Reports); //例外メッセージ memoryApplication.CreateErrorReport("Er:6043;", tmpl, log_Reports); } } catch (Exception ex) { nResult = null; { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sName, log_Reports); //名前 tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(ec_Name.Cur_Configuration), log_Reports); //設定位置パンくずリスト tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Exception(ex), log_Reports); //例外メッセージ memoryApplication.CreateErrorReport("Er:6044;", tmpl, log_Reports); } } // // // // log_Method.EndMethod(log_Reports); return(nResult); }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// レコードセットの追加。 /// </summary> /// <param name="eName"></param> /// <param name="recordSet"></param> /// <param name="log_Reports"></param> public void Add( Expression_Node_String ec_Name, RecordSet recordSet, MemoryApplication memoryApplication, Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Expr.Name_Library, this, "Add", log_Reports); // // string sName = ec_Name.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports).Trim(); try { this.dictionary_Recordset.Add(sName, recordSet); //// debug: 追加したレコードセットの内容。 //{ // ystem.Console.WriteLine(Info_N.LibraryName + ":" + this.GetType().Name + "#Add: 追加したレコードセットの内容"+ // " fld=["+oRecordSet.NField.E_Execute(EnumHitcount.Unconstraint, log_Reports)+"]" + // " lookup-value=["+oRecordSet.NLookupValue.E_Execute(EnumHitcount.Unconstraint, log_Reports)+"]" + // " required=[" + oRecordSet.NRequired.E_Execute(EnumHitcount.Unconstraint, log_Reports) + "]" + // " from=[" + oRecordSet.NFrom.E_Execute(EnumHitcount.Unconstraint, log_Reports) + "]" + // " description=[" + oRecordSet.NDescription.E_Execute(EnumHitcount.Unconstraint, log_Reports) + "]" + // " Storage=[" + oRecordSet.NStorage.E_Execute(EnumHitcount.Unconstraint, log_Reports) + "]" // ); //} } catch (ArgumentException ex) { //return; { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sName, log_Reports); //名前 tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(ec_Name.Cur_Configuration), log_Reports); //設定位置パンくずリスト tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Exception(ex), log_Reports); //例外メッセージ memoryApplication.CreateErrorReport("Er:6042;", tmpl, log_Reports); } } // // // // log_Method.EndMethod(log_Reports); }
/// <summary> /// レコードセットの削除。 /// </summary> /// <param name="eStorage"></param> /// <param name="log_Reports"></param> public void Remove(Expression_Node_String ec_Storage, MemoryApplication memoryApplication, Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Expr.Name_Library, this, "Remove", log_Reports); // // string sStorage = ec_Storage.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports).Trim(); Exception err_Excp; try { this.dictionary_Recordset.Remove(sStorage); // #デバッグ中 System.Console.WriteLine(Info_Expr.Name_Library + ":" + this.GetType().Name + "#Remove: 【レコードセット削除】sName=[" + sStorage + "]"); } catch (Exception ex) { err_Excp = ex; goto gt_Error_Exception; } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_Exception: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sStorage, log_Reports); //名前 tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(ec_Storage.Cur_Configuration), log_Reports); //設定位置パンくずリスト tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports); //例外メッセージ memoryApplication.CreateErrorReport("Er:6045;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// レコードセットの追加。 /// </summary> /// <param name="eName"></param> /// <param name="recordSet"></param> /// <param name="log_Reports"></param> public void Add( Expression_Node_String ec_Name, RecordSet recordSet, MemoryApplication memoryApplication, Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Expr.Name_Library, this, "Add",log_Reports); // // string sName = ec_Name.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports).Trim(); try { this.dictionary_Recordset.Add(sName, recordSet); //// debug: 追加したレコードセットの内容。 //{ // ystem.Console.WriteLine(Info_N.LibraryName + ":" + this.GetType().Name + "#Add: 追加したレコードセットの内容"+ // " fld=["+oRecordSet.NField.E_Execute(EnumHitcount.Unconstraint, log_Reports)+"]" + // " lookup-value=["+oRecordSet.NLookupValue.E_Execute(EnumHitcount.Unconstraint, log_Reports)+"]" + // " required=[" + oRecordSet.NRequired.E_Execute(EnumHitcount.Unconstraint, log_Reports) + "]" + // " from=[" + oRecordSet.NFrom.E_Execute(EnumHitcount.Unconstraint, log_Reports) + "]" + // " description=[" + oRecordSet.NDescription.E_Execute(EnumHitcount.Unconstraint, log_Reports) + "]" + // " Storage=[" + oRecordSet.NStorage.E_Execute(EnumHitcount.Unconstraint, log_Reports) + "]" // ); //} } catch (ArgumentException ex) { //return; { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sName, log_Reports);//名前 tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(ec_Name.Cur_Configuration), log_Reports);//設定位置パンくずリスト tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Exception(ex), log_Reports);//例外メッセージ memoryApplication.CreateErrorReport("Er:6042;", tmpl, log_Reports); } } // // // // log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <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 string GetMessage(Log_Reports log_Reports) { Expression_Node_String expr_Str = this.p1pText.Compile(log_Reports); StringBuilder sb = new StringBuilder(); sb.Append(expr_Str.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); sb.Append(System.Environment.NewLine); // コールスタックを付けます。 sb.Append(this.text_Callstack); return(sb.ToString()); }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// データソースから値を取得し、コントロールに取り込みます。 /// /// データソースが設定されていない場合は、フォームのクリアーになります。 /// </summary> public void RefreshData( Log_Reports log_Reports ) { Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); pg_Method.BeginMethod(Info_Controls.Name_Library, this, "RefreshData", log_Reports); // // List <Expression_Node_String> listExpr_Data = this.ControlCommon.Expression_Control.SelectDirectchildByNodename(NamesNode.S_DATA, false, EnumHitcount.Unconstraint, log_Reports); List <Expression_Node_String> listExpr_DataSource = Utility_Expression_NodeImpl.SelectItemsByPmAsCsv(listExpr_Data, PmNames.S_ACCESS.Name_Pm, ValuesAttr.S_FROM, false, EnumHitcount.First_Exist, log_Reports); if (!log_Reports.Successful) { goto gt_EndMethod; } Expression_Node_String ec_DataSource = listExpr_DataSource[0]; if (null == ec_DataSource) { // データソースが設定されていないとき //.WriteLine(this.GetType().Name + "#RefreshData: データソースが設定されていません。"); this.Clear(); } else { if (log_Reports.Successful) { this.ControlCommon.BAutomaticinputting = true; // // 最初の1件。なければ空文字列。 // Expression_Node_String ec_Str = ec_DataSource; this.Text = ec_Str.Execute4_OnExpressionString(EnumHitcount.First_Exist_Or_Zero, log_Reports); this.ControlCommon.BAutomaticinputting = false; } } goto gt_EndMethod; // // // // gt_EndMethod: pg_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <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; }
//──────────────────────────────────────── /// <summary> /// 有無。 /// </summary> /// <param name="nName"></param> /// <param name="log_Reports"></param> /// <returns></returns> public bool Contains(Expression_Node_String ec_Name, Log_Reports log_Reports) { string sName = ec_Name.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); return this.dictionary_Recordset.ContainsKey(sName); }
/// <summary> /// レコードセットの削除。 /// </summary> /// <param name="eStorage"></param> /// <param name="log_Reports"></param> public void Remove(Expression_Node_String ec_Storage, MemoryApplication memoryApplication, Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Expr.Name_Library, this, "Remove",log_Reports); // // string sStorage = ec_Storage.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports).Trim(); Exception err_Excp; try { this.dictionary_Recordset.Remove(sStorage); // #デバッグ中 System.Console.WriteLine(Info_Expr.Name_Library + ":" + this.GetType().Name + "#Remove: 【レコードセット削除】sName=[" + sStorage + "]"); } catch (Exception ex) { err_Excp = ex; goto gt_Error_Exception; } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_Exception: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sStorage, log_Reports);//名前 tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(ec_Storage.Cur_Configuration), log_Reports);//設定位置パンくずリスト tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports);//例外メッセージ memoryApplication.CreateErrorReport("Er:6045;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// 変数名を指定することで、文字列を返します。 /// /// </summary> /// <param select="oVariableName"></param> /// <param select="bRequired"></param> /// <param select="log_Reports"></param> /// <returns></returns> public string GetStringByVariablename( Expression_Node_String ec_VariableName, bool bRequired, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "GetStringByVariablename",log_Reports); // // // // string sResult; string sVarName = ec_VariableName.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); // 【仕様変更 2011-03-03】「変数名無し」(つまり「$」だけ)は、文字「$」を返します。 //if ("" == sVarName) //{ // return "$"; //} //else if (!this.dictionaryExpression_Item.ContainsKey(sVarName)) { sResult = null; if (bRequired) { goto gt_Error_NotFoundVariable; } } else { sResult = this.dictionaryExpression_Item[sVarName].Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NotFoundVariable: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー925!", log_Method); Log_TextIndented t = new Log_TextIndentedImpl(); t.Append("変数["); t.Append(sVarName); t.Append("]は存在しませんでした。"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append(" 問題箇所ヒント:"); ec_VariableName.Cur_Configuration.Parent.ToText_Locationbreadcrumbs(t); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append(" 実行経路ヒント:"); ec_VariableName.Cur_Configuration.Parent.ToText_Locationbreadcrumbs(t); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append("ヒント:登録されている変数の個数=["); t.Append(this.dictionaryExpression_Item.Count); t.Append("]"); t.Append(Environment.NewLine); foreach (KeyValuePair<string, Expression_Node_String> pair in this.dictionaryExpression_Item) { t.Append(pair.Key); t.Append("="); t.Append(pair.Value); t.Append(Environment.NewLine); } r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return sResult; }
//──────────────────────────────────────── /// <summary> /// 変数を設定します。 /// </summary> public void SetVariable( XenonName o_Name_Variable, Expression_Node_String ec_Value, bool bRequired, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "SetVariable",log_Reports); // // if ( o_Name_Variable.SValue.StartsWith(NamesVar.S_SP_) || o_Name_Variable.SValue.StartsWith(NamesVar.S_UP_) ) { string sFilePath = ec_Value.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); Configurationtree_Node parent_Configurationtree_Node = new Configurationtree_NodeImpl("!ハードコーディング_" + this.GetType().Name + "#SetVariable", null); Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L09Mid_4", parent_Configurationtree_Node); cf_Fpath.InitPath( sFilePath, log_Reports ); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } Expression_Node_Filepath ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath); this.SetFilepathValue( o_Name_Variable.SValue, ec_Fpath, bRequired, log_Reports ); } else if ( // 新仕様 o_Name_Variable.SValue.StartsWith(NamesVar.S_SS_) || o_Name_Variable.SValue.StartsWith(NamesVar.S_US_) ) { string str1 = ec_Value.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); this.SetStringValue( o_Name_Variable, str1, bRequired, log_Reports ); } else { } // // // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// 実行。 /// </summary> /// <param name="sender"></param> /// <param name="eventMonitor"></param> /// <param name="log_Reports"></param> public override string Execute5_Main(Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute5_Main", log_Reports); string sFncName0; this.TrySelectAttribute(out sFncName0, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); if (log_Reports.CanStopwatch) { log_Method.Log_Stopwatch.Message = "「E■[" + sFncName0 + "]アクション」実行(A)"; log_Method.Log_Stopwatch.Begin(); } if (this.EnumEventhandler == EnumEventhandler.O_Lr) { string sName_Usercontrol; if (this.Functionparameterset.Sender is Customcontrol) { Customcontrol ccFc = (Customcontrol)this.Functionparameterset.Sender; sName_Usercontrol = ccFc.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); log_Reports.Comment_EventCreationMe += "/追記:[" + sName_Usercontrol + "]コントロールが、[" + sFncName0 + "]アクションを実行。"; } else { sName_Usercontrol = "(▲不明101!)"; log_Reports.Comment_EventCreationMe += "/追記:[" + sFncName0 + "]アクションを実行。"; } // // // // List <Usercontrol> ucFcList; if (log_Reports.Successful) { // 正常時 // テーブルデータをコントロールにセットします。 // // 指定のコントロール(無指定の場合、自コントロール)を // まず取得。 // Expression_Node_String ec_ArgListboxName; this.TrySelectAttribute(out ec_ArgListboxName, Expression_Node_Function20Impl.PM_NAME_CONTROL_LISTBOX, EnumHitcount.One_Or_Zero, log_Reports); ucFcList = this.Owner_MemoryApplication.MemoryForms.GetUsercontrolsByName( ec_ArgListboxName, true, log_Reports); } else { ucFcList = new List <Usercontrol>(); } // リストボックスにテーブルのデータソースを関連付けます。 if (log_Reports.Successful) { // 正常時 // リストボックス コントロール。 Usercontrol fcUc = ucFcList[0]; Expression_Node_String ec_TableName = null; string sTableName; this.TrySelectAttribute(out sTableName, Expression_Node_Function20Impl.PM_NAME_TABLE, EnumHitcount.One_Or_Zero, log_Reports); if ("" != sTableName)//this.E_SysArgDic.ContainsKey(E_SysFnc20Impl.S_ARG_TABLE_NAME) { //テーブル名を指定(アクション用引数) this.TrySelectAttribute(out ec_TableName, Expression_Node_Function20Impl.PM_NAME_TABLE, EnumHitcount.One_Or_Zero, log_Reports); // #デバッグ if (log_Method.CanWarning()) { log_Method.WriteWarning_ToConsole(" <arg3 tableName=”[" + ec_TableName.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]”>属性でした。"); } } else { // #デバッグ if (log_Method.CanWarning()) { log_Method.WriteWarning_ToConsole(" <arg3 tableName=”☆”>属性が未指定でした。"); } Configuration_Node owner_Configurationtree_Control; { owner_Configurationtree_Control = this.Cur_Configuration.GetParentByNodename( NamesNode.S_CONTROL1, EnumConfiguration.Tree, true, log_Reports); } // // 次を期待。 // <data target=”list-box”> // <arg5 name=”tableName” value=”☆”> // List <Configurationtree_Node> cfList_Data = ((Configurationtree_Node)owner_Configurationtree_Control).GetChildrenByNodename( NamesNode.S_DATA, false, log_Reports); foreach (Configurationtree_Node cf_Data in cfList_Data) { string sAccess; cf_Data.Dictionary_Attribute.TryGetValue(PmNames.S_ACCESS, out sAccess, false, log_Reports); List <string> sList_Access = new CsvTo_ListImpl().Read(sAccess); if (sList_Access.Contains(ValuesAttr.S_FROM)) { // <data access=”from”> string sDataMemory; cf_Data.Dictionary_Attribute.TryGetValue(PmNames.S_MEMORY, out sDataMemory, true, log_Reports); if (!log_Reports.Successful) { goto gt_EndMethod; } if (ValuesAttr.S_RECORDS == sDataMemory) { cf_Data.Dictionary_Attribute.TryGetValue(PmNames.S_NAME_TABLE, out sTableName, true, log_Reports); if (!log_Reports.Successful) { goto gt_EndMethod; } ec_TableName = new Expression_Leaf_StringImpl(sTableName, this, cf_Data); // #デバッグ if (log_Method.CanWarning()) { log_Method.WriteWarning_ToConsole(" <data tableName=”[" + sTableName + "]”>属性でした。"); } } else { //#連続エラー { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sDataMemory, log_Reports);//属性memoryの値 this.Owner_MemoryApplication.CreateErrorReport("Er:110007;", tmpl, log_Reports); } } } } if (null == ec_TableName) { // エラー処理? if (log_Method.CanError()) { log_Method.WriteError_ToConsole(" 直接指定されなかったので、既に<data>にtableName属性があると期待しましたが、ありませんでした。"); } sTableName = ""; //string sTableName = ""; ec_TableName = new Expression_Leaf_StringImpl(sTableName, this, owner_Configurationtree_Control); // owner_Cf_Fc.S_DataSource } } //↓この中で時間かかってる。 Utility_Listbox.BindTableToDatasource( fcUc,// リストボックス・コントロール ec_TableName, this.Owner_MemoryApplication, log_Reports ); //↑この中で時間かかってる。 } } goto gt_EndMethod; // // gt_EndMethod: log_Method.EndMethod(log_Reports); return(""); }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// テーブル名を指定することで、テーブルを返します。 /// </summary> /// <param select="nTableName"></param> /// <param select="bRequired">該当しなかった場合に警告表示を行うなら真。</param> /// <returns>該当しなかった場合はヌルを返します。</returns> public Table_Humaninput GetTable_HumaninputByName( Expression_Node_String ec_TableName, bool bRequired, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "GetTable_HumaninputByName", log_Reports); // // // // Table_Humaninput o_Table; string sTableName = ec_TableName.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);; if (this.dictionary_Table_Humaninput.ContainsKey(sTableName)) { o_Table = this.dictionary_Table_Humaninput[sTableName]; } else { o_Table = null; if (bRequired) { // // エラー goto gt_Error_NotFoundTable; } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NotFoundTable: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー928!", log_Method); StringBuilder s = new StringBuilder(); s.Append("["); s.Append(sTableName); s.Append("]という名前のテーブルは存在しませんでした。"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // ヒント s.Append(r.Message_Configuration(ec_TableName.Cur_Configuration.Parent)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return(o_Table); }
/// <summary> /// テーブルを返します。NAME_FORM列値を指定してください。 /// </summary> /// <param select="nTableName"></param> /// <param select="bRequired">該当しなかった場合にエラー扱いなら真。</param> /// <returns>該当しなかった場合はヌルを返します。</returns> public List <Table_Humaninput> GetTable_HumaninputByFormgroup( Expression_Node_String expr_KeyExpected, bool bRequired, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "GetTable_HumaninputByFormgroup", log_Reports); // // List <Table_Humaninput> list_ResltTable = new List <Table_Humaninput>(); if (null == expr_KeyExpected) { goto gt_EndMethod; } try { string str_KeyExpected = expr_KeyExpected.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); foreach (Table_Humaninput xenonTable in this.dictionary_Table_Humaninput.Values) { if (null != xenonTable.Tableunit && str_KeyExpected == xenonTable.Tableunit) { list_ResltTable.Add(xenonTable); } } } catch (KeyNotFoundException) { if (bRequired) { // // エラー goto gt_Error_NotFound; } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NotFound: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー929!", log_Method); StringBuilder t = new StringBuilder(); t.Append("指定したレイアウト_グループ名["); t.Append(expr_KeyExpected.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); t.Append("]は、存在しませんでした。"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); // ヒント t.Append(r.Message_Configuration(expr_KeyExpected.Cur_Configuration.Parent)); r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return(list_ResltTable); }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── public void SelectItem( Expression_Node_String ec_KeyFieldName, Expression_Node_String ec_ExpectedValue, Log_Reports log_Reports ) { Log_Method pg_Method = new Log_MethodImpl(); pg_Method.BeginMethod(Info_Controls.Name_Library, this, "SelectItem", log_Reports); // string sName_KeyFld = ec_KeyFieldName.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); bool bMatched = false; // // リストボックスは、現在作成中かも知れない。 // 項目を選択するタイミングが合わないかも知れない。 // // ※TODO: リストボックスの構築が終わるまで待ちたい。 // string err_STableName; for (int nRow = 0; nRow < this.Items.Count; nRow++) { //.WriteLine(this.GetType().Name + "#SelectItem:(" + Info_Forms .LibraryName+ ") rowIndex=[" + rowIndex + "]"); DataRowView dataRowView = (DataRowView)this.Items[nRow]; Value_Humaninput o_FldValue = null;//フィールド { // todo: フィールド値 if (dataRowView.DataView.Table.Columns.Contains(sName_KeyFld)) { object fldValue = dataRowView.Row[sName_KeyFld]; bool bParsedSuccessful = Utility_HumaninputValue.TryParse( fldValue, out o_FldValue, true, log_Reports ); if (!log_Reports.Successful) { goto gt_EndMethod; } } else { // エラー err_STableName = dataRowView.DataView.Table.TableName; goto gt_Error_NotFoundField; } } Value_Humaninput o_ExpectedValue = null; { // // oFldValue と同じ型の CellData を作成。 // o_ExpectedValue = Utility_HumaninputValue.NewInstance( o_FldValue, true, pg_Method.Fullname, log_Reports ); if (!log_Reports.Successful) { goto gt_EndMethod; } o_ExpectedValue.Text = ec_ExpectedValue.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); } if (log_Reports.Successful) { if (o_ExpectedValue.Equals(o_FldValue)) { // // 一致したら // bMatched = true; // // その列を選択。 // this.ControlCommon.BAutomaticinputting = true; this.SelectedIndex = nRow; { // リストボックスの縦幅 int nH = this.Height; // 項目の高さ int nIH = this.ItemHeight; // 表示項目数 float nVi = (float)nH / (float)nIH; // 半分の位置 int nHalf = (int)Math.Floor(nVi / 2.0f); int nTI = nRow - nHalf; if (nTI < 0) { nTI = 0; } this.TopIndex = nTI;//選択した項目が中央に表示されるようにスクロール。 } this.ControlCommon.BAutomaticinputting = false; break; } } } // 一致していなければ、選択を解除。 if (!bMatched) { // // まず、選択解除。 // this.ControlCommon.BAutomaticinputting = true; this.ClearSelected();//.SelectedIndex = -1; this.ControlCommon.BAutomaticinputting = false; } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NotFoundField: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sName_KeyFld, log_Reports); //キー・フィールド名 tmpl.SetParameter(2, err_STableName, log_Reports); //テーブル名 tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Configuration(ec_KeyFieldName.Cur_Configuration), log_Reports); //キー・フィールド名の設定位置パンくずリスト tmpl.SetParameter(4, Log_RecordReportsImpl.ToText_Configuration(ec_ExpectedValue.Cur_Configuration), log_Reports); //テーブル名の設定位置パンくずリスト this.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:505;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: pg_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// スクリプトファイル情報を返します。TYPE_DATA値を指定してください。 /// </summary> /// <param select="nTableName"></param> /// <param select="bRequired">該当しなかった場合にエラー扱いなら真。</param> /// <returns>該当しなかった場合はヌルを返します。</returns> public List<MemoryCodefileinfo> GetCodefileinfoByTypedata( Expression_Node_String ec_Typedata, bool bRequired, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "GetCodefileinfoByTypedata",log_Reports); // // List<MemoryCodefileinfo> result = new List<MemoryCodefileinfo>(); if (null == ec_Typedata) { goto gt_EndMethod; } try { string sExpectedTypedata = ec_Typedata.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); foreach (MemoryCodefileinfo codefile in this.Dictionary_Table.Values) { if (sExpectedTypedata == codefile.Typedata) { result.Add(codefile); } } } catch (KeyNotFoundException) { if (bRequired) { // // エラー goto gt_Error_NotFound; } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NotFound: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー927!", log_Method); StringBuilder s = new StringBuilder(); s.Append("指定したタイプデータ名["); s.Append(ec_Typedata.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); s.Append("]は、存在しませんでした。"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // ヒント s.Append(r.Message_Configuration(ec_Typedata.Cur_Configuration.Parent)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return result; }
//──────────────────────────────────────── public virtual string Execute5_Main( Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(); log_Method.BeginMethod(Info_Syntax.Name_Library, this, "E_ExecuteMain", log_Reports); // // StringBuilder sb_Result = new StringBuilder(); List <Expression_Node_String> ecList_Child = this.List_Expression_Child.SelectList(EnumHitcount.Unconstraint, log_Reports); switch (this.enumHitcount) { case EnumHitcount.First_Exist: { // // 最初の1件のみ。存在しない場合エラー。 // if (0 < ecList_Child.Count) { Expression_Node_String ec_Child = ecList_Child[0]; string str1 = ec_Child.Execute4_OnExpressionString(this.enumHitcount, log_Reports); sb_Result.Append(str1); } else { // // エラー goto gt_Error_NotFoundOne; } } break; case EnumHitcount.First_Exist_Or_Zero: { // // 最初の1件のみ。存在しない場合、空文字列。 // if (0 < ecList_Child.Count) { Expression_Node_String ec_Child = ecList_Child[0]; string str1 = ec_Child.Execute4_OnExpressionString(this.enumHitcount, log_Reports); sb_Result.Append(str1); } else { // // 存在しないので、空文字列。 // // そのままスルー。 } } break; case EnumHitcount.Unconstraint: { // // 制限なし // foreach (Expression_Node_String ec_Child in ecList_Child) { string s1 = ec_Child.Execute4_OnExpressionString(this.enumHitcount, log_Reports); sb_Result.Append(s1); } } break; default: { // // エラー goto gt_Error_UndefinedEnum; } } goto gt_EndMethod; // #region 異常系 //──────────────────────────────────────── gt_Error_NotFoundOne: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー111!", log_Method); StringBuilder sb = new StringBuilder(); sb.Append("必ず、最初の1件を取得する指定でしたが、1件も存在しませんでした。"); sb.Append(Environment.NewLine); sb.Append(Environment.NewLine); // ヒント r.Message = sb_Result.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_UndefinedEnum: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー113!", log_Method); StringBuilder sb = new StringBuilder(); sb.Append("this.requestItems.VolumeConstraintEnum=["); sb.Append(this.enumHitcount.ToString()); sb.Append("]には、プログラム側でまだ未対応です。"); // ヒント r.Message = sb_Result.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // gt_EndMethod: log_Method.EndMethod(log_Reports); return(sb_Result.ToString()); }
//──────────────────────────────────────── #endregion #region 判定 //──────────────────────────────────────── /// <summary> /// 有無。 /// </summary> /// <param name="nName"></param> /// <param name="log_Reports"></param> /// <returns></returns> public bool Contains(Expression_Node_String ec_Name, Log_Reports log_Reports) { string sName = ec_Name.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); return(this.dictionary_Recordset.ContainsKey(sName)); }
/// <summary> /// テーブルを返します。レイアウト_グループ名を指定してください。 /// </summary> /// <param select="nTableName"></param> /// <param select="bRequired">該当しなかった場合にエラー扱いなら真。</param> /// <returns>該当しなかった場合はヌルを返します。</returns> public List<Table_Humaninput> GetTable_HumaninputByTypedata( Expression_Node_String expr_KeyExpected, bool bRequired, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "GetTable_HumaninputByTypedata", log_Reports); // // List<Table_Humaninput> list_ResltTable = new List<Table_Humaninput>(); string str_KeyExpected = ""; if (null == expr_KeyExpected) { if (bRequired) { goto gt_Error_NullExpected; } goto gt_EndMethod; } try { str_KeyExpected = expr_KeyExpected.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); foreach (Table_Humaninput xenonTable in this.dictionary_Table_Humaninput.Values) { if (null != xenonTable.Typedata && str_KeyExpected == xenonTable.Typedata) { list_ResltTable.Add(xenonTable); } } } catch (KeyNotFoundException) { if (bRequired) { // エラー goto gt_Error_NotFound; } } if (list_ResltTable.Count<1) { // エラー goto gt_Error_NotFound; } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NullExpected: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー929!", log_Method); StringBuilder t = new StringBuilder(); t.Append("指定したキー比較値がヌルでした。[" + str_KeyExpected + "]"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); // ヒント t.Append(r.Message_Configuration(expr_KeyExpected.Cur_Configuration.Parent)); r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_NotFound: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー929!", log_Method); StringBuilder t = new StringBuilder(); t.Append("指定した"+NamesFld.S_TYPE_DATA+"["); t.Append(expr_KeyExpected.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); t.Append("]にヒットするテーブルは、存在しませんでした。\n\nもしかして?\n ・ツール設定ファイル、プロジェクトファイル、ファイル一覧ファイル、テーブルファイルをまだ読み込めていない?\n ・ファイル名が間違っている?"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); // ヒント t.Append(r.Message_Configuration(expr_KeyExpected.Cur_Configuration.Parent)); r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return list_ResltTable; }
//──────────────────────────────────────── /// <summary> /// コントロール(UserControl)を追加します。 /// </summary> /// <param select="nFcName">コントロール名。</param> /// <param select="fcUc"></param> public void PutUsercontrol( Expression_Node_String ec_FcName, Usercontrol fcUc, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "PutUsercontrol",log_Reports); // // string sFcName = ec_FcName.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); if (fcUc is Control) { this.dictionary_Item[sFcName] = fcUc; } else { MessageBox.Show( "コントロール[" + sFcName + "]は Control ではありませんでした。", "▲プログラム・エラー86!" ); } // // // // log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── public void SelectItem( Expression_Node_String ec_KeyFieldName, Expression_Node_String ec_ExpectedValue, Log_Reports log_Reports ) { Log_Method pg_Method = new Log_MethodImpl(); pg_Method.BeginMethod(Info_Controls.Name_Library, this, "SelectItem",log_Reports); // string sName_KeyFld = ec_KeyFieldName.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); bool bMatched = false; // // リストボックスは、現在作成中かも知れない。 // 項目を選択するタイミングが合わないかも知れない。 // // ※TODO: リストボックスの構築が終わるまで待ちたい。 // string err_STableName; for (int nRow = 0; nRow < this.Items.Count; nRow++) { //.WriteLine(this.GetType().Name + "#SelectItem:(" + Info_Forms .LibraryName+ ") rowIndex=[" + rowIndex + "]"); DataRowView dataRowView = (DataRowView)this.Items[nRow]; Value_Humaninput o_FldValue = null;//フィールド { // todo: フィールド値 if (dataRowView.DataView.Table.Columns.Contains(sName_KeyFld)) { object fldValue = dataRowView.Row[sName_KeyFld]; bool bParsedSuccessful = Utility_HumaninputValue.TryParse( fldValue, out o_FldValue, true, log_Reports ); if (!log_Reports.Successful) { goto gt_EndMethod; } } else { // エラー err_STableName = dataRowView.DataView.Table.TableName; goto gt_Error_NotFoundField; } } Value_Humaninput o_ExpectedValue = null; { // // oFldValue と同じ型の CellData を作成。 // o_ExpectedValue = Utility_HumaninputValue.NewInstance( o_FldValue, true, pg_Method.Fullname, log_Reports ); if (!log_Reports.Successful) { goto gt_EndMethod; } o_ExpectedValue.Text = ec_ExpectedValue.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); } if (log_Reports.Successful) { if (o_ExpectedValue.Equals(o_FldValue)) { // // 一致したら // bMatched = true; // // その列を選択。 // this.ControlCommon.BAutomaticinputting = true; this.SelectedIndex = nRow; { // リストボックスの縦幅 int nH = this.Height; // 項目の高さ int nIH = this.ItemHeight; // 表示項目数 float nVi = (float)nH / (float)nIH; // 半分の位置 int nHalf = (int)Math.Floor(nVi / 2.0f); int nTI = nRow - nHalf; if (nTI < 0) { nTI = 0; } this.TopIndex = nTI;//選択した項目が中央に表示されるようにスクロール。 } this.ControlCommon.BAutomaticinputting = false; break; } } } // 一致していなければ、選択を解除。 if (!bMatched) { // // まず、選択解除。 // this.ControlCommon.BAutomaticinputting = true; this.ClearSelected();//.SelectedIndex = -1; this.ControlCommon.BAutomaticinputting = false; } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NotFoundField: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sName_KeyFld,log_Reports);//キー・フィールド名 tmpl.SetParameter(2, err_STableName, log_Reports);//テーブル名 tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Configuration(ec_KeyFieldName.Cur_Configuration), log_Reports);//キー・フィールド名の設定位置パンくずリスト tmpl.SetParameter(4, Log_RecordReportsImpl.ToText_Configuration(ec_ExpectedValue.Cur_Configuration), log_Reports);//テーブル名の設定位置パンくずリスト this.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:505;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: pg_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// コントロールの存在の有無を返します。 /// </summary> /// <param select="nFcName">コントロール名。</param> /// <returns>コントロールの存在の有無</returns> public bool ContainsUsercontrolByName( Expression_Node_String ec_FcName, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "ContainsUsercontrolByName",log_Reports); // // string sFcName = ec_FcName.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); bool bResult = this.dictionary_Item.ContainsKey(sFcName); // // // // log_Method.EndMethod(log_Reports); return bResult; }
//──────────────────────────────────────── /// <summary> /// スクリプトファイル情報を返します。TYPE_DATA値を指定してください。 /// </summary> /// <param select="nTableName"></param> /// <param select="bRequired">該当しなかった場合にエラー扱いなら真。</param> /// <returns>該当しなかった場合はヌルを返します。</returns> public List <MemoryCodefileinfo> GetCodefileinfoByTypedata( Expression_Node_String ec_Typedata, bool bRequired, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "GetCodefileinfoByTypedata", log_Reports); // // List <MemoryCodefileinfo> result = new List <MemoryCodefileinfo>(); if (null == ec_Typedata) { goto gt_EndMethod; } try { string sExpectedTypedata = ec_Typedata.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); foreach (MemoryCodefileinfo codefile in this.Dictionary_Table.Values) { if (sExpectedTypedata == codefile.Typedata) { result.Add(codefile); } } } catch (KeyNotFoundException) { if (bRequired) { // // エラー goto gt_Error_NotFound; } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NotFound: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー927!", log_Method); StringBuilder s = new StringBuilder(); s.Append("指定したタイプデータ名["); s.Append(ec_Typedata.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); s.Append("]は、存在しませんでした。"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // ヒント s.Append(r.Message_Configuration(ec_Typedata.Cur_Configuration.Parent)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return(result); }
//──────────────────────────────────────── /// <summary> /// 名前を指定すると、コントロールを返します。 /// 名前は、カンマ区切りでの複数件にも対応しています。 /// </summary> /// <param select="nFcName">コントロール名。</param> /// <param select="bRequired">該当しなかった場合に処理失敗扱いとするなら真。</param> /// <returns>該当しなかった場合はヌルを返します。</returns> public List<Usercontrol> GetUsercontrolsByName( Expression_Node_String ec_FcName,//Parent_Nodeとしても使う。 bool bRequired, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "GetUsercontrolsByName",log_Reports); // // // // string sFcNameCsv; string err_SFcName; List<Usercontrol> list_FcUc = new List<Usercontrol>(); if (log_Reports.Successful) { if (null == ec_FcName) { // // 必ずエラー。 goto gt_Error_NullName; } // コントロール名。カンマ区切りかも知れない。 sFcNameCsv = ec_FcName.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); List<string> sList_FcName = new CsvTo_ListImpl().Read(sFcNameCsv); foreach (string sFcName_humanInput in sList_FcName) { if (log_Reports.Successful) { // コントロール名の前後のスペースは切り落とします。 string sFcName = sFcName_humanInput.Trim(); //TODO:末尾に「*」(dirty再読込要求)が付いてたら外したい。 if (sFcName.EndsWith("*")) { sFcName = sFcName.Substring(0, sFcName.Length - 1); } Usercontrol ucFc; if (!this.dictionary_Item.ContainsKey(sFcName)) { // 該当なし=無視orエラー ucFc = null; if (bRequired) { // エラー err_SFcName = sFcName; goto gt_Error_NotFoundFc; } } else { ucFc = this.dictionary_Item[sFcName]; if (bRequired && null == ucFc) { // エラー err_SFcName = sFcName; goto gt_Error_NullFc; } } list_FcUc.Add(ucFc); } } if (bRequired && list_FcUc.Count < 1) { // エラー goto gt_Error_ZeroCount; } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_ZeroCount: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー340!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("1件以上のコントロールが該当することが条件でしたが、0件しか該当しませんでした。指定コントロール名=["); s.Append(sFcNameCsv); s.Append("]"); s.Newline(); s.Newline(); s.Append("もしかして? :中身が空の変数を指定していませんか?"); s.Newline(); s.Newline(); // ヒント r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_NullName: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー341!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("コントロールの名前が指定されていません。"); s.Newline(); s.Newline(); s.Append("もしかして? :<action>要素に引数を指定していますか?"); s.Newline(); s.Newline(); // ヒント r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_NullFc: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー932!", log_Method); StringBuilder t = new StringBuilder(); t.Append("プログラム・エラー!"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append("["); t.Append(err_SFcName); t.Append("]という名前のコントロールは、名前は登録されていましたがヌルでした。"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); // ヒント r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_NotFoundFc: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー372!", log_Method); StringBuilder t = new StringBuilder(); t.Append("["); t.Append(err_SFcName); t.Append("]という名前のコントロールは登録されていませんでした。"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); // ヒント t.Append(r.Message_Configuration(ec_FcName.Cur_Configuration)); t.Append("一覧:"); this.ForEach_Children(delegate(string sKey, Usercontrol fcUc, ref bool bRemove, ref bool bBreak) { t.Append(sKey); t.Append(Environment.NewLine); }); r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return list_FcUc; }
/// <summary> /// テーブルを返します。レイアウト_グループ名を指定してください。 /// </summary> /// <param select="nTableName"></param> /// <param select="bRequired">該当しなかった場合にエラー扱いなら真。</param> /// <returns>該当しなかった場合はヌルを返します。</returns> public List <Table_Humaninput> GetTable_HumaninputByTypedata( Expression_Node_String expr_KeyExpected, bool bRequired, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "GetTable_HumaninputByTypedata", log_Reports); // // List <Table_Humaninput> list_ResltTable = new List <Table_Humaninput>(); string str_KeyExpected = ""; if (null == expr_KeyExpected) { if (bRequired) { goto gt_Error_NullExpected; } goto gt_EndMethod; } try { str_KeyExpected = expr_KeyExpected.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); foreach (Table_Humaninput xenonTable in this.dictionary_Table_Humaninput.Values) { if (null != xenonTable.Typedata && str_KeyExpected == xenonTable.Typedata) { list_ResltTable.Add(xenonTable); } } } catch (KeyNotFoundException) { if (bRequired) { // エラー goto gt_Error_NotFound; } } if (list_ResltTable.Count < 1) { // エラー goto gt_Error_NotFound; } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NullExpected: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー929!", log_Method); StringBuilder t = new StringBuilder(); t.Append("指定したキー比較値がヌルでした。[" + str_KeyExpected + "]"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); // ヒント t.Append(r.Message_Configuration(expr_KeyExpected.Cur_Configuration.Parent)); r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_NotFound: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー929!", log_Method); StringBuilder t = new StringBuilder(); t.Append("指定した" + NamesFld.S_TYPE_DATA + "["); t.Append(expr_KeyExpected.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); t.Append("]にヒットするテーブルは、存在しませんでした。\n\nもしかして?\n ・ツール設定ファイル、プロジェクトファイル、ファイル一覧ファイル、テーブルファイルをまだ読み込めていない?\n ・ファイル名が間違っている?"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); // ヒント t.Append(r.Message_Configuration(expr_KeyExpected.Cur_Configuration.Parent)); r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return(list_ResltTable); }
//──────────────────────────────────────── #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()); }
//──────────────────────────────────────── /// <summary> /// 実行。 /// /// 指定のコントロールの、指定のイベントを実行します。 /// /// todo:どこで利用されている? /// </summary> /// <param name="sender"></param> /// <param name="nFcName">コントロール名。</param> /// <param name="oEventName"></param> /// <param name="log_Reports"></param> public void Execute1_Usercontrol( object sender, Expression_Node_String ec_FcName, XenonName o_Name_Event, MemoryApplication owner_MemoryApplication, Log_Reports log_Reports ) { //.WriteLine(this.GetType().Name + "#PerformFc: 【アクション_パフォーマー開始】"); Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute1_Usercontrol", log_Reports); // // Usercontrol ucFc = null; string sFcName1 = ec_FcName.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); owner_MemoryApplication.MemoryForms.ForEach_Children(delegate(string sKey, Usercontrol ucFc2, ref bool bRemove, ref bool bBreak) { string sFcName2 = ucFc2.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); if (sFcName2 == sFcName1) { ucFc = ucFc2; } }); if (null != ucFc) { // 一致したfcUcがあれば、一致した最後のfcUcを。 this.Execute1_UsercontrolImpl( sender, ucFc, o_Name_Event, owner_MemoryApplication, log_Reports ); } else { // // // //.WriteLine(this.GetType().Name + "#PerformFc: ■[" + sFcName_prm + "]という名前のコントロールはありませんでした。"); } // // log_Method.EndMethod(log_Reports); //.WriteLine(this.GetType().Name + "#PerformFc: 【アクション_パフォーマー終了】"); }
//──────────────────────────────────────── /// <summary> /// <f-cell>→M /// </summary> /// <param name="outputValueStr"></param> /// <param name="nKeyExpected"></param> /// <param name="nFcell"></param> /// <param name="moApplication"></param> /// <param name="log_Reports"></param> public void Translate( string sOutputValue, Expression_Node_String ec_KeyExpected, Expression_Node_String ec_SfCell,//Sf:cell;相当と想定。 MemoryApplication moApplication, Log_Reports log_Reports ) { Log_Method pg_Method = new Log_MethodImpl(0); pg_Method.BeginMethod(Info_Controls.Name_Library, this, "EToM2",log_Reports); // // string sName_Fnc; ec_SfCell.TrySelectAttribute(out sName_Fnc, PmNames.S_NAME.Name_Pm, EnumHitcount.One, log_Reports); if (NamesFnc.S_CELL != sName_Fnc) { // エラー。 goto gt_Error_NotSfcell; } string sSelectedFldName; if (log_Reports.Successful) { bool bHit = ec_SfCell.TrySelectAttribute( out sSelectedFldName, PmNames.S_SELECT.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports ); //if (!bHit) //{ // // 【追加 2012-07-10】 // // Sf:cell; の子要素arg1 には、name="select" のものがある。本来これは属性連結しておいて欲しい。 // List<Expression_Node_String> list_Arg1 = e_SfCell.SelectDirectchildByNodename(NamesNode.S_ARG1, false, EnumHitcount.Unconstraint, log_Reports); // d_InMethod.WriteDebug_ToConsole(1, "sSelectedFldNameが属性になかった。子要素arg1(" + list_Arg1 .Count+ "個)から探す。"); // if (0<d_InMethod.NDebugLevel && list_Arg1.Count<=0) // { // Log_TextIndented s = new Log_TextIndentedImpl(); // e_SfCell.ToText_Snapshot(s); // d_InMethod.WriteDebug_ToConsole(1, s.ToString()); // } // EUtil_NodeImpl.SelectItemsByAttrAsCsv(list_Arg1, PmNames.NAME.SAttrName, ValuesAttr.S_SELECT, false, EnumHitcount.First_Exist, log_Reports); // if (log_Reports.Successful) // { // sSelectedFldName = list_Arg1[0].Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); // } //} } else { sSelectedFldName = ""; } Expression_Node_String ec_KeyFldName1 = null; if (log_Reports.Successful) { Expression_Node_String ec_Where = null; // // 「E■where」は子要素。 // // 再検索。 ec_SfCell.List_Expression_Child.ForEach(delegate(Expression_Node_String ec_Child, ref bool bRemove, ref bool bBreak) { string sValue; ec_Child.TrySelectAttribute(out sValue, PmNames.S_NAME.Name_Pm, EnumHitcount.One, log_Reports); if (NamesNode.S_FNC == ec_Child.Cur_Configuration.Name && NamesFnc.S_WHERE == sValue) { ec_Where = ec_Child; if (pg_Method.CanDebug(2)) { pg_Method.WriteDebug_ToConsole("子「E■[" + ec_Child.Cur_Configuration.Name + "]」。子要素数=[" + ec_Where.List_Expression_Child.Count + "]"); } ec_Where.List_Expression_Child.ForEach(delegate(Expression_Node_String e_Item, ref bool bRemove2, ref bool bBreak2) { if (NamesNode.S_FNC == e_Item.Cur_Configuration.Name) { Expression_Node_String ec_Field; bool bHit3 = e_Item.TrySelectAttribute(out ec_Field, PmNames.S_FIELD.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); if (bHit3) { //「E■f-cell」/「E■@where」/「E■fnc field=”★”」。 ec_KeyFldName1 = ec_Field; if (pg_Method.CanDebug(2)) { pg_Method.WriteDebug_ToConsole( "「E■f-cell」/「E■a-where」/「E■fnc field=”[" + ec_KeyFldName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]”」。"); } } else { throw new Exception("ここは通らない?"); } } else { // #エラー System.Console.WriteLine(Info_Controls.Name_Library + ":" + this.GetType().Name + "#EToM: 「E■fnc」がありませんでした。"); } }); } else { if (pg_Method.CanDebug(2)) { pg_Method.WriteDebug_ToConsole( "(無視) 子「E■[" + ec_Child.Cur_Configuration.Name + "]」。"); } } }); if (null == ec_Where) { // #エラー System.Console.WriteLine(Info_Controls.Name_Library + ":" + this.GetType().Name + "#EToM: 「E■f-cell」に、子「E■where」が無かった? そういう場合(無条件)もある。"); } } else { ec_KeyFldName1 = null; } // // from // Expression_Node_String ec_TableName1;//ソース情報利用 if (log_Reports.Successful) { // Sf:cell; に from が指定されていない? bool bHit = ec_SfCell.TrySelectAttribute( out ec_TableName1, PmNames.S_FROM.Name_Pm, EnumHitcount.One, log_Reports ); //if (null == e_TableName1) //{ // d_InMethod.WriteDebug_ToConsole(1, "e_TableName1が属性になかった。子要素arg1から探す。"); // // 【追加 2012-07-10】 // // Sf:cell; の子要素arg1 には、name=”from” のものがある。本来これは属性連結しておいて欲しい。 // List<Expression_Node_String> list_Arg1 = e_SfCell.SelectDirectchildByNodename(NamesNode.S_ARG1, false, EnumHitcount.Unconstraint, log_Reports); // EUtil_NodeImpl.SelectItemsByAttrAsCsv(list_Arg1, PmNames.NAME.SAttrName, ValuesAttr.S_FROM, false, EnumHitcount.First_Exist, log_Reports); // if (log_Reports.Successful) // { // e_TableName1 = list_Arg1[0]; // } //} } else { ec_TableName1 = null; } // // required // bool bExpectedValueRequired = false; if (log_Reports.Successful) { string sRequired1; bool bHit = ec_SfCell.TrySelectAttribute(out sRequired1, PmNames.S_REQUIRED.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); if (bHit) { // 【旧仕様】 bool bParseSuccessful = bool.TryParse(sRequired1, out bExpectedValueRequired); } else { // 【新仕様】 // // 新仕様では、「E■f-cell/@E■where/E■prm name=”required”」。 // { Expression_Node_String ec_Where; bool bHit1 = ec_SfCell.TrySelectAttribute(out ec_Where, PmNames.S_WHERE.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); if (bHit1) { throw new Exception("こーこは通らない?"); } } } } else { } // e_TableName を取得してから引数エラーチェック。 if (null == ec_KeyExpected) { // エラー goto gt_Error_NullKeyExpected; } // ────────── Table_Humaninput o_Table; if (log_Reports.Successful) { o_Table = moApplication.MemoryTables.GetTable_HumaninputByName(ec_TableName1, true, log_Reports); // エラー時には、エラーメッセージを出させます。 if (null == o_Table) { // // エラー中断。 goto gt_Error_NotFoundTable; } else { // // 正常時 // //.WriteLine("(" + Info_Forms .LibraryName+ ")" + this.GetType().NFcName + "#...: (1)テーブル検索終了 refOTable=[" + refOTable.SourceFilePath + "]"); } } else { o_Table = null; } string err_SKeyFldName; string err_SSelectedFldName; // field=""。 Fielddefinition o_KeyFldDef; if (log_Reports.Successful) { // // 検索のキーとなるフィールドの定義を調べます。 // List<string> sList_KeyFldName; { sList_KeyFldName = new List<string>(); string sKeyFldName = ec_KeyFldName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); if ("" == sKeyFldName.Trim()) { // エラー err_SKeyFldName = sKeyFldName; goto gt_Error_EmptyKeyField; } sList_KeyFldName.Add(sKeyFldName); if (sList_KeyFldName.Count < 1) { // エラー err_SKeyFldName = sKeyFldName; goto gt_Error_ZeroKeyField; } } RecordFielddefinition recordFielddefinition; bool bHit = o_Table.TryGetFieldDefinitionByName( out recordFielddefinition, sList_KeyFldName, true, log_Reports ); if (!log_Reports.Successful || !bHit) { goto gt_EndMethod; } o_KeyFldDef = recordFielddefinition.ValueAt(0); } else { o_KeyFldDef = null; } RecordFielddefinition recordFielddefinition_Selected; if (log_Reports.Successful) { // 選択対象のフィールドの定義を調べます。 List<string> sList_SelectedFldName; { sList_SelectedFldName = new CsvTo_ListImpl().Read(sSelectedFldName); foreach (string sName in sList_SelectedFldName) { if ("" == sName.Trim()) { // エラー err_SSelectedFldName = sSelectedFldName; goto gt_Error_EmptySelectField; } } if (sList_SelectedFldName.Count < 1) { // エラー err_SSelectedFldName = sSelectedFldName; goto gt_Error_ZeroSelectField; } } bool bHit = o_Table.TryGetFieldDefinitionByName( out recordFielddefinition_Selected, sList_SelectedFldName, false, log_Reports ); if (!log_Reports.Successful || !bHit) { goto gt_EndMethod; } } else { recordFielddefinition_Selected = null; } if (log_Reports.Successful) { if (null == o_KeyFldDef) { // // エラー中断。 goto gt_Error_NotFoundKeyFldDefinition; } } if (log_Reports.Successful) { if (recordFielddefinition_Selected.Count < 1) { // // エラー中断。 goto gt_Error_NotFoundSelectFldDefinition; } } if (log_Reports.Successful) { List<DataRow> dst_Row = new List<DataRow>(); string sKeyFieldName = ec_KeyFldName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); string sExpectedValue = ec_KeyExpected.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); Configuration_Node cf_WrittenPlace_Query = ec_SfCell.Cur_Configuration; SelectPerformerImpl sp = new SelectPerformerImpl(); sp.Select( out dst_Row, sKeyFieldName, sExpectedValue, bExpectedValueRequired, o_KeyFldDef, o_Table.DataTable, cf_WrittenPlace_Query, log_Reports ); if (0 < dst_Row.Count) { //.WriteLine("(" + Info_Forms .LibraryName+ ")" + this.GetType().NFcName + "#...: (6a)該当 recordSet.Count=[" + recordSet.Count + "]"); foreach (DataRow row in dst_Row) { ToMemory_CellImpl updater = new ToMemory_CellImpl(); recordFielddefinition_Selected.ForEach(delegate(Fielddefinition fielddefinition_Selected, ref bool isBreak2, Log_Reports log_Reports2) { updater.ToMemory_ToSelectedField( sOutputValue, ec_SfCell, row, fielddefinition_Selected, log_Reports ); }, log_Reports); } } else { // エラー。 goto gt_Error_NotFoundRecord; } } goto gt_EndMethod; // // gt_Error_NotSfcell: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー909!", pg_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("Sf:cell;でないExpression_Node_Stringが指定されました。"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // ヒント s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration)); if (null != ec_SfCell) { ec_SfCell.ToText_Snapshot(s); } r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; // // gt_Error_NullKeyExpected: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー906!", pg_Method); StringBuilder s = new StringBuilder(); s.Append("引数e_KeyExpectedにヌルが指定されました。 e_KeyExpected=["); s.Append(ec_KeyExpected); s.Append("]"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append(" this.TableName=["); s.Append(ec_TableName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); s.Append("]"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // ヒント s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; gt_Error_EmptyKeyField: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー903!", pg_Method); StringBuilder s = new StringBuilder(); s.Append("fieldで指定されたキーフィールドの名前が空文字列でした。 err_SKeyFldName=["); s.Append(err_SKeyFldName); s.Append("]"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append(" this.TableName=["); s.Append(ec_TableName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); s.Append("]"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // ヒント s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; gt_Error_ZeroKeyField: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー902!", pg_Method); StringBuilder s = new StringBuilder(); s.Append("fieldで指定されたキーフィールドの個数が0個でした。 err_SKeyFldName=["); s.Append(err_SKeyFldName); s.Append("]"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append(" this.TableName=["); s.Append(ec_TableName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); s.Append("]"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // ヒント s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; gt_Error_EmptySelectField: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー904!", pg_Method); StringBuilder s = new StringBuilder(); s.Append("selectで指定されたフィールドの名前に空文字列がありました。 err_SSelectedFldName=["); s.Append(err_SSelectedFldName); s.Append("]"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append(" this.TableName=["); s.Append(ec_TableName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); s.Append("]"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // ヒント s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; gt_Error_ZeroSelectField: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー901!", pg_Method); StringBuilder s = new StringBuilder(); s.Append("selectで指定されたフィールドの個数が0個でした。 err_SSelectedFldName=["); s.Append(err_SSelectedFldName); s.Append("]"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append(" this.TableName=["); s.Append(ec_TableName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); s.Append("]"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // ヒント s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; // エラー。 gt_Error_NotFoundTable: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー1011!", pg_Method); StringBuilder s = new StringBuilder(); s.Append(" ヌル=refTable"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append(" this.TableName=["); s.Append(ec_TableName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); s.Append("]"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // ヒント s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; gt_Error_NotFoundKeyFldDefinition: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー478!", pg_Method); StringBuilder t = new StringBuilder(); t.Append(" キーフィールドの定義を取得できませんでした。"); t.Append(Environment.NewLine); t.Append("「E■["); t.Append(ec_KeyFldName1.Cur_Configuration.Name); t.Append("]」、キーフィールド名=["); t.Append(ec_KeyFldName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); t.Append("]"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); // ヒント t.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration)); r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; gt_Error_NotFoundSelectFldDefinition: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー479!", pg_Method); StringBuilder t = new StringBuilder(); t.Append(" 取得データが入っているはずのフィールドの定義を取得できませんでした。"); t.Append(Environment.NewLine); t.Append(" 指定されたフィールド名=["); t.Append(sSelectedFldName); t.Append("]"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); // ヒント t.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration)); r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; gt_Error_NotFoundRecord: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー344!", pg_Method); string sDebugExceptedKey = ec_KeyExpected.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("【失敗】"); s.Newline(); s.Newline(); s.Append("["); s.Append(o_Table.Name); s.Append("](テーブル)には、"); s.Append(Environment.NewLine); s.Append("["); s.Append(ec_KeyFldName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); s.Append("]フィールドに"); s.Append("["); s.Append(sDebugExceptedKey); s.Append("]が入っているレコードは、見つかりませんでした。"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append("この入力したデータは、入力が確定されず、無視されています。"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append("もしかして?"); s.Append(Environment.NewLine); s.Append(" ・ツールの不便さにより、手入力で"); s.Append(Environment.NewLine); s.Append(" 指定のテーブルに ID付きのレコードの空欄を"); s.Append(Environment.NewLine); s.Append(" 予め 作っておかなければならなかった、といった決まりごとはありませんか?"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append(" ・それとも、それ以外の理由?"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append("────────以下はプログラマー用の情報。"); s.Append(Environment.NewLine); // ヒント s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration)); r.Message = s.ToString(); //essageBox.Show(r.SMsg(log_Reports), Info_Forms.LibraryName + ":" + this.GetType().Name ); log_Reports.EndCreateReport(); } goto gt_EndMethod; // // gt_EndMethod: pg_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// フィールドから値を取得。 /// /// TODO:セルタイプ以外にも対応したい。 /// </summary> /// <param name="RecordSet_toSave">ヌル不可</param> /// <param name="eSelectedFldName">選択フィールド</param> /// <param name="RecordSetSaveTo_or_null"></param> /// <param name="log_Reports"></param> /// <returns>行リスト<列リスト></returns> public List <List <string> > P5_Select_CellType( RecordSet dst_Rs_toSave, Selectstatement selectSt_ToSave, Expressionv_4ASelectRecord ecv_selRec_OrNull, //where Configuration_Node parent_Cf_Query, //this Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Expr.Name_Library, this, "P5_Select", log_Reports); // // List <List <string> > reslt_sFieldListList = new List <List <string> >(); // // (1)テーブル Table_Humaninput o_Table; { o_Table = this.Owner_MemoryApplication.MemoryTables.GetTable_HumaninputByName( selectSt_ToSave.Expression_From, true, log_Reports); if (null == o_Table) { // エラー。 goto gt_Error_NullTable; } } if (!log_Reports.Successful) { // // エラーが出ていたら、さっさと抜ける。 goto gt_EndMethod; } // // // // // 条件 // // // // Fielddefinition keyFldDefinition = null; string err_SSelectedFldName = null; Exception err_Exception = null; Recordcondition err_Recordcondition = null; foreach (Recordcondition recCond in selectSt_ToSave.List_Recordcondition) { err_Recordcondition = recCond; // // (2)検索のキーフィールドの定義を調べます。 // キーフィールド定義 { List <string> sList_KeyFldName; { // 要素数1個。 sList_KeyFldName = new List <string>(); sList_KeyFldName.Add(recCond.Name_Field); } RecordFielddefinition recordFielddefinition; bool bHit = o_Table.TryGetFieldDefinitionByName( out recordFielddefinition, sList_KeyFldName, false, log_Reports ); if (!log_Reports.Successful || !bHit) { // エラー goto gt_EndMethod; } keyFldDefinition = recordFielddefinition.ValueAt(0); } // // (3)選択対象のフィールドの定義を調べます。 RecordFielddefinition recordFieldDefinition_Selected; { bool bHit = o_Table.TryGetFieldDefinitionByName( out recordFieldDefinition_Selected, selectSt_ToSave.List_SName_SelectField, true, log_Reports ); if (!log_Reports.Successful) { // エラー goto gt_EndMethod; } } // // (4) if (null == keyFldDefinition) { // エラー。 goto gt_Error_NullKeyFldDefinition; } List <string> list_FldImpl3 = new List <string>(); recordFieldDefinition_Selected.ForEach(delegate(Fielddefinition fielddefinition_Selected, ref bool isBreak2, Log_Reports log_Reports2) { string sSelectField = fielddefinition_Selected.Name_Trimupper; // // (5) if (null == fielddefinition_Selected) { // エラー。 isBreak2 = true; goto gt_Error_NullSelectedFldDefinition; } // // (6)欠番 // // (7) if (null == dst_Rs_toSave || dst_Rs_toSave.List_Field.Count < 1) { 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) { // 既エラー。 isBreak2 = true; goto gt_EndInnermethod; } if (null == dst_Rs_toSave) { // (7-2) isBreak2 = true; goto gt_Error_UndefinedPrimitiveType; } } else { // レコードセットは、一時記憶から取得済み。 } // (8) if (log_Reports.Successful) { // キー_フィールドの型別に、処理。 switch (keyFldDefinition.Type_Field) { case EnumTypeFielddefinition.String: { // (8-1)キーが string型フィールドなら // この行の、選択対象のフィールドの値。 foreach (Dictionary <string, Value_Humaninput> record in dst_Rs_toSave.List_Field) { // 値。 Value_Humaninput selectedCellData; try { selectedCellData = (Value_Humaninput)record[sSelectField]; } catch (KeyNotFoundException ex) { selectedCellData = null; err_SSelectedFldName = sSelectField; err_Exception = ex; isBreak2 = true; goto gt_Error_NotFoundFld; } Expression_Node_String ec_SelectedValue = this.GetSelectedFieldValue( fielddefinition_Selected, selectedCellData, parent_Cf_Query, log_Reports ); list_FldImpl3.Add(ec_SelectedValue.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); } } break; case EnumTypeFielddefinition.Int: { // // (8-2) キー・フィールドが int型の場合。 foreach (Dictionary <string, Value_Humaninput> record in dst_Rs_toSave.List_Field) { // この行の、選択対象のフィールドの値。 if (null != log_Reports && !log_Reports.Successful) //無限ループ防止 { // エラー発生時は無視。 } else { Value_Humaninput selectedCellData; try { selectedCellData = record[sSelectField]; } catch (KeyNotFoundException ex) { selectedCellData = null; err_SSelectedFldName = sSelectField; err_Exception = ex; isBreak2 = true; goto gt_Error_NotFoundFld; } { // 値。 Expression_Node_String ec_SelectedValue = this.GetSelectedFieldValue( fielddefinition_Selected, selectedCellData, parent_Cf_Query, log_Reports ); list_FldImpl3.Add(ec_SelectedValue.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); } } } } break; case EnumTypeFielddefinition.Bool: { // (8-3) キーが、bool型フィールド // 値。 foreach (Dictionary <string, Value_Humaninput> record in dst_Rs_toSave.List_Field) { // この行の、選択対象のフィールドの値。 Value_Humaninput selectedCellData; try { selectedCellData = (Value_Humaninput)record[sSelectField]; } catch (KeyNotFoundException ex) { selectedCellData = null; err_SSelectedFldName = sSelectField; err_Exception = ex; isBreak2 = true; goto gt_Error_NotFoundFld; } Expression_Node_String ec_SelectedValue = this.GetSelectedFieldValue( fielddefinition_Selected, selectedCellData, parent_Cf_Query, log_Reports ); list_FldImpl3.Add(ec_SelectedValue.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); } } break; default: { // // (8-4) // // 既にエラー対策済み。 if (null != log_Reports) //無限ループ防止 { // // エラー。 isBreak2 = true; goto gt_Error_UndefinedPrimitiveType; } // // 非エラー中断。 isBreak2 = true; goto gt_EndInnermethod; } break; } } goto gt_EndInnermethod; // #region 異常系 //──────────────────────────────────────── gt_Error_NullSelectedFldDefinition: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, o_Table.Name, log_Reports); //テーブル名 tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(parent_Cf_Query), log_Reports); //設定位置パンくずリスト this.Owner_MemoryApplication.CreateErrorReport("Er:6026;", tmpl, log_Reports); } goto gt_EndInnermethod; //──────────────────────────────────────── gt_Error_UndefinedPrimitiveType: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, keyFldDefinition.ToString_Type(), log_Reports); //キー・フィールド定義型名 tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(parent_Cf_Query), log_Reports); //設定位置パンくずリスト this.Owner_MemoryApplication.CreateErrorReport("Er:6027;", tmpl, log_Reports); } goto gt_EndInnermethod; //──────────────────────────────────────── gt_Error_NotFoundFld: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, err_SSelectedFldName, log_Reports); //選択フィールド名 tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(parent_Cf_Query), log_Reports); //設定位置パンくずリスト tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Exception(err_Exception), log_Reports); //例外メッセージ this.Owner_MemoryApplication.CreateErrorReport("Er:6028;", tmpl, log_Reports); } goto gt_EndInnermethod; //──────────────────────────────────────── #endregion // gt_EndInnermethod: ; }, log_Reports);//select列1つ if (0 < list_FldImpl3.Count) { // フィールドがあれば追加。 reslt_sFieldListList.Add(list_FldImpl3); } } goto gt_EndMethod; // #region 異常系 //──────────────────────────────────────── gt_Error_NullTable: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); this.Owner_MemoryApplication.CreateErrorReport("Er:6024;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_NullKeyFldDefinition: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(parent_Cf_Query), log_Reports);//設定位置パンくずリスト this.Owner_MemoryApplication.CreateErrorReport("Er:6025;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // gt_EndMethod: log_Method.EndMethod(log_Reports); return(reslt_sFieldListList); }
//──────────────────────────────────────── /// <summary> /// 変数名を指定することで、ファイルパスを返します。 /// </summary> /// <param select="oVariableName"></param> /// <param select="bRequired"></param> /// <param select="log_Reports"></param> /// <returns></returns> public Expression_Node_Filepath GetExpressionfilepathByVariablename( Expression_Node_String ec_Name_Variable, bool bRequired, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "GetExpressionfilepathByVariablename", log_Reports); // // // // Expression_Node_Filepath ec_Fpath_Result; string sName_Var = ec_Name_Variable.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); if (!this.dictionaryExpression_Item.ContainsKey(sName_Var)) { ec_Fpath_Result = null; if (bRequired) { // 未該当の場合、エラーにします。 goto gt_Error_NotFoundVariable; } } else { Expression_Node_String ec_Str = this.dictionaryExpression_Item[sName_Var]; if (ec_Str is Expression_Node_Filepath) { ec_Fpath_Result = (Expression_Node_Filepath)ec_Str; //if (ec_Fpath_Result.SDirectory_Base == "" && null != this.ec_FpathBaseOrNull) //{ // string sFopath = this.ec_FpathBaseOrNull.Execute4_OnExpressionString( // EnumHitcount.Unconstraint, log_Reports); // if (log_Reports.Successful) // { // ec_Fpath_Result.SetDirectory_Base(sFopath, log_Reports); // } //} } else { ec_Fpath_Result = null; goto gt_Error_AnotherClass; } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NotFoundVariable: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー376!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("変数["); s.Append(sName_Var); s.Append("]は存在しませんでした。"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append("ヒント:登録されている変数の個数=["); s.Append(this.dictionaryExpression_Item.Count); s.Append("]"); s.Append(Environment.NewLine); s.Append("──────────ここから"); s.Append(Environment.NewLine); foreach (KeyValuePair <string, Expression_Node_String> kvp in this.dictionaryExpression_Item) { s.Append("key=[" + kvp.Key + "] value=[" + kvp.Value.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]"); s.Append(Environment.NewLine); } s.Append("──────────ここまで"); s.Append(Environment.NewLine); // ヒント s.Append(r.Message_Configuration(ec_Name_Variable.Cur_Configuration)); //s.Append(r.Message_Configuration(ec_Name_Variable.Cur_Configurationtree.Parent)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_AnotherClass: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー909", log_Method); r.Message = "変数[" + sName_Var + "]はファイルパス型を期待しましたが、ファイルパス型ではありませんでした。"; log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return(ec_Fpath_Result); }
//──────────────────────────────────────── /// <summary> /// 変数名を指定することで、ファイルパスを返します。 /// </summary> /// <param select="oVariableName"></param> /// <param select="bRequired"></param> /// <param select="log_Reports"></param> /// <returns></returns> public Expression_Node_Filepath GetExpressionfilepathByVariablename( Expression_Node_String ec_Name_Variable, bool bRequired, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "GetExpressionfilepathByVariablename",log_Reports); // // // // Expression_Node_Filepath ec_Fpath_Result; string sName_Var = ec_Name_Variable.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); if (!this.dictionaryExpression_Item.ContainsKey(sName_Var)) { ec_Fpath_Result = null; if (bRequired) { // 未該当の場合、エラーにします。 goto gt_Error_NotFoundVariable; } } else { Expression_Node_String ec_Str = this.dictionaryExpression_Item[sName_Var]; if (ec_Str is Expression_Node_Filepath) { ec_Fpath_Result = (Expression_Node_Filepath)ec_Str; //if (ec_Fpath_Result.SDirectory_Base == "" && null != this.ec_FpathBaseOrNull) //{ // string sFopath = this.ec_FpathBaseOrNull.Execute4_OnExpressionString( // EnumHitcount.Unconstraint, log_Reports); // if (log_Reports.Successful) // { // ec_Fpath_Result.SetDirectory_Base(sFopath, log_Reports); // } //} } else { ec_Fpath_Result = null; goto gt_Error_AnotherClass; } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NotFoundVariable: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー376!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("変数["); s.Append(sName_Var); s.Append("]は存在しませんでした。"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append("ヒント:登録されている変数の個数=["); s.Append(this.dictionaryExpression_Item.Count); s.Append("]"); s.Append(Environment.NewLine); s.Append("──────────ここから"); s.Append(Environment.NewLine); foreach (KeyValuePair<string, Expression_Node_String> kvp in this.dictionaryExpression_Item) { s.Append("key=[" + kvp.Key + "] value=[" + kvp.Value.Execute4_OnExpressionString(EnumHitcount.Unconstraint,log_Reports) + "]"); s.Append(Environment.NewLine); } s.Append("──────────ここまで"); s.Append(Environment.NewLine); // ヒント s.Append(r.Message_Configuration(ec_Name_Variable.Cur_Configuration)); //s.Append(r.Message_Configuration(ec_Name_Variable.Cur_Configurationtree.Parent)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_AnotherClass: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー909", log_Method); r.Message = "変数[" + sName_Var + "]はファイルパス型を期待しましたが、ファイルパス型ではありませんでした。"; log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return ec_Fpath_Result; }
//──────────────────────────────────────── /// <summary> /// 変数を設定します。 /// </summary> public void SetVariable( XenonName o_Name_Variable, Expression_Node_String ec_Value, bool bRequired, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "SetVariable", log_Reports); // // if ( o_Name_Variable.SValue.StartsWith(NamesVar.S_SP_) || o_Name_Variable.SValue.StartsWith(NamesVar.S_UP_) ) { string sFilePath = ec_Value.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); Configurationtree_Node parent_Configurationtree_Node = new Configurationtree_NodeImpl("!ハードコーディング_" + this.GetType().Name + "#SetVariable", null); Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L09Mid_4", parent_Configurationtree_Node); cf_Fpath.InitPath( sFilePath, log_Reports ); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } Expression_Node_Filepath ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath); this.SetFilepathValue( o_Name_Variable.SValue, ec_Fpath, bRequired, log_Reports ); } else if ( // 新仕様 o_Name_Variable.SValue.StartsWith(NamesVar.S_SS_) || o_Name_Variable.SValue.StartsWith(NamesVar.S_US_) ) { string str1 = ec_Value.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); this.SetStringValue( o_Name_Variable, str1, bRequired, log_Reports ); } else { } // // // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
/// <summary> /// レコードセットの取得。 /// </summary> /// <param name="eName"></param> /// <param name="log_Reports"></param> /// <returns>該当がなければヌル。</returns> public RecordSet Get(Expression_Node_String ec_Name, MemoryApplication memoryApplication, Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Expr.Name_Library, this, "Get",log_Reports); // // string sName = ec_Name.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports).Trim(); RecordSet nResult; try { //ystem.Console.WriteLine(Info_N.LibraryName + ":" + this.GetType().Name + "#Remove: 【レコードセット削除】sName=[" + sName + "]"); nResult = this.dictionary_Recordset[sName]; } catch (KeyNotFoundException ex) { nResult = null; { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sName, log_Reports);//名前 tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(ec_Name.Cur_Configuration), log_Reports);//設定位置パンくずリスト tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Exception(ex), log_Reports);//例外メッセージ memoryApplication.CreateErrorReport("Er:6043;", tmpl, log_Reports); } } catch (Exception ex) { nResult = null; { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sName, log_Reports);//名前 tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(ec_Name.Cur_Configuration), log_Reports);//設定位置パンくずリスト tmpl.SetParameter(3, Log_RecordReportsImpl.ToText_Exception(ex), log_Reports);//例外メッセージ memoryApplication.CreateErrorReport("Er:6044;", tmpl, log_Reports); } } // // // // log_Method.EndMethod(log_Reports); return nResult; }
//──────────────────────────────────────── /// <summary> /// 変数名を指定することで、文字列を返します。 /// /// </summary> /// <param select="oVariableName"></param> /// <param select="bRequired"></param> /// <param select="log_Reports"></param> /// <returns></returns> public string GetStringByVariablename( Expression_Node_String ec_VariableName, bool bRequired, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "GetStringByVariablename", log_Reports); // // // // string sResult; string sVarName = ec_VariableName.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); // 【仕様変更 2011-03-03】「変数名無し」(つまり「$」だけ)は、文字「$」を返します。 //if ("" == sVarName) //{ // return "$"; //} //else if (!this.dictionaryExpression_Item.ContainsKey(sVarName)) { sResult = null; if (bRequired) { goto gt_Error_NotFoundVariable; } } else { sResult = this.dictionaryExpression_Item[sVarName].Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NotFoundVariable: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー925!", log_Method); Log_TextIndented t = new Log_TextIndentedImpl(); t.Append("変数["); t.Append(sVarName); t.Append("]は存在しませんでした。"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append(" 問題箇所ヒント:"); ec_VariableName.Cur_Configuration.Parent.ToText_Locationbreadcrumbs(t); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append(" 実行経路ヒント:"); ec_VariableName.Cur_Configuration.Parent.ToText_Locationbreadcrumbs(t); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append("ヒント:登録されている変数の個数=["); t.Append(this.dictionaryExpression_Item.Count); t.Append("]"); t.Append(Environment.NewLine); foreach (KeyValuePair <string, Expression_Node_String> pair in this.dictionaryExpression_Item) { t.Append(pair.Key); t.Append("="); t.Append(pair.Value); t.Append(Environment.NewLine); } r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return(sResult); }
/// <summary> /// テーブルを返します。NAME_FORM列値を指定してください。 /// </summary> /// <param select="nTableName"></param> /// <param select="bRequired">該当しなかった場合にエラー扱いなら真。</param> /// <returns>該当しなかった場合はヌルを返します。</returns> public List<Table_Humaninput> GetTable_HumaninputByFormgroup( Expression_Node_String expr_KeyExpected, bool bRequired, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "GetTable_HumaninputByFormgroup",log_Reports); // // List<Table_Humaninput> list_ResltTable = new List<Table_Humaninput>(); if (null==expr_KeyExpected) { goto gt_EndMethod; } try { string str_KeyExpected = expr_KeyExpected.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); foreach (Table_Humaninput xenonTable in this.dictionary_Table_Humaninput.Values) { if (null!=xenonTable.Tableunit && str_KeyExpected == xenonTable.Tableunit) { list_ResltTable.Add(xenonTable); } } } catch (KeyNotFoundException) { if (bRequired) { // // エラー goto gt_Error_NotFound; } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NotFound: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー929!", log_Method); StringBuilder t = new StringBuilder(); t.Append("指定したレイアウト_グループ名["); t.Append(expr_KeyExpected.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); t.Append("]は、存在しませんでした。"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); // ヒント t.Append(r.Message_Configuration(expr_KeyExpected.Cur_Configuration.Parent)); r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return list_ResltTable; }
//──────────────────────────────────────── /// <summary> /// テーブル名を指定することで、テーブルを返します。 /// </summary> /// <param select="nTableName"></param> /// <param select="bRequired">該当しなかった場合に警告表示を行うなら真。</param> /// <returns>該当しなかった場合はヌルを返します。</returns> public Table_Humaninput GetTable_HumaninputByName( Expression_Node_String ec_TableName, bool bRequired, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "GetTable_HumaninputByName",log_Reports); // // // // Table_Humaninput o_Table; string sTableName = ec_TableName.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); ; if (this.dictionary_Table_Humaninput.ContainsKey(sTableName)) { o_Table = this.dictionary_Table_Humaninput[sTableName]; } else { o_Table = null; if (bRequired) { // // エラー goto gt_Error_NotFoundTable; } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NotFoundTable: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー928!", log_Method); StringBuilder s = new StringBuilder(); s.Append("["); s.Append(sTableName); s.Append("]という名前のテーブルは存在しませんでした。"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // ヒント s.Append(r.Message_Configuration(ec_TableName.Cur_Configuration.Parent)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return o_Table; }
//──────────────────────────────────────── /// <summary> /// <f-cell>→M /// </summary> /// <param name="outputValueStr"></param> /// <param name="nKeyExpected"></param> /// <param name="nFcell"></param> /// <param name="moApplication"></param> /// <param name="log_Reports"></param> public void Translate( string sOutputValue, Expression_Node_String ec_KeyExpected, Expression_Node_String ec_SfCell,//Sf:cell;相当と想定。 MemoryApplication moApplication, Log_Reports log_Reports ) { Log_Method pg_Method = new Log_MethodImpl(0); pg_Method.BeginMethod(Info_Controls.Name_Library, this, "EToM2", log_Reports); // // string sName_Fnc; ec_SfCell.TrySelectAttribute(out sName_Fnc, PmNames.S_NAME.Name_Pm, EnumHitcount.One, log_Reports); if (NamesFnc.S_CELL != sName_Fnc) { // エラー。 goto gt_Error_NotSfcell; } string sSelectedFldName; if (log_Reports.Successful) { bool bHit = ec_SfCell.TrySelectAttribute( out sSelectedFldName, PmNames.S_SELECT.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports ); //if (!bHit) //{ // // 【追加 2012-07-10】 // // Sf:cell; の子要素arg1 には、name="select" のものがある。本来これは属性連結しておいて欲しい。 // List<Expression_Node_String> list_Arg1 = e_SfCell.SelectDirectchildByNodename(NamesNode.S_ARG1, false, EnumHitcount.Unconstraint, log_Reports); // d_InMethod.WriteDebug_ToConsole(1, "sSelectedFldNameが属性になかった。子要素arg1(" + list_Arg1 .Count+ "個)から探す。"); // if (0<d_InMethod.NDebugLevel && list_Arg1.Count<=0) // { // Log_TextIndented s = new Log_TextIndentedImpl(); // e_SfCell.ToText_Snapshot(s); // d_InMethod.WriteDebug_ToConsole(1, s.ToString()); // } // EUtil_NodeImpl.SelectItemsByAttrAsCsv(list_Arg1, PmNames.NAME.SAttrName, ValuesAttr.S_SELECT, false, EnumHitcount.First_Exist, log_Reports); // if (log_Reports.Successful) // { // sSelectedFldName = list_Arg1[0].Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); // } //} } else { sSelectedFldName = ""; } Expression_Node_String ec_KeyFldName1 = null; if (log_Reports.Successful) { Expression_Node_String ec_Where = null; // // 「E■where」は子要素。 // // 再検索。 ec_SfCell.List_Expression_Child.ForEach(delegate(Expression_Node_String ec_Child, ref bool bRemove, ref bool bBreak) { string sValue; ec_Child.TrySelectAttribute(out sValue, PmNames.S_NAME.Name_Pm, EnumHitcount.One, log_Reports); if (NamesNode.S_FNC == ec_Child.Cur_Configuration.Name && NamesFnc.S_WHERE == sValue) { ec_Where = ec_Child; if (pg_Method.CanDebug(2)) { pg_Method.WriteDebug_ToConsole("子「E■[" + ec_Child.Cur_Configuration.Name + "]」。子要素数=[" + ec_Where.List_Expression_Child.Count + "]"); } ec_Where.List_Expression_Child.ForEach(delegate(Expression_Node_String e_Item, ref bool bRemove2, ref bool bBreak2) { if (NamesNode.S_FNC == e_Item.Cur_Configuration.Name) { Expression_Node_String ec_Field; bool bHit3 = e_Item.TrySelectAttribute(out ec_Field, PmNames.S_FIELD.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); if (bHit3) { //「E■f-cell」/「E■@where」/「E■fnc field=”★”」。 ec_KeyFldName1 = ec_Field; if (pg_Method.CanDebug(2)) { pg_Method.WriteDebug_ToConsole("「E■f-cell」/「E■a-where」/「E■fnc field=”[" + ec_KeyFldName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "]”」。"); } } else { throw new Exception("ここは通らない?"); } } else { // #エラー System.Console.WriteLine(Info_Controls.Name_Library + ":" + this.GetType().Name + "#EToM: 「E■fnc」がありませんでした。"); } }); } else { if (pg_Method.CanDebug(2)) { pg_Method.WriteDebug_ToConsole("(無視) 子「E■[" + ec_Child.Cur_Configuration.Name + "]」。"); } } }); if (null == ec_Where) { // #エラー System.Console.WriteLine(Info_Controls.Name_Library + ":" + this.GetType().Name + "#EToM: 「E■f-cell」に、子「E■where」が無かった? そういう場合(無条件)もある。"); } } else { ec_KeyFldName1 = null; } // // from // Expression_Node_String ec_TableName1;//ソース情報利用 if (log_Reports.Successful) { // Sf:cell; に from が指定されていない? bool bHit = ec_SfCell.TrySelectAttribute( out ec_TableName1, PmNames.S_FROM.Name_Pm, EnumHitcount.One, log_Reports ); //if (null == e_TableName1) //{ // d_InMethod.WriteDebug_ToConsole(1, "e_TableName1が属性になかった。子要素arg1から探す。"); // // 【追加 2012-07-10】 // // Sf:cell; の子要素arg1 には、name=”from” のものがある。本来これは属性連結しておいて欲しい。 // List<Expression_Node_String> list_Arg1 = e_SfCell.SelectDirectchildByNodename(NamesNode.S_ARG1, false, EnumHitcount.Unconstraint, log_Reports); // EUtil_NodeImpl.SelectItemsByAttrAsCsv(list_Arg1, PmNames.NAME.SAttrName, ValuesAttr.S_FROM, false, EnumHitcount.First_Exist, log_Reports); // if (log_Reports.Successful) // { // e_TableName1 = list_Arg1[0]; // } //} } else { ec_TableName1 = null; } // // required // bool bExpectedValueRequired = false; if (log_Reports.Successful) { string sRequired1; bool bHit = ec_SfCell.TrySelectAttribute(out sRequired1, PmNames.S_REQUIRED.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); if (bHit) { // 【旧仕様】 bool bParseSuccessful = bool.TryParse(sRequired1, out bExpectedValueRequired); } else { // 【新仕様】 // // 新仕様では、「E■f-cell/@E■where/E■prm name=”required”」。 // { Expression_Node_String ec_Where; bool bHit1 = ec_SfCell.TrySelectAttribute(out ec_Where, PmNames.S_WHERE.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); if (bHit1) { throw new Exception("こーこは通らない?"); } } } } else { } // e_TableName を取得してから引数エラーチェック。 if (null == ec_KeyExpected) { // エラー goto gt_Error_NullKeyExpected; } // ────────── Table_Humaninput o_Table; if (log_Reports.Successful) { o_Table = moApplication.MemoryTables.GetTable_HumaninputByName(ec_TableName1, true, log_Reports); // エラー時には、エラーメッセージを出させます。 if (null == o_Table) { // // エラー中断。 goto gt_Error_NotFoundTable; } else { // // 正常時 // //.WriteLine("(" + Info_Forms .LibraryName+ ")" + this.GetType().NFcName + "#...: (1)テーブル検索終了 refOTable=[" + refOTable.SourceFilePath + "]"); } } else { o_Table = null; } string err_SKeyFldName; string err_SSelectedFldName; // field=""。 Fielddefinition o_KeyFldDef; if (log_Reports.Successful) { // // 検索のキーとなるフィールドの定義を調べます。 // List <string> sList_KeyFldName; { sList_KeyFldName = new List <string>(); string sKeyFldName = ec_KeyFldName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); if ("" == sKeyFldName.Trim()) { // エラー err_SKeyFldName = sKeyFldName; goto gt_Error_EmptyKeyField; } sList_KeyFldName.Add(sKeyFldName); if (sList_KeyFldName.Count < 1) { // エラー err_SKeyFldName = sKeyFldName; goto gt_Error_ZeroKeyField; } } RecordFielddefinition recordFielddefinition; bool bHit = o_Table.TryGetFieldDefinitionByName( out recordFielddefinition, sList_KeyFldName, true, log_Reports ); if (!log_Reports.Successful || !bHit) { goto gt_EndMethod; } o_KeyFldDef = recordFielddefinition.ValueAt(0); } else { o_KeyFldDef = null; } RecordFielddefinition recordFielddefinition_Selected; if (log_Reports.Successful) { // 選択対象のフィールドの定義を調べます。 List <string> sList_SelectedFldName; { sList_SelectedFldName = new CsvTo_ListImpl().Read(sSelectedFldName); foreach (string sName in sList_SelectedFldName) { if ("" == sName.Trim()) { // エラー err_SSelectedFldName = sSelectedFldName; goto gt_Error_EmptySelectField; } } if (sList_SelectedFldName.Count < 1) { // エラー err_SSelectedFldName = sSelectedFldName; goto gt_Error_ZeroSelectField; } } bool bHit = o_Table.TryGetFieldDefinitionByName( out recordFielddefinition_Selected, sList_SelectedFldName, false, log_Reports ); if (!log_Reports.Successful || !bHit) { goto gt_EndMethod; } } else { recordFielddefinition_Selected = null; } if (log_Reports.Successful) { if (null == o_KeyFldDef) { // // エラー中断。 goto gt_Error_NotFoundKeyFldDefinition; } } if (log_Reports.Successful) { if (recordFielddefinition_Selected.Count < 1) { // // エラー中断。 goto gt_Error_NotFoundSelectFldDefinition; } } if (log_Reports.Successful) { List <DataRow> dst_Row = new List <DataRow>(); string sKeyFieldName = ec_KeyFldName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); string sExpectedValue = ec_KeyExpected.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); Configuration_Node cf_WrittenPlace_Query = ec_SfCell.Cur_Configuration; SelectPerformerImpl sp = new SelectPerformerImpl(); sp.Select( out dst_Row, sKeyFieldName, sExpectedValue, bExpectedValueRequired, o_KeyFldDef, o_Table.DataTable, cf_WrittenPlace_Query, log_Reports ); if (0 < dst_Row.Count) { //.WriteLine("(" + Info_Forms .LibraryName+ ")" + this.GetType().NFcName + "#...: (6a)該当 recordSet.Count=[" + recordSet.Count + "]"); foreach (DataRow row in dst_Row) { ToMemory_CellImpl updater = new ToMemory_CellImpl(); recordFielddefinition_Selected.ForEach(delegate(Fielddefinition fielddefinition_Selected, ref bool isBreak2, Log_Reports log_Reports2) { updater.ToMemory_ToSelectedField( sOutputValue, ec_SfCell, row, fielddefinition_Selected, log_Reports ); }, log_Reports); } } else { // エラー。 goto gt_Error_NotFoundRecord; } } goto gt_EndMethod; // // gt_Error_NotSfcell: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー909!", pg_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("Sf:cell;でないExpression_Node_Stringが指定されました。"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // ヒント s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration)); if (null != ec_SfCell) { ec_SfCell.ToText_Snapshot(s); } r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; // // gt_Error_NullKeyExpected: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー906!", pg_Method); StringBuilder s = new StringBuilder(); s.Append("引数e_KeyExpectedにヌルが指定されました。 e_KeyExpected=["); s.Append(ec_KeyExpected); s.Append("]"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append(" this.TableName=["); s.Append(ec_TableName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); s.Append("]"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // ヒント s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; gt_Error_EmptyKeyField: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー903!", pg_Method); StringBuilder s = new StringBuilder(); s.Append("fieldで指定されたキーフィールドの名前が空文字列でした。 err_SKeyFldName=["); s.Append(err_SKeyFldName); s.Append("]"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append(" this.TableName=["); s.Append(ec_TableName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); s.Append("]"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // ヒント s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; gt_Error_ZeroKeyField: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー902!", pg_Method); StringBuilder s = new StringBuilder(); s.Append("fieldで指定されたキーフィールドの個数が0個でした。 err_SKeyFldName=["); s.Append(err_SKeyFldName); s.Append("]"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append(" this.TableName=["); s.Append(ec_TableName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); s.Append("]"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // ヒント s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; gt_Error_EmptySelectField: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー904!", pg_Method); StringBuilder s = new StringBuilder(); s.Append("selectで指定されたフィールドの名前に空文字列がありました。 err_SSelectedFldName=["); s.Append(err_SSelectedFldName); s.Append("]"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append(" this.TableName=["); s.Append(ec_TableName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); s.Append("]"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // ヒント s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; gt_Error_ZeroSelectField: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー901!", pg_Method); StringBuilder s = new StringBuilder(); s.Append("selectで指定されたフィールドの個数が0個でした。 err_SSelectedFldName=["); s.Append(err_SSelectedFldName); s.Append("]"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append(" this.TableName=["); s.Append(ec_TableName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); s.Append("]"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // ヒント s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; // エラー。 gt_Error_NotFoundTable: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー1011!", pg_Method); StringBuilder s = new StringBuilder(); s.Append(" ヌル=refTable"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append(" this.TableName=["); s.Append(ec_TableName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); s.Append("]"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); // ヒント s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; gt_Error_NotFoundKeyFldDefinition: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー478!", pg_Method); StringBuilder t = new StringBuilder(); t.Append(" キーフィールドの定義を取得できませんでした。"); t.Append(Environment.NewLine); t.Append("「E■["); t.Append(ec_KeyFldName1.Cur_Configuration.Name); t.Append("]」、キーフィールド名=["); t.Append(ec_KeyFldName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); t.Append("]"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); // ヒント t.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration)); r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; gt_Error_NotFoundSelectFldDefinition: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー479!", pg_Method); StringBuilder t = new StringBuilder(); t.Append(" 取得データが入っているはずのフィールドの定義を取得できませんでした。"); t.Append(Environment.NewLine); t.Append(" 指定されたフィールド名=["); t.Append(sSelectedFldName); t.Append("]"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); // ヒント t.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration)); r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; gt_Error_NotFoundRecord: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー344!", pg_Method); string sDebugExceptedKey = ec_KeyExpected.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("【失敗】"); s.Newline(); s.Newline(); s.Append("["); s.Append(o_Table.Name); s.Append("](テーブル)には、"); s.Append(Environment.NewLine); s.Append("["); s.Append(ec_KeyFldName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); s.Append("]フィールドに"); s.Append("["); s.Append(sDebugExceptedKey); s.Append("]が入っているレコードは、見つかりませんでした。"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append("この入力したデータは、入力が確定されず、無視されています。"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append("もしかして?"); s.Append(Environment.NewLine); s.Append(" ・ツールの不便さにより、手入力で"); s.Append(Environment.NewLine); s.Append(" 指定のテーブルに ID付きのレコードの空欄を"); s.Append(Environment.NewLine); s.Append(" 予め 作っておかなければならなかった、といった決まりごとはありませんか?"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append(" ・それとも、それ以外の理由?"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append(Environment.NewLine); s.Append("────────以下はプログラマー用の情報。"); s.Append(Environment.NewLine); // ヒント s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration)); r.Message = s.ToString(); //essageBox.Show(r.SMsg(log_Reports), Info_Forms.LibraryName + ":" + this.GetType().Name ); log_Reports.EndCreateReport(); } goto gt_EndMethod; // // gt_EndMethod: pg_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// データソースから値を取得し、コントロールに取り込みます。 /// /// データソースが設定されていない場合は、フォームのクリアーになります。 /// </summary> public void RefreshData( Log_Reports log_Reports ) { Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); pg_Method.BeginMethod(Info_Controls.Name_Library, this, "RefreshData", log_Reports); // // List <Expression_Node_String> list_Expr_Data = this.ControlCommon.Expression_Control.SelectDirectchildByNodename(NamesNode.S_DATA, false, EnumHitcount.Unconstraint, log_Reports); List <Expression_Node_String> list_Expr_Datasource = Utility_Expression_NodeImpl.SelectItemsByPmAsCsv(list_Expr_Data, PmNames.S_ACCESS.Name_Pm, ValuesAttr.S_FROM, false, EnumHitcount.First_Exist, log_Reports); if (!log_Reports.Successful) { goto gt_EndMethod; } Expression_Node_String expr_Datasource = list_Expr_Datasource[0]; if (null == expr_Datasource) { // データソースが設定されていないとき this.Clear(); } else { if (log_Reports.Successful) { if (0 < expr_Datasource.List_Expression_Child.Count) { expr_Datasource.List_Expression_Child.ForEach(delegate(Expression_Node_String expr_First, ref bool bRemove, ref bool bBreak) { if (log_Reports.Successful) { // // 最初の1件。なければ空文字列。 // string sValue; if (null == expr_First) { sValue = ""; } else { Expression_Node_String e_str = (Expression_Node_String)expr_First; sValue = e_str.Execute4_OnExpressionString(EnumHitcount.First_Exist_Or_Zero, log_Reports); } switch (this.EnumCheckboxValuetype) { case EnumCheckboxValuetype.Bool: // // // // bool型のチェックボックス // // // { if ("" == sValue.Trim()) { // // 暫定: 空白は、falseとして扱います。 // sValue = "false"; } this.ControlCommon.BAutomaticinputting = true; bool bChecked; bool bResult = bool.TryParse(sValue, out bChecked); this.Checked = bChecked; if (!bResult) { // エラー this.Checked = false; this.BackColor = Color.Red; //#内部メソッド内のエラー { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sValue, log_Reports); //値 // データソース要素のソースを調べますが、「どのテーブルから取ってきたか」ではなく、 // 「設定ファイルに何と書かれていたか」を取ってきます。 //tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(expr_Datasource.Cur_Configurationtree), log_Reports);//設定位置パンくずリスト tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration( expr_First.Cur_Configuration), log_Reports);//設定位置パンくずリスト this.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:539;", tmpl, log_Reports); } } this.ControlCommon.BAutomaticinputting = false; } break; case EnumCheckboxValuetype.Zero_One: // // // // 0,1型のチェックボックス // // // { if ("" == sValue.Trim()) { // // 暫定: 空白は、0(偽)として扱います。 // sValue = "0"; } this.ControlCommon.BAutomaticinputting = true; int nCheckedInt; bool bResult = int.TryParse(sValue, out nCheckedInt); if (bResult) { if (0 == nCheckedInt) { this.Checked = false; } else if (1 == nCheckedInt) { this.Checked = true; } else { // // 警告 // this.Checked = false; this.BackColor = Color.Red; //#内部メソッド内のエラー { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, nCheckedInt.ToString(), log_Reports); //値 tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Configuration(expr_First.Cur_Configuration), log_Reports); //設定位置パンくずリスト this.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:540;", tmpl, log_Reports); } } } else { // // エラー // this.Checked = false; this.BackColor = Color.Red; //#内部メソッド内のエラー { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(expr_First.Cur_Configuration), log_Reports); //設定位置パンくずリスト this.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:541;", tmpl, log_Reports); } } goto automatic_input_end; // // // // automatic_input_end: this.ControlCommon.BAutomaticinputting = false; } break; default: { // // エラー // this.Checked = false; this.BackColor = Color.Red; //#内部メソッド内のエラー { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(expr_First.Cur_Configuration), log_Reports); //設定位置パンくずリスト this.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:542;", tmpl, log_Reports); } } break; } } // // 最初の1件のみ。 bBreak = true; }); } else { // 件数が無ければ。 this.ControlCommon.BAutomaticinputting = true; this.Checked = false;// 空にする。 this.ControlCommon.BAutomaticinputting = false; } } else { } } goto gt_EndMethod; // // gt_EndMethod: pg_Method.EndMethod(log_Reports); }