protected void groupDeleteButton_Click(object sender, EventArgs e) { UserGroup userGroupObj = new UserGroup(); DataTable dt = new DataTable(); dt = userGroupObj.GetGroupInfo(GroupListBox.SelectedValue); foreach (DataRow row in dt.Rows) { groupId = Convert.ToInt16(row["id"].ToString()); } userGroupObj.DeleteGroup(groupId); GroupListBox.Items.Clear(); LoadGroups(); if (GroupListBox.Items.Count > 0) { GroupInfoLoad(GroupListBox.Items[0].ToString()); } }
/// <summary> /// ɾ���� /// </summary> public void DeleteGroup() { string groupId = Request.Params["groupId"]; string userId = Request.Params["userId"]; GroupRelation groupRelation = new GroupRelation(); if (groupRelation.ExistGroupUser(groupId, userId)) {// ���û����»������û� groupRelation.MoveToStrangerGroup(groupId); } UserGroup userGroup = new UserGroup(); if (userGroup.DeleteGroup(groupId)) {// ɾ����ɹ� WriteMessage("ɾ���ɹ���"); } else { WriteMessage("0"); } }