private void btnCodesEdit_Click(object sender, EventArgs e) { try { if (listCodes.SelectedItems.Count > 0) { var selectedRow = _views.MainForm.datasetBilling.ICDCodes.FindByID((int)listCodes.SelectedItems[0].Tag); AddNewICD9Item newGroupDialog = new AddNewICD9Item(selectedRow.ICD9Code, selectedRow.Description, selectedRow.RegExp, selectedRow.OneWay, selectedRow.Combination, "Edit"); var dialogResult = newGroupDialog.ShowDialog(); if (dialogResult == System.Windows.Forms.DialogResult.OK) { //Change that name var newIcd = newGroupDialog.icd; var newDescription = newGroupDialog.description; var regExp = newGroupDialog.regExp; var oneWay = newGroupDialog.oneWay; var combination = newGroupDialog.combination; if (!String.IsNullOrEmpty(newIcd) && !String.IsNullOrEmpty(newDescription)) { //Change value in listView listCodes.SelectedItems[0].SubItems[0].Text = newIcd; listCodes.SelectedItems[0].SubItems[1].Text = newDescription; var regExpString = regExp ? "Yes" : ""; listCodes.SelectedItems[0].SubItems[2].Text = regExpString; var oneWayString = oneWay ? "Yes" : ""; listCodes.SelectedItems[0].SubItems[3].Text = oneWayString; var id = selectedRow.ID; selectedRow.ICD9Code = newIcd; selectedRow.Description = newDescription; selectedRow.RegExp = regExp; selectedRow.OneWay = oneWay; selectedRow.Combination = combination; _views.MainForm.adapterICDCodesBilling.Update(_views.MainForm.datasetBilling.ICDCodes); _views.MainForm.adapterICDCodesBilling.Fill(_views.MainForm.datasetBilling.ICDCodes); FillCodesList(id); } } } } catch (Exception ex) { MainForm.ShowExceptionMessage(ex); } }
private void btnCodesAdd_Click(object sender, EventArgs e) { try { if (_lastSelectedGroupID > 0) { //Popup dialog for new Group AddNewICD9Item newGroupDialog = new AddNewICD9Item("", "", false, false, false); var dialogResult = newGroupDialog.ShowDialog(); if (dialogResult == System.Windows.Forms.DialogResult.OK) { //Change that name var icd = newGroupDialog.icd; var description = newGroupDialog.description; var regExp = newGroupDialog.regExp; var oneWay = newGroupDialog.oneWay; var combination = newGroupDialog.combination; if (!String.IsNullOrEmpty(icd)) { var newCode = _views.MainForm.datasetBilling.ICDCodes.NewICDCodesRow(); newCode.ICD9Code = icd; newCode.Description = description; newCode.RegExp = regExp; newCode.GroupID = _lastSelectedGroupID; newCode.OneWay = oneWay; newCode.Combination = combination; _views.MainForm.datasetBilling.ICDCodes.Rows.Add(newCode); _views.MainForm.adapterICDCodesBilling.Update(_views.MainForm.datasetBilling.ICDCodes); var id = MainForm.GetLastInsertedID(_views.MainForm.adapterICDCodesBilling.Connection); _views.MainForm.adapterICDCodesBilling.Fill(_views.MainForm.datasetBilling.ICDCodes); FillCodesList(id); } } } } catch (Exception ex) { MainForm.ShowExceptionMessage(ex); } }