public HistoryUserControl(long ProductID, bool showUserName = false) { InitializeComponent(); InterfaceToDataBaseSaleMethods Methods = new InterfaceToDataBaseSaleMethods(); List <Sale> UserSaleList = Methods.GetProductSalesHistory(ProductID).Result; Init(UserSaleList, showUserName); }
public HistoryUserControl(DateTime Date, int comparePositions = 3, bool showUserName = false) { InitializeComponent(); InterfaceToDataBaseSaleMethods Methods = new InterfaceToDataBaseSaleMethods(); List <Sale> UserSaleList = Methods.GetDateSalesHistory(Date, comparePositions).Result; Init(UserSaleList, showUserName); }
public async void CommitSale() { InterfaceToDataBaseSaleMethods Methods = new InterfaceToDataBaseSaleMethods(); await Methods.CreateSale(loggedUserData.UserID); //loggedUserBasket.Clear(); //basketSizeLabel.Text = loggedUserBasket.Count.ToString(); InterfaceToDataBaseBasketMethods BasketMethods = new InterfaceToDataBaseBasketMethods(); basketSizeLabel.Text = BasketMethods.CountBaskets(loggedUserData.UserID).Result.ToString(); SetHomeUserControl(); }
public HistoryUserControl(User UserData, bool showUserName = false) { InitializeComponent(); InterfaceToDataBaseSaleMethods Methods = new InterfaceToDataBaseSaleMethods(); List <Sale> UserSaleList = new List <Sale>(); if (UserData != null) { UserSaleList = Methods.GetUserSalesHistory(UserData.UserID).Result; } Init(UserSaleList, showUserName); }
private void Init(List <Sale> UserSaleList, bool showUserName = false) { salesFlowPanel.Controls.Add(new SaleDataUserControl(showUserName)); decimal sum = 0; foreach (Sale sale in UserSaleList) { InterfaceToDataBaseSaleMethods Methods = new InterfaceToDataBaseSaleMethods(); sum += Methods.GetSaleValue(sale.SaleID).Result; salesFlowPanel.Controls.Add(new SaleDataUserControl(sale, sum, showUserName)); } numberLabel.Text = UserSaleList.Count.ToString(); sumLabel.Text = sum.ToString() + "zł"; }