private void RefreshDataView() { listView.Items.Clear(); SysGisTable mSystable = new SysCommon.Gis.SysGisTable(_TmpWorkSpace); Exception err = null; //打开系统参数表 List <Dictionary <string, object> > listdic = mSystable.GetRows("SYSSETTING", "", out err); if (listdic != null) { for (int i = 0; i < listdic.Count; i++) { Dictionary <string, object> pDic = listdic[i]; ListViewItem pListViewItem = new ListViewItem(); //参数名 if (pDic.ContainsKey("SETTINGNAME")) { if (pDic["SETTINGNAME"] != null) { pListViewItem.SubItems[0].Text = pDic["SETTINGNAME"].ToString();//比较特殊,默认已经有一个子项 } //else //{ // pListViewItem.SubItems.Add(""); //} } //else //{ pListViewItem.SubItems.Add(""); } //参数值 if (pDic.ContainsKey("SETTINGVALUE")) { if (pDic["SETTINGVALUE"] != null) { pListViewItem.SubItems.Add(pDic["SETTINGVALUE"].ToString()); } else { pListViewItem.SubItems.Add(""); } } else { pListViewItem.SubItems.Add(""); } //参数数据类型 if (pDic.ContainsKey("DATATYPE")) { if (pDic["DATATYPE"] != null) { pListViewItem.SubItems.Add(pDic["DATATYPE"].ToString()); } else { pListViewItem.SubItems.Add(""); } } else { pListViewItem.SubItems.Add(""); } //参数描述 if (pDic.ContainsKey("DESCRIPTION")) { if (pDic["DESCRIPTION"] != null) { pListViewItem.SubItems.Add(pDic["DESCRIPTION"].ToString()); } else { pListViewItem.SubItems.Add(""); } } else { pListViewItem.SubItems.Add(""); } //如果BLOB类型的字段有值 if (pDic.ContainsKey("SETTINGVALUE2")) { if (pDic["SETTINGVALUE2"] != null) { if (pListViewItem.SubItems[2].Text.Contains("File")) { pListViewItem.SubItems[1].Text = "*"; } } } listView.Items.Add(pListViewItem); } } mSystable = null; }
private void UCSysSetting_Load(object sender, EventArgs e) { //数据类型下拉框 comboBoxDataType.Items.Add(""); comboBoxDataType.Items.Add("String"); comboBoxDataType.Items.Add("Double"); comboBoxDataType.Items.Add("Integer"); comboBoxDataType.Items.Add("XmlFile"); comboBoxDataType.Items.Add("MxdFile"); //最初 不可导入、导出参数 buttonXImport.Enabled = false; buttonXExport.Enabled = false; ///Zq 20111118 add buttonModify.Enabled = false; ///end SysGisTable mSystable = new SysCommon.Gis.SysGisTable(_TmpWorkSpace); Exception err = null; //打开系统参数表 List <Dictionary <string, object> > listdic = mSystable.GetRows("SYSSETTING", "", out err); if (listdic != null) { for (int i = 0; i < listdic.Count; i++) { Dictionary <string, object> pDic = listdic[i]; ListViewItem pListViewItem = new ListViewItem(); //参数名 if (pDic.ContainsKey("SETTINGNAME")) { if (pDic["SETTINGNAME"] != null) { pListViewItem.SubItems[0].Text = pDic["SETTINGNAME"].ToString();//比较特殊,默认已经有一个子项 } //else //{ // pListViewItem.SubItems.Add(""); //} } //else //{ pListViewItem.SubItems.Add(""); } //参数值 if (pDic.ContainsKey("SETTINGVALUE")) { if (pDic["SETTINGVALUE"] != null) { pListViewItem.SubItems.Add(pDic["SETTINGVALUE"].ToString()); } else { pListViewItem.SubItems.Add(""); } } else { pListViewItem.SubItems.Add(""); } //参数数据类型 if (pDic.ContainsKey("DATATYPE")) { if (pDic["DATATYPE"] != null) { pListViewItem.SubItems.Add(pDic["DATATYPE"].ToString()); } else { pListViewItem.SubItems.Add(""); } } else { pListViewItem.SubItems.Add(""); } //参数描述 if (pDic.ContainsKey("DESCRIPTION")) { if (pDic["DESCRIPTION"] != null) { pListViewItem.SubItems.Add(pDic["DESCRIPTION"].ToString()); } else { pListViewItem.SubItems.Add(""); } } else { pListViewItem.SubItems.Add(""); } //如果BLOB类型的字段有值 if (pDic.ContainsKey("SETTINGVALUE2")) { if (pDic["SETTINGVALUE2"] != null) { if (pListViewItem.SubItems[2].Text.Contains("File")) { pListViewItem.SubItems[1].Text = "*"; } } } listView.Items.Add(pListViewItem); } } //判断导入、导出参数按钮的可用状态 if (comboBoxDataType.Text.Contains("File")) { buttonXImport.Enabled = true; buttonXExport.Enabled = true; } else { buttonXImport.Enabled = false; buttonXExport.Enabled = false; } mSystable = null; }