private void buttonRemoveGroup_Click(object sender, EventArgs e) { try { int idx = remove_cb.SelectedIndex; if (idx < 0) { return; } int id = Convert.ToInt32(group.GetAllGroup().Rows[idx][0]); int user_id = CurrentUser.Id; if (group.DeleteGroup(id, user_id)) { MessageBox.Show("Remove Successfully", "Remove Group", MessageBoxButtons.OK, MessageBoxIcon.Information); remove_cb.Text = ""; } else { MessageBox.Show("You are not the owner of this group!", "Remove Group", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } refresh(); } catch { MessageBox.Show("Empty Field", "Remove Group", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); throw; } }
private void deletebtn_Click(object sender, EventArgs e) { string acc_code = AccTypeCodetxt.Text; DataTable dt = Group.GetGroup(acc_code); if (dt.Rows.Count == 0) { GUIutils.ShowMessage("Account Type Code Doesn't Exist"); return; } Group.DeleteGroup(acc_code); }
public errorCompositeType DeleteGroup(int iIdGroup) { errorCompositeType lstError = new errorCompositeType(); try { Group et = new Group(); et.DeleteGroup(iIdGroup); lstError.bError = true; lstError.sError = ""; return(lstError); } catch (Exception ex) { lstError.bError = false; lstError.sError = ex.Message; return(lstError); } }