private static void ShowStatisticsResponse(StatisticsResponse statisticsResponse) { Console.WriteLine( $"{nameof(statisticsResponse.ProofSealsStoredToday)}: {statisticsResponse.ProofSealsStoredToday}\n" + $"{nameof(statisticsResponse.ProofSealsStoredLast7Days)}: {statisticsResponse.ProofSealsStoredLast7Days}\n" + $"{nameof(statisticsResponse.ProofSealsStoredLast30Days)}: {statisticsResponse.ProofSealsStoredLast30Days}\n"); Console.WriteLine( $"{nameof(statisticsResponse.ProofRequestsToday)}: {statisticsResponse.ProofRequestsToday}\n" + $"{nameof(statisticsResponse.ProofRequestsLast7Days)}: {statisticsResponse.ProofRequestsLast7Days}\n" + $"{nameof(statisticsResponse.ProofRequestsLast30Days)}: {statisticsResponse.ProofRequestsLast30Days}\n"); Console.WriteLine( $"{nameof(statisticsResponse.ApiCalls)}: {statisticsResponse.ApiCalls}\n" + $"{nameof(statisticsResponse.ApiCallsToday)}: {statisticsResponse.ApiCallsToday}\n" + $"{nameof(statisticsResponse.ApiCallsLast7Days)}: {statisticsResponse.ApiCallsLast7Days}\n" + $"{nameof(statisticsResponse.ApiCallsLast30Days)}: {statisticsResponse.ApiCallsLast30Days}\n"); Console.WriteLine( $"{nameof(statisticsResponse.ProofSealsStored)}: {statisticsResponse.ProofSealsStored}\n" + $"{nameof(statisticsResponse.ProofCertificates)}: {statisticsResponse.ProofCertificates}\n" + $"{nameof(statisticsResponse.ProofSealBundles)}: {statisticsResponse.ProofSealBundles}\n" + $"{nameof(statisticsResponse.ApiKeys)}: {statisticsResponse.ApiKeys}\n" + $"{nameof(statisticsResponse.HotWalletEptBalance)}: {statisticsResponse.HotWalletEptBalance}\n" + $"{nameof(statisticsResponse.PendingHotWalletBalance)}: {statisticsResponse.PendingHotWalletBalance}\n"); }
public async void GetStatistics_Valid() { using (BlockchainApiHelper apiHelper = new BlockchainApiHelper()) { StatisticsResponse statisticsResponse = await apiHelper.StatisticsExplorer.GetAsync(); Assert.NotNull(statisticsResponse); } }
public ActionResult <StatisticsResponse> GetStatistics() { var stats = new StatisticsResponse() { AmountPlaces = _context.Places.Count(), AmountReviews = _context.Reviews.Count(), AmountUsers = _context.Users.Count() }; return(stats); }
public string FormHistResponse(StatisticsRequest request) { var response = new StatisticsResponse { Labels = GetLabels(request.Year, request.StartMonth, request.EndMonth), VacationAbsenceData = GetTotalAbsenceValues(request, Reason.V), SickAbsenceData = GetTotalAbsenceValues(request, Reason.S), PersonalAbsenceData = GetTotalAbsenceValues(request, Reason.P) }; return(JsonConvert.SerializeObject(response)); }
public Task <StatisticsResponse> Statistics(StatisticsRequest request) { StatisticsResponse response = new StatisticsResponse(); string alphaPart = Regex.Match(request.Parameters.TextToAnalyze, @"[a-zA-Z].*").Value; response.Result.TextStatistics.HyphensQuantity = alphaPart.Length; response.Result.TextStatistics.WordQuantity = request.Parameters.TextToAnalyze.Length; response.Result.TextStatistics.SpacesQuantity = request.Parameters.TextToAnalyze.Split(" ").Length; return(Task.FromResult(response)); }
public StatisticsResponse GetStatistics() { var foundProcesses = processesDataAccess.GetProcesses(); var preparedProcesses = foundProcesses.Select(ReadDataFromProcess).ToList(); var result = new StatisticsResponse() { processes = preparedProcesses.OrderBy(x => x.Pid).ToList(), SumNonpagedSystemMemorySize64InBytes = preparedProcesses.Sum(x => x.NonpagedSystemMemorySize64InBytes ?? 0), SumPagedMemorySize64InBytes = preparedProcesses.Sum(x => x.PagedMemorySize64InBytes ?? 0) }; return(result); }
public StatisticsResponse GetStatistics(DateTime dateTimeFrom, DateTime dateTimeTo, string mcc) { MessageSearchCriteria criteria = new MessageSearchCriteria() { DateTimeFrom = dateTimeFrom, DateTimeTo = dateTimeTo, Mcc = mcc }; var messages = _dal.GetStatisticsInRange(criteria).ToList(); var response = new StatisticsResponse() { Total = messages.Count, Statistics = messages }; return(response); }
public override bool IsInstalled() { //Call statistics endpoint var response = ApiGet("statistics"); StatisticsResponse statisticsResponse; //Try deserialize JSON response as response object try { statisticsResponse = StatisticsResponse.FromJson(response); } catch { //If the JSON cannot be deserialized then there is a problem with the API, so we return false return(false); } //Check the API status var value = statisticsResponse.Sections.FirstOrDefault(sec => sec.Id == "general")?.Items.FirstOrDefault(item => item.Id == "state")?.Value; //Check if the value is one return(value == 1); }
public static string ToJson(this StatisticsResponse self) => JsonConvert.SerializeObject(self, Converter.Settings);
public void UpdateList() { File.AppendAllText("debug.txt", "\nStarting scan"); List <ListItem> newItemList = new List <ListItem>(); List <Responses.En> items = Request.itemsList(); string itemList = ""; foreach (var item in items) { itemList += " " + item.item_name; } File.AppendAllText("debug.txt", "\nAll items: " + Environment.NewLine + itemList); if (MainFrame.cfg.relicsExcluded) { items = items.Where(x => !x.item_name.ToLower().StartsWith("axi ")).Where(x => !x.item_name.ToLower().StartsWith("meso ")).Where(x => !x.item_name.ToLower().StartsWith("neo ")).Where(x => !x.item_name.ToLower().StartsWith("lith ")).ToList(); itemList = ""; foreach (var item in items) { itemList += " " + item.item_name; } File.AppendAllText("debug.txt", Environment.NewLine + Environment.NewLine + Environment.NewLine + "\nRelics excluded, new item list: " + itemList); } if (MainFrame.cfg.setsExcluded) { items = items.Where(x => !x.item_name.ToLower().EndsWith(" set")).ToList(); itemList = ""; foreach (var item in items) { itemList += " " + item.item_name; } File.AppendAllText("debug.txt", Environment.NewLine + Environment.NewLine + Environment.NewLine + "\nSets excluded, new item list: " + itemList); } int currPercent = 0; int itemsToCheck = items.Count; int checkedItems = 0; foreach (var item in items) { try { string response = Request.DLString($"items/{item.url_name}/statistics"); StatisticsResponse statResponse = new StatisticsResponse(); List <FEEhour> newListClosed = new List <FEEhour>(); statResponse = JsonConvert.DeserializeObject <Responses.StatisticsResponse>(response); newListClosed = statResponse.payload.statistics_closed.fhours.OrderByDescending(x => x.datetime).ToList(); if (MainFrame.cfg.modsExcluded) { if (statResponse.payload.statistics_live.ndays.Count != 0) { if (statResponse.payload.statistics_live.ndays.FirstOrDefault().mod_rank != null) { File.AppendAllText("debug.txt", Environment.NewLine + $"\nMods excluded, {item.item_name} will not be in the list"); continue; } } } if (newListClosed.Count() != 0) { int volume = 0; foreach (var FEHItem in newListClosed) { volume += FEHItem.volume; } double newSma = Request.CalculateSMA(item.url_name, statResponse); if (newSma > MainFrame.cfg.minMA && volume > MainFrame.cfg.minVolume) { ListItem fullItem = new ListItem(); fullItem.url_name = item.url_name; fullItem.name = item.item_name; fullItem.moving_avg = newSma; newItemList.Add(fullItem); } else { File.AppendAllText("debug.txt", Environment.NewLine + $"\n{item.item_name} has been excluded as it does not meet the min. requirements. SMA: {newSma} Volume: {volume}"); } } checkedItems++; currPercent = (int)(((double)checkedItems / (double)itemsToCheck) * 100.00); this.Invoke((MethodInvoker) delegate { Progressbar.Value = currPercent; }); } catch (Exception e) { MessageBox.Show("Inner Exception occured: " + e.Message + "\nStacktrace: " + e.StackTrace); } } MainFrame.cfg.itemList = newItemList; MainFrame.cfg.lastupdate = DateTime.Today; MainFrame.cfg.saveCfg(); //MessageBox.Show("List updated, now checking for hot deals on " + newItemList.Count + " items.","Success"); this.Invoke((MethodInvoker) delegate { ExitButton.Enabled = true; LastUpdate.Text = "0"; Progressbar.Value = 0; }); Program.scanRunning = false; }