Beispiel #1
0
        //*******************************************************************
        //*                                                                 *
        //*                             MIKE                                *
        //*                                                                 *
        //*******************************************************************



        // STEP 1
        private void tabselection()
        {
            if (tabControl.SelectedIndex == 0)
            {
                if (cboPackageId.SelectedValue == null)
                {
                    GetPackages();
                    int ID1 = Convert.ToInt32(cboPackageId.SelectedValue);

                    load_table();
                }
            }

            if (tabControl.SelectedIndex == 2)
            {
                this.GetProductsSuppliers();
            }
            if (tabControl.SelectedIndex == 4)
            {
                cboProductName.DataSource    = ProductDB.GetProducts();
                cboProductName.DisplayMember = "ProdName";
                cboProductName.ValueMember   = "ProductId";


                dataGridPackProdSup.DataSource = Packages_Products_SuppliersDB.GetPackages_Products_Supplierss();
            }
            if (tabControl.SelectedIndex == 5)
            {
                GetPackages();
            }
        }
Beispiel #2
0
        // STEP 4
        private void btnAddPackProdSup_Click(object sender, EventArgs e)
        {
            int pkgID = Convert.ToInt32(cboPkgPPS.SelectedValue);
            int pkgPS = Convert.ToInt32(cboPSPPS.SelectedValue);

            Packages_Products_SuppliersDB.AddProductSupplier(pkgID, pkgPS);
            dataGridPackProdSup.DataSource = Packages_Products_SuppliersDB.GetPackages_Products_Supplierss();
            MessageBox.Show("You have added new Product to the Package!");
        }
Beispiel #3
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            ProductsSuppliers pps  = new ProductsSuppliers();
            package           psup = new package();

            psup.PackageId        = ((package)cboPkgPPS.SelectedItem).PackageId;
            pps.ProductSupplierId = ((ProductsSuppliers)cboPSPPS.SelectedItem).ProductSupplierId;


            bool logic = Packages_Products_SuppliersDB.Delete(psup, pps);

            dataGridPackProdSup.DataSource = Packages_Products_SuppliersDB.GetPackages_Products_Supplierss();

            if (logic == true)
            {
                MessageBox.Show("You have Deleted Product from the package Package!");
            }
            else
            {
                MessageBox.Show("The selected product does not exists in the selected package");
                dataGridPackProdSup.Rows[3].Selected = true;
            }
        }