Exemple #1
0
        }     // end getItem

        private void btnCreateBook_Click(System.Object sender, System.EventArgs e)
        {
            if (txtBookISBNLeft.Enabled == false)
            {
                FormController.activateBook(this);
                FormController.deactivateAllButBook(this);
            }
            else
            {
                if (validateBook())
                {
                    int     tempISBNL = Convert.ToInt32(txtBookISBNLeft.Text);
                    int     tempISBNR = Convert.ToInt32(txtBookISBNRight.Text);
                    int     tempPages = Convert.ToInt32(txtBookPages.Text);
                    int     tempUPC   = Convert.ToInt32(txtProductUPC.Text);
                    decimal tempPrice = Convert.ToDecimal(txtProductPrice.Text);
                    int     tempQuant = Convert.ToInt32(txtProductQuantity.Text);



                    dbFunctions.InsertProduct(tempUPC, tempPrice, txtProductTitle.Text, tempQuant, "Book");

                    MessageBox.Show("NEW BOOK ADDED");
                }
                else
                {
                    MessageBox.Show("Invalid data");
                }
            }
        }
Exemple #2
0
        //edit determines what shows based on the type
        private void btnEdit_Click(System.Object sender, System.EventArgs e)
        {
            bool   ok      = false;
            string record  = "";
            int    tempUPC = Convert.ToInt32(txtProductUPC.Text);

            if (dbFunctions.getProductType() == "Book")
            {
                FormController.activateBook(this);
                FormController.deactivateAllButBook(this);
                btnCreateBook.Enabled = false;
            }
            if (dbFunctions.getProductType() == "BookCis")
            {
                FormController.activateBookCIS(this);
                FormController.deactivateAllButBookCIS(this);
                btnCreateBookCIS.Enabled = false;
            }
            if (dbFunctions.getProductType() == "DVD")
            {
                FormController.activateDVD(this);
                FormController.deactivateAllButDVD(this);
                btnCreateDVD.Enabled = false;
            }
            if (dbFunctions.getProductType() == "CDChamber")
            {
                FormController.activateCDOrchestra(this);
                FormController.deactivateAllButCDOrchestra(this);
                btnCreateCDOrchestra.Enabled = false;
            }
            if (dbFunctions.getProductType() == "CDOrchestra")
            {
                FormController.activateCDChamber(this);
                FormController.deactivateAllButCDChamber(this);
                btnCreateCDChamber.Enabled = false;
            }
        }