//──────────────────────────────────────── public void ToMemory_DataTargetFcell( string sValue_Output, 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, "ToM_DataTargetFcell",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; } // ■f-cellの子要素 Expression_Node_String ec_KeyExpected1 = null; int nKeyCount = 0; { // //「E■f-cell」の子要素のリスト。 ec_SfCell.List_Expression_Child.ForEach(delegate(Expression_Node_String e_Item, ref bool bRemove2, ref bool bBreak2) { // キー値 が1つ入っています。 ec_KeyExpected1 = e_Item; nKeyCount++; }); } // それでも @keyValueを取得できなければ。 if (null == ec_KeyExpected1) { //「E■rec-cond」を調べる。 Expression_Node_String ec_Where; bool bHit2 = ec_SfCell.TrySelectAttribute(out ec_Where, PmNames.S_WHERE.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); if (bHit2) { 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) { //ystem.Console.WriteLine(Info_Forms.LibraryName + ":" + this.GetType().Name + "#ToM: 「E■f-cell」の「E■@where」属性の下の「E■fnc」を解析。その子要素がvalue相当であるはず。"); ec_KeyExpected1 = e_Item; } else { } }); } } if (1 < nKeyCount) { ec_KeyExpected1 = null; if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー311!", pg_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("「E■f-cell」系要素の子要素が、「E■rec-cond」を除いて[" + nKeyCount + "]個ありました。"); s.Newline(); s.Append("この子要素は キー値になるもので、1個でなければいけません。"); s.Newline(); // 一覧 s.Append("──────────子要素名一覧"); s.Newline(); ec_SfCell.List_Expression_Child.ForEach(delegate(Expression_Node_String e_Str1, ref bool bRemove2, ref bool bBreak2) { if ("" == e_Str1.Cur_Configuration.Name) { s.Append("E■(要素名無し)"); s.Newline(); } else { s.Append("E■"); s.Append(e_Str1.Cur_Configuration.Name); s.Newline(); } }); s.Append("──────────"); s.Newline(); // ヒント s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } } else if (null == ec_KeyExpected1) { if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー312!", pg_Method); Log_TextIndented s = new Log_TextIndentedImpl(); //s.Append("「E■f-cell」系要素の子要素に、「E■f-text」や「E■f-cell」が無いのか、有っても値がありませんでした。"); s.Append("「E■f-cell」の「keyValue」相当の値が指定されていませんでした。"); s.Newline(); // 一覧 s.Append("──────────子要素名一覧"); s.Newline(); ec_SfCell.List_Expression_Child.ForEach(delegate(Expression_Node_String e_Str1, ref bool bRemove2, ref bool bBreak2) { if ("" == e_Str1.Cur_Configuration.Name) { s.Append("E■(要素名無し)"); s.Newline(); } else { s.Append("E■"); s.Append(e_Str1.Cur_Configuration.Name); s.Newline(); } }); s.Append("──────────"); s.Newline(); // ヒント s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } } if (log_Reports.Successful) { // // <f-cell>1つにつき。 // ExpressionToMemory_FcellImpl to = new ExpressionToMemory_FcellImpl(); to.Translate( sValue_Output, ec_KeyExpected1, ec_SfCell,// <f-cell>相当と想定。 moApplication, log_Reports ); } 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_EndMethod: pg_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// /// </summary> /// <param name="e_Result">検索結果。</param> /// <param name="name"></param> /// <param name="bRequired"></param> /// <param name="hits"></param> /// <param name="log_Reports"></param> /// <returns>検索結果が1件以上あれば真。</returns> public bool TrySelect( out Expression_Node_String out_Result_Expr, string name, EnumHitcount hits, Log_Reports log_Reports//bug:ヌルのことがある? ) { Log_Method log_Method = new Log_MethodImpl(); log_Method.BeginMethod(Info_Syntax.Name_Library, this, "TrySelect", log_Reports); // bool isHit; if (this.dicExpression_Item.ContainsKey(name)) { // ヒット。 out_Result_Expr = this.dicExpression_Item[name]; isHit = true; } else { // 一致なし。 isHit = false; if (Utility_Hitcount.IsError_IfNoHit(hits, log_Reports)) { //エラーにする。 out_Result_Expr = null; goto gt_Error_NotFoundOne; } else { // 該当しないキーを指定され、値を取得できなかったが、エラー報告しない。 Configurationtree_Node parent_Conf = new Configurationtree_NodeImpl("!ハードコーディング_NStringDictionaryImpl#Get", null); out_Result_Expr = new Expression_Leaf_StringImpl(null, parent_Conf); } } goto gt_EndMethod; // #region 異常系 //──────────────────────────────────────── gt_Error_NotFoundOne: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー141!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("指定された名前["); s.Append(name); s.Append("]は、“EDic(連想配列)”の中にありませんでした。"); s.Newline(); s.Append("┌────────┐キー一覧(個数=["); s.Append(this.dicExpression_Item.Count); s.Append("])"); s.Newline(); foreach (string sKey in this.dicExpression_Item.Keys) { s.Append("["); s.Append(sKey); s.Append("]"); s.Newline(); } s.Append("└────────┘"); s.Newline(); // ヒント if (null != this.Owner_Conf) { s.Append("◆オーナー情報1"); s.Newline(); this.Owner_Conf.ToText_Content(s); } if (0 < this.dicExpression_Item.Count) { foreach (Expression_Node_String e_Item in this.dicExpression_Item.Values) { Expression_Node_String e_Parent = e_Item.Parent_Expression; if (null != e_Parent)//親要素が設定されていないことがある。 { // 最初の1個。 s.Append("◆最初の要素の親の情報。"); s.Newline(); e_Parent.ToText_Snapshot(s); } break; } } // // オーナーの情報。 if (null != this.owner_Conf)//オーナー要素が設定されていないことがある。 { s.Newline(); s.Newline(); s.Append("◆オーナー情報2。"); s.Newline(); this.owner_Conf.ToText_Locationbreadcrumbs(s); } r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // gt_EndMethod: log_Method.EndMethod(log_Reports); return(isHit); }
//──────────────────────────────────────── /// <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); }
//──────────────────────────────────────── /// <summary> /// 例えば ("access",”from”)と指定すれば、 /// 指定リストの要素の中で <~ access=”from,to”> といった属性を持つものはヒットする。 /// /// 選択アイテムをリストから除外するなら bRemove=true にします。 /// </summary> /// <param name="sName"></param> /// <param name="sExpectedValue"></param> /// <param name="request_Items"></param> /// <param name="log_Reports"></param> /// <returns></returns> private static List <Expression_Node_String> SelectItemsByPmAsCsv_Full_( List <Expression_Node_String> ecList_Item, string sPmName, bool bUnconditional,//無条件一致なら真 string sExpectedValue, bool bRemove, EnumHitcount hits, Log_Reports log_Reports ) { Log_Method pg_Method = new Log_MethodImpl(0); pg_Method.BeginMethod(Info_Controls.Name_Library, "Util_E_NodeImpl", "SelectItemsByAttrAsCsv_Full_", log_Reports); // // //Util_E_NodeImpl dammy_This = new Util_E_NodeImpl(); List <Expression_Node_String> ecList_Result = new List <Expression_Node_String>(); for (int nI = 0; nI < ecList_Item.Count; nI++) { Expression_Node_String ec_Item = ecList_Item[nI]; if (log_Reports.Successful) { Expression_Node_String ec_AttrValue; bool bHit = ec_Item.TrySelectAttribute(out ec_AttrValue, sPmName, EnumHitcount.One_Or_Zero, log_Reports); if (bHit) { string sAttrValue = ec_AttrValue.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); CsvTo_ListImpl to = new CsvTo_ListImpl(); List <string> sList_Value = to.Read(sAttrValue); bool bHit10 = false; if (bUnconditional) { //if(""!=sAttrValue) //{ bHit = true; //} } else if (sList_Value.Contains(sExpectedValue)) { bHit10 = true; } if (bHit10) { ecList_Result.Add(ec_Item); if (bRemove) { // 削除 ecList_Item.RemoveAt(nI); nI--; } if (EnumHitcount.First_Exist == hits || EnumHitcount.First_Exist_Or_Zero == hits) { // 最初の1件で削除は終了。複数件ヒットするかどうかは判定しない。 break; } } } } } //ystem.Console.WriteLine(Info_Forms.LibraryName + ":Util_E_NodeImpl.GetItemsByAttrAsCsv: 直後 list_E_Result.Count=[" + list_E_Result.Count + "]"); if (EnumHitcount.One == hits) { // 必ず1件だけヒットする想定。 if (ecList_Result.Count != 1) { goto gt_Error_NotOne; } } else if (EnumHitcount.First_Exist == hits) { // 必ずヒットする。複数件あれば、最初の1件だけ取得。 if (0 == ecList_Result.Count) { goto gt_Error_NoHit; } else if (1 < ecList_Result.Count) { ecList_Result.RemoveRange(1, ecList_Result.Count - 1); } } else if (EnumHitcount.First_Exist_Or_Zero == hits) { // ヒットすれば最初の1件だけ、ヒットしなければ0件の想定。 if (1 < ecList_Result.Count) { ecList_Result.RemoveRange(1, ecList_Result.Count - 1); } } else { } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NoHit: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー102!", pg_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("必ず、1件以上ヒットする指定でしたが、["); s.Append(ecList_Result.Count); s.Append("]件ヒットしました。"); s.Newline(); s.Newline(); s.AppendI(1, "ヒット件数=["); s.Append(ecList_Result.Count); s.Append("]"); s.Newline(); s.AppendI(1, "items.Count=["); s.Append(ecList_Item.Count); s.Append("]"); s.Newline(); s.AppendI(1, "sPmName=["); s.Append(sPmName); s.Append("]"); s.Newline(); s.AppendI(1, "無条件一致か?=["); s.Append(bUnconditional); s.Append("]"); s.Newline(); s.AppendI(1, "sExpectedValue=["); s.Append(sExpectedValue); s.Append("]"); s.Newline(); s.AppendI(1, "bRemove=["); s.Append(bRemove); s.Append("]"); s.Newline(); s.AppendI(1, "request_Items=["); s.Append(hits); s.Append("]"); s.Newline(); s.Append("┌────────┐処理後に残った内容 要素数=["); s.Append(ecList_Item.Count); s.Append("]"); s.Newline(); foreach (Expression_Node_String e_Item2 in ecList_Item) { string sAttrNameValue; bool bHit = e_Item2.TrySelectAttribute(out sAttrNameValue, sPmName, EnumHitcount.One_Or_Zero, log_Reports); s.AppendI(1, "・「E■["); s.Append(e_Item2.Cur_Configuration.Name); s.Append("] name=”["); s.Append(sAttrNameValue); s.Append("] 値=”["); s.Append(e_Item2.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports)); s.Append("]”」"); s.Newline(); e_Item2.ToText_Snapshot(s); } s.Append("└────────┘"); s.Newline(); // ヒント if (1 < ecList_Item.Count) { Expression_Node_String parent_Expr = ecList_Item[0].Parent_Expression; if (null != parent_Expr) { s.Append("┌────────┐先頭要素の親"); s.Newline(); parent_Expr.ToText_Snapshot(s); s.Append("└────────┘"); s.Newline(); } } r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_NotOne: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー101!", pg_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("必ず、1件のみ取得する指定でしたが、["); s.Append(ecList_Result.Count); s.Append("]件取得しました。"); s.Newline(); s.Newline(); s.AppendI(1, "sPmName=["); s.Append(sPmName); s.Append("]"); s.Newline(); s.AppendI(1, "無条件一致か?=["); s.Append(bUnconditional); s.Append("]"); s.Newline(); s.AppendI(1, "sExpectedValue=["); s.Append(sExpectedValue); s.Append("]"); s.Newline(); s.AppendI(1, "bRemove=["); s.Append(bRemove); s.Append("]"); s.Newline(); // ヒント r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: pg_Method.EndMethod(log_Reports); return(ecList_Result); }
//──────────────────────────────────────── public void ToMemory_DataTargetFcell( string sValue_Output, 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, "ToM_DataTargetFcell", 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; } // ■f-cellの子要素 Expression_Node_String ec_KeyExpected1 = null; int nKeyCount = 0; { // //「E■f-cell」の子要素のリスト。 ec_SfCell.List_Expression_Child.ForEach(delegate(Expression_Node_String e_Item, ref bool bRemove2, ref bool bBreak2) { // キー値 が1つ入っています。 ec_KeyExpected1 = e_Item; nKeyCount++; }); } // それでも @keyValueを取得できなければ。 if (null == ec_KeyExpected1) { //「E■rec-cond」を調べる。 Expression_Node_String ec_Where; bool bHit2 = ec_SfCell.TrySelectAttribute(out ec_Where, PmNames.S_WHERE.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); if (bHit2) { 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) { //ystem.Console.WriteLine(Info_Forms.LibraryName + ":" + this.GetType().Name + "#ToM: 「E■f-cell」の「E■@where」属性の下の「E■fnc」を解析。その子要素がvalue相当であるはず。"); ec_KeyExpected1 = e_Item; } else { } }); } } if (1 < nKeyCount) { ec_KeyExpected1 = null; if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー311!", pg_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("「E■f-cell」系要素の子要素が、「E■rec-cond」を除いて[" + nKeyCount + "]個ありました。"); s.Newline(); s.Append("この子要素は キー値になるもので、1個でなければいけません。"); s.Newline(); // 一覧 s.Append("──────────子要素名一覧"); s.Newline(); ec_SfCell.List_Expression_Child.ForEach(delegate(Expression_Node_String e_Str1, ref bool bRemove2, ref bool bBreak2) { if ("" == e_Str1.Cur_Configuration.Name) { s.Append("E■(要素名無し)"); s.Newline(); } else { s.Append("E■"); s.Append(e_Str1.Cur_Configuration.Name); s.Newline(); } }); s.Append("──────────"); s.Newline(); // ヒント s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } } else if (null == ec_KeyExpected1) { if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー312!", pg_Method); Log_TextIndented s = new Log_TextIndentedImpl(); //s.Append("「E■f-cell」系要素の子要素に、「E■f-text」や「E■f-cell」が無いのか、有っても値がありませんでした。"); s.Append("「E■f-cell」の「keyValue」相当の値が指定されていませんでした。"); s.Newline(); // 一覧 s.Append("──────────子要素名一覧"); s.Newline(); ec_SfCell.List_Expression_Child.ForEach(delegate(Expression_Node_String e_Str1, ref bool bRemove2, ref bool bBreak2) { if ("" == e_Str1.Cur_Configuration.Name) { s.Append("E■(要素名無し)"); s.Newline(); } else { s.Append("E■"); s.Append(e_Str1.Cur_Configuration.Name); s.Newline(); } }); s.Append("──────────"); s.Newline(); // ヒント s.Append(r.Message_Configuration(ec_SfCell.Cur_Configuration)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } } if (log_Reports.Successful) { // // <f-cell>1つにつき。 // ExpressionToMemory_FcellImpl to = new ExpressionToMemory_FcellImpl(); to.Translate( sValue_Output, ec_KeyExpected1, ec_SfCell,// <f-cell>相当と想定。 moApplication, log_Reports ); } 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_EndMethod: pg_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <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 アクション //──────────────────────────────────────── public override string Execute5_Main(Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute5_Main", log_Reports); string sFncName0; this.TrySelectAttribute(out sFncName0, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); if (log_Reports.CanStopwatch) { log_Method.Log_Stopwatch.Message = "Nアクション[" + sFncName0 + "]実行"; log_Method.Log_Stopwatch.Begin(); } // // Expression_Node_String err_Ec_FcName1; if (this.EnumEventhandler == EnumEventhandler.O_Lr) { if (this.Functionparameterset.Sender is Customcontrol) { Customcontrol fcCc = (Customcontrol)this.Functionparameterset.Sender; string sName_Usercontrol = fcCc.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString( EnumHitcount.Unconstraint, log_Reports ); log_Reports.Comment_EventCreationMe = "[" + sName_Usercontrol + "]コントロールが、[" + sFncName0 + "]アクションを実行。"; } else { log_Reports.Comment_EventCreationMe = "[" + sFncName0 + "]アクションを実行。"; } // // // // // // このNAction29を含んでいるcontrol要素から // コントロールの名前を取得。 Expression_Node_String ec_FcName1; // // このNAction29要素を含んでいる control要素から、コントロールの名前を取得。 List <Usercontrol> list_FcUc; if (log_Reports.Successful) { // 正常時 Configuration_Node cf_Event = this.Cur_Configuration.GetParentByNodename( NamesNode.S_EVENT, EnumConfiguration.Unknown, false, log_Reports); if (null != cf_Event) { Configuration_Node owner_Configurationtree_Control = cf_Event.GetParentByNodename( NamesNode.S_CONTROL1, EnumConfiguration.Tree, true, log_Reports); if (null != owner_Configurationtree_Control) { string sName_Usercontrol; ((Configurationtree_Node)owner_Configurationtree_Control).Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_Usercontrol, true, log_Reports); Expression_Node_StringImpl ec_Str = new Expression_Node_StringImpl(this, this.Cur_Configuration); ec_Str.AppendTextNode( sName_Usercontrol, this.Cur_Configuration, log_Reports ); ec_FcName1 = ec_Str; } else { ec_FcName1 = null; } } else { ec_FcName1 = null; } // // 指定のコントロール // list_FcUc = this.Owner_MemoryApplication.MemoryForms.GetUsercontrolsByName( ec_FcName1, true, log_Reports ); } else { // // エラー。 ec_FcName1 = null; list_FcUc = null; err_Ec_FcName1 = ec_FcName1; goto gt_Error_NullFcUc; } // ここで、fcUc は必ずある。 Usercontrol fct = list_FcUc[0]; // // // // View // // // // 最初の1個のみ有効。必ずあるとする。 List <Expression_Node_String> ecList_View = fct.ControlCommon.Expression_Control.SelectDirectchildByNodename(NamesNode.S_VIEW, false, EnumHitcount.One, log_Reports); if (!log_Reports.Successful) { goto gt_EndMethod; } Expression_Node_StringImpl ec_View = (Expression_Node_StringImpl)ecList_View[0]; // // O → N は、Fcnfをロードした時点で実行済み。 if (ec_View.List_Expression_Child.Count < 1) { // // エラー。 // // このアクションを使うからには、 // 必ず<view>の中に子要素がないといけない。 err_Ec_FcName1 = ec_FcName1; goto gt_Error_EmptyView; } object errorRule = null; Expression_Node_String err_Ec_DataTarget = null; if (log_Reports.Successful) { // 正常時 ec_View.List_Expression_Child.ForEach(delegate(Expression_Node_String ec_Child, ref bool bRemove, ref bool bBreak) { string sFncName; ec_Child.TrySelectAttribute(out sFncName, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); if ( NamesNode.S_FNC == ec_Child.Cur_Configuration.Name && NamesFnc.S_LISTBOX_LABELS == sFncName ) { // <f-list-box-labels> // // fcUc は、必ずリストボックス。 if (!(fct is UsercontrolListbox)) { // // エラー。 goto gt_Error_NotListbox; } UsercontrolListbox uctLst = (UsercontrolListbox)fct; // // リストボックスの表示を自作します。項目の高さが固定の場合。 uctLst.DrawMode = DrawMode.OwnerDrawFixed; // // N → Uc // // 描画プログラムの作成。 ListboxItemDrawer_02Impl drawer = new ListboxItemDrawer_02Impl( this.Owner_MemoryApplication); // // item-valur-to-variable="" 属性 // //if (null == nF11.E_ItemValueToVariable) { // <データ access="to">から取りたい。 Expression_Node_String ec_ItemValueToVariable = null;//ソース情報利用 List <Expression_Node_String> ecList_DataTarget; { List <Expression_Node_String> ecList_Data = uctLst.ControlCommon.Expression_Control.SelectDirectchildByNodename(NamesNode.S_DATA, false, EnumHitcount.Unconstraint, log_Reports); ecList_DataTarget = Utility_Expression_NodeImpl.SelectItemsByPmAsCsv(ecList_Data, PmNames.S_ACCESS.Name_Pm, ValuesAttr.S_TO, false, EnumHitcount.First_Exist, log_Reports); } if (!log_Reports.Successful) { goto gt_EndMethod2; } Expression_Node_String ec_DataTarget = ecList_DataTarget[0]; err_Ec_DataTarget = ec_DataTarget; if (null != ec_DataTarget) { bool bHit = ec_DataTarget.TrySelectAttribute( out ec_ItemValueToVariable, PmNames.S_NAME_VAR.Name_Pm, EnumHitcount.One, log_Reports); if (bHit) { drawer.Expression_ValueVariableName = ec_ItemValueToVariable; } else { // エラー。 goto gt_Error_NullItemValueToVariable; } } else { // エラー。 goto gt_Error_NotFoundDataTarget; } } //else //{ // // // // 変数名設定。 // drawer.Ec_ValueVariableName = nF11.E_ItemValueToVariable; //} // // <fnc name=”Sf:item-label;”> List <Expression_Node_String> ecList_Fnc = ec_Child.SelectDirectchildByNodename(NamesNode.S_FNC, false, EnumHitcount.Unconstraint, log_Reports); ecList_Fnc = Utility_Expression_NodeImpl.SelectItemsByPmAsCsv(ecList_Fnc, PmNames.S_NAME.Name_Pm, NamesFnc.S_ITEM_LABEL2, false, EnumHitcount.First_Exist, log_Reports); if (!log_Reports.Successful) { // エラー。 goto gt_EndMethod2; } drawer.Expression_ItemLabel = ecList_Fnc[0]; if (log_Reports.Successful) { // // 描画プログラムの変更。 uctLst.ListboxItemDrawer = drawer; } } else { errorRule = ec_Child; // // エラー。未定義の<view>。 goto gt_Error_UndefinedView; } goto gt_EndMethod2; // // // // // // エラー。 gt_Error_NotListbox: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, ec_FcName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), log_Reports); //コントロール名 tmpl.SetParameter(2, fct.GetType().Name, log_Reports); //コントロールのクラス名 this.Owner_MemoryApplication.CreateErrorReport("Er:110019;", tmpl, log_Reports); } goto gt_EndMethod2; // // エラー。 gt_Error_NotFoundDataTarget: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, ec_FcName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), log_Reports);//コントロール名 this.Owner_MemoryApplication.CreateErrorReport("Er:110020;", tmpl, log_Reports); } goto gt_EndMethod2; // // エラー。 gt_Error_NullItemValueToVariable: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, PmNames.S_NAME_VAR.Name_Pm, log_Reports); //引数名NameVar tmpl.SetParameter(2, ec_FcName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), log_Reports); //コントロール名 // // 「access="to"」要素を取得しているような。 // Log_TextIndented s1 = new Log_TextIndentedImpl(); err_Ec_DataTarget.ToText_Snapshot(s1); tmpl.SetParameter(3, s1.ToString(), log_Reports);//データターゲットの変数の中身 Log_TextIndented s2 = new Log_TextIndentedImpl(); err_Ec_DataTarget.Cur_Configuration.ToText_Content(s2); tmpl.SetParameter(4, s2.ToString(), log_Reports);//データターゲットの設定の中身 this.Owner_MemoryApplication.CreateErrorReport("Er:110021;", tmpl, log_Reports); } goto gt_EndMethod2; // // エラー。 gt_Error_UndefinedView: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, errorRule.GetType().Name, log_Reports); //要素のクラス名 tmpl.SetParameter(2, ec_Child.Cur_Configuration.Name, log_Reports); //設定の子要素のノード名 tmpl.SetParameter(3, sFncName, log_Reports); //設定の子要素の関数名 this.Owner_MemoryApplication.CreateErrorReport("Er:110022;", tmpl, log_Reports); } goto gt_EndMethod2; gt_EndMethod2: ; }); // // 「表示プログラム」を作成、 // リストボックスにその「リスト作成プログラム」を渡す。 // リストボックスは再表示されるたびに、 // その「リスト作成プログラム」を実行。 // 以下、その「表示プログラム」の内容。 // // ループカウンタの回数だけ、リストに項目を追加。 // // その内容は、値が<a-item-value>から取得。 // // その内容は、表示ラベルが<a-item-label>から取得。 // // その表示ラベルは、次の条件に一致した時、グレー色にする。 // // <a-item-gray-out> // <f-all-true> // <a-empty-field> } goto gt_EndMethod; } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NullFcUc: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, err_Ec_FcName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), log_Reports);//コントロール名 this.Owner_MemoryApplication.CreateErrorReport("Er:110023;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_EmptyView: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, err_Ec_FcName1.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), log_Reports);//検索ヒット数 this.Owner_MemoryApplication.CreateErrorReport("Er:110024;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return(""); }
//──────────────────────────────────────── public override void Translate( Configurationtree_Node cur_Cf,//「S■fnc」 Expression_Node_String parent_Ec,//「S■fnc」、や「S■event」か? MemoryApplication memoryApplication, Log_TextIndented_ConfigurationtreeToExpression pg_ParsingLog, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_ConfigurationtreeToExpression.Name_Library, this, "SToE",log_Reports); if (log_Method.CanDebug(1)) { pg_ParsingLog.Increment("(29)" + cur_Cf.Name); } // // // // if (!log_Reports.Successful) { goto gt_EndMethod; } if (null == parent_Ec) { goto gt_Error_NullParent; } // // // // 自 // // // Expression_Node_String cur_Ec = null; //「E■fnc」 // // 親ファンク名 // 自ファンク名 // string parent_SName_Fnc = ""; string sName_MyFnc = ""; { bool bHit9 = parent_Ec.TrySelectAttribute(out parent_SName_Fnc, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); if (!log_Reports.Successful) { goto gt_EndMethod; } else if (NamesNode.S_FNC == parent_Ec.Cur_Configuration.Name && "" == parent_SName_Fnc) { // // エラー。親要素が、name属性を持たない「E■fnc」だった。 // goto gt_Error_NoNameParent1; } } // 「E■fnc」には、name=”★”属性が必須。 bool bHit = cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sName_MyFnc, true, log_Reports); if (!log_Reports.Successful) { goto gt_EndMethod; } // // // // 自 // // // if (log_Reports.Successful) { // 「E■fnc」要素を作成。 if (NamesFnc.S_ALL_TRUE == sName_MyFnc) { cur_Ec = Expressionv_5FAllTrueImpl.Create(parent_Ec, cur_Cf, memoryApplication); } else if (NamesFnc.S_TEXT_TEMPLATE == sName_MyFnc) { cur_Ec = Expression_SftextTemplate.Create(parent_Ec, cur_Cf, memoryApplication); } else if (NamesFnc.S_CELL == sName_MyFnc) { if (log_Method.CanDebug(10)) { log_Method.WriteDebug_ToConsole( "(2) 「S■fnc name=”[" + sName_MyFnc + "]”」要素 属性解析開始。"); } cur_Ec = Expression_SfcellImpl.Create(parent_Ec, cur_Cf, memoryApplication); } else if (NamesFnc.S_VALUE_CONTROL == sName_MyFnc) { // コントロール名を取得し、コントロールの値を返すように設定。 string sFcName; cur_Cf.Dictionary_Attribute.TryGetValue(PmNames.S_VALUE, out sFcName, true, log_Reports); if (!log_Reports.Successful) { goto gt_EndMethod; } Expression_Node_String ec_FcName = new Expression_Leaf_StringImpl(sFcName, parent_Ec, cur_Cf); cur_Ec = new Expression_ValuecontrolImpl(ec_FcName, memoryApplication, parent_Ec, cur_Cf); } else if (NamesFnc.S_SWITCH == sName_MyFnc) { if(log_Method.CanDebug(1)) { Log_TextIndented s = new Log_TextIndentedImpl(); parent_Ec.ToText_Snapshot(s); log_Method.WriteDebug_ToConsole( "E■switch生成。s=" + s.ToString()); } cur_Ec = Expression_SfswitchImpl.Create(parent_Ec, cur_Cf); } else { if(sName_MyFnc.StartsWith(NamesFnc.S_UF)) { // ユーザー定義関数 cur_Ec = new Expression_FfncImpl(parent_Ec, cur_Cf, memoryApplication); } else { // システム定義関数 cur_Ec = new Expression_Node_StringImpl(parent_Ec, cur_Cf); } } } else { goto gt_EndMethod; } // // // // 属性 // // // if (log_Reports.Successful) { // 元からあった。 this.ParseAttr_InConfigurationtreeToExpression( cur_Cf, cur_Ec, true,//name属性は必須。 false,//value属性は、子<f-str>にしない。 log_Reports ); } // // // // 子 // // // if (log_Reports.Successful) { if(NamesFnc.S_TEXT_TEMPLATE == sName_MyFnc) { this.ParseChild_SpecialTextTemplate_( cur_Cf, cur_Ec, memoryApplication, pg_ParsingLog, log_Reports ); } else if (NamesFnc.S_SWITCH == sName_MyFnc) { this.ParseChild_SpecialSwitch_( cur_Cf,//「S■fnc」 cur_Ec,//「E■fnc」 memoryApplication, pg_ParsingLog, log_Reports ); } else if (NamesFnc.S_VLD_EMPTY_FIELD == sName_MyFnc) { // <a-empty-field>要素 ConfigurationtreeToExpression_V55_AEmptyFieldImpl_ to = new ConfigurationtreeToExpression_V55_AEmptyFieldImpl_(); to.Translate( cur_Cf, cur_Ec, memoryApplication, pg_ParsingLog, log_Reports ); } else { // この「S□fnc」の子を解析。 // 「Sf:cell;」 // 「Sf:where;」 // 「Sf:rec-cond;」 // 【追加 2012-06-02】 this.ParseChild_SpecialFnc_( cur_Cf, cur_Ec, memoryApplication, pg_ParsingLog, log_Reports ); } } else { goto gt_EndMethod; } // // // // 親へ連結 // // // if (log_Reports.Successful) { // // "hardcoding-control" に追加する子要素としては、f-cellなどがある。 // if ( sName_MyFnc.StartsWith(NamesFnc.S_UF)//ユーザー定義関数 || NamesFnc.S_TEXT_TEMPLATE == sName_MyFnc//テンプレート || NamesFnc.S_SWITCH == sName_MyFnc//スイッチ文 || (NamesNode.S_FNC == cur_Cf.Name && NamesFnc.S_VALUE_CONTROL == sName_MyFnc)//todo: || (NamesNode.S_FNC == parent_Ec.Cur_Configuration.Name) || (NamesFnc.S_CELL == sName_MyFnc || NamesFnc.S_TEXT_TEMPLATE == sName_MyFnc) || (sName_MyFnc == NamesFnc.S_REC_COND && NamesNode.S_FNC == parent_Ec.Cur_Configuration.Name && NamesFnc.S_WHERE == parent_SName_Fnc)//親が<rec-cond>で、自<fnc name=”Sf:Where;”>要素 ) { parent_Ec.List_Expression_Child.Add(cur_Ec, log_Reports); } else { // エラー goto gt_Error_CanNotAddParent; // todo: //throw new Exception(Info_SToE.LibraryName + ":" + this.GetType().Name + "#SToE:(18)★★親要素へ連結不能 ・親「E■[" + e_Parent.Cur_Configurationtree.Name + "] name=”[" + sParentFncName + "]”」 ← 自「S■[" + s_AFnc.Name_Node + "] name=”[" + sFncName + "]”」中止。 /エラー。親要素に追加しようとしましたが、予想しない親要素でした。"); } } // // // 終わり際に、デバッグ // // if (log_Method.CanDebug(10) && log_Reports.Successful) { if (null != cur_Ec)//既にエラーが出ている場合。 { log_Method.WriteDebug_ToConsole("(19) 自要素の属性の数=[" + cur_Ec.Dictionary_Expression_Attribute.Count + "]"); log_Method.WriteDebug_ToConsole("(21) ┌────┐自要素。その子要素の数=[" + cur_Ec.List_Expression_Child.Count + "]"); cur_Ec.List_Expression_Child.ForEach( delegate(Expression_Node_String e_Child, ref bool bRemove, ref bool bBreak) { log_Method.WriteDebug_ToConsole("「S■" + e_Child.Cur_Configuration.Name + "」"); }); log_Method.WriteDebug_ToConsole( "(22) └────┘"); log_Method.WriteDebug_ToConsole( "(23)└────────────────┘ 「S■[" + cur_Cf.Name + "] name=”[" + sName_MyFnc + "]”」(fnc)要素解析終了。"); // // name属性の指定は必須です。 // string sName8; bool bHit8 = cur_Ec.TrySelectAttribute(out sName8, PmNames.S_NAME.Name_Pm, EnumHitcount.One, log_Reports); if (!bHit8) { // todo: throw new Exception(Info_ConfigurationtreeToExpression.Name_Library + ":" + this.GetType().Name + "#SToE:(24)fnc要素にname属性が指定されていないのはエラーです①。"); } else if ("" == sName8) { // todo: //throw new Exception(Info_SToE.LibraryName + ":" + this.GetType().Name + "#SToE:(24)fnc要素に空文字列のname属性が指定されているのはエラーです。"); goto gt_Error_NoNameParent2; } } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_CanNotAddParent: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, cur_Cf.Name, log_Reports);//設定ノード名 tmpl.SetParameter(2, sName_MyFnc, log_Reports);//関数名 if (null != cur_Ec) { tmpl.SetParameter(3, cur_Ec.Dictionary_Expression_Attribute.Count.ToString(), log_Reports);//属性の数 //属性リスト StringBuilder s1 = new StringBuilder(); cur_Ec.Dictionary_Expression_Attribute.ForEach( delegate(string sName2, Expression_Node_String e_Attr2, ref bool bBreak) { s1.Append("属" + sName2 + "=”" + e_Attr2.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "”\n"); }); tmpl.SetParameter(4, s1.ToString(), log_Reports); tmpl.SetParameter(5, cur_Ec.List_Expression_Child.Count.ToString(), log_Reports);//子要素の数 //子要素リスト StringBuilder s2 = new StringBuilder(); cur_Ec.List_Expression_Child.ForEach( delegate(Expression_Node_String e_Child, ref bool bRemove, ref bool bBreak) { s2.Append("子「S■" + e_Child.Cur_Configuration.Name + "」\n"); }); tmpl.SetParameter(6, s2.ToString(), log_Reports); tmpl.SetParameter(7, NamesNode.S_ARG, log_Reports);//期待の親設定ノード名 tmpl.SetParameter(8, PmNames.S_WHERE.Name_Pm, log_Reports);//期待の親設定関数名 } else { tmpl.SetParameter(3, "ヌル", log_Reports);//設定属性の数 tmpl.SetParameter(4, "ヌル", log_Reports);//設定属性リスト tmpl.SetParameter(5, "ヌル", log_Reports);//設定子要素の数 tmpl.SetParameter(6, "ヌル", log_Reports);//設定子要素リスト tmpl.SetParameter(7, "ヌル", log_Reports);//期待の親設定ノード名 tmpl.SetParameter(8, "ヌル", log_Reports);//期待の親設定関数名 } if (null != parent_Ec) { tmpl.SetParameter(9, parent_Ec.Cur_Configuration.Name, log_Reports);//実際の親Expression要素ノード名 tmpl.SetParameter(10, parent_SName_Fnc, log_Reports);//実際の親Expression要素関数名 tmpl.SetParameter(11, parent_Ec.Dictionary_Expression_Attribute.Count.ToString(), log_Reports);//Expression属性の数 StringBuilder s3 = new StringBuilder(); parent_Ec.Dictionary_Expression_Attribute.ForEach( delegate(string sName2, Expression_Node_String e_Attr2, ref bool bBreak) { s3.Append("属" + sName2 + "=”" + e_Attr2.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "”\n"); }); tmpl.SetParameter(12, s3.ToString(), log_Reports);//子Expression属性リスト tmpl.SetParameter(13, parent_Ec.List_Expression_Child.Count.ToString(), log_Reports);//子Expression要素数 StringBuilder s4 = new StringBuilder(); parent_Ec.List_Expression_Child.ForEach( delegate(Expression_Node_String e_Child, ref bool bRemove, ref bool bBreak) { s4.Append("子「S■" + e_Child.Cur_Configuration.Name + "」\n"); }); tmpl.SetParameter(14, s4.ToString(), log_Reports);//子Expression要素リスト } else { tmpl.SetParameter(9, "ヌル", log_Reports);//実際の親Expression要素ノード名 tmpl.SetParameter(10, "ヌル", log_Reports);//実際の親Expression要素関数名 tmpl.SetParameter(11, "ヌル", log_Reports);//Expression属性の数 tmpl.SetParameter(12, "ヌル", log_Reports);//子Expression属性リスト tmpl.SetParameter(13, "ヌル", log_Reports);//子Expression要素数 tmpl.SetParameter(14, "ヌル", log_Reports);//子Expression要素リスト } tmpl.SetParameter(15, Log_RecordReportsImpl.ToText_Configuration(parent_Ec.Cur_Configuration), log_Reports);//設定位置パンくずリスト memoryApplication.CreateErrorReport("Er:7021;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_NoNameParent2: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, cur_Cf.Name, log_Reports);//設定ノード名 tmpl.SetParameter(2, sName_MyFnc, log_Reports);//関数名 if (null != cur_Ec) { tmpl.SetParameter(3, cur_Ec.Dictionary_Expression_Attribute.Count.ToString(), log_Reports);//属性の数 //属性リスト StringBuilder s1 = new StringBuilder(); cur_Ec.Dictionary_Expression_Attribute.ForEach( delegate(string sName2, Expression_Node_String e_Attr2, ref bool bBreak) { s1.Append("属" + sName2 + "=”" + e_Attr2.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "”\n"); }); tmpl.SetParameter(4, s1.ToString(), log_Reports); tmpl.SetParameter(5, cur_Ec.List_Expression_Child.Count.ToString(), log_Reports);//子要素の数 //子要素リスト StringBuilder s2 = new StringBuilder(); cur_Ec.List_Expression_Child.ForEach( delegate(Expression_Node_String e_Child, ref bool bRemove, ref bool bBreak) { s2.Append("子「S■" + e_Child.Cur_Configuration.Name + "」\n"); }); tmpl.SetParameter(6, s2.ToString(), log_Reports); tmpl.SetParameter(7, NamesNode.S_ARG, log_Reports);//期待の親設定ノード名 tmpl.SetParameter(8, PmNames.S_WHERE.Name_Pm, log_Reports);//期待の親設定関数名 } else { tmpl.SetParameter(3, "ヌル", log_Reports);//設定属性の数 tmpl.SetParameter(4, "ヌル", log_Reports);//設定属性リスト tmpl.SetParameter(5, "ヌル", log_Reports);//設定子要素の数 tmpl.SetParameter(6, "ヌル", log_Reports);//設定子要素リスト tmpl.SetParameter(7, "ヌル", log_Reports);//期待の親設定ノード名 tmpl.SetParameter(8, "ヌル", log_Reports);//期待の親設定関数名 } if (null != parent_Ec) { tmpl.SetParameter(9, parent_Ec.Cur_Configuration.Name, log_Reports);//実際の親Expression要素ノード名 tmpl.SetParameter(10, parent_SName_Fnc, log_Reports);//実際の親Expression要素関数名 tmpl.SetParameter(11, parent_Ec.Dictionary_Expression_Attribute.Count.ToString(), log_Reports);//Expression属性の数 StringBuilder s3 = new StringBuilder(); parent_Ec.Dictionary_Expression_Attribute.ForEach( delegate(string sName2, Expression_Node_String e_Attr2, ref bool bBreak) { s3.Append("属" + sName2 + "=”" + e_Attr2.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "”\n"); }); tmpl.SetParameter(12, s3.ToString(), log_Reports);//子Expression属性リスト tmpl.SetParameter(13, parent_Ec.List_Expression_Child.Count.ToString(), log_Reports);//子Expression要素数 StringBuilder s4 = new StringBuilder(); parent_Ec.List_Expression_Child.ForEach( delegate(Expression_Node_String e_Child, ref bool bRemove, ref bool bBreak) { s4.Append("子「S■" + e_Child.Cur_Configuration.Name + "」\n"); }); tmpl.SetParameter(14, s4.ToString(), log_Reports);//子Expression要素リスト } else { tmpl.SetParameter(9, "ヌル", log_Reports);//実際の親Expression要素ノード名 tmpl.SetParameter(10, "ヌル", log_Reports);//実際の親Expression要素関数名 tmpl.SetParameter(11, "ヌル", log_Reports);//Expression属性の数 tmpl.SetParameter(12, "ヌル", log_Reports);//子Expression属性リスト tmpl.SetParameter(13, "ヌル", log_Reports);//子Expression要素数 tmpl.SetParameter(14, "ヌル", log_Reports);//子Expression要素リスト } tmpl.SetParameter(15, Log_RecordReportsImpl.ToText_Configuration(parent_Ec.Cur_Configuration), log_Reports);//設定位置パンくずリスト memoryApplication.CreateErrorReport("Er:7022;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_NoNameParent1: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, cur_Cf.Name, log_Reports);//設定ノード名 tmpl.SetParameter(2, sName_MyFnc, log_Reports);//関数名 if (null != cur_Ec) { tmpl.SetParameter(3, cur_Ec.Dictionary_Expression_Attribute.Count.ToString(), log_Reports);//属性の数 //属性リスト StringBuilder s1 = new StringBuilder(); cur_Ec.Dictionary_Expression_Attribute.ForEach( delegate(string sName2, Expression_Node_String e_Attr2, ref bool bBreak) { s1.Append("属" + sName2 + "=”" + e_Attr2.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "”\n"); }); tmpl.SetParameter(4, s1.ToString(), log_Reports); tmpl.SetParameter(5, cur_Ec.List_Expression_Child.Count.ToString(), log_Reports);//子要素の数 //子要素リスト StringBuilder s2 = new StringBuilder(); cur_Ec.List_Expression_Child.ForEach( delegate(Expression_Node_String e_Child, ref bool bRemove, ref bool bBreak) { s2.Append("子「S■" + e_Child.Cur_Configuration.Name + "」\n"); }); tmpl.SetParameter(6, s2.ToString(), log_Reports); tmpl.SetParameter(7, NamesNode.S_ARG, log_Reports);//期待の親設定ノード名 tmpl.SetParameter(8, PmNames.S_WHERE.Name_Pm, log_Reports);//期待の親設定関数名 } else { tmpl.SetParameter(3, "ヌル", log_Reports);//設定属性の数 tmpl.SetParameter(4, "ヌル", log_Reports);//設定属性リスト tmpl.SetParameter(5, "ヌル", log_Reports);//設定子要素の数 tmpl.SetParameter(6, "ヌル", log_Reports);//設定子要素リスト tmpl.SetParameter(7, "ヌル", log_Reports);//期待の親設定ノード名 tmpl.SetParameter(8, "ヌル", log_Reports);//期待の親設定関数名 } if (null != parent_Ec) { tmpl.SetParameter(9, parent_Ec.Cur_Configuration.Name, log_Reports);//実際の親Expression要素ノード名 tmpl.SetParameter(10, parent_SName_Fnc, log_Reports);//実際の親Expression要素関数名 tmpl.SetParameter(11, parent_Ec.Dictionary_Expression_Attribute.Count.ToString(), log_Reports);//Expression属性の数 StringBuilder s3 = new StringBuilder(); parent_Ec.Dictionary_Expression_Attribute.ForEach( delegate(string sName2, Expression_Node_String e_Attr2, ref bool bBreak) { s3.Append("属" + sName2 + "=”" + e_Attr2.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports) + "”\n"); }); tmpl.SetParameter(12, s3.ToString(), log_Reports);//子Expression属性リスト tmpl.SetParameter(13, parent_Ec.List_Expression_Child.Count.ToString(), log_Reports);//子Expression要素数 StringBuilder s4 = new StringBuilder(); parent_Ec.List_Expression_Child.ForEach( delegate(Expression_Node_String e_Child, ref bool bRemove, ref bool bBreak) { s4.Append("子「S■" + e_Child.Cur_Configuration.Name + "」\n"); }); tmpl.SetParameter(14, s4.ToString(), log_Reports);//子Expression要素リスト } else { tmpl.SetParameter(9, "ヌル", log_Reports);//実際の親Expression要素ノード名 tmpl.SetParameter(10, "ヌル", log_Reports);//実際の親Expression要素関数名 tmpl.SetParameter(11, "ヌル", log_Reports);//Expression属性の数 tmpl.SetParameter(12, "ヌル", log_Reports);//子Expression属性リスト tmpl.SetParameter(13, "ヌル", log_Reports);//子Expression要素数 tmpl.SetParameter(14, "ヌル", log_Reports);//子Expression要素リスト } tmpl.SetParameter(15, Log_RecordReportsImpl.ToText_Configuration(parent_Ec.Cur_Configuration), log_Reports);//設定位置パンくずリスト memoryApplication.CreateErrorReport("Er:7023;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_NullParent: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Configuration(cur_Cf), log_Reports);//設定位置パンくずリスト memoryApplication.CreateErrorReport("Er:7004;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: if (Log_ReportsImpl.BDebugmode_Static) { pg_ParsingLog.Decrement(cur_Cf.Name); } log_Method.EndMethod(log_Reports); }