示例#1
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);
        }
示例#2
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);
        }