private void butChange_Click(object sender, System.EventArgs e) { FormProcCodes FormP = new FormProcCodes(); FormP.IsSelectionMode = true; FormP.ShowDialog(); if (FormP.DialogResult == DialogResult.Cancel) { textADA.Text = ProcedureCodes.GetStringProcCode(AutoCodeItemCur.CodeNum); return; } if (AutoCodeItems.GetContainsKey(FormP.SelectedCodeNum) && AutoCodeItems.GetOne(FormP.SelectedCodeNum).AutoCodeNum != AutoCodeItemCur.AutoCodeNum) { //This section is a fix for an old bug that did not cause items to get deleted properly if (!AutoCodes.GetContainsKey(AutoCodeItems.GetOne(FormP.SelectedCodeNum).AutoCodeNum)) { AutoCodeItems.Delete(AutoCodeItems.GetOne(FormP.SelectedCodeNum)); textADA.Text = ProcedureCodes.GetStringProcCode(FormP.SelectedCodeNum); } else { MessageBox.Show(Lan.g(this, "That procedure code is already in use in a different Auto Code. Not allowed to use it here.")); textADA.Text = ProcedureCodes.GetStringProcCode(AutoCodeItemCur.CodeNum); } } else { textADA.Text = ProcedureCodes.GetStringProcCode(FormP.SelectedCodeNum); } }
private void butChange_Click(object sender, System.EventArgs e) { FormProcCodes FormP = new FormProcCodes(); FormP.IsSelectionMode = true; FormP.ShowDialog(); if (FormP.DialogResult == DialogResult.Cancel) { textADA.Text = AutoCodeItemCur.ADACode; } else { if (AutoCodeItems.HList.ContainsKey(FormP.SelectedADA) && (int)AutoCodeItems.HList[FormP.SelectedADA] != AutoCodeItemCur.AutoCodeNum) { //This section is a fix for an old bug that did not cause items to get deleted properly if (!AutoCodes.HList.ContainsKey((int)AutoCodeItems.HList[FormP.SelectedADA])) { AutoCodeItems.Delete((int)AutoCodeItems.HList[FormP.SelectedADA]); textADA.Text = FormP.SelectedADA; } else { MessageBox.Show(Lan.g(this, "That ADA code is already in use in a different Auto Code. Not allowed to use it here.")); textADA.Text = AutoCodeItemCur.ADACode; } } else { textADA.Text = FormP.SelectedADA; } } }
private void butDelete_Click(object sender, System.EventArgs e) { if (tbAutoItem.SelectedRow == -1) { MessageBox.Show(Lan.g(this, "Please select an item first.")); return; } AutoCodeItem AutoCodeItemCur = listForCode[tbAutoItem.SelectedRow]; AutoCodeConds.DeleteForItemNum(AutoCodeItemCur.AutoCodeItemNum); AutoCodeItems.Delete(AutoCodeItemCur); FillTable(); }
private void FormAutoCodeEdit_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (DialogResult == DialogResult.OK) { return; } if (IsNew) { for (int i = 0; i < AutoCodeItems.ListForCode.Length; i++) { AutoCodeItem AutoCodeItemCur = AutoCodeItems.ListForCode[i]; AutoCodeConds.DeleteForItemNum(AutoCodeItemCur.AutoCodeItemNum); AutoCodeItems.Delete(AutoCodeItemCur); } AutoCodes.Delete(AutoCodeCur); } }