示例#1
0
        public HistoryUserControl(long ProductID, bool showUserName = false)
        {
            InitializeComponent();
            InterfaceToDataBaseSaleMethods Methods = new InterfaceToDataBaseSaleMethods();
            List <Sale> UserSaleList = Methods.GetProductSalesHistory(ProductID).Result;

            Init(UserSaleList, showUserName);
        }
示例#2
0
        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);
        }
示例#3
0
        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();
        }
示例#4
0
        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);
        }
示例#5
0
        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ł";
        }