예제 #1
0
 public List<AppDic> GetOptions(string type)
 {
     List<AppDic> list = new List<AppDic>();
      string sql = "SELECT Id, Type, Key, Value FROM AppConfig WHERE Type = @Type";
      List<SQLiteParameter> parameters = new List<SQLiteParameter>();
      parameters.Add(new SQLiteParameter("@Type", type));
      DataTable dt = dbHelper.ExecuteDataTable(sql, parameters.ToArray());
      Dictionary<string, string> dic = new Dictionary<string, string>();
      foreach (DataRow row in dt.Rows)
      {
          AppDic item = new AppDic();
          item.Type = (string)row["Type"];
          item.Key = (string)row["Key"];
          item.Label = (string)row["Value"];
          list.Add(item);
      }
      return list;
 }
예제 #2
0
파일: DicForm.cs 프로젝트: rew170/soomecode
 private void DicListView_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
 {
     if (e.IsSelected)
     {
         AppDic dic = (AppDic)e.Item.Tag;
         this.EditKeyTxt.Text = dic.Key;
         this.EditValTxt.Text = dic.Label;
         this.EditBtn.Enabled = true;
         this.DeleteBtn.Enabled = true;
         SelectedAppDic = dic;
         foreach (string key in DataCache.Instance.DicTypeOptions.Keys)
         {
             string val = (string)DataCache.Instance.DicTypeOptions[key];
             KeyValuePair<string, string> item = new KeyValuePair<string, string>(key, val);
             if (dic.Type == key)
             {
                 this.EditDicType.SelectedItem = item;
             }
         }
     }
 }