private void btnConfirm_Click(object sender, EventArgs e) { bool operationResult = AdminUserClass.confirmUser(txtUserId.Text); if (operationResult) { MessageBox.Show("User Confirmed successfully"); clearUserControls(); } else { MessageBox.Show("Error!"); } }
private void btnUpdateUser_Click(object sender, EventArgs e) { bool operationResult = AdminUserClass.userOperations("Update", txtUserId.Text, txtName.Text, txtSurname.Text, txtAddress.Text, txtEmail.Text, txtUserName.Text, txtPassword.Text, cbIsAdmin.Checked ? true : false); if (operationResult) { MessageBox.Show("User Updated successfully"); clearUserControls(); } else { MessageBox.Show("Error!"); } }
/** @brief button delete user * call userDelete() function in AdminUserClass * The parameter of the userDelete() function is id. */ private void btnDeleteUser_Click(object sender, EventArgs e) { SqlConnection connection = dbHelper.getConnection(); bool operationResult = AdminUserClass.userDelete(txtUserId.Text); if (operationResult) { MessageBox.Show("User deleted successfully", "INFORMATION", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Error!", "INFORMATION", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/** * button delete MusicCDs from the database */ private void btnDeleteMusicCDs_Click(object sender, EventArgs e) { //bool affected = dbHelper.deleteAProductFromDB(typeof(OnlineBookStore.MusicCDsClass), txtMusicCDsId.Text.ToString()); AdminUserClass adminOps = AdminUserClass.Instance; bool affected = adminOps.deleteProduct(typeof(OnlineBookStore.MusicCDsClass), txtMusicCDsId.Text.ToString()); if (!affected) { MessageBox.Show("Error not successful"); } else { MessageBox.Show("MusicCD is deleted successfully", "INFORMATION", MessageBoxButtons.OK, MessageBoxIcon.Information); clearMusicCDsControl(); } }
private void btnUpdateMagazine_Click(object sender, EventArgs e) { MagazineClass magazine = new MagazineClass(txtMagazineName.Text, txtMagazineId.Text, Convert.ToDouble(txtMagazinePrice.Text), Convert.ToInt32(txtMagazineStock.Text), txtMagazineIssue.Text, txtMagazineType.Text, txtMagazineImage.Text); //bool affected = dbHelper.updateAProductAtDB(magazine); AdminUserClass adminOps = AdminUserClass.Instance; bool affected = adminOps.updateProduct(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(); } }
private void btnUpdateMusicCDs_Click(object sender, EventArgs e) { MusicCDsClass music = new MusicCDsClass(txtMusicName.Text, txtMusicCDsId.Text, Convert.ToDouble(txtMusicPrice.Text), Convert.ToInt32(txtMusicCDsStock.Text), txtMusicSinger.Text, txtMusicType.Text, txtMusicCDsImage.Text); //bool affected = dbHelper.updateAProductAtDB(music); AdminUserClass adminOps = AdminUserClass.Instance; bool affected = adminOps.updateProduct(music); if (!affected) { MessageBox.Show("Error not successful"); } else { MessageBox.Show("Music CDs updated successfully", "INFORMATION", MessageBoxButtons.OK, MessageBoxIcon.Information); clearMusicCDsControl(); } }
private void btnUpdateBook_Click(object sender, EventArgs e) { BookClass book = new BookClass(txtBookName.Text, txtBookId.Text, Convert.ToDouble(txtBookPrice.Text), Convert.ToInt32(txtBookStock.Text), txtBookIsbn.Text, txtBookAuthor.Text, txtBookPublisher.Text, Convert.ToInt32(txtBookPage.Text), txtBookImage.Text); //bool affected = dbHelper.updateAProductAtDB(book); AdminUserClass adminOps = AdminUserClass.Instance; bool affected = adminOps.updateProduct(book); if (!affected) { MessageBox.Show("Error not successful"); } else { MessageBox.Show("Book updated successfully", "INFORMATION", MessageBoxButtons.OK, MessageBoxIcon.Information); clearBookControls(); } }
public override bool saveCustomer(string id, string name, string surname, string address, string email, string username, string password, bool isadmin) { bool operationResult = AdminUserClass.userOperations("Add", id, name, surname, address, email, username, password, isadmin); return(operationResult); }