Example #1
0
        public void CreateBasketDatafromOrder(Order orderDataObject)
        {
            DisableAmountBox();
            removeButton.Visible = false;

            InterfaceToDataBaseProductMethods Methods = new InterfaceToDataBaseProductMethods();

            productDataObject = Methods.GetProductData(orderDataObject.ProductID).Result;

            SetData(orderDataObject);
        }
Example #2
0
        public BasketDataUserControl(Basket basketDataObject)
        {
            InitializeComponent();
            this.basketDataObject = basketDataObject;
            InterfaceToDataBaseProductMethods Methods = new InterfaceToDataBaseProductMethods();

            productDataObject = Methods.GetProductData(basketDataObject.ProductID).Result;
            SetData();
            //amountBox.TextChanged += amountBox_TextChanged;
            amountBox.Enter += amountBox_Enter;
            amountBox.Leave += amountBox_Leave;
        }
Example #3
0
        private async void SearchCatalog()
        {
            List <Control> ctrls = new List <Control>();

            foreach (Control c in productsFlowPanel.Controls)
            {
                ctrls.Add(c);
            }
            productsFlowPanel.Controls.Clear();
            foreach (Control c in ctrls)
            {
                c.Dispose();
            }

            InterfaceToDataBaseProductMethods Methods = new InterfaceToDataBaseProductMethods();
            List <Product> products = await Methods.CatalogProducts(searchArgument, categoryID, 1);

            foreach (Product product in products)
            {
                productsFlowPanel.Controls.Add(new ProductDataUserControl(product));
            }
        }
Example #4
0
        private async void SetSaleInfo()
        {
            InterfaceToDataBaseProductMethods Methods = new InterfaceToDataBaseProductMethods();

            productOnSale = await Methods.GetRandomSale();

            if (productOnSale != null)
            {
                if (productOnSale.Picture == null)
                {
                    salePictureBox.Visible = false;
                    saleLabel.TextAlign    = ContentAlignment.MiddleCenter;
                }
                else
                {
                    salePictureBox.Image = productOnSale.Picture;
                }
                saleLabel.Text = "Promocja na: " + productOnSale.ProductName + "!\n" + "Jedyne " + productOnSale.Discount + "zł z " + productOnSale.Price + "zł za ";
                switch (productOnSale.UnitType)
                {
                case 0:
                    saleLabel.Text += "sztukę!";
                    break;

                case 1:
                    saleLabel.Text += "kilogram!";
                    break;

                case 2:
                    saleLabel.Text += "litr!";
                    break;
                }
            }
            else
            {
                salePictureBox.Visible = false;
                saleLabel.Text         = Properties.Resources.DefaultSale;
            }
        }