Exemplo n.º 1
0
        public static void DeleteDomain(string string_0)
        {
            if (m_pDomainTable == null)
            {
                m_pDomainTable = AppConfigInfo.OpenTable(CodeDomainTableStruct.TableName);
                if (m_pDomainTable == null)
                {
                    return;
                }
            }
            IQueryFilter queryFilter = new QueryFilter
            {
                WhereClause = string.Format("{0} = '{1}'", CodeDomainTableStruct.DomainIDFieldName, string_0)
            };

            m_pDomainTable.DeleteSearchedRows(queryFilter);
            if (m_pDomainMapTable == null)
            {
                m_pDomainMapTable = AppConfigInfo.OpenTable(CodeDomainMapTableStruct.TableName);
                if (m_pDomainMapTable == null)
                {
                    return;
                }
            }
            queryFilter.WhereClause = string.Format("{0} = '{1}'", CodeDomainMapTableStruct.DomainID, string_0);
            m_pDomainMapTable.DeleteSearchedRows(queryFilter);
        }
Exemplo n.º 2
0
        public static string GetDamainName(string string_0, string string_1)
        {
            string str = "";

            if (m_pDomainMapTable == null)
            {
                m_pDomainMapTable = AppConfigInfo.OpenTable(CodeDomainMapTableStruct.TableName);
                if (m_pDomainMapTable == null)
                {
                    return(str);
                }
            }
            string[] strArray = string_1.Split(new char[] { '.' });
            string   str3     = string.Format("{0}='{1}' and {2}='{3}'",
                                              new object[]
            {
                CodeDomainMapTableStruct.FieldName, string_0, CodeDomainMapTableStruct.FeatureClassName,
                strArray[strArray.Length - 1]
            });
            IQueryFilter queryFilter = new QueryFilter
            {
                WhereClause = str3
            };
            ICursor o   = m_pDomainMapTable.Search(queryFilter, false);
            IRow    row = o.NextRow();

            if (row != null)
            {
                str = row.get_Value(m_pDomainMapTable.FindField(CodeDomainMapTableStruct.DomainID)).ToString();
                row.Store();
            }
            ComReleaser.ReleaseCOMObject(o);
            return(str);
        }
Exemplo n.º 3
0
        public static void ModifyCodeDoaminMap(string string_0, string string_1, string string_2)
        {
            if (m_pDomainMapTable == null)
            {
                m_pDomainMapTable = AppConfigInfo.OpenTable(CodeDomainMapTableStruct.TableName);
                if (m_pDomainMapTable == null)
                {
                    return;
                }
            }
            string[] strArray = string_0.Split(new char[] { '.' });
            string_0 = strArray[strArray.Length - 1];
            string str = string.Format("{0}='{1}' and {2}='{3}'",
                                       new object[]
                                       { CodeDomainMapTableStruct.FieldName, string_1, CodeDomainMapTableStruct.FeatureClassName, string_0 });
            IQueryFilter queryFilter = new QueryFilter
            {
                WhereClause = str
            };
            ICursor o   = m_pDomainMapTable.Search(queryFilter, false);
            IRow    row = o.NextRow();

            if (row != null)
            {
                row.set_Value(m_pDomainMapTable.FindField(CodeDomainMapTableStruct.DomainID), string_2);
                row.Store();
            }
            ComReleaser.ReleaseCOMObject(o);
        }
Exemplo n.º 4
0
        private void CatoTemplateApplySelect_Load(object sender, EventArgs e)
        {
            CartoTemplateTableStruct struct2 = new CartoTemplateTableStruct();
            ITable table = AppConfigInfo.OpenTable(struct2.TableName);

            if (table != null)
            {
                ICursor  o     = table.Search(null, false);
                IRow     row   = o.NextRow();
                string[] items = new string[2];
                while (row != null)
                {
                    CartoTemplateData data = new CartoTemplateData(row);
                    items[0] = data.Name;
                    items[1] = data.Description;
                    ListViewItem item = new ListViewItem(items)
                    {
                        Tag = data
                    };
                    this.listView1.Items.Add(item);
                    row = o.NextRow();
                }
                ComReleaser.ReleaseCOMObject(o);
                o = null;
            }
        }
Exemplo n.º 5
0
 public static void AddFieldCodeDoaminMap(string string_0, string string_1, string string_2)
 {
     if (m_pDomainMapTable == null)
     {
         m_pDomainMapTable = AppConfigInfo.OpenTable(CodeDomainMapTableStruct.TableName);
         if (m_pDomainMapTable == null)
         {
             return;
         }
     }
     string[] strArray = string_0.Split(new char[] { '.' });
     string_0 = strArray[strArray.Length - 1];
     if (CheckHasDamain(string_1, string_0))
     {
         ModifyCodeDoaminMap(string_0, string_1, string_2);
     }
     else
     {
         IRow row = m_pDomainMapTable.CreateRow();
         row.set_Value(m_pDomainMapTable.FindField(CodeDomainMapTableStruct.FeatureClassName), string_0);
         row.set_Value(m_pDomainMapTable.FindField(CodeDomainMapTableStruct.FieldName), string_1);
         row.set_Value(m_pDomainMapTable.FindField(CodeDomainMapTableStruct.DomainID), string_2);
         row.Store();
     }
 }
Exemplo n.º 6
0
        public static bool IsZDFeatureClass(IFeatureClass ifeatureClass_0)
        {
            bool result;

            if (ifeatureClass_0 == null)
            {
                result = false;
            }
            else
            {
                ITable table = null;
                try
                {
                    table = AppConfigInfo.OpenTable("ZDInfos");
                }
                catch
                {
                }
                if (table == null)
                {
                    try
                    {
                        ZDHistoryManage zDHistoryManage = new ZDHistoryManage();
                        zDHistoryManage.CreateTable(AppConfigInfo.GetWorkspace() as IFeatureWorkspace);
                        table = AppConfigInfo.OpenTable("ZDInfos");
                    }
                    catch (System.Exception)
                    {
                    }
                }
                if (table == null)
                {
                    result = false;
                }
                else
                {
                    string workspaceConnectInfo =
                        WorkspaceOperator.GetWorkspaceConnectInfo((ifeatureClass_0 as IDataset).Workspace);
                    IQueryFilter queryFilter = new QueryFilter();
                    string[]     array       = (ifeatureClass_0 as IDataset).Name.Split(new char[]
                    {
                        '.'
                    });
                    queryFilter.WhereClause = string.Format("FeatureClassName='{0}' and GDBConnectInfo='{1}'",
                                                            array[array.Length - 1], workspaceConnectInfo);
                    try
                    {
                        int num = table.RowCount(queryFilter);
                        result = (num == 1);
                        return(result);
                    }
                    catch (System.Exception)
                    {
                    }
                    result = false;
                }
            }
            return(result);
        }
Exemplo n.º 7
0
        public static bool Register(IFeatureClass ifeatureClass_0, string string_0)
        {
            bool result;

            if (ZDRegister.IsZDFeatureClass(ifeatureClass_0))
            {
                result = false;
            }
            else
            {
                string[] array = (ifeatureClass_0 as IDataset).Name.Split(new char[]
                {
                    '.'
                });
                ZDRegisterTable   zDRegisterTable  = new ZDRegisterTable();
                ITable            table            = AppConfigInfo.OpenTable("ZDInfos");
                IFeatureWorkspace featureWorkspace = (ifeatureClass_0 as IDataset).Workspace as IFeatureWorkspace;
                string            finalName        = WorkspaceOperator.GetFinalName2(featureWorkspace as IWorkspace,
                                                                                     esriDatasetType.esriDTFeatureClass, "", array[array.Length - 1], "_His");
                IRow row = table.CreateRow();
                RowOperator.SetFieldValue(row, zDRegisterTable.FeatureClassNameField, array[array.Length - 1]);
                RowOperator.SetFieldValue(row, zDRegisterTable.ZDBHFieldName, string_0);
                RowOperator.SetFieldValue(row, zDRegisterTable.RegisterDateFieldName, System.DateTime.Now);
                RowOperator.SetFieldValue(row, zDRegisterTable.HistoryFeatureClassName, finalName);
                string workspaceConnectInfo =
                    WorkspaceOperator.GetWorkspaceConnectInfo((ifeatureClass_0 as IDataset).Workspace);
                RowOperator.SetFieldValue(row, zDRegisterTable.GDBConnectInfoName, workspaceConnectInfo);
                RowOperator.SetFieldValue(row, zDRegisterTable.GuidName, System.Guid.NewGuid().ToString());
                row.Store();
                (ifeatureClass_0 as IDataset).Name.Split(new char[]
                {
                    '.'
                });
                IFields fields = (ifeatureClass_0.Fields as IClone).Clone() as IFields;
                IField  field  = new ESRI.ArcGIS.Geodatabase.Field();
                (field as IFieldEdit).Name_2      = "OriginOID_";
                (field as IFieldEdit).AliasName_2 = "原始宗地编号";
                (field as IFieldEdit).Type_2      = esriFieldType.esriFieldTypeInteger;
                (fields as IFieldsEdit).AddField(field);
                IFeatureClass featureClass = featureWorkspace.CreateFeatureClass(finalName, fields, null, null,
                                                                                 esriFeatureType.esriFTSimple, "shape", "");
                if ((featureWorkspace as IWorkspace).Type == esriWorkspaceType.esriRemoteDatabaseWorkspace)
                {
                    IVersionedObject3 versionedObject = featureClass as IVersionedObject3;
                    if (versionedObject != null)
                    {
                        versionedObject.RegisterAsVersioned3(false);
                    }
                }
                result = true;
            }
            return(result);
        }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
        public static bool EditDomain(string string_0, string string_1, string string_2, string string_3,
                                      string string_4, string string_5, string string_6, string string_7, esriFieldType esriFieldType_0)
        {
            if (m_pDomainTable == null)
            {
                m_pDomainTable = AppConfigInfo.OpenTable(CodeDomainTableStruct.TableName);
                if (m_pDomainTable == null)
                {
                    return(false);
                }
            }
            IQueryFilter queryFilter = new QueryFilter
            {
                WhereClause =
                    string.Format("{0} = '{1}' and {2}<>'{3}'",
                                  new object[]
                {
                    CodeDomainTableStruct.DomainNameFieldName, string_3,
                    CodeDomainTableStruct.DomainIDFieldName, string_0
                })
            };

            if (m_pDomainTable.RowCount(queryFilter) > 0)
            {
                MessageBox.Show("存在同名域值定义,请取其他名字!");
                return(false);
            }
            queryFilter.WhereClause = string.Format("{0} = '{1}'", CodeDomainTableStruct.DomainIDFieldName, string_0);
            ICursor o   = m_pDomainTable.Search(queryFilter, false);
            IRow    row = o.NextRow();

            if (row != null)
            {
                row.set_Value(m_pDomainTable.FindField(CodeDomainTableStruct.ConnectionFieldName), string_1);
                row.set_Value(m_pDomainTable.FindField(CodeDomainTableStruct.TableFieldName), string_2);
                row.set_Value(m_pDomainTable.FindField(CodeDomainTableStruct.DomainNameFieldName), string_3);
                row.set_Value(m_pDomainTable.FindField(CodeDomainTableStruct.ValueFieldName), string_4);
                row.set_Value(m_pDomainTable.FindField(CodeDomainTableStruct.DescriptionFieldName), string_5);
                row.set_Value(m_pDomainTable.FindField(CodeDomainTableStruct.fieldtypeFieldName),
                              (short)esriFieldType_0);
                row.set_Value(m_pDomainTable.FindField(CodeDomainTableStruct.IDFieldName), string_6);
                row.set_Value(m_pDomainTable.FindField(CodeDomainTableStruct.ParentIDFieldName), string_7);
                row.Store();
            }
            ComReleaser.ReleaseCOMObject(o);
            return(true);
        }
Exemplo n.º 10
0
 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);
     }
 }
Exemplo n.º 11
0
        public bool Load(out IList ilist_0, out IList ilist_1, out IList ilist_2)
        {
            ilist_0 = new ArrayList();
            ilist_1 = new ArrayList();
            ilist_2 = new ArrayList();
            new List <Staff>();
            ITable  table = AppConfigInfo.OpenTable(this.string_0);
            ICursor o     = table.Search(null, false);

            for (IRow row = o.NextRow(); row != null; row = o.NextRow())
            {
                ilist_0.Add(row.get_Value(table.FindField("ID")).ToString());
                ilist_1.Add(row.get_Value(table.FindField("NAME")).ToString());
                ilist_2.Add(row.get_Value(table.FindField("PASSWORD_")).ToString());
            }
            ComReleaser.ReleaseCOMObject(o);
            return(true);
        }
Exemplo n.º 12
0
        public static bool GetDomainInfo(string string_0, out string string_1, out string string_2, out string string_3,
                                         out string string_4, out string string_5, out string string_6, out string string_7,
                                         out esriFieldType esriFieldType_0)
        {
            string_1        = "";
            string_2        = "";
            string_3        = "";
            string_4        = "";
            string_5        = "";
            string_6        = "";
            string_7        = "";
            esriFieldType_0 = esriFieldType.esriFieldTypeString;
            if (m_pDomainTable == null)
            {
                m_pDomainTable = AppConfigInfo.OpenTable(CodeDomainTableStruct.TableName);
                if (m_pDomainTable == null)
                {
                    return(false);
                }
            }
            IQueryFilter queryFilter = new QueryFilter
            {
                WhereClause = string.Format("{0} = '{1}'", CodeDomainTableStruct.DomainIDFieldName, string_0)
            };
            ICursor o   = m_pDomainTable.Search(queryFilter, false);
            IRow    row = o.NextRow();

            if (row != null)
            {
                string_1 = row.get_Value(m_pDomainTable.FindField(CodeDomainTableStruct.ConnectionFieldName)).ToString();
                string_2 = row.get_Value(m_pDomainTable.FindField(CodeDomainTableStruct.TableFieldName)).ToString();
                string_3 = row.get_Value(m_pDomainTable.FindField(CodeDomainTableStruct.DomainNameFieldName)).ToString();
                string_4 = row.get_Value(m_pDomainTable.FindField(CodeDomainTableStruct.ValueFieldName)).ToString();
                string_5 =
                    row.get_Value(m_pDomainTable.FindField(CodeDomainTableStruct.DescriptionFieldName)).ToString();
                string_6        = row.get_Value(m_pDomainTable.FindField(CodeDomainTableStruct.IDFieldName)).ToString();
                string_7        = row.get_Value(m_pDomainTable.FindField(CodeDomainTableStruct.ParentIDFieldName)).ToString();
                esriFieldType_0 =
                    (esriFieldType)
                    Convert.ToInt32(row.get_Value(m_pDomainTable.FindField(CodeDomainTableStruct.fieldtypeFieldName)));
            }
            ComReleaser.ReleaseCOMObject(o);
            return(true);
        }
Exemplo n.º 13
0
        public bool ValidePassword(string string_1, string string_2)
        {
            ITable table = AppConfigInfo.OpenTable(this.string_0);

            if (table == null)
            {
                return(false);
            }
            IQueryFilter queryFilter = new QueryFilter
            {
                WhereClause = "ID='" + string_1 + "' and PASSWORD_ = '" + string_2 + "'"
            };

            if (table.RowCount(queryFilter) == 0)
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 14
0
 public static NameValueCollection GetCodeDomain(string string_0, NameValueCollection nameValueCollection_0)
 {
     if (m_pDomainTable == null)
     {
         m_pDomainTable = AppConfigInfo.OpenTable(CodeDomainTableStruct.TableName);
     }
     if (m_pDomainTable != null)
     {
         string       str         = string.Format("{0}='{1}'", CodeDomainTableStruct.DomainIDFieldName, string_0);
         IQueryFilter queryFilter = new QueryFilter
         {
             WhereClause = str
         };
         ICursor o     = m_pDomainTable.Search(queryFilter, false);
         IRow    row   = o.NextRow();
         int     index = m_pDomainTable.FindField(CodeDomainTableStruct.ConnectionFieldName);
         int     num2  = m_pDomainTable.FindField(CodeDomainTableStruct.TableFieldName);
         int     num3  = m_pDomainTable.FindField(CodeDomainTableStruct.DescriptionFieldName);
         int     num4  = m_pDomainTable.FindField(CodeDomainTableStruct.ValueFieldName);
         if (row != null)
         {
             string str2 = row.get_Value(num2).ToString();
             string str3 = row.get_Value(index).ToString();
             string str4 = row.get_Value(num3).ToString();
             string str5 = row.get_Value(num4).ToString();
             DataAccessLayerBaseClass dataAccessLayer =
                 DataAccessLayerFactory.GetDataAccessLayer(DataProviderType.OleDb, str3);
             string str6 = string.Format("select {0},{1} from {2}", str4, str5, str2);
             dataAccessLayer.Open();
             DataTable table = dataAccessLayer.ExecuteDataTable(str6);
             for (int i = 0; i < table.Rows.Count; i++)
             {
                 string name = table.Rows[i][str4].ToString().Trim();
                 string str8 = table.Rows[i][str5].ToString().Trim();
                 nameValueCollection_0.Add(name, str8);
             }
         }
         ComReleaser.ReleaseCOMObject(o);
     }
     return(nameValueCollection_0);
 }
Exemplo n.º 15
0
        private void method_0(int int_0, IPageLayout ipageLayout_0)
        {
            ElementsTableStruct struct2 = new ElementsTableStruct();
            ITable       table          = AppConfigInfo.OpenTable(struct2.TableName);
            IQueryFilter queryFilter    = new QueryFilterClass
            {
                WhereClause = struct2.TemplateIDFieldName + "=" + int_0.ToString()
            };
            ICursor o = table.Search(queryFilter, false);

            for (IRow row = o.NextRow(); row != null; row = o.NextRow())
            {
                IElement element = this.method_3(row, ipageLayout_0);
                if (element != null)
                {
                    (this._hookHelper.PageLayout as IGraphicsContainer).AddElement(element, -1);
                }
            }
            ComReleaser.ReleaseCOMObject(o);
            o = null;
        }
Exemplo n.º 16
0
        public List <Staff> Load()
        {
            List <Staff> list  = new List <Staff>();
            ITable       table = AppConfigInfo.OpenTable(this.string_0);

            if (table != null)
            {
                ICursor o = table.Search(null, false);
                for (IRow row = o.NextRow(); row != null; row = o.NextRow())
                {
                    Staff item = new Staff
                    {
                        StaffID   = Convert.ToString(row.get_Value(table.FindField("ID"))),
                        LoginName = Convert.ToString(row.get_Value(table.FindField("NAME"))),
                        RealName  = Convert.ToString(row.get_Value(table.FindField("REALNAME"))),
                        Password  = Convert.ToString(row.get_Value(table.FindField("PASSWORD_")))
                    };
                    list.Add(item);
                }
                ComReleaser.ReleaseCOMObject(o);
            }
            return(list);
        }
Exemplo n.º 17
0
        public static bool CheckHasDamain(string string_0, string string_1)
        {
            if (m_pDomainMapTable == null)
            {
                m_pDomainMapTable = AppConfigInfo.OpenTable(CodeDomainMapTableStruct.TableName);
                if (m_pDomainMapTable == null)
                {
                    return(false);
                }
            }
            string[] strArray = string_1.Split(new char[] { '.' });
            string   str      = string.Format("({0}='{1}' and {2}='{3}') or ({0}='{1}' and {2}='')",
                                              new object[]
            {
                CodeDomainMapTableStruct.FieldName, string_0, CodeDomainMapTableStruct.FeatureClassName,
                strArray[strArray.Length - 1]
            });
            IQueryFilter queryFilter = new QueryFilter
            {
                WhereClause = str
            };

            return(m_pDomainMapTable.RowCount(queryFilter) > 0);
        }
Exemplo n.º 18
0
        public static string GetHistoryZDFeatureName(IFeatureClass ifeatureClass_0)
        {
            string result;

            if (ifeatureClass_0 == null)
            {
                result = "";
            }
            else
            {
                ITable table = null;
                try
                {
                    table = AppConfigInfo.OpenTable("ZDInfos");
                }
                catch
                {
                }
                if (table == null)
                {
                    try
                    {
                        ZDHistoryManage zDHistoryManage = new ZDHistoryManage();
                        zDHistoryManage.CreateTable(AppConfigInfo.GetWorkspace() as IFeatureWorkspace);
                        table = AppConfigInfo.OpenTable("ZDInfos");
                    }
                    catch (System.Exception)
                    {
                    }
                }
                if (table == null)
                {
                    result = "";
                }
                else
                {
                    string workspaceConnectInfo =
                        WorkspaceOperator.GetWorkspaceConnectInfo((ifeatureClass_0 as IDataset).Workspace);
                    IQueryFilter queryFilter = new QueryFilter();
                    string[]     array       = (ifeatureClass_0 as IDataset).Name.Split(new char[]
                    {
                        '.'
                    });
                    queryFilter.WhereClause = string.Format("FeatureClassName='{0}' and GDBConnectInfo='{1}'",
                                                            array[array.Length - 1], workspaceConnectInfo);
                    using (ComReleaser comReleaser = new ComReleaser())
                    {
                        ICursor cursor = table.Search(queryFilter, false);
                        comReleaser.ManageLifetime(cursor);
                        IRow row = cursor.NextRow();
                        if (row != null)
                        {
                            int    num  = table.FindField("HistoryFeatureClass");
                            string text = "";
                            if (num != -1)
                            {
                                text = row.get_Value(num).ToString();
                            }
                            result = text;
                            return(result);
                        }
                    }
                    result = "";
                }
            }
            return(result);
        }
Exemplo n.º 19
0
        public static bool UnRegister(IFeatureClass ifeatureClass_0)
        {
            new ZDRegisterTable();
            ITable table = AppConfigInfo.OpenTable("ZDInfos");
            bool   result;

            if (table == null)
            {
                result = false;
            }
            else
            {
                IQueryFilter queryFilter = new QueryFilter();
                string[]     array       = (ifeatureClass_0 as IDataset).Name.Split(new char[]
                {
                    '.'
                });
                string workspaceConnectInfo =
                    WorkspaceOperator.GetWorkspaceConnectInfo((ifeatureClass_0 as IDataset).Workspace);
                queryFilter.WhereClause = string.Format("FeatureClassName='{0}' and GDBConnectInfo='{1}'",
                                                        array[array.Length - 1], workspaceConnectInfo);
                string arg  = "";
                string name = "";
                using (ComReleaser comReleaser = new ComReleaser())
                {
                    ICursor cursor = table.Search(queryFilter, false);
                    comReleaser.ManageLifetime(cursor);
                    IRow row = cursor.NextRow();
                    if (row != null)
                    {
                        int num = table.FindField("HistoryFeatureClass");
                        if (num != -1)
                        {
                            name = row.get_Value(num).ToString();
                        }
                        num = table.FindField("Guid");
                        if (num != -1)
                        {
                            arg = row.get_Value(num).ToString();
                        }
                        row.Delete();
                    }
                }
                table                   = AppConfigInfo.OpenTable("ZDHistory");
                queryFilter             = new QueryFilter();
                queryFilter.WhereClause = string.Format("ZDRegisterGuid='{0}'", arg);
                IWorkspaceEdit workspaceEdit = AppConfigInfo.GetWorkspace() as IWorkspaceEdit;
                bool           flag          = false;
                if (!workspaceEdit.IsBeingEdited())
                {
                    flag = true;
                    workspaceEdit.StartEditing(true);
                }
                workspaceEdit.StartEditOperation();
                table.DeleteSearchedRows(queryFilter);
                workspaceEdit.StopEditOperation();
                workspaceEdit.StopEditing(true);
                if (!flag)
                {
                    workspaceEdit.StartEditing(true);
                }
                try
                {
                    IFeatureWorkspace featureWorkspace = (ifeatureClass_0 as IDataset).Workspace as IFeatureWorkspace;
                    IFeatureClass     featureClass     = featureWorkspace.OpenFeatureClass(name);
                    (featureClass as IDataset).Delete();
                }
                catch (System.Exception)
                {
                }
                result = true;
            }
            return(result);
        }