/// <summary> /// OKボタン押下時の動作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CommitButton_Click(object sender, RoutedEventArgs e) { // this.SaveMethodChange(); int RowCnt = attrMethSearchResultList.Items.IndexOf(attrMethSearchResultList.SelectedItem); AttrMthSearchItem nowRow = viewModel.AttrMethItems[RowCnt]; string appendString = ""; if (nowRow.attrMethFlg == "m") { if (nowRow.methParameterDesc != null) { appendString = nowRow.elemName + "." + nowRow.attrMethName + "(" + nowRow.methParameterDesc + ")"; } else { appendString = nowRow.elemName + "." + nowRow.attrMethName + "( )"; } } else { appendString = nowRow.elemName + "." + nowRow.attrMethName; } // 親画面(BehaviorEditor)から呼ばれた場合 if (this.Owner != null) { BehaviorEditor parent = (BehaviorEditor)this.Owner; parent.insertTextOnCaret(appendString); } this.Close(); }
/// <summary> /// SQLiteのDBから属性、操作の値を取得 /// </summary> /// <returns></returns> private List <AttrMthSearchItem> readAttributesAndMethods() { string dbFileName = ProjectSetting.getVO().projectPath + "\\" + ProjectSetting.getVO().dbName; SQLiteConnection conn = new SQLiteConnection("Data Source=" + dbFileName); conn.Open(); List <AttrMthSearchItem> retList = new List <AttrMthSearchItem>(); string fields = @"atmt.elemId, elm.elemName, elm.elemAlias, elm.elemType, elm.elemStereotype, atmt.elemGuid, atmt.attrMthFlg, atmt.attrMthId, atmt.attrMthType, atmt.attrMthGuid, atmt.attrMthName, atmt.attrMthAlias, atmt.attrMthNotes, ifnull(atmt.mthParamDesc, ''), elm.elementPath"; string whereCond = @" elm.elemType in ('Class', 'Interface', 'Enumeration') and elm.elementPath like '%/論理モデル/%' "; string sql = @"select " + fields + " from t_attr_mth atmt inner join t_element elm on atmt.elemId = elm.objectId " + " where " + whereCond + " order by atmt.elemId, atmt.attrMthId "; using (var command = conn.CreateCommand()) { //クエリの実行 command.CommandText = sql; using (var sdr = command.ExecuteReader()) { // while (sdr.Read()) { AttrMthSearchItem attrMth = new AttrMthSearchItem(); attrMth.elemId = sdr.GetInt32(0); attrMth.elemName = StringUtil.removeQuoteChar(sdr.GetString(1)); attrMth.elemAlias = sdr.GetString(2); attrMth.elemType = sdr.GetString(3); attrMth.elemStereotype = sdr.GetString(4); attrMth.elemGuid = sdr.GetString(5); attrMth.attrMethFlg = sdr.GetString(6); if (attrMth.attrMethFlg == "a") { attrMth.attrMethId = sdr.GetInt32(7) * -1; } else { attrMth.attrMethId = sdr.GetInt32(7); } attrMth.attrMethType = sdr.GetString(8); attrMth.attrMethGuid = sdr.GetString(9); attrMth.attrMethName = StringUtil.removeQuoteChar(sdr.GetString(10)); attrMth.attrMethAlias = sdr.GetString(11); attrMth.attrMethNotes = sdr.GetString(12); attrMth.methParameterDesc = sdr.GetString(13); attrMth.elementPath = sdr.GetString(14); retList.Add(attrMth); } } } conn.Close(); // 一件でも取得できたらtrueを返す return(retList); }