private void copyTable()
            {
                dropDestinationTable();

                using (var cmd = _destination.CreateCommand())
                {
                    cmd.CommandText = _destinationTable;
                    cmd.CommandType = CommandType.TableDirect;

                    _operation.StatusDescription       = "Services_Definitions_CreatingDestTable";
                    _operation.IsProgressIndeterminate = true;

                    IDbCommand readCmd = _source.CreateCommand();
                    readCmd.CommandText = "SELECT * FROM " + _sourceExpression;
                    DataTable schema = null;
                    using (var sourceReader = readCmd.ExecuteReader())
                    {
                        schema = sourceReader.GetSchemaTable();
                        sourceReader.Close();
                    }

                    createDestinationTable(schema);

                    int rowCount = countRowsToCopy();

                    using (var sourceReader = readCmd.ExecuteReader())
                    {
                        _operation.StatusDescription       = "Services_Definitions_LoadingTaxa";
                        _operation.IsProgressIndeterminate = false;


                        var copyOperation = new ProgressInterval(_operation, _progressPerTaxonList, rowCount);

                        using (var destinationResultSet = cmd.ExecuteResultSet(ResultSetOptions.Updatable | ResultSetOptions.Scrollable))
                        {
                            while (sourceReader.Read())
                            {
                                SqlCeUpdatableRecord record = destinationResultSet.CreateRecord();
                                object[]             values = new object[sourceReader.FieldCount];
                                sourceReader.GetValues(values);
                                record.SetValues(values);
                                destinationResultSet.Insert(record);
                                copyOperation.advance();
                            }
                            destinationResultSet.Close();
                        }
                        sourceReader.Close();
                    }
                }
                return;
            }
        private List <IISOViewModel> buildQueryResult(IList <ISerializableObject> result)
        {
            CurrentOperation = new AsyncOperationInstance(true, null)
            {
                StatusDescription       = "SelectFD_Status_FillingResults",
                Progress                = 0,
                IsProgressIndeterminate = false,
            };

            List <IISOViewModel> list = new List <IISOViewModel>(result.Count());

            if (result.Count() == 0)
            {
                sendNotification("SelectFD_ResultEmpty");
                return(list);
            }

            ProgressInterval localProgress = null;

            localProgress = new ProgressInterval(CurrentOperation, 100f, result.Count());

            var conversionQuery = from obj in result
                                  select ISOStore.addOrRetrieveVMForISO(obj);

            foreach (var line in conversionQuery)
            {
                list.Add(line);
                if (localProgress != null)
                {
                    if (localProgress.IsCancelRequested)
                    {
                        break;
                    }
                    else
                    {
                        localProgress.advance();
                    }
                }
            }
            return(list);
        }
Ejemplo n.º 3
0
            public MultipleUris(string apikey, string client, int priority,
                                MiningIntensity intensity, IEnumerable <Uri> uris)
            {
                if (uris == null)
                {
                    throw new ArgumentNullException("files");
                }
                if (string.IsNullOrEmpty(apikey))
                {
                    throw new ArgumentNullException("apikey");
                }

                this.apikey    = apikey;
                this.Client    = client;
                this.Priority  = priority;
                this.Intensity = intensity;
                this.uris      = uris;

                if (this.uris.Count() > 0)
                {
                    pi = new ProgressInterval(this.uris.Count());
                }
            }