public static CodeDomainEx AddCodeDomain(string string_0, string string_1, string string_2, string string_3, string string_4, string string_5, string string_6, esriFieldType esriFieldType_0) { if (m_pDomainTable == null) { m_pDomainTable = AppConfigInfo.OpenTable(CodeDomainTableStruct.TableName); if (m_pDomainTable == null) { return(null); } } IQueryFilter queryFilter = new QueryFilter { WhereClause = string.Format("{0} = '{1}'", CodeDomainTableStruct.DomainNameFieldName, string_2) }; if (m_pDomainTable.RowCount(queryFilter) > 0) { MessageBox.Show("存在同名域值定义,请取其他名字!"); return(null); } string str = Guid.NewGuid().ToString(); IRow row = m_pDomainTable.CreateRow(); row.set_Value(m_pDomainTable.FindField(CodeDomainTableStruct.ConnectionFieldName), string_0); row.set_Value(m_pDomainTable.FindField(CodeDomainTableStruct.TableFieldName), string_1); row.set_Value(m_pDomainTable.FindField(CodeDomainTableStruct.DomainNameFieldName), string_2); row.set_Value(m_pDomainTable.FindField(CodeDomainTableStruct.ValueFieldName), string_3); row.set_Value(m_pDomainTable.FindField(CodeDomainTableStruct.DescriptionFieldName), string_4); m_pDomainTable.FindField(CodeDomainTableStruct.DomainIDFieldName); row.set_Value(m_pDomainTable.FindField(CodeDomainTableStruct.DomainIDFieldName), str); row.set_Value(m_pDomainTable.FindField(CodeDomainTableStruct.fieldtypeFieldName), (short)esriFieldType_0); row.set_Value(m_pDomainTable.FindField(CodeDomainTableStruct.IDFieldName), string_5); row.set_Value(m_pDomainTable.FindField(CodeDomainTableStruct.ParentIDFieldName), string_6); row.Store(); CodeDomainEx item = new CodeDomainEx { DomainID = str, Name = string_2, FieldType = esriFieldType_0, ConnectionStr = string_0, CodeFieldName = string_3, IDFieldName = string_5, NameFieldName = string_4, ParentIDFieldName = string_6, TableFieldName = string_1 }; CodeDomainExs.Add(item); return(item); }
public static void LoadDomain() { if (m_pDomainTable == null) { m_pDomainTable = AppConfigInfo.OpenTable(CodeDomainTableStruct.TableName); } if (m_pDomainTable != null) { ICursor o = m_pDomainTable.Search(null, false); IRow row = o.NextRow(); int index = m_pDomainTable.FindField(CodeDomainTableStruct.DomainNameFieldName); int num2 = m_pDomainTable.FindField(CodeDomainTableStruct.DomainIDFieldName); int num3 = m_pDomainTable.FindField(CodeDomainTableStruct.fieldtypeFieldName); int num4 = m_pDomainTable.FindField(CodeDomainTableStruct.DescriptionFieldName); int num5 = m_pDomainTable.FindField(CodeDomainTableStruct.ValueFieldName); int num6 = m_pDomainTable.FindField(CodeDomainTableStruct.ParentIDFieldName); int num7 = m_pDomainTable.FindField(CodeDomainTableStruct.IDFieldName); int num8 = m_pDomainTable.FindField(CodeDomainTableStruct.TableFieldName); int num9 = m_pDomainTable.FindField(CodeDomainTableStruct.ConnectionFieldName); while (row != null) { string str = row.get_Value(index).ToString(); if (str.Length > 0) { string str2 = row.get_Value(num2).ToString(); esriFieldType type = (esriFieldType)Convert.ToInt32(row.get_Value(num3)); CodeDomainEx item = new CodeDomainEx { DomainID = str2, Name = str, FieldType = type, TableFieldName = row.get_Value(num8).ToString(), CodeFieldName = row.get_Value(num5).ToString(), IDFieldName = row.get_Value(num7).ToString(), ConnectionStr = row.get_Value(num9).ToString(), ParentIDFieldName = row.get_Value(num6).ToString(), NameFieldName = row.get_Value(num4).ToString() }; CodeDomainExs.Add(item); } row = o.NextRow(); } ComReleaser.ReleaseCOMObject(o); } }