Пример #1
0
 private void method_1(IVersionedTable iversionedTable_0, IVersionedTable iversionedTable_1, string string_0,
                       string string_1, esriDifferenceType esriDifferenceType_0, string string_2, bool bool_2, IList ilist_0)
 {
     try
     {
         int          num;
         IRow         row;
         IQueryFilter queryFilter = new QueryFilterClass();
         IObjectClass class2      = iversionedTable_0 as IObjectClass;
         queryFilter.SubFields = class2.OIDFieldName;
         IDifferenceCursor cursor = iversionedTable_0.Differences(iversionedTable_1 as ITable,
                                                                  esriDifferenceType_0, queryFilter);
         cursor.Next(out num, out row);
         while (num != -1)
         {
             if (bool_2)
             {
                 this.method_2(num, esriDifferenceType_0, string_1, string_0, string_2, ilist_0);
             }
             else
             {
                 this.method_2(num, esriDifferenceType_0, string_0, string_1, string_2, ilist_0);
             }
             cursor.Next(out num, out row);
         }
     }
     catch
     {
     }
 }
Пример #2
0
        public IFIDSet FindHistoricalDifferences(IWorkspace workspace, string historicalMarkerName, string tableName,
                                                 esriDifferenceType differenceType)
        {
            IHistoricalWorkspace historicalWorkspace = (IHistoricalWorkspace)workspace;
            IHistoricalVersion   historicalVersion   =
                historicalWorkspace.FindHistoricalVersionByName(historicalWorkspace.DefaultMarkerName);
            IHistoricalVersion historicalVersion1 = historicalWorkspace.FindHistoricalVersionByName(historicalMarkerName);
            IFeatureWorkspace  featureWorkspace   = (IFeatureWorkspace)historicalVersion;
            IFeatureWorkspace  featureWorkspace1  = (IFeatureWorkspace)historicalVersion1;
            ITable             table            = featureWorkspace.OpenTable(tableName);
            ITable             table1           = featureWorkspace1.OpenTable(tableName);
            IDifferenceCursor  differenceCursor = ((IVersionedTable)table).Differences(table1, differenceType, null);
            IFIDSet            fIDSetClass      = new FIDSet();
            IRow row = null;
            int  num = -1;

            differenceCursor.Next(out num, out row);
            while (num != -1)
            {
                fIDSetClass.Add(num);
                differenceCursor.Next(out num, out row);
            }
            fIDSetClass.Reset();
            return(fIDSetClass);
        }
Пример #3
0
        private void method_1(IVersionedTable iversionedTable_0, IVersionedTable iversionedTable_1, string string_0,
                              string string_1, esriDifferenceType esriDifferenceType_0, string string_2, bool bool_2, IList ilist_0)
        {
            int  num;
            IRow row;

            try
            {
                IQueryFilter queryFilterClass = new QueryFilter()
                {
                    SubFields = (iversionedTable_0 as IObjectClass).OIDFieldName
                };
                IDifferenceCursor differenceCursor = iversionedTable_0.Differences(iversionedTable_1 as ITable,
                                                                                   esriDifferenceType_0, queryFilterClass);
                differenceCursor.Next(out num, out row);
                while (num != -1)
                {
                    if (!bool_2)
                    {
                        this.method_2(num, esriDifferenceType_0, string_0, string_1, string_2, ilist_0);
                    }
                    else
                    {
                        this.method_2(num, esriDifferenceType_0, string_1, string_0, string_2, ilist_0);
                    }
                    differenceCursor.Next(out num, out row);
                }
            }
            catch
            {
            }
        }
Пример #4
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="DifferenceRow" /> struct.
 /// </summary>
 /// <param name="differenceType">Type of the difference.</param>
 /// <param name="oid">The object id of the row.</param>
 /// <param name="differenceRow">The read-only row reference, which can be null if it was deleted.</param>
 public DifferenceRow(esriDifferenceType differenceType, int oid, IRow differenceRow)
 {
     this.DifferenceType = differenceType;
     this.OID            = oid;
     this.Changed        = differenceRow;
     this.Original       = null;
     this.FieldIndices   = null;
 }
Пример #5
0
        private void method_2(int int_0, esriDifferenceType esriDifferenceType_0, string string_0, string string_1,
                              string string_2, IList ilist_0)
        {
            string str = "";

            this.bool_0 = true;
            switch (esriDifferenceType_0)
            {
            case esriDifferenceType.esriDifferenceTypeInsert:
                str = "版本 " + string_0 + " 中插入行";
                break;

            case esriDifferenceType.esriDifferenceTypeDeleteNoChange:
                str = "版本 " + string_0 + " 中删除了行,而在版本 " + string_1 + " 没有变化";
                break;

            case esriDifferenceType.esriDifferenceTypeUpdateNoChange:
                str = "版本 " + string_0 + " 中更新了记录,而在版本 " + string_1 + " 没有变化";
                break;

            case esriDifferenceType.esriDifferenceTypeUpdateUpdate:
                str = "版本 " + string_0 + " 和 " + string_1 + "都更新了该行";
                break;

            case esriDifferenceType.esriDifferenceTypeUpdateDelete:
                str = "版本 " + string_0 + " 中更新了该行,而在版本 " + string_1 + "删除了该行";
                break;

            case esriDifferenceType.esriDifferenceTypeDeleteUpdate:
                str = "版本 " + string_0 + " 中删除了该行,而在版本 " + string_1 + " 中更新了该行";
                break;
            }
            ilist_0.Add(string_2.ToUpper() + ": 对象OID " + int_0.ToString());
            ilist_0.Add(str);
            if (((esriDifferenceType_0 == esriDifferenceType.esriDifferenceTypeUpdateUpdate) ||
                 (esriDifferenceType_0 == esriDifferenceType.esriDifferenceTypeUpdateDelete)) ||
                (esriDifferenceType_0 == esriDifferenceType.esriDifferenceTypeDeleteUpdate))
            {
                ilist_0.Add("发现冲突");
            }
            if ((esriDifferenceType_0 == esriDifferenceType.esriDifferenceTypeUpdateNoChange) ||
                (esriDifferenceType_0 == esriDifferenceType.esriDifferenceTypeUpdateUpdate))
            {
                this.method_3(int_0, string_0, string_1, ilist_0);
            }
            ilist_0.Add("________________________________________________________");
        }
Пример #6
0
        public static IFIDSet FindVersionDifferences(IWorkspace workspace, string childVersionName,
                                                     string parentVersionName, string tableName, esriDifferenceType differenceType)
        {
            IVersionedWorkspace versionedWorkspace = (IVersionedWorkspace)workspace;
            IVersion            version            = versionedWorkspace.FindVersion(childVersionName);
            IVersion            version1           = versionedWorkspace.FindVersion(parentVersionName);
            IVersion            commonAncestor     = ((IVersion2)version).GetCommonAncestor(version1);
            ITable            table            = ((IFeatureWorkspace)version).OpenTable(tableName);
            ITable            table1           = ((IFeatureWorkspace)commonAncestor).OpenTable(tableName);
            IDifferenceCursor differenceCursor = ((IVersionedTable)table).Differences(table1, differenceType, null);
            IFIDSet           fIDSetClass      = new FIDSet();
            IRow row = null;
            int  num = -1;

            differenceCursor.Next(out num, out row);
            while (num != -1)
            {
                fIDSetClass.Add(num);
                differenceCursor.Next(out num, out row);
            }
            fIDSetClass.Reset();
            return(fIDSetClass);
        }
Пример #7
0
        private void method_2(int int_0, esriDifferenceType esriDifferenceType_0, string string_0, string string_1,
                              string string_2, IList ilist_0)
        {
            string[] string0;
            string   str = "";

            this.bool_0 = true;
            switch (esriDifferenceType_0)
            {
            case esriDifferenceType.esriDifferenceTypeInsert:
            {
                str = string.Concat("版本 ", string_0, " 中插入行");
                break;
            }

            case esriDifferenceType.esriDifferenceTypeDeleteNoChange:
            {
                string0 = new string[] { "版本 ", string_0, " 中删除了行,而在版本 ", string_1, " 没有变化" };
                str     = string.Concat(string0);
                break;
            }

            case esriDifferenceType.esriDifferenceTypeUpdateNoChange:
            {
                string0 = new string[] { "版本 ", string_0, " 中更新了记录,而在版本 ", string_1, " 没有变化" };
                str     = string.Concat(string0);
                break;
            }

            case esriDifferenceType.esriDifferenceTypeUpdateUpdate:
            {
                string0 = new string[] { "版本 ", string_0, " 和 ", string_1, "都更新了该行" };
                str     = string.Concat(string0);
                break;
            }

            case esriDifferenceType.esriDifferenceTypeUpdateDelete:
            {
                string0 = new string[] { "版本 ", string_0, " 中更新了该行,而在版本 ", string_1, "删除了该行" };
                str     = string.Concat(string0);
                break;
            }

            case esriDifferenceType.esriDifferenceTypeDeleteUpdate:
            {
                string0 = new string[] { "版本 ", string_0, " 中删除了该行,而在版本 ", string_1, " 中更新了该行" };
                str     = string.Concat(string0);
                break;
            }
            }
            ilist_0.Add(string.Concat(string_2.ToUpper(), ": 对象OID ", int_0.ToString()));
            ilist_0.Add(str);
            if ((esriDifferenceType_0 == esriDifferenceType.esriDifferenceTypeUpdateUpdate ||
                 esriDifferenceType_0 == esriDifferenceType.esriDifferenceTypeUpdateDelete
                ? true
                : esriDifferenceType_0 == esriDifferenceType.esriDifferenceTypeDeleteUpdate))
            {
                ilist_0.Add("发现冲突");
            }
            if ((esriDifferenceType_0 == esriDifferenceType.esriDifferenceTypeUpdateNoChange
                ? true
                : esriDifferenceType_0 == esriDifferenceType.esriDifferenceTypeUpdateUpdate))
            {
                this.method_3(int_0, string_0, string_1, ilist_0);
            }
            ilist_0.Add("________________________________________________________");
        }
Пример #8
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="DifferenceRow" /> struct.
 /// </summary>
 /// <param name="differenceType">Type of the difference.</param>
 /// <param name="oid">The object id of the row.</param>
 /// <param name="differenceRow">The read-only row reference, which can be null if it was deleted.</param>
 /// <param name="sourceRow">The source row.</param>
 /// <param name="fieldIndices">An array with indices of fields with different values.</param>
 public DifferenceRow(esriDifferenceType differenceType, int oid, IRow differenceRow, IRow sourceRow, ILongArray fieldIndices)
     : this(differenceType, oid, differenceRow)
 {
     this.Original     = sourceRow;
     this.FieldIndices = fieldIndices;
 }
Пример #9
0
        public static IFIDSet FindVersionDifferences(IWorkspace workspace, String sourceVersionName, String targetVersionName, String tableName, esriDifferenceType differenceType)
        {
            // Get references to the child and parent versions.
            IVersionedWorkspace versionedWorkspace = (IVersionedWorkspace)workspace;
            IVersion            sourceVersion      = versionedWorkspace.FindVersion(sourceVersionName);
            IVersion            targetVersion      = versionedWorkspace.FindVersion(targetVersionName);

            // Cast to the IVersion2 interface to find the common ancestor.
            IVersion2 sourceVersion2        = (IVersion2)sourceVersion;
            IVersion  commonAncestorVersion = sourceVersion2.GetCommonAncestor(targetVersion);

            // Cast the child version to IFeatureWorkspace and open the table.
            IFeatureWorkspace targetFWS   = (IFeatureWorkspace)sourceVersion;
            ITable            targetTable = targetFWS.OpenTable(tableName);

            // Cast the common ancestor version to IFeatureWorkspace and open the table.
            IFeatureWorkspace commonAncestorFWS   = (IFeatureWorkspace)commonAncestorVersion;
            ITable            commonAncestorTable = commonAncestorFWS.OpenTable(tableName);

            // Cast to the IVersionedTable interface to create a difference cursor.
            IVersionedTable   versionedTable   = (IVersionedTable)targetTable;
            IDifferenceCursor differenceCursor = versionedTable.Differences(commonAncestorTable, differenceType, null);

            // Create output variables for the IDifferenceCursor.Next method and a FID set.
            IFIDSet fidSet        = new FIDSetClass();
            IRow    differenceRow = null;
            int     objectID      = -1;

            // Step through the cursor, showing the ID of each modified row.
            differenceCursor.Next(out objectID, out differenceRow);
            while (objectID != -1)
            {
                fidSet.Add(objectID);
                differenceCursor.Next(out objectID, out differenceRow);
            }

            fidSet.Reset();
            return(fidSet);
        }