/// <summary> /// Deletes tag group. Called when the "Delete group" button is pressed. /// Expects the CreateTagGroup method to be run first. /// </summary> private bool DeleteTagGroup() { // Get the tag group string where = "TagGroupName LIKE 'MyNew%'"; // Get the data DataSet groups = TagGroupInfoProvider.GetTagGroups(where, null); if (!DataHelper.DataSourceIsEmpty(groups)) { // Loop through the individual items foreach (DataRow groupDr in groups.Tables[0].Rows) { // Create object from DataRow TagGroupInfo deleteGroup = new TagGroupInfo(groupDr); // Delete the tag group TagGroupInfoProvider.DeleteTagGroupInfo(deleteGroup); } return(true); } return(false); }
private void gridTagGroups_OnAction(string actionName, object actionArgument) { int groupId = -1; string siteId = null; switch (actionName) { // Editing of the category fired case "edit": // Get category ID groupId = ValidationHelper.GetInteger(actionArgument, -1); siteId = Convert.ToString(this.siteSelector.Value); // Create a target site URL and pass the category ID as a parameter string editUrl = "TagGroup_Edit.aspx?groupid=" + groupId.ToString() + "&siteid=" + siteId; URLHelper.Redirect(editUrl); break; // Deleteing of the category was fired case "delete": groupId = ValidationHelper.GetInteger(actionArgument, -1); if (groupId > -1) { // If no item depends on the current group DataSet ds = TagInfoProvider.GetTags("TagGroupID = " + groupId, null); if (DataHelper.DataSourceIsEmpty(ds)) { // Delete the class TagGroupInfoProvider.DeleteTagGroupInfo(groupId); } else { // Display error on deleting this.lblError.Visible = true; this.lblError.Text = GetString("tags.taggroup_list.hasdependencies"); } } break; } }