private async Task UpdateValues() { ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(this); int Counter = 0; mAdapter.AddSectionHeaderItem("Incomplete Orders"); var Unpaid = await api.GetPendingOrdersByReason("unpaid"); var NotShipped = await api.GetPendingOrdersByReason("not shipped"); var PendingCount = await api.GetPendingOrdersCount(); var Currency = await api.GetCurrency(); mAdapter.AddItem("Unpaid: " + Unpaid.ToString("0.0#") + " " + Currency); mAdapter.AddItem("Not Yet Shipped: " + NotShipped.ToString("0.0#") + " " + Currency); mAdapter.AddItem("Pending Count: " + PendingCount); mAdapter.AddSectionHeaderItem("Bestsellers (Quantity)"); var BestQuantity = await api.GetBestsellerByQuantity(); foreach (BestsellerDTO elem in BestQuantity) { if (Counter != prefs.GetInt("bestsellers_quantity", 5) - 1) { mAdapter.AddItem(elem.Product.Name); } else { break; } Counter++; } mAdapter.AddSectionHeaderItem("Bestsellers (Amount)"); Counter = 0; var BestAmount = await api.GetBestsellerByAmount(); foreach (BestsellerDTO elem in BestAmount) { if (Counter != prefs.GetInt("bestsellers_amount", 5) - 1) { mAdapter.AddItem(elem.Product.Name); } else { break; } Counter++; } dialog.Dismiss(); }
protected void InitializeConfigs(ISharedPreferences prefs) { mAdapter = new SeparatedListAdapter(this); mAdapter.AddSectionHeaderItem("Sale Values Settings"); mAdapter.AddItem("Number of Bestsellers by Quantity: " + prefs.GetInt("bestsellers_quantity", 5)); mAdapter.AddItem("Number of Bestsellers by Amount:" + prefs.GetInt("bestsellers_amount", 5)); mAdapter.AddSectionHeaderItem("Dashboard Settings"); mAdapter.AddItem("Number of Popular Keywords: " + prefs.GetInt("keywords_dashboard", 3)); mAdapter.AddItem("Sale Values in " + prefs.GetString("sales_format", "Integer")); mAdapter.AddSectionHeaderItem("Statistics Settings"); mAdapter.AddItem("Number of Popular Keywords: " + prefs.GetInt("keywords_stats", 5)); Configs.Adapter = mAdapter; }
private async Task UpdateValues() { mAdapter = new SeparatedListAdapter(this); ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(this); mAdapter.AddSectionHeaderItem("Popular Keywords"); var Keywords = await api.GetPopularKeywords(prefs.GetInt("keywords_stats", 5)); for (int i = 0; i < prefs.GetInt("keywords_stats", 5); i++) { mAdapter.AddItem(Keywords[i].Keyword); } mAdapter.AddSectionHeaderItem("Registered Users"); var WeekCustomers = await api.GetCustomerCountByTime(7); var TwoWeeksCustomers = await api.GetCustomerCountByTime(14); var MonthCustomers = await api.GetCustomerCountByTime(30); var YearCustomers = await api.GetCustomerCountByTime(365); mAdapter.AddItem("Last 7 Days: " + WeekCustomers); mAdapter.AddItem("Last 14 Days: " + TwoWeeksCustomers); mAdapter.AddItem("Last Month: " + MonthCustomers); mAdapter.AddItem("Last Year: " + YearCustomers); mAdapter.AddSectionHeaderItem("Total Sales"); var WeekSales = await api.GetTotalSalesByTime(7); var TwoWeeksSales = await api.GetTotalSalesByTime(14); var MonthSales = await api.GetTotalSalesByTime(30); var YearSales = await api.GetTotalSalesByTime(365); var Currency = await api.GetCurrency(); mAdapter.AddItem("Last 7 Days: " + WeekSales.ToString("0.0#") + " " + Currency); mAdapter.AddItem("Last 14 Days: " + TwoWeeksSales.ToString("0.0#") + " " + Currency); mAdapter.AddItem("Last Month: " + MonthSales.ToString("0.0#") + " " + Currency); mAdapter.AddItem("Last Year: " + YearSales.ToString("0.0#") + " " + Currency); StatsList.Adapter = mAdapter; dialog.Dismiss(); }