示例#1
0
        /// <summary>
        /// This function is responsible for filtering the file list based off a string. It also
        /// orders the list based on the option provided by the user
        /// </summary>
        /// <param name="SearchCriteria">
        /// A <see cref="FileTypeModel"/> object representing the file selected.
        /// </param>
        /// <param name="OrderCriteria">
        /// Integer that corresponds to the OrderingOptions Enum
        /// </param>
        /// <returns>
        /// A list of FileUIInfo objects
        /// </returns>
        private List <Common.FileUIInfo> NameSearch(string SearchCriteria, int OrderCriteria)
        {
            List <Common.FileUIInfo> publicFileObjects = GetPublicFiles();

            List <Common.FileUIInfo> searchedList = new List <Common.FileUIInfo>();

            if (OrderCriteria == (int)OrderingOption.Alphabetical)
            {
                searchedList = SearchQueries.FilterByFileNameOrderByNameAscending(publicFileObjects, SearchCriteria);
            }
            else if (OrderCriteria == (int)OrderingOption.ReverseAlphabetical)
            {
                searchedList = SearchQueries.FilterByFileNameOrderByNameDescending(publicFileObjects, SearchCriteria);
            }
            else if (OrderCriteria == (int)OrderingOption.NewestFirst)
            {
                searchedList = SearchQueries.FilterByFileNameOrderByNameDescending(publicFileObjects, SearchCriteria);
            }
            else if (OrderCriteria == (int)OrderingOption.OldestFirst)
            {
                searchedList = SearchQueries.FilterByFileNameOrderByNameAscending(publicFileObjects, SearchCriteria);
            }

            return(searchedList);
        }
        public async Task <List <StrippedClient> > SearchClientByQuery(SearchQueries searchQuery)
        {
            List <StrippedClient> allClientList = await GetAllStrippedClientData();

            List <StrippedClient> matchingClients = new List <StrippedClient>();

            if (searchQuery.isHardSearch)
            {
                matchingClients = allClientList
                                  .Where(c => !searchQuery.tags.Any() || searchQuery.tags.All(queryTagID => c.tags.Any(clientTag => clientTag.tagID == queryTagID)))
                                  .Where(c => !searchQuery.statuses.Any() || searchQuery.statuses.All(queryStatusID => c.clientStatus.statusID == queryStatusID))
                                  .Where(c => !searchQuery.events.Any() || searchQuery.events.All(queryEventID => c.responses.Any(r => r.responseEvent.eventTypeID == queryEventID)))
                                  .Where(c => !searchQuery.names.Any() || searchQuery.names.All(queryName => c.clientName == queryName))
                                  .Where(c => !searchQuery.nicknames.Any() || searchQuery.nicknames.All(queryNickname => c.nickname == queryNickname))
                                  .Where(c => !searchQuery.emails.Any() || searchQuery.emails.All(queryEmail => c.email == queryEmail))
                                  .Where(c => !searchQuery.responses.Any() || searchQuery.responses.All(queryResponse => c.responses.Any(r => r.responseText.Contains(queryResponse))))
                                  .Where(c => !searchQuery.cardAssignments.Any() || searchQuery.cardAssignments.All(queryAssignmentAmount => c.cardAssignments == queryAssignmentAmount))
                                  .Where(c => !searchQuery.giftAssignments.Any() || searchQuery.giftAssignments.All(queryAssignmentAmount => c.giftAssignments == queryAssignmentAmount)).ToList();
            }
            else
            {
                matchingClients = allClientList
                                  .Where(c => !searchQuery.tags.Any() || searchQuery.tags.Any(queryTagID => c.tags.Any(t => t.tagID == queryTagID)))
                                  .Where(c => !searchQuery.statuses.Any() || searchQuery.statuses.Any(queryStatusID => c.clientStatus.statusID == queryStatusID))
                                  .Where(c => !searchQuery.events.Any() || searchQuery.events.Any(queryEventID => c.responses.Any(r => r.responseEvent.eventTypeID == queryEventID)))
                                  .Where(c => !searchQuery.names.Any() || searchQuery.names.Any(queryName => c.clientName == queryName))
                                  .Where(c => !searchQuery.nicknames.Any() || searchQuery.nicknames.Any(queryNickname => c.nickname == queryNickname))
                                  .Where(c => !searchQuery.emails.Any() || searchQuery.emails.Any(queryEmail => c.email == queryEmail))
                                  .Where(c => !searchQuery.responses.Any() || searchQuery.responses.Any(queryResponse => c.responses.Any(r => r.responseText.Contains(queryResponse))))
                                  .Where(c => !searchQuery.cardAssignments.Any() || searchQuery.cardAssignments.Any(queryAssignmentAmount => c.cardAssignments == queryAssignmentAmount))
                                  .Where(c => !searchQuery.giftAssignments.Any() || searchQuery.giftAssignments.Any(queryAssignmentAmount => c.giftAssignments == queryAssignmentAmount)).ToList();
            }

            return(matchingClients);
        }
示例#3
0
        /// <summary>
        /// This function responsible foe filtering the file list date and ordering
        /// it based on the user input.
        /// </summary>
        /// <param name="startDate">
        /// A datetime contaning the lowerbound for the date search
        /// </param>
        /// <param name="endDate">
        /// A datetime containing the upper bound for the date search
        /// </param>
        /// <param name="OrderCriteria">
        /// Integer corresponding to the OrderingOption enum
        /// </param>
        /// <returns>
        /// A list for FileUIInfo objects
        /// </returns>
        private List <Common.FileUIInfo> DateSearch(DateTime startDate, DateTime endDate, int OrderCriteria)
        {
            List <Common.FileUIInfo> publicFileObjects = GetPublicFiles();

            List <Common.FileUIInfo> searchedList = new List <Common.FileUIInfo>();

            if (OrderCriteria == (int)OrderingOption.Alphabetical)
            {
                searchedList = SearchQueries.FilterDateOrderByNameAscending(publicFileObjects, startDate, endDate);
            }
            else if (OrderCriteria == (int)OrderingOption.ReverseAlphabetical)
            {
                searchedList = SearchQueries.FilterDateOrderByNameDescending(publicFileObjects, startDate, endDate);
            }
            else if (OrderCriteria == (int)OrderingOption.NewestFirst)
            {
                searchedList = SearchQueries.FilterDateOrderByDateDescending(publicFileObjects, startDate, endDate);
            }
            else if (OrderCriteria == (int)OrderingOption.OldestFirst)
            {
                searchedList = SearchQueries.FilterDateOrderByDateAscending(publicFileObjects, startDate, endDate);
            }

            return(searchedList);
        }
示例#4
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Updates the DistributionChartLayout with the information from the specified grid.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public void UpdateFromDistributionGrid(DistributionGrid grid)
        {
            if (grid == null)
            {
                return;
            }

            Reset();

            // Save the search items.
            for (int i = 1; i < grid.Rows.Count; i++)
            {
                if (i != grid.NewRowIndex)
                {
                    SearchItems.Add(grid[0, i].Value as string);
                }
            }

            // Add the search item column.
            ColumnWidths.Add(grid.Columns[0].Width);

            // Save the environments and column widths.
            for (int i = 1; i < grid.Columns.Count - 1; i++)
            {
                ColumnWidths.Add(grid.Columns[i].Width);
                var query = grid.Columns[i].Tag as SearchQuery;
                if (query != null)
                {
                    SearchQueries.Add(query);
                }
            }

            // Add the new environment column (this is like the column equivalent of the new row).
            ColumnWidths.Add(grid.Columns[grid.Columns.Count - 1].Width);
        }
示例#5
0
        public async Task DeleteFromLocal(SavedSearchQuery searchQuery)
        {
            SearchQueries.Remove(searchQuery);

            var savedJson = JsonConvert.SerializeObject(SearchQueries);
            await _jsRuntime.InvokeAsync <object>(
                "stateManager.save", "_searchQueriesList", savedJson);

            await LoadSavedSearches();
        }
        private string GetMailContent()
        {
            StreamReader sr       = new StreamReader(@"ScriptsAndReferences\DailyStatusReport.htm");
            string       mailBody = sr.ReadToEnd();

            sr.Close();

            mailBody = mailBody.Replace("{availability}", Availability.ToString("f2") + "%");
            mailBody = mailBody.Replace("{downloads}", Downloads.ToString("#,##0"));
            mailBody = mailBody.Replace("{restore}", Restore.ToString("#,##0"));
            if (Downloads == 0 || Restore == 0)
            {
                mailBody = mailBody.Replace("{warning}", "Please note that this report will not show the correct numbers for download and restore when ReplicatePackageStats Job is disabled or failing.");
            }
            else
            {
                mailBody = mailBody.Replace("{warning}", "");
            }
            mailBody = mailBody.Replace("{searchqueries}", SearchQueries.ToString("#,##0"));
            mailBody = mailBody.Replace("{uploads}", Uploads.ToString());
            mailBody = mailBody.Replace("{uniqueuploads}", UniqueUploads.ToString());
            mailBody = mailBody.Replace("{newusers}", NewUsers.ToString());
            mailBody = mailBody.Replace("{TrafficPerHour}", TrafficPerHour.ToString("#,##0"));
            mailBody = mailBody.Replace("{trafficmax}", TrafficMax.ToString("#,##0"));
            mailBody = mailBody.Replace("{trafficmin}", TrafficMin.ToString("#,##0"));
            mailBody = mailBody.Replace("{RequestPerHour}", RequestPerHour.ToString());
            mailBody = mailBody.Replace("{requestmax}", RequestMax.ToString());
            mailBody = mailBody.Replace("{requestmin}", RequestMin.ToString());
            mailBody = mailBody.Replace("{ErrorsPerHour}", ErrorsPerHour.ToString());
            mailBody = mailBody.Replace("{errormax}", ErrorsMax.ToString());
            mailBody = mailBody.Replace("{errormin}", ErrorsMin.ToString());
            mailBody = mailBody.Replace("{IndexLag}", IndexLag.ToString());
            mailBody = mailBody.Replace("{indexmax}", IndexMax.ToString());
            mailBody = mailBody.Replace("{indexmin}", IndexMin.ToString());
            mailBody = mailBody.Replace("{InstanceCount}", InstanceCount.ToString());
            mailBody = mailBody.Replace("{instancemax}", InstanceMax.ToString());
            mailBody = mailBody.Replace("{instancemin}", InstanceMin.ToString());
            mailBody = mailBody.Replace("{overallworkercount}", OverallWorkerCount.ToString());
            mailBody = mailBody.Replace("{successcount}", SuccessCount.ToString());
            mailBody = mailBody.Replace("{failedjobnames}", string.Join(", ", FailedJobNames));
            mailBody = mailBody.Replace("{notableissues}", string.Join("<br/>", NotableIssues));
            mailBody = mailBody.Replace("{InstallUpdatesRestoresPerNuGetVersion}", InstallUpdatesRestoresByNuGetVersion());
            mailBody = mailBody.Replace("{InstallUpdatesRestoresPerVSVersion}", InstallUpdatesRestoresByVSVersion());
            mailBody = mailBody.Replace("{IISRequestsDistribution}", CreateTableForIISRequestsDistribution());
            mailBody = mailBody.Replace("{IPRequestDistribution}", IPDetails());
            mailBody = mailBody.Replace("{ResponseTime}", ResponseTimeDetails());
            mailBody = mailBody.Replace("{UserAgent}", UserAgentDetails());
            return(mailBody);
        }
        private string GetMailContent()
        {
            StreamReader sr       = new StreamReader(@"ScriptsAndReferences\WeeklyStatusReport.htm");
            string       mailBody = sr.ReadToEnd();

            sr.Close();

            mailBody = mailBody.Replace("{availability}", Availability.ToString("f2") + "%");
            mailBody = mailBody.Replace("{downloads}", Downloads.ToString("#,##0"));
            mailBody = mailBody.Replace("{restore}", Restore.ToString("#,##0"));
            mailBody = mailBody.Replace("{searchqueries}", SearchQueries.ToString("#,##0"));
            mailBody = mailBody.Replace("{uniqueuploads}", UniqueUploads.ToString());
            mailBody = mailBody.Replace("{uploads}", Uploads.ToString());
            mailBody = mailBody.Replace("{newusers}", NewUsers.ToString());
            mailBody = mailBody.Replace("{TrafficPerHour}", TrafficPerHour.ToString("#,##0"));
            mailBody = mailBody.Replace("{trafficmax}", TrafficMax.ToString("#,##0"));
            mailBody = mailBody.Replace("{trafficmin}", TrafficMin.ToString("#,##0"));
            mailBody = mailBody.Replace("{RequestPerHour}", RequestPerHour.ToString());
            mailBody = mailBody.Replace("{requestmax}", RequestMax.ToString());
            mailBody = mailBody.Replace("{requestmin}", RequestMin.ToString());
            mailBody = mailBody.Replace("{ErrorsPerHour}", ErrorsPerHour.ToString());
            mailBody = mailBody.Replace("{errormax}", ErrorsMax.ToString());
            mailBody = mailBody.Replace("{errormin}", ErrorsMin.ToString());
            mailBody = mailBody.Replace("{IndexLag}", IndexLag.ToString());
            mailBody = mailBody.Replace("{indexmax}", IndexMax.ToString());
            mailBody = mailBody.Replace("{indexmin}", IndexMin.ToString());
            mailBody = mailBody.Replace("{InstanceCount}", InstanceCount.ToString());
            mailBody = mailBody.Replace("{instancemax}", InstanceMax.ToString());
            mailBody = mailBody.Replace("{instancemin}", InstanceMin.ToString());
            mailBody = mailBody.Replace("{InstallUpdatesRestoresPerNuGetVersion}", InstallUpdatesRestoresByNuGetVersion());
            mailBody = mailBody.Replace("{InstallUpdatesRestoresPerVSVersion}", InstallUpdatesRestoresByVSVersion());
            mailBody = mailBody.Replace("{IISRequestsDistribution}", CreateTableForIISRequestsDistribution());
            mailBody = ReplaceWorkJobDetails(mailBody, DatesInWeek);

            return(mailBody);
        }
示例#8
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Clear's the internal search items and queries lists. The XYCharLayout's name is
 /// preserved.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 public void Reset()
 {
     SearchItems.Clear();
     SearchQueries.Clear();
     ColumnWidths.Clear();
 }
示例#9
0
		public void QueryStart(SearchQueries query, object state)
		{
			SearchEngine.QueryManager.InputText = ACTBMainInput.Text;
			SearchEngine.QueryManager.QueryStart(query, state);
		}
示例#10
0
        void Search()
        {
            if (SearchQueries == null)
            {
                MessageBox.Show("Input file with search keywoards not selected.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            if (_appIds == null || _appIds.Count == 0)
            {
                MessageBox.Show("eBay App ID (Client ID) not added.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            StartTimer();

            // output file names
            string fileName, notCompletedFileName;

            if (string.IsNullOrEmpty(OutputDirectoryPath))
            {
                fileName             = null;
                notCompletedFileName = null;
            }
            else
            {
                var fileTime = DateTime.Now.ToFileTimeUtc();
                fileName             = Path.Combine(OutputDirectoryPath, string.Format("{0}.csv", fileTime));
                notCompletedFileName = Path.Combine(OutputDirectoryPath, string.Format("{0}_not_completed.txt", fileTime));
            }

            _cancellationToken = new System.Threading.CancellationTokenSource();

            var parallelOptions = new ParallelOptions();

            parallelOptions.CancellationToken      = _cancellationToken.Token;
            parallelOptions.MaxDegreeOfParallelism = ParallelQueries;

            try
            {
                Parallel.ForEach(SearchQueries, parallelOptions, query =>
                {
                    if (parallelOptions.CancellationToken.IsCancellationRequested)
                    {
                        return;
                    }

                    var status = query.Status;
                    if (status == SearchStatus.Working)
                    {
                        return;
                    }

                    StatusMessage = string.Format("Gathering data for search keywoard {0}...", query.Keywoard);

                    if (FailedQueriesOnly)
                    {
                        if (status != SearchStatus.Complete)
                        {
                            query.Search(Filter, parallelOptions.CancellationToken);
                        }
                    }
                    else
                    {
                        query.Search(Filter, parallelOptions.CancellationToken);
                    }

                    WriteOutput(fileName, query);

                    ExecutedQueries += 1;
                });
            }
            catch (OperationCanceledException)
            {
                // cancelled by user, do nothing
            }

            // create file with search keywoards which failed to complete
            if (notCompletedFileName != null)
            {
                var notCompletedKeywoards = new StringBuilder();
                foreach (var query in SearchQueries)
                {
                    if (query.Status != SearchStatus.Complete)
                    {
                        notCompletedKeywoards.AppendLine(query.Keywoard);
                    }
                }
                if (notCompletedKeywoards.Length > 0)
                {
                    File.WriteAllText(notCompletedFileName, notCompletedKeywoards.ToString());
                }
            }

            if (ExcludeEmptyResults)
            {
                for (var index = SearchQueries.Count - 1; index >= 0; index--)
                {
                    var query = SearchQueries[index];
                    if (query.Status == SearchStatus.Complete && query.Books.Count == 0)
                    {
                        SearchQueries.RemoveAt(index);
                    }
                }
                RaisePropertyChanged(nameof(SearchQueries));
            }

            _cancellationToken.Dispose();
            StopTimer();
        }
示例#11
0
        void Search()
        {
            if (SearchQueries == null)
            {
                return;
            }

            StartTimer();

            // output file names
            string fileName, notCompletedFileName;

            if (string.IsNullOrEmpty(OutputDirectoryPath))
            {
                fileName             = null;
                notCompletedFileName = null;
            }
            else
            {
                var fileTime = DateTime.Now.ToFileTimeUtc();
                fileName             = Path.Combine(OutputDirectoryPath, string.Format("{0}.csv", fileTime));
                notCompletedFileName = Path.Combine(OutputDirectoryPath, string.Format("{0}_not_completed.txt", fileTime));
            }

            var parallelOptions = new ParallelOptions();

            parallelOptions.MaxDegreeOfParallelism = ParallelQueries;

            Parallel.ForEach(SearchQueries, parallelOptions, query =>
            {
                if (_cancelFlag)
                {
                    return;
                }

                var status = query.Status;
                if (status == SearchStatus.Working)
                {
                    return;
                }

                var parser = new HtmlDocument();
                if (FailedQueriesOnly)
                {
                    if (status != SearchStatus.Complete)
                    {
                        query.Search(ref parser, Filter, ParallelQueries, ScrapBooksInParallel);
                    }
                }
                else
                {
                    query.Search(ref parser, Filter, ParallelQueries, ScrapBooksInParallel);
                }

                WriteOutput(fileName, query);

                ExecutedQueries += 1;
            });

            // create file with search keywoards which failed to complete
            if (notCompletedFileName != null)
            {
                var notCompletedKeywoards = new StringBuilder();
                foreach (var query in SearchQueries)
                {
                    if (query.Status != SearchStatus.Complete)
                    {
                        notCompletedKeywoards.AppendLine(query.Keywoard);
                    }
                }
                if (notCompletedKeywoards.Length > 0)
                {
                    File.WriteAllText(notCompletedFileName, notCompletedKeywoards.ToString());
                }
            }

            if (ExcludeEmptyResults)
            {
                for (var index = SearchQueries.Count - 1; index >= 0; index--)
                {
                    var query = SearchQueries[index];
                    if (query.Status == SearchStatus.Complete && query.Books.Count == 0)
                    {
                        SearchQueries.RemoveAt(index);
                    }
                }
                RaisePropertyChanged(nameof(SearchQueries));
            }

            _cancelFlag = false;
            StopTimer();
        }
        public async Task <ActionResult <List <StrippedClient> > > GetClientsByQuery([FromBody] SearchQueries model)
        {
            List <StrippedClient> listLogicStrippedClients = await repository.SearchClientByQuery(model);

            return(Ok(listLogicStrippedClients.OrderBy(c => c.nickname)));
        }
示例#13
0
 private void findAllToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (SearchQueries queries = new SearchQueries(false))
     {
         queries.ShowDialog(this);
     }
 }
示例#14
0
 protected override bool ProcessDialogKey(Keys keyData)
 {
     Action a = null;
     if (keyData == (Keys.Control | Keys.Shift | Keys.F))
     {
         base.DialogResult = DialogResult.Cancel;
         if (a == null)
         {
             a = delegate {
                 using (SearchQueries queries = new SearchQueries(this.chkSamples.Checked, this.cboSearch.Text.Trim()))
                 {
                     queries.ShowDialog();
                 }
             };
         }
         Program.RunOnWinFormsTimer(a);
         return true;
     }
     return base.ProcessDialogKey(keyData);
 }
			public static object GetArgByQueryType(SearchQueries query)
			{
				switch (query)
				{
					case SearchQueries.MostFrequentWord:
					case SearchQueries.LongestWord:
						return true;
					case SearchQueries.LeastFrequentWord:
					case SearchQueries.ShortestWord:
						return false;
					case SearchQueries.MostFrequentBigramm:
						return 2;
					case SearchQueries.MostFrequetntTrigram:
						return 3;
				}
				return new object();
			}
			public async void QueryStart(SearchQueries query, object state)
			{
				if(QueryComplited != null && Queries.ContainsKey(query))
				{
					QueryComplited(this, await Task.Factory.StartNew<List<Entry>>(Queries[query], state));
				}
			}