Exemplo n.º 1
0
        }//end of ochestra click method

        private void btnCreateCDChamber_Click(object sender, EventArgs e)
        {
            if (btnCreateCDChamber.Text == "Create CD Chamber")
            {
                DisplayCDChamberForm();      //shows proper textboxes for cd chamber
                btnEnterUPC.Enabled = false; //no other actions during add
            }
            else
            {
                MessageBox.Show("Saving");
                if (Validators.ValidateCDChamber(txtProductUPC.Text, txtProductPrice.Text, txtProductTitle.Text, txtProductQuantity.Text,
                                                 txtCDClassicalLabel.Text, txtCDClassicalArtists.Text, txtCDChamberInstrumentList.Text))//validates chamber product
                {
                    MessageBox.Show("Passed CD Chamber Test");
                    CDChamber x = new CDChamber();
                    x.Save(this);//now x has all values in textboxes
                    MessageBox.Show(x.ToString());
                    thisProductList.addAnItem(x);

                    dbFunctions.InsertProduct(Convert.ToInt32(txtProductUPC.Text), Convert.ToDecimal(txtProductPrice.Text), txtProductTitle.Text,
                                              Convert.ToInt32(txtProductQuantity.Text), "CDChamber");                                         //add to product table

                    dbFunctions.InsertCDClassical(Convert.ToInt32(txtProductUPC.Text), txtCDClassicalLabel.Text, txtCDClassicalArtists.Text); //add to classical table

                    dbFunctions.InsertCDChamber(Convert.ToInt32(txtProductUPC.Text), txtCDChamberInstrumentList.Text);                        //add to chamber table

                    btnCreateCDChamber.Enabled = false;                                                                                       //makes sure cannot accidently add twice
                }
            }
        }//end of create chamber on click method