private void btnGroupEdit_Click(object sender, EventArgs e) { try { //Popup dialog to edit the Name //Open edit dialog if (listGroups.SelectedItems.Count > 0) { var name = listGroups.SelectedItems[0].Text; AddNewGroup newGroupDialog = new AddNewGroup(name, "Edit"); var dialogResult = newGroupDialog.ShowDialog(); if (dialogResult == System.Windows.Forms.DialogResult.OK) { //Change that name var newName = newGroupDialog.GroupName; if (!String.IsNullOrEmpty(newName)) { var newFilter = _views.MainForm.datasetBilling.ICD9Groups.FindByGroupID((int)listGroups.SelectedItems[0].Tag); newFilter.Name = newName; _views.MainForm.adapterICD9GroupsBilling.Update(_views.MainForm.datasetBilling.ICD9Groups); _views.MainForm.adapterICD9GroupsBilling.Fill(_views.MainForm.datasetBilling.ICD9Groups); FillGroupsList(); } } } } catch (Exception ex) { MainForm.ShowExceptionMessage(ex); } }
private void btnGroupAdd_Click(object sender, EventArgs e) { try { //Popup dialog for new Group AddNewGroup newGroupDialog = new AddNewGroup(""); var dialogResult = newGroupDialog.ShowDialog(); if (dialogResult == System.Windows.Forms.DialogResult.OK) { //Change that name var newName = newGroupDialog.GroupName; if (!String.IsNullOrEmpty(newName)) { var newGroup = _views.MainForm.datasetBilling.ICD9Groups.NewICD9GroupsRow(); newGroup.Name = newName; _views.MainForm.datasetBilling.ICD9Groups.Rows.Add(newGroup); _views.MainForm.adapterICD9GroupsBilling.Update(_views.MainForm.datasetBilling.ICD9Groups); _views.MainForm.adapterICD9GroupsBilling.Fill(_views.MainForm.datasetBilling.ICD9Groups); FillGroupsList(); } } } catch (Exception ex) { MainForm.ShowExceptionMessage(ex); } }