private async void InitializeWishlist() { var Currency = await api.GetCurrency(); var tmp = await api.GetCustomersByEmail(Helper.CurrentCustomer()); Customer = tmp.First(); var CartList = new List <MainPage.CartData>(); var ItemCount = 0; foreach (CartItemDTO c in Customer.Wishlist) { ItemCount += c.Quantity; CartList.Add(new MainPage.CartData { ProdId = c.Product.Id, Id = c.Id, ProductName = c.Product.Name, Quantity = c.Quantity, Image = Helper.ConvertToBitmapImage(c.Product.Image.First()), UnitPrice = c.Product.Price.ToString("0.0#") + " " + Currency, Total = (c.Product.Price * c.Quantity).ToString("0.0#") + " " + Currency }); } if (CartList.Count == 0) { ProductCount.Text = "no"; } else { ProductCount.Text = ItemCount.ToString(); } ProductsList.ItemsSource = CartList; }
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(); }
private async Task InitializePage() { var UnpaidVal = await api.GetPendingOrdersByReason("unpaid"); var NotShippedVal = await api.GetPendingOrdersByReason("not shipped"); var PendingCountVal = await api.GetPendingOrdersCount(); var Currency = await api.GetCurrency(); Unpaid.Text = UnpaidVal.ToString("0.0#") + " " + Currency; NotShipped.Text = NotShippedVal.ToString("0.0#") + " " + Currency; PendingCount.Text = PendingCountVal.ToString(); var BestsellersQuantityArray = await api.GetBestsellerByQuantity(); var BestsellersAmountArray = await api.GetBestsellerByAmount(); var QuantityList = new List <BestsellerData>(); var BestQuantity = settings.GetValueOrDefault(SaleVQuantity, 5); var Counter = 0; foreach (BestsellerDTO prod in BestsellersQuantityArray) { if (Counter == BestQuantity) { break; } QuantityList.Add(new BestsellerData { Image = ConvertToBitmapImage(prod.Product.Image.First()), QuantityOrAmount = prod.Quantity.ToString(), ProductName = prod.Product.Name }); Counter++; } BestsellersQuantity.ItemsSource = QuantityList; LoadingQuantityHolder.Visibility = System.Windows.Visibility.Collapsed; var AmountList = new List <BestsellerData>(); var BestAmount = settings.GetValueOrDefault(SaleVQuantity, 5); Counter = 0; foreach (BestsellerDTO prod in BestsellersAmountArray) { if (Counter == BestAmount) { break; } AmountList.Add(new BestsellerData { Image = ConvertToBitmapImage(prod.Product.Image.First()), QuantityOrAmount = prod.Amount.ToString("0.#") + " " + await api.GetCurrency(), ProductName = prod.Product.Name }); Counter++; } BestsellersAmount.ItemsSource = AmountList; LoadingAmountHolder.Visibility = System.Windows.Visibility.Collapsed; }
private async Task SelectedFilter(string Filter, string Search) { ListView FetchedCarts = FindViewById <ListView>(Resource.Id.searchlistcart); TextView ResultCount = FindViewById <TextView>(Resource.Id.searchresultscart); switch (Filter) { case "Email": CartsList = await api.GetCurrentCarts("email", Search, 0, 0, 0, 0, false); break; case "> Items": CartsList = await api.GetCurrentCarts("higher items", null, 0, Int32.Parse(Search), 0, 0, false); break; case "< Items": CartsList = await api.GetCurrentCarts("lower items", null, Int32.Parse(Search), 0, 0, 0, false); break; case "> Total": CartsList = await api.GetCurrentCarts("higher total", null, 0, 0, 0, Int32.Parse(Search), false); break; case "< Total": CartsList = await api.GetCurrentCarts("lower total", null, 0, 0, Int32.Parse(Search), 0, false); break; case "Abandoned": CartsList = await api.GetCurrentCarts("abandoned", null, 0, 0, 0, 0, true); break; case "Active": CartsList = await api.GetCurrentCarts("active", null, 0, 0, 0, 0, false); break; } FetchedCarts.Adapter = new CartsSearchAdapter(this, CartsList, await api.GetCurrency()); ResultCount.Text = CartsList.Length.ToString() + " Results Found"; ResultCount.Visibility = ViewStates.Visible; dialog.Dismiss(); }
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(); }
private async void InitializeOrder() { Order = await api.GetOrderById(Id); Currency = await api.GetCurrency(); var CustomerTmp = await api.GetCustomersByEmail(Helpers.Helper.CurrentCustomer()); Customer = CustomerTmp.First(); OrderTotalConfirmation.Text = Order.Total.ToString("0.0#") + " " + Currency; BillingName.Text = Order.BillingAddress.Firstname + " " + Order.BillingAddress.Lastname; BillingEmail.Text = Customer.Email; BillingPhone.Text = Order.BillingAddress.Phone; BillingStreet.Text = Order.BillingAddress.Street; BillingCity.Text = Order.BillingAddress.City + ", "; BillingPostal.Text = Order.BillingAddress.PostalCode; BillingCountry.Text = Order.BillingAddress.Country; ShippingName.Text = Order.ShippingAddress.Firstname + " " + Order.ShippingAddress.Lastname; ShippingEmail.Text = Customer.Email; ShippingPhone.Text = Order.ShippingAddress.Phone; ShippingStreet.Text = Order.ShippingAddress.Street; ShippingCity.Text = Order.ShippingAddress.City + ", "; ShippingPostal.Text = Order.ShippingAddress.PostalCode; ShippingCountry.Text = Order.ShippingAddress.Country; var Result = new List <MainPage.CartData>(); foreach (OrderItemDTO c in Order.ProductsList) { Result.Add(new MainPage.CartData { Id = c.OrderId, ProdId = c.Product.Id, Image = Helper.ConvertToBitmapImage(c.Product.Image.First()), ProductName = c.Product.Name, Quantity = c.Quantity, Total = (c.Quantity * c.Product.Price).ToString("0.#"), UnitPrice = c.Product.Price.ToString("0.#") + " " + Currency }); } ProductsList.ItemsSource = Result; HideLoading(); }
private async void ShowResults(ProductDTO[] Found) { var Currency = await api.GetCurrency(); var ResultList = new List <FoundProductData>(); foreach (ProductDTO p in Found) { try { string Rating = ""; if (p.Rating == 0) { Rating = "No Rating available"; } else { for (int i = 0; i < p.Rating; i++) { Rating += "\ue113".ToString(); } } var Descript = p.Description; if (Descript.Equals(string.Empty)) { Descript = "No description"; } ResultList.Add(new FoundProductData { Id = p.Id, Description = Descript, Name = p.Name, Image = Helper.ConvertToBitmapImage(p.Image.First()), Price = p.Price.ToString("0.0#") + " " + Currency, Rating = Rating }); } catch (Exception ex) { } } if (ResultList.Count > 0) { HideNoResultsMessage(); } else { ShowNoResultsMessage(); } ProductsList.ItemsSource = ResultList; HideLoading(); }
private async void InitializeCheckout() { Currency = await api.GetCurrency(); var CustomerTmp = await api.GetCustomersByEmail(Helpers.Helper.CurrentCustomer()); Customer = CustomerTmp.First(); var AddressesA = new List <AddressData>(); foreach (AddressDTO a in Customer.Addresses) { AddressesA.Add(new AddressData { Address = a.Firstname + " " + a.Lastname + "," + a.Phone + "," + a.Street + "," + a.City + "," + a.PostalCode + "," + a.Country, Id = a.Id }); } var ShippingM = new List <string>(await api.GetShippingMethods()).Distinct(); ShippingMethodPicker.ItemsSource = ShippingM; BillingPicker.ItemsSource = AddressesA; ShippingPicker.ItemsSource = AddressesA; PaymentPicker.ItemsSource = await api.GetPaymentMethods(); decimal SubTotalValue = 0; foreach (CartItemDTO c in Customer.ShoppingCart) { SubTotalValue += c.Product.Price * c.Quantity; } var ShipTmp = await api.GetShippingFees(Customer.Id); var TaxTmp = await api.GetTaxFees(Customer.Id); ShippingFees.Text = ShipTmp.ToString("0.0"); OtherFees.Text = TaxTmp.ToString("0.0"); SubTotal.Text = SubTotalValue.ToString("0.0#") + " " + Currency; ShippingFees.Text = ShippingFeesValue.ToString("0.0#") + " " + Currency;; OtherFees.Text = OtherFeesValue.ToString("0.0#") + " " + Currency; Total = SubTotalValue + ShippingFeesValue + OtherFeesValue; OrderTotalPay.Text = Total.ToString("0.0#") + " " + Currency; HideLoading(); }
private async void InitializeOrders() { var CustomerTmp = await api.GetCustomersByEmail(Helpers.Helper.CurrentCustomer()); var Currency = await api.GetCurrency(); Customer = CustomerTmp.First(); Orders = await api.CustomerIdOrders(Customer.Id); var Result = new List <OrderItemData>(); foreach (OrderDTO o in Orders) { SolidColorBrush Status = null; switch (o.OrderStatus) { case OrderStatus.Complete: Status = new SolidColorBrush(Colors.Green); break; case OrderStatus.Cancelled: Status = new SolidColorBrush(Colors.Red); break; case OrderStatus.Pending: Status = new SolidColorBrush(Colors.Yellow); break; case OrderStatus.Processing: Status = new SolidColorBrush(Colors.Orange); break; } Result.Add(new OrderItemData { Id = o.OrderID, Date = o.CreateDate.ToString(), Status = o.OrderStatus.ToString(), Image = Helpers.Helper.ConvertToBitmapImage(o.ProductsList.First().Product.Image.First()), StatusColor = Status, Total = o.Total.ToString("0.0#") + " " + Currency }); } OrdersList.ItemsSource = Result; HideLoading(); }
private async Task InitializeOrder() { Order = await api.GetOrderById(Id); this.Date.Text = Order.CreateDate.ToString(); decimal result = 0; var Currency = await api.GetCurrency(); OrderStatus.Text = Order.OrderStatus.ToString(); ProductTile.Message = Order.ProductsList.First().Product.Price.ToString("0.0#") + " " + Currency; ProductTile.Title = Order.ProductsList.First().Product.Name; ProductTile.Source = (ImageSource)ConvertToBitmapImage(Order.ProductsList.First().Product.Image.First()); var Products = new List <OrderDetailsProduct>(); foreach (OrderItemDTO item in Order.ProductsList) { var toDecimal = (decimal)item.Quantity; result += item.Product.Price * toDecimal; Products.Add(new OrderDetailsProduct { Product = item.Product.Name, Quantity = item.Quantity, Total = (item.Product.Price * toDecimal).ToString("0.0#"), Image = (ImageSource)ConvertToBitmapImage(item.Product.Image.First()) }); } ProductsList.ItemsSource = Products; Total.Text = result.ToString("0.0#") + " " + Currency; switch (Order.ShippingStatus) { case ShippingStatus.NotYetShipped: ShippingStatusDetails.Text = "Not Yet Shipped"; break; case ShippingStatus.PartiallyShipped: ShippingStatusDetails.Text = "Partially Shipped"; break; case ShippingStatus.ShippingNotRequired: ShippingStatusDetails.Text = "Shipping Not Required"; break; default: ShippingStatusDetails.Text = Order.ShippingStatus.ToString(); break; } switch (Order.PayStatus) { case PaymentStatus.PartiallyRefunded: PaymentStatusDetails.Text = "Partially Refunded"; break; default: PaymentStatusDetails.Text = Order.PayStatus.ToString(); break; } var CustomerTask = await api.GetCustomersByEmail(Order.OrderEmail); Customer = CustomerTask.First(); Email.Text = Customer.Email; Name.Text = Customer.FullName; Address.Text = Order.Address; if (Customer.Phone == null) { Phone.Text = "Not Available"; } else { Phone.Text = Customer.Phone; } }
private async Task InitializeStore() { var Current = ""; if (ChangeStore) { ResetValues(); UserSettings.Remove("current_url"); UserSettings.Add("current_url", StoreUrl); UserSettings.Remove("current_user"); UserSettings.Add("current_user", UserName); } UserSettings.TryGetValue("current_user", out Current); SideMenu.Header = await api.GetStoreName(); SideMenu.Header = SideMenu.Header.ToString().ToLower(); AdminName.Text = await api.GetFullName(Current); if (!ChangeStore) { foreach (KeyValuePair <string, object> url in UserSettings) { if (url.Key.StartsWith("store_url_")) { var Name = url.Key.Substring(10); UrlsMap.Add(new KeyValuePair <String, String>(Name, (string)url.Value)); urls.Add(Name); } } MyStoresList.ItemsSource = urls; } var Currency = await api.GetCurrency(); var SaleValuesIn = settings.GetValueOrDefault <int>(SaleValuesDash, 0); var PendingV = await api.GetStats(3); var CompleteV = await api.GetStats(2); var CancelledV = await api.GetStats(1); if (SaleValuesIn == 0) { PendingSales.Text = PendingV + " " + Currency;; CompleteSales.Text = CompleteV + " " + Currency;; CancelledSales.Text = CancelledV + " " + Currency;; } else { PendingSales.Text = PendingV.ToString("0.0#") + " " + Currency;; CompleteSales.Text = CompleteV.ToString("0.0#") + " " + Currency;; CancelledSales.Text = CancelledV.ToString("0.0#") + " " + Currency;; } var PendingOrdersCount = await api.GetPendingOrdersCount(); var CartsCount = await api.GetCartsCount(); var WishlistCount = await api.GetWishlistCount(); PendingOrders.Text = PendingOrdersCount.ToString(); Carts.Text = CartsCount.ToString(); Wishlists.Text = WishlistCount.ToString(); var VisitorsCount = await api.GetOnlineCount(); var RegisteredCount = await api.GetRegisteredCustomersCount(); var VendorsCount = await api.GetVendorsCount(); Visitors.Text = VisitorsCount.ToString(); Registered.Text = RegisteredCount.ToString(); Vendors.Text = VendorsCount.ToString(); var NPopWords = settings.GetValueOrDefault <int>(KeywordsInDash, 3); var PopularWords = await api.GetPopularKeywords(NPopWords); WordsHolder.Children.Clear(); foreach (KeywordDTO word in PopularWords) { var Sp = new StackPanel(); var WordBlock = new TextBlock(); WordBlock.Text = word.Keyword; WordBlock.FontSize = 20; Sp.Background = new SolidColorBrush(Colors.Gray); WordBlock.Margin = new System.Windows.Thickness { Left = 5, Right = 5 }; Sp.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; Sp.VerticalAlignment = System.Windows.VerticalAlignment.Center; Sp.Margin = new System.Windows.Thickness { Left = 5 }; Sp.Children.Add(WordBlock); WordsHolder.Children.Add(Sp); } var BestAmount = await api.GetBestsellerByAmount(); BestsellerAmount.Text = BestAmount.First().Product.Name; var BestQuantity = await api.GetBestsellerByQuantity(); BestsellerQuantity.Text = BestQuantity.First().Product.Name; var WeekCustomers = await api.GetCustomerCountByTime(7); var TwoWeeksCustomers = await api.GetCustomerCountByTime(14); var MonthCustomers = await api.GetCustomerCountByTime(30); var YearCustomers = await api.GetCustomerCountByTime(365); var registered = new int[4] { WeekCustomers, TwoWeeksCustomers, MonthCustomers, YearCustomers }; RegisteredUsersGraph Graph = new RegisteredUsersGraph(registered, true); RegisteredPlot.Model = Graph.MyModel; ChangeStore = false; }
private async Task UpdateValues(NopCore api) { ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(this); var PendingV = FindViewById <TextView>(Resource.Id.pending); var CompleteV = FindViewById <TextView>(Resource.Id.complete); var CancelledV = FindViewById <TextView>(Resource.Id.cancelled); var PendingCountV = FindViewById <TextView>(Resource.Id.pendingorders); var CartsCountV = FindViewById <TextView>(Resource.Id.carts); var WishlistCountV = FindViewById <TextView>(Resource.Id.wishlists); var RegisteredV = FindViewById <TextView>(Resource.Id.registered); var OnlineV = FindViewById <TextView>(Resource.Id.online); var VendorsV = FindViewById <TextView>(Resource.Id.vendors); var BestsellerQV = FindViewById <TextView>(Resource.Id.bestsellersquantity); var BestsellerAV = FindViewById <TextView>(Resource.Id.bestsellersamount); var KeywordsLoadingV = FindViewById <TextView>(Resource.Id.keywords); var KeywordsLayoutHolder = FindViewById <LinearLayout>(Resource.Id.wordlayout); var Complete = await api.GetStats(2); var Pending = await api.GetStats(3); var Cancelled = await api.GetStats(1); var Currency = await api.GetCurrency(); if (prefs.GetString("sales_format", "Integer").Equals("Integer")) { PendingV.Text = Pending.ToString("0") + " " + Currency; CompleteV.Text = Complete.ToString("0") + " " + Currency; CancelledV.Text = Cancelled.ToString("0") + " " + Currency; } else { PendingV.Text = Pending.ToString("0.0#") + " " + Currency; CompleteV.Text = Complete.ToString("0.0#") + " " + Currency; CancelledV.Text = Cancelled.ToString("0.0#") + " " + Currency; } var PendingCount = await api.GetPendingOrdersCount(); var CartsCount = await api.GetCartsCount(); var WishlistCount = await api.GetWishlistCount(); PendingCountV.Text = PendingCount.ToString(); CartsCountV.Text = CartsCount.ToString(); WishlistCountV.Text = WishlistCount.ToString(); var Registered = await api.GetRegisteredCustomersCount(); var Online = await api.GetOnlineCount(); var Vendors = await api.GetVendorsCount(); RegisteredV.Text = Registered.ToString(); OnlineV.Text = Online.ToString(); VendorsV.Text = Vendors.ToString(); var Keywords = await api.GetPopularKeywords(3); var BestsellerQ = await api.GetBestsellerByQuantity(); var BestsellerA = await api.GetBestsellerByAmount(); int wordSpace = DensityPixel(2); KeywordsLayoutHolder.RemoveAllViews(); for (int i = 0; i < prefs.GetInt("keywords_dashboard", 3); i++) { LinearLayout WordHolder = new LinearLayout(this); LinearLayout.LayoutParams WordLayout = (LinearLayout.LayoutParams)KeywordsLayoutHolder.LayoutParameters; WordHolder.Orientation = Orientation.Horizontal; var WHParams = WordLayout; WHParams.SetMargins(0, 0, wordSpace, 0); WordHolder.LayoutParameters = WHParams; TextView word = new TextView(this); word.Text = Keywords[i].Keyword; word.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.keyword_holder_bg)); word.SetTextColor(Resources.GetColor(Resource.Color.white)); word.SetPadding(wordSpace, wordSpace, wordSpace, wordSpace); word.SetSingleLine(); WordHolder.AddView(word); KeywordsLayoutHolder.AddView(WordHolder); } BestsellerAV.Text = BestsellerA[0].Product.Name; BestsellerQV.Text = BestsellerQ[0].Product.Name; var WeekCustomers = await api.GetCustomerCountByTime(7); var TwoWeeksCustomers = await api.GetCustomerCountByTime(14); var MonthCustomers = await api.GetCustomerCountByTime(30); var YearCustomers = await api.GetCustomerCountByTime(365); var registered = new int [4] { WeekCustomers, TwoWeeksCustomers, MonthCustomers, YearCustomers }; RegisteredUsersGraph Graph = new RegisteredUsersGraph(registered, false); var plotView = FindViewById <PlotView>(Resource.Id.plotView_Temp); plotView.Model = Graph.MyModel; dialog.Dismiss(); }
private async void InitializeCategory() { Categories = await api.GetSubCategoriesFromParent(Id); var ParentCat = await api.GetCategoryById(Id); CategoryPivot.Title = ParentCat.Name.ToUpper(); Currency = await api.GetCurrency(); if (Categories.Count() == 0) { ToggleBar(true); try { var Products = await api.GetAllProductsFromCategory(Id); var Page = new PivotItem(); Page.Header = "all products"; CategoryPivot.Items.Add(Page); var Control = new ListBox(); Control.ItemContainerStyle = Application.Current.Resources["NoSelectColor"] as Style; Control.ItemsPanel = Application.Current.Resources["ProductCategoryWrapper"] as ItemsPanelTemplate; Control.ItemTemplate = Application.Current.Resources["ProductCategoryTemplate"] as DataTemplate; foreach (ProductDTO p in Products) { Control.Items.Add(new MainPage.ProductData { Id = p.Id, Description = p.Description, Image = Helper.ConvertToBitmapImage(p.Image.First()), ProductName = p.Name, Value = p.Price.ToString("0.0#") + " " + Currency }); } Control.SelectionChanged += Control_SelectionChanged; Page.Content = Control; } catch (Exception ex) { } } else { foreach (CategoryDTO c in Categories) { var CatList = new ListBox(); CatList.ItemContainerStyle = Application.Current.Resources["NoSelectColor"] as Style; CatList.ItemsPanel = Application.Current.Resources["ProductCategoryWrapper"] as ItemsPanelTemplate; var Page = new PivotItem(); Page.Header = c.Name.ToLower(); CategoryPivot.Items.Add(Page); var SubCats = await api.GetSubCategoriesFromParent(c.Id); if (SubCats.Count() == 0) { if (Categories.First().Equals(c)) { ToggleBar(true); } CatList.ItemTemplate = Application.Current.Resources["ProductCategoryTemplate"] as DataTemplate; var Products = await api.GetAllProductsFromCategory(c.Id); foreach (ProductDTO p in Products) { CatList.Items.Add(new MainPage.ProductData { Id = p.Id, Description = p.Description, Image = Helper.ConvertToBitmapImage(p.Image.First()), ProductName = p.Name, Value = p.Price.ToString("0.0#") + " " + Currency }); } CatList.SelectionChanged += Control_SelectionChanged; } else { CatList.ItemTemplate = Application.Current.Resources["CategoryTemplate"] as DataTemplate; foreach (CategoryDTO subC in SubCats) { CatList.Items.Add(new MainPage.CategoryData { Id = subC.Id, Image = Helper.ConvertToBitmapImage(subC.Image), Name = subC.Name }); } } Page.Content = CatList; } } Initialized = true; }
private async Task SearchForCarts(string Search, string Filter) { ListBox ResultList = null; switch (Filter) { case "Email": CartsList = await api.GetCurrentCarts("email", Search, 0, 0, 0, 0, false); ResultList = EmailSearch; break; case ">Items": CartsList = await api.GetCurrentCarts("higher items", null, 0, Int32.Parse(Search), 0, 0, false); ResultList = GItemsSearch; break; case "<Items": CartsList = await api.GetCurrentCarts("lower items", null, Int32.Parse(Search), 0, 0, 0, false); ResultList = LItemsSearch; break; case ">Total": CartsList = await api.GetCurrentCarts("higher total", null, 0, 0, 0, Int32.Parse(Search), false); ResultList = GTotalSearch; break; case "<Total": CartsList = await api.GetCurrentCarts("lower total", null, 0, 0, Int32.Parse(Search), 0, false); ResultList = LTotalSearch; break; case "Abandoned": CartsList = await api.GetCurrentCarts("abandoned", null, 0, 0, 0, 0, true); ResultList = AbandonedSearch; break; case "Active": CartsList = await api.GetCurrentCarts("active", null, 0, 0, 0, 0, false); ResultList = ActiveSearch; break; } var Result = new List <CartData>(); var Currency = await api.GetCurrency(); foreach (CustomerDTO c in CartsList) { var Quantity = 0; var Amount = 0; foreach (CartItemDTO item in c.ShoppingCart) { Quantity += item.Quantity; Amount += item.Quantity * (int)item.Product.Price; } var Cart = new CartData { Email = c.Email, FullName = c.FullName, Quantity = Quantity, Amount = Amount.ToString() + " " + Currency }; Result.Add(Cart); } LoadingHolder.Visibility = System.Windows.Visibility.Collapsed; ResultList.ItemsSource = Result; FilterHolder.Visibility = System.Windows.Visibility.Visible; }
private async Task GetCart() { var CustomerEmail = Intent.GetStringExtra("customeremail"); var CartTmp = await api.GetCustomersByEmail(CustomerEmail); Cart = CartTmp.First(); var ProductsList = FindViewById <ListView>(Resource.Id.cartproductslist); if (Wishlist) { ProductsList.Adapter = new CartProductsAdapter(this, Cart.Wishlist.ToArray(), await api.GetCurrency()); } else { ProductsList.Adapter = new CartProductsAdapter(this, Cart.ShoppingCart.ToArray(), await api.GetCurrency()); } dialog.Dismiss(); }
private async Task InitializeStats() { var PopularKeywords = await api.GetPopularKeywords(20); var PopularByCount = new List <KeywordDTO>(); PopularByCount.AddRange(PopularKeywords); var PopularByAlphabet = new List <KeywordDTO>(); PopularByAlphabet.AddRange(PopularKeywords); PopularByAlphabet.Sort(delegate(KeywordDTO x, KeywordDTO y) { return(x.Keyword.CompareTo(y.Keyword)); }); var MaxCount = PopularByCount.First().Count; var MinCount = PopularByCount.Last().Count; var Counter = 0; var NPopWords = settings.GetValueOrDefault <int>(KeywordsInStats, 10); foreach (KeywordDTO K in PopularByAlphabet) { if (Counter == NPopWords) { break; } var Word = new TextBlock(); var Delta = 1 + ((double)(MaxCount - MinCount) / 6); if (K.Count <= Delta) { Word.Foreground = new SolidColorBrush(Color.FromArgb(255, 176, 229, 124)); Word.FontSize = SIZE1; } else if (K.Count > Delta && K.Count < Delta * 2) { Word.Foreground = new SolidColorBrush(Color.FromArgb(255, 180, 216, 231)); Word.FontSize = SIZE2; } else if (K.Count > Delta * 2 && K.Count < Delta * 3) { Word.Foreground = new SolidColorBrush(Color.FromArgb(255, 86, 186, 236)); Word.FontSize = SIZE3; } else if (K.Count > Delta * 3 && K.Count < Delta * 4) { Word.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 240, 170)); Word.FontSize = SIZE4; } else if (K.Count > Delta * 4 && K.Count < Delta * 5) { Word.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 174, 174)); Word.FontSize = SIZE5; } else { Word.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 236, 148)); Word.FontSize = SIZE6; } Word.Text = K.Keyword; Word.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; Word.Margin = new Thickness(0, 0, 5, 0); KeywordsHolder.Children.Add(Word); } var WeekCustomers = await api.GetCustomerCountByTime(7); var TwoWeeksCustomers = await api.GetCustomerCountByTime(14); var MonthCustomers = await api.GetCustomerCountByTime(30); var YearCustomers = await api.GetCustomerCountByTime(365); UsersSeven.Text = WeekCustomers.ToString(); UsersFour.Text = TwoWeeksCustomers.ToString(); UsersMonth.Text = MonthCustomers.ToString(); UsersYear.Text = YearCustomers.ToString(); 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(); TotalSeven.Text = WeekSales.ToString("0.0#") + " " + Currency; TotalFour.Text = TwoWeeksSales.ToString("0.0#") + " " + Currency; TotalMonth.Text = MonthSales.ToString("0.0#") + " " + Currency; TotalYear.Text = YearSales.ToString("0.0#") + " " + Currency; }
private async void InitializeMainPages() { string Current = ""; UserSettings.TryGetValue("current_user", out Current); var tmp = await api.GetCustomersByEmail(Current); Currency = await api.GetCurrency(); Customer = tmp.First(); CustomerName.Text = Customer.FullName; var Featured = await api.FeaturedProducts(); FeaturedCount = Featured.Count(); var FeaturedList = new List <ProductData>(); int FeatCount = Helper.GetSetting <int>("featured_count"); int tmpCount = 0; foreach (ProductDTO p in Featured) { if (tmpCount == FeatCount) { break; } FeaturedList.Add(new ProductData { Id = p.Id, ProductName = p.Name, Description = p.Description, Image = Helper.ConvertToBitmapImage(p.Image.First()), Value = p.Price.ToString("0") + " " + Currency }); tmpCount++; } FeaturedProducts.ItemsSource = FeaturedList; var BestsellersA = await api.GetBestsellerByAmount(); var BestsellersQ = await api.GetBestsellerByQuantity(); var Bests = new List <ProductData>(); var BestCount = Helper.GetSetting <int>("bestsellers_count") / 2; for (int i = 0; i < BestCount; i++) { if (i < BestsellersA.Count()) { Bests.Add(new ProductData { Id = BestsellersA[i].Product.Id, ProductName = BestsellersA[i].Product.Name, Value = BestsellersA[i].Product.Price.ToString("0.#") + " " + Currency, Image = Helper.ConvertToBitmapImage(BestsellersA[i].Product.Image.First()) }); } if (i < BestsellersQ.Count()) { Bests.Add(new ProductData { Id = BestsellersQ[i].Product.Id, ProductName = BestsellersQ[i].Product.Name, Value = BestsellersQ[i].Product.Price.ToString("0.#") + " " + Currency, Image = Helper.ConvertToBitmapImage(BestsellersQ[i].Product.Image.First()) }); } } BestsellersList.ItemsSource = Bests; var Categories = await api.GetMainCategories(); var CategoriesList = new List <CategoryData>(); foreach (CategoryDTO c in Categories) { CategoriesList.Add(new CategoryData { Id = c.Id, Name = c.Name, Image = Helper.ConvertToBitmapImage(c.Image) }); } CategoriesListbox.ItemsSource = CategoriesList; HideLoading(); }
private async void InitializeDetails() { Product = await api.GetProductById(Id); Name.Text = Product.Name; URL = await api.GetStoreUrl(); var Currency = await api.GetCurrency(); Price.Text = Product.Price.ToString("0.0#") + " " + Currency; if (Product.inStock) { Availability.Text = "In Stock"; AvailabilityHolder.Background = new SolidColorBrush(Colors.Green); } else { AvailabilityHolder.Background = new SolidColorBrush(Colors.Red); Availability.Text = "Out of Stock"; } Description.Text = CleanDescription(Product.ExtendedDescription); foreach (byte[] i in Product.Image) { StackPanel sp = new StackPanel(); sp.Width = 480; sp.Height = 300; var img = new Image(); img.Source = Helper.ConvertToBitmapImage(i) as ImageSource; img.MinHeight = 100; img.MinWidth = 240; img.MaxHeight = 250; img.MaxWidth = 400; sp.Children.Add(img); sp.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; sp.VerticalAlignment = System.Windows.VerticalAlignment.Center; ImageList.Children.Add(sp); } for (int i = 0; i < Product.Attributes.Count; i++) { StackPanel sp = new StackPanel(); switch (Product.Attributes[i].AttributeControl) { case AttributeControlType.TextBox: PhoneTextBox p = new PhoneTextBox(); p.Hint = Product.Attributes[i].Name; Controls.Add(p); sp.Children.Add(p); break; case AttributeControlType.DropdownList: ListPicker l = new ListPicker(); l.Header = Product.Attributes[i].Name; foreach (string v in Product.Attributes[i].Values) { l.Items.Add(v); } Controls.Add(l); sp.Children.Add(l); break; case AttributeControlType.MultilineTextbox: PhoneTextBox m = new PhoneTextBox(); m.MinHeight = 150; m.Hint = Product.Attributes[i].Name; Controls.Add(m); sp.Children.Add(m); break; case AttributeControlType.RadioList: TextBlock titleRadio = new TextBlock(); titleRadio.Text = Product.Attributes[i].Name; titleRadio.Style = Resources["PhoneTextSubtleStyle"] as Style; sp.Children.Add(titleRadio); var TmpRadio = new List <RadioButton> (Product.Attributes[i].Values.Count); foreach (string s in Product.Attributes[i].Values) { RadioButton rv = new RadioButton(); rv.GroupName = Product.Attributes[i].Name; rv.Content = s; TmpRadio.Add(rv); sp.Children.Add(rv); } Controls.Add(TmpRadio); break; case AttributeControlType.Checkboxes: TextBlock titleCheck = new TextBlock(); titleCheck.Text = Product.Attributes[i].Name; titleCheck.Style = Resources["PhoneTextSubtleStyle"] as Style; sp.Children.Add(titleCheck); var TmpCheck = new List <CheckBox>(Product.Attributes[i].Values.Count); foreach (string s in Product.Attributes[i].Values) { CheckBox c = new CheckBox(); c.Content = s; TmpCheck.Add(c); sp.Children.Add(c); } Controls.Add(TmpCheck); break; } Attributes.Children.Add(sp); } }