private void btnCategoryUpdate_Click(object sender, EventArgs e) { try { if (txtStatus.Text != "") { bool d = StatusRepo.checkIfStatusExists(txtStatus.Text); if (d) { MessageBox.Show("This status already exists"); } else { StatusRepo.update(this.id, txtStatus.Text); MessageBox.Show("Status has been updated."); List <SMLIB.Entity.Status> statuses = StatusRepo.retrieve(); fillListView(statuses); btnCategoryDelete.Enabled = false; btnCategoryUpdate.Enabled = false; btnCategoryAdd.Enabled = true; clearAll(); } } else { MessageBox.Show("Status has been updated."); } } catch (Exception) { MessageBox.Show("Please select an item to update."); } }
private void btnCategoryAdd_Click(object sender, EventArgs e) { if (txtStatus.Text != "") { bool b = StatusRepo.checkIfStatusExists(txtStatus.Text); if (b) { MessageBox.Show("This status value already exists, please try again."); } else { StatusRepo.insert(Guid.NewGuid(), txtStatus.Text); MessageBox.Show("Status inserted."); List <SMLIB.Entity.Status> statuses = StatusRepo.retrieve(); fillListView(statuses); clearAll(); } } else { MessageBox.Show("Status can not be empty."); } }