//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// データソースから値を取得し、コントロールに取り込みます。 /// /// データソースが設定されていない場合は、フォームのクリアーになります。 /// </summary> public void RefreshData( Log_Reports log_Reports ) { List <Expression_Node_String> ecList_Data = this.ControlCommon.Expression_Control.SelectDirectchildByNodename(NamesNode.S_DATA, false, EnumHitcount.Unconstraint, log_Reports); List <Expression_Node_String> ecList_DataSource = Utility_Expression_NodeImpl.SelectItemsByPmAsCsv(ecList_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 = ecList_DataSource[0]; if (null == ec_DataSource) { // データソースが未設定のとき this.Items.Clear(); } else { // データソースが設定されているとき。 // 未実装 TODO 実装すること。 } goto gt_EndMethod; // // // // gt_EndMethod: ; }
//──────────────────────────────────────── #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> /// <returns>成功すれば真。</returns> public void ToMemory( string sValue_Output, Expression_Node_String ec_Control,//「Expr■control」相当。 MemoryApplication moApplication, Log_Reports log_Reports ) { Log_Method pg_Method = new Log_MethodImpl(); pg_Method.BeginMethod(Info_Controls.Name_Library, this, "ToM", log_Reports); // // List <Expression_Node_String> listExpr_Data = ec_Control.SelectDirectchildByNodename(NamesNode.S_DATA, false, EnumHitcount.Unconstraint, log_Reports); List <Expression_Node_String> listExpr_DataTarget = Utility_Expression_NodeImpl.SelectItemsByPmAsCsv(listExpr_Data, PmNames.S_ACCESS.Name_Pm, ValuesAttr.S_TO, false, EnumHitcount.First_Exist, log_Reports); if (!log_Reports.Successful) { goto gt_EndMethod; } Expression_Node_String ec_DataTarget = listExpr_DataTarget[0]; this.ToMemory_ParentFcells( sValue_Output, ec_DataTarget, moApplication, log_Reports ); //essageBox.Show("アップデートデータ【終了】", "(FormsImpl)" + this.GetType().NFcName + "#:"); //.WriteLine(this.GetType().NFcName + "#: 【終了】"); // // // // goto gt_EndMethod; gt_EndMethod: pg_Method.EndMethod(log_Reports); // 正常終了 return; }
//──────────────────────────────────────── public void UsercontrolToMemory( Log_Reports log_Reports ) { Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); pg_Method.BeginMethod(Info_Controls.Name_Library, this, "UsercontrolToMemory", log_Reports); // // if (null == this.ControlCommon.Expression_Control) { // このコントロールに対応づくテーブル等の設定がなく、ただの空箱の場合。 // Visual Studio のビジュアルエディターで直接置いただけの時は、ここに来ます。 // 何もせず終了。 goto gt_EndMethod; } List <Expression_Node_String> ecList_Data = this.ControlCommon.Expression_Control.SelectDirectchildByNodename(NamesNode.S_DATA, false, EnumHitcount.Unconstraint, log_Reports); List <Expression_Node_String> ecList_DataTarget = Utility_Expression_NodeImpl.SelectItemsByPmAsCsv(ecList_Data, PmNames.S_ACCESS.Name_Pm, ValuesAttr.S_TO, false, EnumHitcount.First_Exist, log_Reports); if (!log_Reports.Successful) { goto gt_EndMethod; } Expression_Node_String ec_DataTarget = ecList_DataTarget[0]; if (null == ec_DataTarget) { // エラー: データターゲットが未設定のとき goto gt_Error_NullDatatarget; } else { // // データターゲットが設定されているとき // //#未実装 TODO: 実装すること。 if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー477!", pg_Method); StringBuilder t = new StringBuilder(); t.Append("コントロール=["); t.Append(this.Name); t.Append("]のUpdateDataをしようとしましたが、" + pg_Method.Fullname + " は 未実装でした。"); t.Append(Environment.NewLine); t.Append("プログラミングのミスの可能性があります。"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); // ヒント r.Message = t.ToString(); log_Reports.EndCreateReport(); } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NullDatatarget: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, this.Name, log_Reports);//コントロール名 this.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:503;", tmpl, log_Reports); } //──────────────────────────────────────── #endregion // // gt_EndMethod: pg_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// データ・ターゲットへの出力を行います。 /// /// イベント・ハンドラー以外でも、直接、データターゲットへの出力を行うことができます。 /// </summary> public void UsercontrolToMemory( Log_Reports log_Reports ) { Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); pg_Method.BeginMethod(Info_Controls.Name_Library, this, "UsercontrolToMemory", log_Reports); // // if (null == this.ControlCommon.Expression_Control) { // このコントロールに対応づくテーブル等の設定がなく、ただの空箱の場合。 // Visual Studio のビジュアルエディターで直接置いただけの時は、ここに来ます。 // 何もせず終了。 goto gt_EndMethod; } List <Expression_Node_String> ecList_Data = this.ControlCommon.Expression_Control.SelectDirectchildByNodename(NamesNode.S_DATA, false, EnumHitcount.Unconstraint, log_Reports); List <Expression_Node_String> ecList_DataTarget = Utility_Expression_NodeImpl.SelectItemsByPmAsCsv(ecList_Data, PmNames.S_ACCESS.Name_Pm, ValuesAttr.S_TO, false, EnumHitcount.First_Exist, log_Reports); if (!log_Reports.Successful) { goto gt_EndMethod; } Expression_Node_String ec_DataTarget = ecList_DataTarget[0]; if (null == ec_DataTarget) { // エラー: データターゲットが未設定のとき goto gt_Error_Nulltarget; } else { // データターゲットが設定されているとき CustomcontrolNumericUpDown ccNumericUpDown = this;//イベントハンドラーのsender引数と一致すること。 // TODO 数値型テキストボックスで空白を出力しようとしたときにエラーになるのはバグなので修正したい。 // 特にトリムは行いません。 string sValueText = ccNumericUpDown.Text; decimal valueDecimal = ccNumericUpDown.Value; ToMemory_Performer nDataTargetUpdater = new ExpressionDataTargetUpdaterImpl(); nDataTargetUpdater.ToMemory( sValueText, this.ControlCommon.Expression_Control, this.ControlCommon.Owner_MemoryApplication, log_Reports ); if (log_Reports.Successful) { // 成功時 ccNumericUpDown.BackColor = System.Drawing.SystemColors.Window; } else { // 設定失敗時。 ccNumericUpDown.BackColor = Color.Yellow; } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_Nulltarget: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, this.Name, log_Reports);//コントロール名 this.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:508;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // 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> ecList_Data = this.ControlCommon.Expression_Control.SelectDirectchildByNodename(NamesNode.S_DATA, false, EnumHitcount.Unconstraint, log_Reports); List <Expression_Node_String> ecList_DataSource = Utility_Expression_NodeImpl.SelectItemsByPmAsCsv(ecList_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 = ecList_DataSource[0]; if (null == ec_DataSource) { // データソースが設定されていないとき this.Clear(); } else { if (log_Reports.Successful) { //EnumHitcount requestItems = new EnumHitcount(); //requestItems = EnumHitcount.First_Exist_Or_Zero; if (0 < ec_DataSource.List_Expression_Child.Count) { ec_DataSource.List_Expression_Child.ForEach(delegate(Expression_Node_String e_str, ref bool bRemove, ref bool bBreak) { this.ControlCommon.BAutomaticinputting = true; // // 最初の1件。無ければ空文字列。 // string sValue = e_str.Execute4_OnExpressionString(EnumHitcount.First_Exist_Or_Zero, log_Reports); if (sValue == "") { // // 空文字列の場合。 // this.Text = ""; } else { decimal decimalValue; bool bSuccessful = decimal.TryParse(sValue, out decimalValue); if (bSuccessful) { this.Value = decimalValue;// decimal.Parse(valueString); this.Text = sValue; } else { // // パース_エラー // this.Value = new Decimal(); this.Text = ""; } } this.ControlCommon.BAutomaticinputting = false; // 最初の1件のみ。 bBreak = true; }); } else { // 件数が無ければ。 this.ControlCommon.BAutomaticinputting = true; this.Text = "";// 空にする。 //hNumericUpDown.Enabled = true; this.ControlCommon.BAutomaticinputting = false; } } else { } } goto gt_EndMethod; // // // // gt_EndMethod: pg_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// データ・ターゲットへの出力を行います。 /// /// イベント・ハンドラー以外でも、直接、データターゲットへの出力を行うことができます。 /// /// 旧名:PerformDataTargetOut /// </summary> public void UsercontrolToMemory( Log_Reports log_Reports ) { Log_Method pg_Method = new Log_MethodImpl(); pg_Method.BeginMethod(Info_Controls.Name_Library, this, "UsercontrolToMemory", log_Reports); // // if (null == this.ControlCommon.Expression_Control) { // このコントロールに対応づくテーブル等の設定がなく、ただの空箱の場合。 // Visual Studio のビジュアルエディターで直接置いただけの時は、ここに来ます。 // 何もせず終了。 goto gt_EndMethod; } List <Expression_Node_String> ecList_Data = this.ControlCommon.Expression_Control.SelectDirectchildByNodename(NamesNode.S_DATA, false, EnumHitcount.Unconstraint, log_Reports); List <Expression_Node_String> ecList_DataTarget = Utility_Expression_NodeImpl.SelectItemsByPmAsCsv(ecList_Data, PmNames.S_ACCESS.Name_Pm, ValuesAttr.S_TO, false, EnumHitcount.First_Exist, log_Reports); if (!log_Reports.Successful) { goto gt_EndMethod; } Expression_Node_String ec_DataTarget = ecList_DataTarget[0]; if (null == ec_DataTarget) { // エラー: データターゲットが未設定のとき goto gt_Error_NullDatatarget; } else { // // データターゲットが設定されているとき // // // 未実装 TODO: 実装すること。 // { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, this.Name, log_Reports);//コントロール名 this.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:536;", tmpl, log_Reports); } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NullDatatarget: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, this.Name, log_Reports);//コントロール名 this.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:511;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: pg_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// データ・ターゲットへの出力を行います。 /// </summary> public void UsercontrolToMemory( Log_Reports log_Reports ) { Log_Method pg_Method = new Log_MethodImpl(); pg_Method.BeginMethod(Info_Controls.Name_Library, this, "UsercontrolToMemory", log_Reports); // // if (null == this.ControlCommon.Expression_Control) { // このコントロールに対応づくテーブル等の設定がなく、ただの空箱の場合。 // Visual Studio のビジュアルエディターで直接置いただけの時は、ここに来ます。 // 何もせず終了。 goto gt_EndMethod; } List <Expression_Node_String> ecList_Data = this.ControlCommon.Expression_Control.SelectDirectchildByNodename(NamesNode.S_DATA, false, EnumHitcount.Unconstraint, log_Reports); List <Expression_Node_String> ecList_DataTarget = Utility_Expression_NodeImpl.SelectItemsByPmAsCsv(ecList_Data, PmNames.S_ACCESS.Name_Pm, ValuesAttr.S_TO, false, EnumHitcount.First_Exist, log_Reports); if (!log_Reports.Successful) { goto gt_EndMethod; } Expression_Node_String ec_DataTarget = ecList_DataTarget[0]; if (null == ec_DataTarget) { // エラー: データターゲットが未設定のとき goto gt_Error_NullDatatarget; } if (log_Reports.Successful) { //this……イベントハンドラーのsender引数と一致すること。 // TODO 数値型テキストボックスで空白を出力しようとしたときにエラーになるのはバグなので修正したい。 // 特にトリムは行いません。 string sText = this.Text; // // 改行文字を、改行に変換。 // if ("" != this.SNewline) { sText = sText.Replace(Environment.NewLine, this.SNewline); } // // テーブルにデータを書き出す方法。 { ToMemory_Performer toM = new ExpressionDataTargetUpdaterImpl(); toM.ToMemory( sText, this.ControlCommon.Expression_Control, this.ControlCommon.Owner_MemoryApplication, log_Reports ); } if (log_Reports.Successful) { // 成功時 this.BackColor = System.Drawing.SystemColors.Window; } else { // 設定失敗時。 this.BackColor = Color.Yellow; } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NullDatatarget: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, this.Name, log_Reports);//コントロール名 this.ControlCommon.Owner_MemoryApplication.CreateErrorReport("Er:513;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: pg_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── #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); }