//──────────────────────────────────────── public static Value_Humaninput NewInstance( object value, bool isRequired, string nodeConfigtree, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_Table.Name_Library, "Utility_HumaninputValue", "NewInstance", log_Reports); Value_Humaninput result; if(value is String_HumaninputImpl) { result = new String_HumaninputImpl(nodeConfigtree); } else if(value is Int_HumaninputImpl) { result = new Int_HumaninputImpl(nodeConfigtree); } else if(value is Bool_HumaninputImpl) { result = new Bool_HumaninputImpl(nodeConfigtree); } else { result = null; if (isRequired) { //エラー goto gt_Error_AnotherType; } } goto gt_EndMethod; // #region 異常系 //──────────────────────────────────────── gt_Error_AnotherType: if(log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー292!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("▲エラー201!(" + Info_Table.Name_Library + ")"); s.Newline(); s.Append("string,int,boolセルデータクラス以外のオブジェクトが指定されました。"); s.Newline(); s.Append("指定された値のクラス=["); s.Append(value.GetType().Name); s.Append("]"); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // gt_EndMethod: log_Method.EndMethod(log_Reports); return result; }
public MemoryGloballistconfig Perform( string sFpath_Glcnf, Log_Reports log_Reports ) { Log_Method pg_Method = new Log_MethodImpl(0); pg_Method.BeginMethod(Info_Operating.Name_Library, this, "Perform",log_Reports); // グローバルリスト・コンフィグ設定ファイルの内容。 MemoryGloballistconfig moGlcnf = new MemoryGloballistconfigImpl(); Configurationtree_Node parent_Configurationtree_Node = new Configurationtree_NodeImpl("グローバルリスト設定",null); Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L03_2", parent_Configurationtree_Node); cf_Fpath.InitPath(sFpath_Glcnf, log_Reports); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } Expression_Node_Filepath ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath); string sFpatha_Xml = ec_Fpath.Execute4_OnExpressionString( EnumHitcount.Unconstraint, log_Reports); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); if (log_Reports.Successful) { // 正常時 try { // ファイルの読込み doc.Load(sFpatha_Xml); } catch (System.ArgumentException ex) { if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー0800206!", pg_Method); StringBuilder t = new StringBuilder(); t.Append("『SRSグローバルリスト』設定ファイルを読込もうとしたら、エラーが発生しました。"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append("ファイル=["); t.Append(sFpath_Glcnf); t.Append("]"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append("もしかすると:"); t.Append(Environment.NewLine); t.Append(" ・ファイルパスが間違っているか、未入力なのかも知れません。ファイルパスを指定してください。"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append("例外メッセージ:["); t.Append(ex.GetType().Name); t.Append("]:"); t.Append(ex.Message); r.Message = t.ToString(); log_Reports.EndCreateReport(); } } catch (System.Exception ex) { if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー0800205!", pg_Method); StringBuilder t = new StringBuilder(); t.Append("『SRSグローバルリスト』設定ファイルの読込中にエラーが発生しました。"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append("ファイル=["); t.Append(sFpath_Glcnf); t.Append("]"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append("もしかすると:"); t.Append(Environment.NewLine); t.Append(" ・読込む設定ファイルを間違えている? それは『SRSグローバルリスト 設定ファイル』で合っていますか?"); t.Append(Environment.NewLine); t.Append(" ・読込んだ設定ファイルの内容に間違いがある?"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append("例外メッセージ:["); t.Append(ex.GetType().Name); t.Append("]:"); t.Append(ex.Message); r.Message = t.ToString(); log_Reports.EndCreateReport(); } } } if (log_Reports.Successful) { // 正常時 try { // ルート要素を取得 System.Xml.XmlElement root = doc.DocumentElement; // type要素を列挙 System.Xml.XmlNodeList typeNL = root.GetElementsByTagName("type"); for (int nTypeIndex = 0; nTypeIndex < typeNL.Count; nTypeIndex++) { XmlNode x_TypeNode = typeNL.Item(nTypeIndex); if (log_Reports.Successful) { // 正常時 if (XmlNodeType.Element == x_TypeNode.NodeType) { // // type要素 // XmlElement x_TypeElm = (XmlElement)x_TypeNode; string sType = x_TypeElm.Attributes.GetNamedItem(SrsAttrName.S_NAME).Value; GloballistconfigTypesectionImpl typeSection = new GloballistconfigTypesectionImpl(); typeSection.Name_Type = sType; moGlcnf.TypesectionList.List_Item.Add(typeSection); } } } // human要素を列挙 System.Xml.XmlNodeList x_HumanNL = root.GetElementsByTagName("human"); for (int nHumanIndex = 0; nHumanIndex < x_HumanNL.Count; nHumanIndex++) { XmlNode x_HumanNode = x_HumanNL.Item(nHumanIndex); if (log_Reports.Successful) { // 正常時 if (XmlNodeType.Element == x_HumanNode.NodeType) { // // human要素 // XmlElement x_HumanElm = (XmlElement)x_HumanNode; GloballistconfigHuman human = new GloballistconfigHumanImpl(); human.Name = x_HumanElm.Attributes.GetNamedItem(SrsAttrName.S_NAME).Value; moGlcnf.Dictionary_Human.Add(human.Name, human); // variable要素を列挙 System.Xml.XmlNodeList x_VariableNL = x_HumanElm.GetElementsByTagName("variable"); for (int n_VariableIndex = 0; n_VariableIndex < x_VariableNL.Count; n_VariableIndex++) { XmlNode x_VariableNode = x_VariableNL.Item(n_VariableIndex); if (XmlNodeType.Element == x_VariableNode.NodeType) { // // variable要素 // XmlElement x_VariableElm = (XmlElement)x_VariableNode; GloballistconfigVariable variable = new GloballistconfigVariableImpl(); variable.Name_Type = x_VariableElm.Attributes.GetNamedItem("type").Value; // 変数の連想配列に、項目を追加 if (human.Dictionary_Variable.ContainsKey(variable.Name_Type)) { // エラー if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー1002!", pg_Method); r.Message = "指定された変数の型["+variable.Name_Type+"]が、重複されて記述されています。"; log_Reports.EndCreateReport(); } } else { human.Dictionary_Variable.Add(variable.Name_Type, variable); // number要素を列挙 System.Xml.XmlNodeList numberNL = x_VariableElm.GetElementsByTagName("number"); for (int numberIndex = 0; numberIndex < numberNL.Count; numberIndex++) { XmlNode numberNode = numberNL.Item(numberIndex); if (XmlNodeType.Element == numberNode.NodeType) { // // number要素 // XmlElement numberElm = (XmlElement)numberNode; GloballistconfigNumber numberObj = new GloballistconfigNumberImpl(); numberObj.Text_Range = numberElm.Attributes.GetNamedItem("range").Value; Int_HumaninputImpl oPriority = new Int_HumaninputImpl("!ハードコーディング_LoaderOfGlobalListConfigXml"); oPriority.Text = numberElm.Attributes.GetNamedItem("priority").Value; numberObj.Priority = oPriority; // 変数の連想配列に、変数番号オブジェクトを追加 variable.Dictionary_Number.Add(numberObj.Text_Range, numberObj); } } } } } } } } } catch (System.IO.IOException ex) { if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー080103!", pg_Method); r.Message = "『SRSグローバルリスト』設定ファイルが見つかりません。:" + ex.Message; log_Reports.EndCreateReport(); } } catch (System.Exception ex) { if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー0800204!", pg_Method); StringBuilder t = new StringBuilder(); t.Append("『SRSグローバルリスト』設定ファイルの読込中にエラーが発生しました。"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append("ファイル=["); t.Append(sFpath_Glcnf); t.Append("]"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append("もしかすると:"); t.Append(Environment.NewLine); t.Append(" ・読込む設定ファイルを間違えている? それは『SRSグローバルリスト 設定ファイル』で合っていますか?"); t.Append(Environment.NewLine); t.Append(" ・読込んだ設定ファイルの内容に間違いがある?"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append("例外メッセージ:["); t.Append(ex.GetType().Name); t.Append("]:"); t.Append(ex.Message); r.Message = t.ToString(); log_Reports.EndCreateReport(); } } } // // // // gt_EndMethod: pg_Method.EndMethod(log_Reports); return moGlcnf; }
//──────────────────────────────────────── /// <summary> /// DataRow → Dictionary /// </summary> /// <param name="row"></param> /// <param name="log_Reports"></param> public void Add(DataRow row, Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_Table.Name_Library, this, "Add",log_Reports); Dictionary<string, Value_Humaninput> record = new Dictionary<string, Value_Humaninput>(); int nFieldCount = row.ItemArray.Length; for (int nFieldIndex = 0; nFieldIndex < nFieldCount; nFieldIndex++) { // フィールド名 string sFieldName = xenonTable.RecordFielddefinition.ValueAt(nFieldIndex).Name_Trimupper; // 値 Value_Humaninput oValue; if (row[nFieldIndex] is DBNull) { //// デバッグ //if (true) //{ //Log_TextIndented txt = new Log_TextIndentedImpl(); // txt.Append(InfxenonTable.LibraryName + ":" + this.GetType().Name + "#Add:【ヌル】"); // txt.Append(" field=[" + sFieldName + "]"); // ystem.Console.WriteLine(txt.ToString()); //} String sConfigStack = xenonTable.Expression_Filepath_ConfigStack.Execute4_OnExpressionString( EnumHitcount.Unconstraint, log_Reports); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } EnumTypeFielddefinition typeField = xenonTable.RecordFielddefinition.ValueAt(nFieldIndex).Type_Field; switch (typeField) { case EnumTypeFielddefinition.String: oValue = new String_HumaninputImpl(sConfigStack); break; case EnumTypeFielddefinition.Int: oValue = new Int_HumaninputImpl(sConfigStack); break; case EnumTypeFielddefinition.Bool: oValue = new Bool_HumaninputImpl(sConfigStack); break; default: // エラー。 goto gt_Error_UndefinedType; } } else { oValue = (Value_Humaninput)row[nFieldIndex]; //// デバッグ //if (true) //{ //Log_TextIndented txt = new Log_TextIndentedImpl(); // txt.Append(InfxenonTable.LibraryName + ":" + this.GetType().Name + "#Add:【○】"); // txt.Append(" 値=[" + oValue.HumanInputString + "]"); // ystem.Console.WriteLine(txt.ToString()); //} } record.Add(sFieldName, oValue); } this.List_Field.Add(record); // 正常 goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_UndefinedType: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー293!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append(" 未定義の型です。プログラムのミスの可能性があります。"); s.Append(Environment.NewLine); s.Append(Environment.NewLine); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return; }
//──────────────────────────────────────── /// <summary> /// 選択されているセルに、指定の値を上書きします。 /// </summary> /// <param nFcName="outputValueStr"></param> /// <param nFcName="row"></param> /// <param nFcName="selFldDefinition">選択フィールド</param> /// <param nFcName="log_Reports"></param> public void ToMemory_ToSelectedField( string sValue_Output, Expression_Node_String ec_Fcell, DataRow row, Fielddefinition selFldDefinition,//選択したフィールド定義 Log_Reports log_Reports ) { //essageBox.Show("アップデートデータ【開始】 outputValueStr=[" + outputValueStr + "]\n", "(FormsImpl)" + this.GetType().NFcName ); //.WriteLine(this.GetType().NFcName + "#: 【開始】データのアップデートを始める。"); Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); pg_Method.BeginMethod(Info_Controls.Name_Library, this, "ToM_ToSelectedField",log_Reports); // // string sName_SelectedFld; { bool bHit = ec_Fcell.TrySelectAttribute( out sName_SelectedFld, PmNames.S_SELECT.Name_Pm, EnumHitcount.One, log_Reports ); } string sConfigStack_StringOfCell = sName_SelectedFld; switch (selFldDefinition.Type_Field) { case EnumTypeFielddefinition.String: { // 空欄も自動処理 String_HumaninputImpl cellData = new String_HumaninputImpl(sConfigStack_StringOfCell); cellData.Text = sValue_Output; row[sName_SelectedFld] = cellData; } break; case EnumTypeFielddefinition.Int: { // 空欄も自動処理 Int_HumaninputImpl cellData = new Int_HumaninputImpl(sConfigStack_StringOfCell); cellData.Text = sValue_Output; row[sName_SelectedFld] = cellData; } break; case EnumTypeFielddefinition.Bool: { // 空欄も自動処理 Bool_HumaninputImpl cellData = new Bool_HumaninputImpl(sConfigStack_StringOfCell); cellData.Text = sValue_Output; row[sName_SelectedFld] = cellData; } break; default: { if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー398!", pg_Method); StringBuilder t = new StringBuilder(); t.Append("予期しない、フィールドの型です。"); t.Append(Environment.NewLine); t.Append("selFldDefinition.Type=["); t.Append(selFldDefinition.ToString_Type()); t.Append("]"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); // ヒント t.Append(r.Message_Configuration( ec_Fcell.Cur_Configuration)); r.Message = t.ToString(); log_Reports.EndCreateReport(); } } break; } // pg_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// /// </summary> /// <param name="pcLst"></param> /// <param name="log_Reports"></param> protected void Execute6_Sub( ListBox pcLst, Log_Reports log_Reports ) { // // // //()メソッド開始 // // // Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute6_Sub", log_Reports); // //このイベントが起こったリストボックスの名前。 // string sName_Control; if (pcLst is CustomcontrolListbox) { CustomcontrolListbox cclst = (CustomcontrolListbox)pcLst; sName_Control = cclst.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports); log_Method.WriteDebug_ToConsole(sName_Control); } else { sName_Control = ""; } // // // //現在、選択している項目。 // // // DataRowView selectedDataRow = (DataRowView)pcLst.SelectedItem; if (null == selectedDataRow) { // 選択している行がなければ。 // エラー。 goto gt_Error_NoSelectedField; } // // // // 現在選択しているレコードの 指定フィールドの値を取得します。 // // // { //指定されているフィールド名。 string sName_Field; this.TrySelectAttribute(out sName_Field, Expression_Node_Function25Impl.PM_NAME_FIELD, EnumHitcount.One_Or_Zero, log_Reports); //そのフィールドの値。 Int_HumaninputImpl cellData = (Int_HumaninputImpl)selectedDataRow[sName_Field]; string sValue_Field = cellData.Text.Trim(); //.WriteLine(this.GetType().Name + "#: ◆ fieldValue=[" + fieldValue + "]"); //変数名。 Expression_Node_String ec_Name_ArgDestinationVariable; this.TrySelectAttribute(out ec_Name_ArgDestinationVariable, Expression_Node_Function25Impl.PM_NAME_VAR_DESTINATION, EnumHitcount.One_Or_Zero, log_Reports); //指定した変数に、フィールド値を格納します。 this.Owner_MemoryApplication.MemoryVariables.SetStringValue( new XenonNameImpl( ec_Name_ArgDestinationVariable.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), ec_Name_ArgDestinationVariable.Cur_Configuration ), sValue_Field, true, log_Reports ); } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NoSelectedField: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sName_Control, log_Reports); //コントロール名 tmpl.SetParameter(2, pcLst.SelectedIndex.ToString(), log_Reports); //リストボックスの選択しているindex this.Owner_MemoryApplication.CreateErrorReport("Er:110010;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
public MemoryGloballistconfig Perform( string sFpath_Glcnf, Log_Reports log_Reports ) { Log_Method pg_Method = new Log_MethodImpl(0); pg_Method.BeginMethod(Info_Operating.Name_Library, this, "Perform", log_Reports); // グローバルリスト・コンフィグ設定ファイルの内容。 MemoryGloballistconfig moGlcnf = new MemoryGloballistconfigImpl(); Configurationtree_Node parent_Configurationtree_Node = new Configurationtree_NodeImpl("グローバルリスト設定", null); Configurationtree_NodeFilepath cf_Fpath = new Configurationtree_NodeFilepathImpl("ファイルパス出典未指定L03_2", parent_Configurationtree_Node); cf_Fpath.InitPath(sFpath_Glcnf, log_Reports); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } Expression_Node_Filepath ec_Fpath = new Expression_Node_FilepathImpl(cf_Fpath); string sFpatha_Xml = ec_Fpath.Execute4_OnExpressionString( EnumHitcount.Unconstraint, log_Reports); if (!log_Reports.Successful) { // 既エラー。 goto gt_EndMethod; } System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); if (log_Reports.Successful) { // 正常時 try { // ファイルの読込み doc.Load(sFpatha_Xml); } catch (System.ArgumentException ex) { if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー0800206!", pg_Method); StringBuilder t = new StringBuilder(); t.Append("『SRSグローバルリスト』設定ファイルを読込もうとしたら、エラーが発生しました。"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append("ファイル=["); t.Append(sFpath_Glcnf); t.Append("]"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append("もしかすると:"); t.Append(Environment.NewLine); t.Append(" ・ファイルパスが間違っているか、未入力なのかも知れません。ファイルパスを指定してください。"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append("例外メッセージ:["); t.Append(ex.GetType().Name); t.Append("]:"); t.Append(ex.Message); r.Message = t.ToString(); log_Reports.EndCreateReport(); } } catch (System.Exception ex) { if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー0800205!", pg_Method); StringBuilder t = new StringBuilder(); t.Append("『SRSグローバルリスト』設定ファイルの読込中にエラーが発生しました。"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append("ファイル=["); t.Append(sFpath_Glcnf); t.Append("]"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append("もしかすると:"); t.Append(Environment.NewLine); t.Append(" ・読込む設定ファイルを間違えている? それは『SRSグローバルリスト 設定ファイル』で合っていますか?"); t.Append(Environment.NewLine); t.Append(" ・読込んだ設定ファイルの内容に間違いがある?"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append("例外メッセージ:["); t.Append(ex.GetType().Name); t.Append("]:"); t.Append(ex.Message); r.Message = t.ToString(); log_Reports.EndCreateReport(); } } } if (log_Reports.Successful) { // 正常時 try { // ルート要素を取得 System.Xml.XmlElement root = doc.DocumentElement; // type要素を列挙 System.Xml.XmlNodeList typeNL = root.GetElementsByTagName("type"); for (int nTypeIndex = 0; nTypeIndex < typeNL.Count; nTypeIndex++) { XmlNode x_TypeNode = typeNL.Item(nTypeIndex); if (log_Reports.Successful) { // 正常時 if (XmlNodeType.Element == x_TypeNode.NodeType) { // // type要素 // XmlElement x_TypeElm = (XmlElement)x_TypeNode; string sType = x_TypeElm.Attributes.GetNamedItem(SrsAttrName.S_NAME).Value; GloballistconfigTypesectionImpl typeSection = new GloballistconfigTypesectionImpl(); typeSection.Name_Type = sType; moGlcnf.TypesectionList.List_Item.Add(typeSection); } } } // human要素を列挙 System.Xml.XmlNodeList x_HumanNL = root.GetElementsByTagName("human"); for (int nHumanIndex = 0; nHumanIndex < x_HumanNL.Count; nHumanIndex++) { XmlNode x_HumanNode = x_HumanNL.Item(nHumanIndex); if (log_Reports.Successful) { // 正常時 if (XmlNodeType.Element == x_HumanNode.NodeType) { // // human要素 // XmlElement x_HumanElm = (XmlElement)x_HumanNode; GloballistconfigHuman human = new GloballistconfigHumanImpl(); human.Name = x_HumanElm.Attributes.GetNamedItem(SrsAttrName.S_NAME).Value; moGlcnf.Dictionary_Human.Add(human.Name, human); // variable要素を列挙 System.Xml.XmlNodeList x_VariableNL = x_HumanElm.GetElementsByTagName("variable"); for (int n_VariableIndex = 0; n_VariableIndex < x_VariableNL.Count; n_VariableIndex++) { XmlNode x_VariableNode = x_VariableNL.Item(n_VariableIndex); if (XmlNodeType.Element == x_VariableNode.NodeType) { // // variable要素 // XmlElement x_VariableElm = (XmlElement)x_VariableNode; GloballistconfigVariable variable = new GloballistconfigVariableImpl(); variable.Name_Type = x_VariableElm.Attributes.GetNamedItem("type").Value; // 変数の連想配列に、項目を追加 if (human.Dictionary_Variable.ContainsKey(variable.Name_Type)) { // エラー if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー1002!", pg_Method); r.Message = "指定された変数の型[" + variable.Name_Type + "]が、重複されて記述されています。"; log_Reports.EndCreateReport(); } } else { human.Dictionary_Variable.Add(variable.Name_Type, variable); // number要素を列挙 System.Xml.XmlNodeList numberNL = x_VariableElm.GetElementsByTagName("number"); for (int numberIndex = 0; numberIndex < numberNL.Count; numberIndex++) { XmlNode numberNode = numberNL.Item(numberIndex); if (XmlNodeType.Element == numberNode.NodeType) { // // number要素 // XmlElement numberElm = (XmlElement)numberNode; GloballistconfigNumber numberObj = new GloballistconfigNumberImpl(); numberObj.Text_Range = numberElm.Attributes.GetNamedItem("range").Value; Int_HumaninputImpl oPriority = new Int_HumaninputImpl("!ハードコーディング_LoaderOfGlobalListConfigXml"); oPriority.Text = numberElm.Attributes.GetNamedItem("priority").Value; numberObj.Priority = oPriority; // 変数の連想配列に、変数番号オブジェクトを追加 variable.Dictionary_Number.Add(numberObj.Text_Range, numberObj); } } } } } } } } } catch (System.IO.IOException ex) { if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー080103!", pg_Method); r.Message = "『SRSグローバルリスト』設定ファイルが見つかりません。:" + ex.Message; log_Reports.EndCreateReport(); } } catch (System.Exception ex) { if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー0800204!", pg_Method); StringBuilder t = new StringBuilder(); t.Append("『SRSグローバルリスト』設定ファイルの読込中にエラーが発生しました。"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append("ファイル=["); t.Append(sFpath_Glcnf); t.Append("]"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append("もしかすると:"); t.Append(Environment.NewLine); t.Append(" ・読込む設定ファイルを間違えている? それは『SRSグローバルリスト 設定ファイル』で合っていますか?"); t.Append(Environment.NewLine); t.Append(" ・読込んだ設定ファイルの内容に間違いがある?"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); t.Append("例外メッセージ:["); t.Append(ex.GetType().Name); t.Append("]:"); t.Append(ex.Message); r.Message = t.ToString(); log_Reports.EndCreateReport(); } } } // // // // gt_EndMethod: pg_Method.EndMethod(log_Reports); return(moGlcnf); }
//──────────────────────────────────────── public GloballistconfigNumberImpl() { this.sRange = ""; this.priority = new Int_HumaninputImpl("!ハードコーディング_MoGlConfigImpl"); }
/// <summary> /// 空行を作成します。 /// </summary> /// <returns></returns> public Record_Humaninput CreateNewRecord(string config, Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_Table.Name_Library, this, "CreateNewRecord", log_Reports); // 新しいレコードを1つ作ります。 DataRow newDataRow = this.DataTable.NewRow(); // 全ての列は現在、DBNullになっています。 // ひとまず、全ての列に有効なインスタンスを設定します。 int indexColumn = 0; this.RecordFielddefinition.ForEach(delegate(Fielddefinition fielddefinition, ref bool isBreak2, Log_Reports log_Reports2) { // 列の型を調べます。 // セルのソースヒント名 string nodeConfigtree_NameOfCell; if ("" == fielddefinition.Name_Trimupper) { // 名無しフィールド // フィールド名がないので、インデックスで指定します。 Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("("); s.Append(indexColumn); s.Append(")番フィールド"); nodeConfigtree_NameOfCell = s.ToString(); } else { nodeConfigtree_NameOfCell = fielddefinition.Name_Humaninput; } switch (fielddefinition.Type_Field) { case EnumTypeFielddefinition.String: { String_HumaninputImpl stringH = new String_HumaninputImpl(nodeConfigtree_NameOfCell); stringH.Text = ""; if ("" == fielddefinition.Name_Trimupper) { // 名無しフィールド // フィールド名がないので、インデックスで指定します。 newDataRow[indexColumn] = stringH; } else { newDataRow[fielddefinition.Name_Trimupper] = stringH; } } break; case EnumTypeFielddefinition.Int: { Int_HumaninputImpl intH = new Int_HumaninputImpl(nodeConfigtree_NameOfCell); intH.Text = ""; if ("" == fielddefinition.Name_Trimupper) { // 名無しフィールド // フィールド名がないので、インデックスで指定します。 newDataRow[indexColumn] = intH; } else { newDataRow[fielddefinition.Name_Trimupper] = intH; } } break; case EnumTypeFielddefinition.Bool: { Bool_HumaninputImpl boolH = new Bool_HumaninputImpl(nodeConfigtree_NameOfCell); boolH.Text = ""; if ("" == fielddefinition.Name_Trimupper) { // 名無しフィールド // フィールド名がないので、インデックスで指定します。 newDataRow[indexColumn] = boolH; } else { newDataRow[fielddefinition.Name_Trimupper] = boolH; } } break; default: { // 正常(警告は出したい) if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Warning); r.SetTitle("▲エラー431!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Newline(); s.Append("この列は、未定義の型です。[" + fielddefinition.ToString_Type() + "]"); r.Message = s.ToString(); log_Reports.EndCreateReport(); } // 文字列型を入れる。 String_HumaninputImpl stringH = new String_HumaninputImpl(nodeConfigtree_NameOfCell); stringH.Text = ""; if ("" == fielddefinition.Name_Trimupper) { // 名無しフィールド // フィールド名がないので、インデックスで指定します。 newDataRow[indexColumn] = stringH; } else { newDataRow[fielddefinition.Name_Trimupper] = stringH; } } break; } indexColumn++; }, log_Reports); goto gt_EndMethod; // gt_EndMethod: log_Method.EndMethod(log_Reports); return new Record_HumaninputImpl(config, newDataRow, this); }
//──────────────────────────────────────── public Value_Humaninput NewField(string nodeConfigtree, Log_Reports log_Reports) { Log_Method log_Method = new Log_MethodImpl(0); log_Method.BeginMethod(Info_Table.Name_Library, this, "NewField", log_Reports); Value_Humaninput result; switch (this.Type_Field) { case EnumTypeFielddefinition.String: { result = new String_HumaninputImpl(nodeConfigtree); } break; case EnumTypeFielddefinition.Int: { result = new Int_HumaninputImpl(nodeConfigtree); } break; case EnumTypeFielddefinition.Bool: { result = new Bool_HumaninputImpl(nodeConfigtree); } break; default: { // 未該当 result = null; goto gt_Error_Unspported; } } goto gt_EndMethod; // #region 異常系 //──────────────────────────────────────── gt_Error_Unspported: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー464!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append("フィールド定義を元にして、フィールド値を用意しようとしましたが、未定義のフィールド型でした。"); s.Newline(); s.Append("this.Type.ToString()=["); s.Append(this.ToString_Type()); s.Append("]"); s.Newline(); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // gt_EndMethod: log_Method.EndMethod(log_Reports); return result; }
//──────────────────────────────────────── /// <summary> /// NOフィールドの値で指定したレコードを返します。なければヌルです。 /// </summary> /// <param name="exceptedNo"></param> /// <returns></returns> public Record_Humaninput SelectByNo( Int_HumaninputImpl valueint_No, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(); log_Method.BeginMethod(Info_Table.Name_Library, this, "SelectByNo",log_Reports); // Record_Humaninput result; if (valueint_No.IsSpaces()) { // 空白なら中断。 result = null; goto gt_Error_Spaces; } else if (!valueint_No.IsValidated) { // エラーデータなら中断。 result = null; goto gt_Error_Invalid; } int nExpectedNo; bool bParsed = Int_HumaninputImpl.TryParse( valueint_No, out nExpectedNo, EnumOperationIfErrorvalue.Error, null, log_Reports ); if (!log_Reports.Successful) { // 既エラー result = null; goto gt_EndMethod; } if (bParsed) { foreach (DataRow dataRow in this.DataTable.Rows) { if (dataRow.Table.Columns.Contains("NO")) { // NO列があれば Value_Humaninput valueH = (Value_Humaninput)dataRow["NO"]; if (valueH is Int_HumaninputImpl) { Int_HumaninputImpl intH = (Int_HumaninputImpl)valueH; if (intH.IsSpaces()) { // 空白なら無視 } else if (!intH.IsValidated) { // エラーデータなら無視 } else { int int_No; bool isParsed2 = Int_HumaninputImpl.TryParse( intH, out int_No, EnumOperationIfErrorvalue.Error, null, log_Reports ); if (!log_Reports.Successful) { // 既エラー result = null; goto gt_EndMethod; } if (isParsed2) { if (nExpectedNo == int_No) { // 一致すれば。 result = new Record_HumaninputImpl( int_No.ToString(), dataRow, this); goto gt_EndMethod; } } } } } } } result = null; goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_Spaces: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー641!", log_Method); r.Message = "(空白なので中断)"; log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_Invalid: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー642!", log_Method); r.Message = "(エラーデータなので中断)"; log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return result; }
//──────────────────────────────────────── /// <summary> /// 指定のInt型フィールドの値で指定したレコードを返します。なければヌルです。 /// </summary> /// <param name="fieldName"></param> /// <param name="expectedInt"></param> /// <returns>一致しなければヌル。</returns> public Record_Humaninput SelectByInt( string name_Field, Int_HumaninputImpl expectedIntParam, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(); log_Method.BeginMethod(Info_Table.Name_Library, this, "SelectByInt",log_Reports); // // // // Record_Humaninput result; if (expectedIntParam.IsSpaces()) { // 空白なら中断。 result = null; goto gt_Error_Spaces; } else if (!expectedIntParam.IsValidated) { // エラーデータなら中断。 result = null; goto gt_Error_Invalid; } int int_Expected; bool isParsed = Int_HumaninputImpl.TryParse( expectedIntParam, out int_Expected, EnumOperationIfErrorvalue.Error, null, log_Reports ); if (!log_Reports.Successful || !isParsed) { // 既エラー result = null; goto gt_EndMethod; } Exception err_Excp; try { foreach (DataRow dataRow in this.DataTable.Rows) { Value_Humaninput valueH = (Value_Humaninput)dataRow[name_Field]; if (valueH is Int_HumaninputImpl) { Int_HumaninputImpl intH = (Int_HumaninputImpl)valueH; if (intH.IsSpaces()) { // 空白なら無視 } else if (!intH.IsValidated) { // エラーデータなら無視 } else { int int_Exists; bool isParsed2 = Int_HumaninputImpl.TryParse( intH, out int_Exists, EnumOperationIfErrorvalue.Error, null, log_Reports ); if (!log_Reports.Successful) { // 既エラー result = null; goto gt_EndMethod; } if (isParsed2) { if (int_Expected == int_Exists) { // 一致すれば。 result = new Record_HumaninputImpl( log_Method.Fullname, dataRow, this); // 正常 goto gt_EndMethod; } } } } //} } } catch (Exception e) { // ArgumentException: 指定した名前の列がなかった場合など。 err_Excp = e; result = null; goto gt_Error_Exception; } result = null; goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_Spaces: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー651!", log_Method); r.Message = "<空白で中断>"; log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_Invalid: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー652!", log_Method); r.Message = "<エラーデータで中断>"; log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_Exception: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー653!", log_Method); Log_TextIndented s = new Log_TextIndentedImpl(); s.Append(r.Message_SException(err_Excp)); r.Message = s.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return result; }
//──────────────────────────────────────── protected void Execute6_Sub( ListBox pcLst, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_Functions.Name_Library, this, "Execute6_Sub", log_Reports); if (log_Reports.CanStopwatch) { string sFncName0; this.TrySelectAttribute(out sFncName0, PmNames.S_NAME.Name_Pm, EnumHitcount.One_Or_Zero, log_Reports); log_Method.Log_Stopwatch.Message = "Nアクション[" + sFncName0 + "]実行"; log_Method.Log_Stopwatch.Begin(); } DataRowView selectedDataRow = (DataRowView)pcLst.SelectedItem; if (null == selectedDataRow) { // 選択している行がなければ。 goto gt_Error_NotFoundSelectedRow; } Expression_Node_String ec_ArgTableName; this.TrySelectAttribute(out ec_ArgTableName, Expression_Node_Function32Impl.PM_NAME_TABLE, EnumHitcount.One_Or_Zero, log_Reports); Table_Humaninput o_Table = this.Owner_MemoryApplication.MemoryTables.GetTable_HumaninputByName( ec_ArgTableName, true, log_Reports ); if (null == o_Table) { // エラー中断。 goto gt_EndMethod; } DataTable dataTable = o_Table.DataTable; //.WriteLine(this.GetType().Name + "#: ◆ テーブルはあった。"); // 現在選択しているレコードの NOフィールドの値を取得します。 { string sArgFieldName; this.TrySelectAttribute(out sArgFieldName, Expression_Node_Function32Impl.PM_NAME_FIELD, EnumHitcount.One_Or_Zero, log_Reports); Int_HumaninputImpl cellData = (Int_HumaninputImpl)selectedDataRow[sArgFieldName]; string sFieldValue = cellData.Text.Trim(); //.WriteLine(this.GetType().Name + "#: ◆ fieldValue=[" + fieldValue + "]"); Expression_Node_String ec_ArgDestinationFcName; this.TrySelectAttribute(out ec_ArgDestinationFcName, Expression_Node_Function32Impl.PM_NAME_CONTROL_DESTINATION, EnumHitcount.One_Or_Zero, log_Reports); // コントロールに格納します。 List <Usercontrol> list_FcUc; { list_FcUc = this.Owner_MemoryApplication.MemoryForms.GetUsercontrolsByName( ec_ArgDestinationFcName, true, log_Reports ); } if (log_Reports.Successful) { Usercontrol fcUc = list_FcUc[0]; fcUc.UsercontrolText = sFieldValue; } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NotFoundSelectedRow: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, pcLst.SelectedIndex.ToString(), log_Reports);//リストボックスで選択している項目のindex this.Owner_MemoryApplication.CreateErrorReport("Er:110016;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
//──────────────────────────────────────── /// <summary> /// O_TableImpl#AddRecordListで使います。 /// </summary> /// <param name="columnIndex"></param> /// <param name="value"></param> /// <param name="oTable"></param> /// <param name="log_Reports"></param> /// <returns></returns> public static Value_Humaninput ConfigurationTo_Field( int index_Column, string value, RecordFielddefinition recordFielddefinition, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(); log_Method.BeginMethod(Info_Table.Name_Library, "Utility_Row", "ConfigurationTo_Field", log_Reports); // // // セルのソースヒント名 string nodeConfigtree; try { nodeConfigtree = recordFielddefinition.ValueAt(index_Column).Name_Humaninput; } catch (ArgumentOutOfRangeException) { // エラー goto gt_Error_Index; } Value_Humaninput result; // 型毎に処理を分けます。 switch (recordFielddefinition.ValueAt(index_Column).Type_Field) { case EnumTypeFielddefinition.Int: { // 空白データも自動処理 Int_HumaninputImpl cellData = new Int_HumaninputImpl(nodeConfigtree); cellData.Text = value; result = cellData; } break; case EnumTypeFielddefinition.Bool: { // 空白データも自動処理 Bool_HumaninputImpl cellData = new Bool_HumaninputImpl(nodeConfigtree); cellData.Text = value; result = cellData; } break; default: { String_HumaninputImpl cellData = new String_HumaninputImpl(nodeConfigtree); cellData.Text = value; result = cellData; } break; } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_Index: result = null; if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー461!", log_Method); Log_TextIndented t = new Log_TextIndentedImpl(); t.Append("列インデックス[" + index_Column + "](0スタート)が指定されましたが、"); t.Newline(); t.Append("列は[" + recordFielddefinition.Count + "]個しかありません。(列定義リストは、絞りこまれている場合もあります)"); t.Newline(); // ヒント r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return result; }
//──────────────────────────────────────── /// <summary> /// 選択されているセルに、指定の値を上書きします。 /// </summary> /// <param nFcName="outputValueStr"></param> /// <param nFcName="row"></param> /// <param nFcName="selFldDefinition">選択フィールド</param> /// <param nFcName="log_Reports"></param> public void ToMemory_ToSelectedField( string sValue_Output, Expression_Node_String ec_Fcell, DataRow row, Fielddefinition selFldDefinition,//選択したフィールド定義 Log_Reports log_Reports ) { //essageBox.Show("アップデートデータ【開始】 outputValueStr=[" + outputValueStr + "]\n", "(FormsImpl)" + this.GetType().NFcName ); //.WriteLine(this.GetType().NFcName + "#: 【開始】データのアップデートを始める。"); Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); pg_Method.BeginMethod(Info_Controls.Name_Library, this, "ToM_ToSelectedField", log_Reports); // // string sName_SelectedFld; { bool bHit = ec_Fcell.TrySelectAttribute( out sName_SelectedFld, PmNames.S_SELECT.Name_Pm, EnumHitcount.One, log_Reports ); } string sConfigStack_StringOfCell = sName_SelectedFld; switch (selFldDefinition.Type_Field) { case EnumTypeFielddefinition.String: { // 空欄も自動処理 String_HumaninputImpl cellData = new String_HumaninputImpl(sConfigStack_StringOfCell); cellData.Text = sValue_Output; row[sName_SelectedFld] = cellData; } break; case EnumTypeFielddefinition.Int: { // 空欄も自動処理 Int_HumaninputImpl cellData = new Int_HumaninputImpl(sConfigStack_StringOfCell); cellData.Text = sValue_Output; row[sName_SelectedFld] = cellData; } break; case EnumTypeFielddefinition.Bool: { // 空欄も自動処理 Bool_HumaninputImpl cellData = new Bool_HumaninputImpl(sConfigStack_StringOfCell); cellData.Text = sValue_Output; row[sName_SelectedFld] = cellData; } break; default: { if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー398!", pg_Method); StringBuilder t = new StringBuilder(); t.Append("予期しない、フィールドの型です。"); t.Append(Environment.NewLine); t.Append("selFldDefinition.Type=["); t.Append(selFldDefinition.ToString_Type()); t.Append("]"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); // ヒント t.Append(r.Message_Configuration( ec_Fcell.Cur_Configuration)); r.Message = t.ToString(); log_Reports.EndCreateReport(); } } break; } // pg_Method.EndMethod(log_Reports); }