private void btnRemoveItem_Click(object sender, EventArgs e) { if (dgvItems.SelectedRows.Count >= 1) { DialogResult dr = new DialogResult(); dr = MessageBox.Show("Are your sure you would like to remove this item?", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { int isValid; CItem item = new CItem(); isValid = item.RemoveItem(conn, Convert.ToInt32(txtQrCode.Text)); if (isValid == 1) { MessageBox.Show("Item was successfully removed.", "User removed.", MessageBoxButtons.OK, MessageBoxIcon.Information); RefreshDataSource(dgvCustomers, "sp_GetItemInfo"); } else { MessageBox.Show("User was not removed.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } ItemTextboxesChangeState(); } } else { MessageBox.Show("Please select an item to remove.", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void btnItemEdit_Click(object sender, EventArgs e) { DialogResult dr = new DialogResult(); dr = MessageBox.Show("Are your sure you would like to update this item?", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { int isValid; CItem item = new CItem(); isValid = item.EditItem(conn, Convert.ToInt32(value: txtQrCode.Text), radAvailability.Checked, cmbItemType.SelectedItem.ToString()); RefreshDataSource(dgvCustomers, "sp_GetItemInfo"); ItemTextboxesChangeState(); } else { MessageBox.Show("Item could not be updated.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnItemAdd_Click(object sender, EventArgs e) { DialogResult dr = new DialogResult(); dr = MessageBox.Show("Are you sure you want to add this Item?", "OK", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { CItem item = new CItem(); int IsValid = item.AddItem(conn, Convert.ToBoolean(radAvailability.Checked), cmbItemType.SelectedItem.ToString()); if (IsValid == 1) { MessageBox.Show("User added successfully!"); RefreshDataSource(dgvCustomers, "sp_GetItemInfo"); } else { MessageBox.Show("There was a problem adding the item."); } } ItemTextboxesChangeState(); }