예제 #1
0
        //Spilt a precursor ion if the elution curve has a 'pause' (intensities drop to zero for a while)
        public IEnumerable <PrecursorIon> SplitBasedOnTime(DBOptions dbOptions)
        {
            if (Queries.Count > 0)
            {
                this.Queries.Sort(Query.AscendingRetentionTimeComparison);
                List <double> timePoints = new List <double>();
                for (int i = 1; i < Queries.Count; i++)
                {
                    timePoints.Add(Queries[i].spectrum.RetentionTimeInMin - Queries[i - 1].spectrum.RetentionTimeInMin);
                }

                double  variance = MathNet.Numerics.Statistics.Statistics.UpperQuartile(timePoints);
                Queries newQ     = new Queries(dbOptions);
                newQ.Add(Queries[0]);
                for (int i = 1; i < Queries.Count; i++)
                {
                    if (timePoints[i - 1] > 10 * variance)
                    {
                        yield return(new PrecursorIon(Sample, newQ, MZ, Charge));

                        newQ.Clear();
                    }
                    newQ.Add(Queries[i]);
                }
                yield return(new PrecursorIon(Sample, newQ, MZ, Charge));
            }
        }
        /// <summary>
        /// Adds the given client-query to the list of queries
        /// </summary>
        /// <param parameterName="parameterExternalName">The parameterName to show to the end user</param>
        /// <param parameterName="table">The table descriptor that the query belongs to</param>
        /// <param parameterName="predicate">The predicate that defines the filter for the query</param>
        /// <param parameterName="parameterDefinitions">The parameter definitions defining the functionParameters to be used</param>
        private LiteQueryViewModel NewUserQuery(string externalName, FeatureTableDescriptor table, System.Linq.Expressions.Expression predicate, ParameterDefinitionCollection parameterDefinitions, bool addToQueries)
        {
            LiteQueryViewModel clientQuery = null;

            if (IsAuthenticated && Queries != null)
            {
                var predicateText = predicate != null?predicate.GeoLinqText(useInternalParameterNames : true) : null;

                var queryDefinition = new FeatureCollectionQueryDefinition()
                {
                    ServiceProviderGroup = table.ServiceProviderGroup,
                    Context              = ServiceProviderDatumContext.User,
                    Name                 = externalName.ToLower(),
                    ExternalName         = externalName,
                    TableDescriptor      = table,
                    ParameterDefinitions = parameterDefinitions
                };

                clientQuery = new LiteQueryViewModel(this.Messenger, queryDefinition, predicateText);

                if (addToQueries)
                {
                    Queries.Add(clientQuery);

                    SaveUserQueries();
                }
            }

            return(clientQuery);
        }
        public GraphQuery <T> AddQuery <T>(string operation, T instance)
        {
            var query = new GraphQuery <T>(operation);

            Queries.Add(query);
            return(query);
        }
예제 #4
0
        public void Init()
        {
            IStorageManager storageManager = Program.Model.GetVaultProcessor(this._ctNodeDefinition.Connection);
            CurrentStorage  storage        = storageManager.CurrentStorage;

            this._ctNodeDefinition.TemplateNode.LoadUserParameters(storage);

            ParseNode(this._ctNodeDefinition.TemplateNode);

            if (this._dicParameters.Any())
            {
                Queries.RaiseListChangedEvents = false;
                Queries.Clear();

                foreach (var query in this._dicParameters.Keys)
                {
                    Queries.Add(query);
                }

                Queries.RaiseListChangedEvents = true;

                var fquery = Queries.FirstOrDefault();

                if (fquery != null)
                {
                    SelectedQuery = fquery;
                }
            }
        }
예제 #5
0
        /// <summary>
        /// Configures the SplunkDataSource and launches the SplunkDataQuery(s).
        /// </summary>
        private static void ProcessSplunkInputs()
        {
            Splunk = new SplunkDataSource(
                Config["Inputs:Splunk:Config:Hostname"],
                Convert.ToInt32(Config["Inputs:Splunk:Config:Port"]),
                Config["Inputs:Splunk:Config:Username"],
                Config["Inputs:Splunk:Config:Password"],
                Convert.ToInt32(Config["Inputs:Splunk:Config:MaxCount"]),
                Convert.ToInt32(Config["Inputs:Splunk:Config:SearchJobTtl"]),
                Convert.ToBoolean(Config["Inputs:Splunk:Config:UseTls"]),
                Convert.ToBoolean(Config["Inputs:Splunk:Config:ValidateCertificate"])
                );

            foreach (var category in Config.GetSection("Inputs:Splunk:Queries").GetChildren())
            {
                Console.WriteLine(String.Format("Starting {0} queries:", category.Key));
                foreach (var query in category.GetChildren())
                {
                    var sq = Splunk.Query(query.Path, query["Code"], Convert.ToDateTime(Config["ReportParameters:EarliestTime"]), Convert.ToDateTime(Config["ReportParameters:LatestTime"]));
                    Queries.Add(sq);
                    Console.WriteLine(String.Format("\t{0} query submitted", query.Key));
                }
                Console.WriteLine();
            }
        }
예제 #6
0
파일: Database.cs 프로젝트: jank3/RestSql
 public override void LoadQueries()
 {
     MySql.Data.MySqlClient.MySqlConnection dbConn = this.ActiveConnection as MySql.Data.MySqlClient.MySqlConnection;
     if (dbConn != null && dbConn.State == System.Data.ConnectionState.Open)
     {
         // get procedures
         String sql = "SHOW PROCEDURE STATUS;";
         //String sql = "SHOW FUNCTION STATUS;";
         var cmd = dbConn.CreateCommand();
         cmd.CommandText = sql;
         var reader = cmd.ExecuteReader();
         Queries.Clear();
         while (reader.HasRows && reader.Read())
         {
             Query q = new Query();
             q.Name = reader[1].ToString();
             Queries.Add(q);
         }
         reader.Close();
         foreach (Query q in Queries)
         {
             q.Load(dbConn);
         }
     }
 }
예제 #7
0
        /**
         * Add delete query to list of queries
         */
        public override void RegisterDeleted(string collectionName, FilterDefinition <BsonDocument> filterDefinition)
        {
            IMongoCollection <BsonDocument> collection = DataSource.GetCollection(collectionName);
            DeleteMongoDbQuery  deleteQuery            = new DeleteMongoDbQuery(collection, filterDefinition);
            LoggingMongoDbQuery query = new LoggingMongoDbQuery(deleteQuery);

            Queries.Add(query);
        }
예제 #8
0
        /**
         * Add creation query to list of queries
         */
        public override void RegisterNew(string collectionName, BsonDocument document)
        {
            IMongoCollection <BsonDocument> collection = DataSource.GetCollection(collectionName);
            CreateMongoDbQuery  createQuery            = new CreateMongoDbQuery(collection, document);
            LoggingMongoDbQuery query = new LoggingMongoDbQuery(createQuery);

            Queries.Add(query);
        }
예제 #9
0
 public void AddQuery(Query query)
 {
     if (query.spectrum.PrecursorIntensity > PeakTopIntensity)
     {
         PeakTopIntensity = query.spectrum.PrecursorIntensity;
     }
     Queries.Add(query);
 }
예제 #10
0
 protected QueryBuilderMultipleDapper Add <TReturn>(Query query, ResultType resultType)
 {
     if (ResultTypeGlobal == ResultType.None)
     {
         ResultTypeGlobal = resultType;
     }
     Queries.Add(new Tuple <Type, Query, ResultType>(typeof(TReturn), query, resultType));
     return(this);
 }
예제 #11
0
        public override void RegisterDirty(string collectionName, FilterDefinition <BsonDocument> filterDefinition,
                                           BsonDocument document)
        {
            IMongoCollection <BsonDocument> collection   = DataSource.GetCollection(collectionName);
            ReplaceMongoDbQuery             replaceQuery = new ReplaceMongoDbQuery(collection, filterDefinition, document);
            LoggingMongoDbQuery             query        = new LoggingMongoDbQuery(replaceQuery);

            Queries.Add(query);
        }
예제 #12
0
        /**
         * Add update query to list of queries
         */
        public override void RegisterDirty(string collectionName, FilterDefinition <BsonDocument> filterDefinition,
                                           UpdateDefinition <BsonDocument> updateDefinition)
        {
            IMongoCollection <BsonDocument> collection = DataSource.GetCollection(collectionName);
            UpdateMongoDbQuery  updateQuery            = new UpdateMongoDbQuery(collection, filterDefinition, updateDefinition);
            LoggingMongoDbQuery query = new LoggingMongoDbQuery(updateQuery);

            Queries.Add(query);
        }
예제 #13
0
        /// <summary>
        ///     Adds the query.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="value">The value.</param>
        public void AddQuery(string name, string value)
        {
            var instance = new QueryParameter();

            instance.Parent = this;
            instance.Name   = name;
            instance.Value  = value;
            Queries.Add(instance);
        }
예제 #14
0
        private void button1_Click(object sender, EventArgs e)
        {
            User _user = new User();

            _user.Name = textBox1.Text;
            Queries.Add <User>(_user);
            dataGridView1.DataSource          = Queries.GetAllData <User>();
            dataGridView1.AutoGenerateColumns = true;
        }
예제 #15
0
        public SqlPlaceholder <T> DeclareSqlVariable <T>(string name)
        {
            Queries.Add(new DeclareVariableStatement <T>(name));

            return(new SqlPlaceholder <T>()
            {
                RawSql = name,
                PlaceholderType = SqlPlaceholderType.SessionVariableName,
            });
        }
예제 #16
0
        /// <summary>
        /// Sets the default query based on query type
        /// </summary>
        /// <param name="queryType">Type of the query.</param>
        /// <param name="queryString">The query string.</param>
        /// <param name="databaseCommandType">Type of the database command.</param>
        /// <param name="parameters">The parameters.</param>
        /// <returns>This</returns>
        /// <exception cref="ArgumentNullException">queryString</exception>
        public IMapping SetQuery(QueryType queryType, string queryString, CommandType databaseCommandType, params IParameter[] parameters)
        {
            if (string.IsNullOrEmpty(queryString))
            {
                throw new ArgumentNullException(nameof(queryString));
            }

            Queries.Add(queryType, new Query(ObjectType, databaseCommandType, queryString, queryType, parameters));
            return(this);
        }
예제 #17
0
        /// <summary>
        /// SELECT ... FROM ...
        /// </summary>
        public StatementResult <T> Select <TFrom, T>(Query <TFrom, T> query)
        {
            var stmt = new SelectStatement <TFrom, T>(query);

            Queries.Add(stmt);
            return(new StatementResult <T>()
            {
                Statement = stmt,
                StatementList = this
            });
        }
예제 #18
0
        /// <summary>
        /// SELECT ... (without FROM)
        /// </summary>
        public StatementResult <TResult> Select <TResult>(Expression <Func <SelectorContext, TResult> > selectExpr)
        {
            var stmt = new SelectStatement <TResult>(selectExpr);

            Queries.Add(stmt);
            return(new StatementResult <TResult>()
            {
                Statement = stmt,
                StatementList = this
            });
        }
        /// <summary>
        /// Whenever a query is renamed, restore it in the sorted collection
        /// </summary>
        /// <param parameterName="query">The query that was renamed</param>
        private void RenamedQuery(LiteQueryViewModel query)
        {
            if (Queries != null && query != null)
            {
                // Might need to be reordered; reinsert the item
                Queries.Remove(query);
                Queries.Add(query);

                SaveUserQueries();
            }
        }
예제 #20
0
        public override void Read()
        {
            TableHash = _worldPacket.ReadUInt32();

            uint count = _worldPacket.ReadBits <uint>(13);

            for (uint i = 0; i < count; ++i)
            {
                Queries.Add(new DBQueryRecord(_worldPacket.ReadUInt32()));
            }
        }
예제 #21
0
        public GraphQuery <JToken> AddSelectionQuery <TInput>(string operation, TInput input, IEnumerable <Field> selections) where TInput : class
        {
            if (input != null)
            {
                var inputString = GetInputString(input);
                operation = string.IsNullOrEmpty(inputString) ? $"{operation}" : $"{operation}({inputString})";
            }
            var query = new GraphQuery <JToken>(operation, selections);

            Queries.Add(query);
            return(query);
        }
예제 #22
0
        public GraphQuery <TOutput> AddQuery <TInput, TOutput>(string operation, TInput input, TOutput output)
        {
            if (input != null)
            {
                var inputString = GetInputString(input);
                operation = string.IsNullOrEmpty(inputString) ? $"{operation}" : $"{operation}({inputString})";
            }
            var query = new GraphQuery <TOutput>(operation);

            Queries.Add(query);
            return(query);
        }
예제 #23
0
 public ArchiveReportParam(string code, string project, DataType dataType, SuperProcess superProcess, CalcParamType ctype, IEnumerable <IntervalType> intervals)
 {
     Code          = code;
     Project       = project;
     DataType      = dataType;
     SuperProcess  = superProcess;
     CalcParamType = ctype;
     foreach (var t in intervals)
     {
         Queries.Add(t, new ArchiveQueryValues());
     }
 }
예제 #24
0
        private Query <TEntity> CreateQuery(string name, View v)
        {
            var q = new Query <TEntity>(
                Session,
                typeof(TEntity).Name.ToLowerInvariant(),
                name,
                !String.IsNullOrEmpty(v.Reduce)
                );

            Queries.Add(name, q);
            return(q);
        }
예제 #25
0
        /// <summary>
        /// Provided wheres will be gathered
        /// </summary>
        /// <param name="informationType">Information type</param>
        /// <param name="where">Where statement</param>
        /// <returns>Returns this with wheres</returns>
        public IDeviceCollection Where(InformationType informationType, string where)
        {
            Setup(HasExecuted());
            Queries.Add(new Query(informationType, where));

            if (InformationTypes == null)
            {
                InformationTypes = new[] { informationType };
            }
            InformationTypes = InformationTypes.Concat(new[] { informationType }).Distinct().ToArray();

            return(this);
        }
        internal void AddRawInputToList(string[] input)
        {
            var operation = input[0];
            var low       = int.Parse(input[1]);
            var high      = -1;

            if (input.Length == 3)
            {
                high = int.Parse(input[2]);
            }

            Queries.Add(new QueryTriple(operation, low, high));
        }
예제 #27
0
		internal override void Init(IBuildContext parseContext, List<ParameterAccessor> sqlParameters)
		{
			var statement = parseContext.GetResultStatement();

			if (parseContext.Builder.Tag != null)
				(statement.Tag ??= new SqlComment()).Lines.AddRange(parseContext.Builder.Tag.Lines);

			Queries.Add(new QueryInfo
			{
				Statement          = statement,
				ParameterAccessors = sqlParameters,
			});
		}
예제 #28
0
        public void ReadData()
        {
            NumberOfBuckets = Console.ReadLine().Split(' ').Select(n => Convert.ToInt64(n)).ToArray()[0];
            BucketList      = new List <string> [NumberOfBuckets];

            NumberOfQueries = Console.ReadLine().Split(' ').Select(n => Convert.ToInt64(n)).ToArray()[0];
            for (long i = 0; i < NumberOfQueries; i++)
            {
                var inputString = Console.ReadLine().Split(' ').Select(n => Convert.ToString(n)).ToArray();
                var command     = inputString[0];
                var value       = inputString[1];
                Queries.Add(new InputPair(command, value));
            }
        }
예제 #29
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            MainWindow mainWindow = (MainWindow)Application.Current.MainWindow;

            if (!string.IsNullOrEmpty(Usertxt.Text) && !string.IsNullOrEmpty(passwordtxt.Password) &&
                !string.IsNullOrEmpty(showUserCmb.Text))
            {
                var controller = await mainWindow.ShowProgressAsync("Please wait...", "Process is Going on..!");

                controller.SetIndeterminate();
                await TaskEx.Delay(1000);

                Log.Info("Before: to add user check existence of user in CreateUser");
                LoginUser _u = (LoginUser)Application.Current.Properties["User"];
                if (!Queries.IsExists <LoginUser>(x => x.FirstName == Usertxt.Text.ToLower()))
                {
                    Log.Info("Before: to add New user");
                    LoginUser _user = new LoginUser();
                    _user.FirstName = Usertxt.Text;
                    _user.Password  = passwordtxt.Password;
                    _user.Role      = showUserCmb.Text;
                    _user.Trial     = _u.Trial;
                    Queries.Add <LoginUser>(_user);
                    Log.Info("After: to add New user,Successfully in CreateUser");
                    await TaskEx.Delay(2000);

                    await controller.CloseAsync();

                    await mainWindow.ShowMessageAsync("User Added Successfully", "");

                    Helpful.CloseAllFlyouts(mainWindow.Flyouts);
                }
                else
                {
                    await TaskEx.Delay(2000);

                    await controller.CloseAsync();

                    await mainWindow.ShowMessageAsync("Please Select another Username:"******"");

                    Usertxt.Text = string.Empty;
                    Usertxt.Focus();
                }
                Log.Info("After: to add user check existence of user,Successfully in CreateUser");
            }
            else
            {
                await mainWindow.ShowMessageAsync("Please Fill all the fields", "");
            }
        }
예제 #30
0
 public DatabaseCollection(TreeView tv)
 {
     base.useNamespaces = true;
     this.Databases     = new List <DatabaseElement>();
     this.Queries       = new List <QueryElement>();
     foreach (TreeNode node in tv.Nodes)
     {
         System.Windows.Forms.MessageBox.Show(node.Tag.ToString());
         if (node.Tag is DatabaseCollection)
         {
             TreeNode[] nodes = tv.Nodes.Find(ref_asm_node, true);
             bool       hasit = nodes.Length > 0;
             Global.statR("DC");
             if (hasit)
             {
                 MessageBox.Show("we have assembly entries");
                 TreeNode found = nodes[0];
             }
             DatabaseCollection dc = node.Tag as DatabaseCollection;
             Global.statR("we're moving past the continue statement at DatabaseCollection level");
             foreach (TreeNode node1 in node.Nodes)
             {
                 if (node1.Tag is DatabaseElement)
                 {
                     Databases.Add(new DatabaseElement(node1));
                 }
                 else
                 if (node1.Tag == (queryContainer))
                 {
                     foreach (TreeNode qnode in node1.Nodes)
                     {
                         QueryElement element = QueryElement.FromNode(qnode);
                         Queries.Add(element);
                     }
                 }
                 else
                 if (node1.Tag is QueryElement)
                 {
                     Queries.Add(QueryElement.FromNode(node1));
                 }
         #if ASMREF
                 else if (node1.Tag is ReferenceAssemblyCollection)
                 {
                     Assemblies = node1.Tag as ReferenceAssemblyCollection;
                 }
         #endif
             }
         }
     }
 }