private void DeleteGroupType() { var selectedGroupType = m_listGroupTypes.SelectedElement; if (selectedGroupType != null) { int id = selectedGroupType.GroupTypeID; m_listGroupTypes.DeleteSelected(); if (id > -1) { var deleteRow = m_groupTypesTable.Where(row => row.RowState != DataRowState.Deleted && row.group_type_id == id).First(); deleteRow.Delete(); } } }
private void button1_Click(object sender, EventArgs e) { short groupTypeId = groupTypesDataTable.Where(row => row.group_type_name == (string)comboBoxParting.SelectedItem). First().group_type_id; if (listBoxGroups.SelectedIndex < 0) { FormEditPlan formPlan = new FormEditPlan(college, groupTypeId); formPlan.ShowDialog(); return; } int index = groupsIndices[listBoxGroups.SelectedIndex]; var group = groupDataTable.FindBygroup_id(index); FormEditPlan planEditor = new FormEditPlan(college, groupTypeId); planEditor.GroupSelector.GroupInfo = group; planEditor.ShowDialog(); }