Esempio n. 1
0
        private void UpdateInventoryForm_Load(object sender, EventArgs e)
        {
            List <Product> products = ProductDb.GetAllProducts();

            productListBox.DataSource    = products;
            productListBox.DisplayMember = nameof(Product.ToString);
        }
Esempio n. 2
0
        /// <summary>
        /// Updates the product list.
        /// </summary>
        private void UpdateList()
        {
            productListBox.DataSource = null;
            productListBox.Items.Clear();
            List <Product>        products         = ProductDb.GetAllProducts();
            IEnumerable <Product> distinctProducts = products.Distinct <Product>();

            productListBox.DataSource = distinctProducts.ToList();
        }
        private void UpdateInvoiceForm_Load(object sender, EventArgs e)
        {
            List <Invoice> invoices = ProductDb.GetAllInvoices();

            invoiceCmbBox.DataSource = invoices.ToList();

            List <Product> products = ProductDb.GetAllProducts();

            productCmbBox.DataSource = products.ToList();
        }
Esempio n. 4
0
        /// <summary>
        /// Loads main form.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Form1_Load(object sender, EventArgs e)
        {
            List <Product>        products         = ProductDb.GetAllProducts();
            IEnumerable <Product> distinctProducts = products.Distinct <Product>();

            productListBox.DataSource = distinctProducts.ToList();

            List <Invoice> invoices = ProductDb.GetAllInvoices();

            invoiceListBox.DataSource = invoices.ToList();
        }
Esempio n. 5
0
        /// <summary>
        /// Launches the Consume Product form.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ConsumeBtn_Click(object sender, EventArgs e)
        {
            List <Product> product = ProductDb.GetAllProducts();

            if (product.Any())
            {
                ConsumeUnitsForm consumeUnits = new ConsumeUnitsForm();
                consumeUnits.ShowDialog();
                UpdateList();
            }
            else
            {
                MessageBox.Show("There are no products in the database", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void ConsumeUnitsForm_Load(object sender, EventArgs e)
        {
            List <Product> products = ProductDb.GetAllProducts();

            consumeProductBox.DataSource = products;
        }