/** @brief click on the add musicsCDs button to print to the database. * writes the information entered to the textboxes into the database. * if it is not added musicsCDs the database, the error message is printed on the screen. * after adding,clears the textboxes. */ private void btnAddMusicCDs_Click(object sender, EventArgs e) { MusicCDsClass music = new MusicCDsClass(txtMusicName.Text, null, Convert.ToDouble(txtMusicPrice.Text), Convert.ToInt32(txtMusicCDsStock.Text), txtMusicSinger.Text, txtMusicType.Text, txtMusicCDsImage.Text); //bool affected = dbHelper.addAProductToDB(music); AdminUserClass adminOps = AdminUserClass.Instance; bool affected = adminOps.addNewProduct(music); if (!affected) { MessageBox.Show("Error not successful"); } else { MessageBox.Show("Music CDs added successfully", "INFORMATION", MessageBoxButtons.OK, MessageBoxIcon.Information); clearMusicCDsControl(); } }
/** @brief click on the add magazine button to print to the database. * writes the information entered to the textboxes into the database. * if it is not added magazine the database, the error message is printed on the screen. * after adding,clears the textboxes. */ private void btnAddMagazine_Click(object sender, EventArgs e) { MagazineClass magazine = new MagazineClass(txtMagazineName.Text, null, Convert.ToDouble(txtMagazinePrice.Text), Convert.ToInt32(txtMagazineStock.Text), txtMagazineIssue.Text, txtMagazineType.Text, txtMagazineImage.Text); //bool affected = dbHelper.addAProductToDB(magazine); AdminUserClass adminOps = AdminUserClass.Instance; bool affected = adminOps.addNewProduct(magazine); if (!affected) { MessageBox.Show("Error not successful", "INFORMATION", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("Magazine added successfully", "INFORMATION", MessageBoxButtons.OK, MessageBoxIcon.Information); clearMagazineControls(); } }
/** @brief click on the add book button to print to the database. * writes the information entered to the textboxes into the database. * if it is not added book the database, the error message is printed on the screen. * after adding,clears the textboxes. */ private void btnAddBook_Click(object sender, EventArgs e) { BookClass book = new BookClass(txtBookName.Text, null, Convert.ToDouble(txtBookPrice.Text), Convert.ToInt32(txtBookStock.Text), txtBookIsbn.Text, txtBookAuthor.Text, txtBookPublisher.Text, Convert.ToInt32(txtBookPage.Text), txtBookImage.Text); //bool affected = dbHelper.addAProductToDB(book); AdminUserClass adminOps = AdminUserClass.Instance; bool affected = adminOps.addNewProduct(book); if (!affected) { MessageBox.Show("Error not successful"); } else { MessageBox.Show("Book added successfully", "INFORMATION", MessageBoxButtons.OK, MessageBoxIcon.Information); clearBookControls(); } }