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;
}
}