Пример #1
0
 public bool OnProcessing(IFeatureProgress Progress)
 {
     if (_RepHandler != null)
     {
         return(_RepHandler(Progress));
     }
     else
     {
         return(false);
     }
 }
Пример #2
0
        public int AppendByTable(ITable tar, ITable src, IPropertySet ps, IFeatureProgress fp)
        {
            int          num         = -1;
            IFdeCursor   fdeCursor   = null;
            IQueryFilter queryFilter = new QueryFilterClass();
            int          result;

            try
            {
                IDataCopy     dataCopy      = new DataCopyClass();
                DataCopyParam dataCopyParam = new DataCopyParamClass();
                queryFilter.WhereClause = "1=1";
                fdeCursor = src.Search(queryFilter, false);
                dataCopyParam.SetFieldMapping(ps);
                dataCopyParam.Filter  = queryFilter;
                dataCopyParam.KeepFid = true;
                dataCopyParam.ResourceConflictPolicy = gviResourceConflictPolicy.gviResourceRenameToNew;
                System.Runtime.InteropServices.Marshal.ReleaseComObject(fdeCursor);
                num    = dataCopy.CopyTable(tar.DataSource, tar.TableName, src.DataSource, src.TableName, dataCopyParam);
                result = num;
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                XtraMessageBox.Show(ex.Message);
                LoggingService.Error(ex.Message + "\r\n" + ex.StackTrace);
                result = num;
            }
            catch (System.Exception ex2)
            {
                XtraMessageBox.Show(ex2.Message);
                LoggingService.Error(ex2.Message + "\r\n" + ex2.StackTrace);
                result = num;
            }
            finally
            {
                if (fdeCursor != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(fdeCursor);
                    fdeCursor = null;
                }
            }
            return(result);
        }
Пример #3
0
        /// <summary>
        ///     Copies the rows from the <paramref name="data" /> table to the source table.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="data">The data that will be copied.</param>
        /// <param name="filter">The filter that will be used prior to copying the data.</param>
        /// <param name="progress">The progress callback.</param>
        /// <returns>
        ///     Returns a <see cref="List{T}" /> representing the object ids of the records loaded.
        /// </returns>
        /// <remarks>
        ///     Assumes that the source and data table have the same schema.
        /// </remarks>
        public static List <int> Load(this ITable source, ITable data, IQueryFilter filter = null, IFeatureProgress progress = null)
        {
            if (progress != null)
            {
                progress.FeatureClassName = ((IDataset)source).Name;
                progress.MinFeatures      = 0;
                progress.MaxFeatures      = data.RowCount(filter);
                progress.Position         = 0;
                progress.StepValue        = 1;
            }

            var oids   = new List <int>();
            var fields = source.Fields.ToDictionary(f => f.Editable);

            using (ComReleaser cr = new ComReleaser())
            {
                ICursor cursor = data.Search(filter, false);
                cr.ManageLifetime(cursor);

                ICursor insert = source.Insert(true);
                cr.ManageLifetime(insert);

                var buffer = source.CreateRowBuffer();

                foreach (var rows in cursor.AsEnumerable().Batch(1000))
                {
                    foreach (var row in rows)
                    {
                        foreach (var field in fields)
                        {
                            buffer.Update(field.Value, row.Value[field.Value], false);
                        }

                        var oid = (int)insert.InsertRow(buffer);
                        oids.Add(oid);

                        if (progress != null)
                        {
                            progress.Step();
                        }
                    }

                    insert.Flush();
                }

                insert.Flush();
            }

            return(oids);
        }
Пример #4
0
 // Methods
 public GvitechFeatureProgress(IFeatureProgress iFeatureProgress)
 {
     this._iFeatureProgress = iFeatureProgress;
 }
Пример #5
0
 public bool OnReplicating(IFeatureProgress Progress)
 {
     //...
     return(true);
 }
Пример #6
0
 public bool OnProcessing(IFeatureProgress Progress)
 {
     return(this._RepHandler != null && this._RepHandler(new GvitechFeatureProgress(Progress)));
 }