private void FillTable() { int count = 0; AutoCodeItems.Refresh(); AutoCodeConds.Refresh(); AutoCodeItems.GetListForCode(AutoCodeCur.AutoCodeNum); tbAutoItem.ResetRows(AutoCodeItems.ListForCode.Length); tbAutoItem.SetGridColor(Color.Gray); tbAutoItem.SetBackGColor(Color.White); for (int i = 0; i < AutoCodeItems.ListForCode.Length; i++) { tbAutoItem.Cell[0, i] = ProcedureCodes.GetProcCode(AutoCodeItems.ListForCode[i].CodeNum).ProcCode; tbAutoItem.Cell[1, i] = ProcedureCodes.GetProcCode(AutoCodeItems.ListForCode[i].CodeNum).Descript; count = 0; for (int j = 0; j < AutoCodeConds.List.Length; j++) { if (AutoCodeConds.List[j].AutoCodeItemNum == AutoCodeItems.ListForCode[i].AutoCodeItemNum) { if (count != 0) { tbAutoItem.Cell[2, i] += ", "; } tbAutoItem.Cell[2, i] += AutoCodeConds.List[j].Cond.ToString(); count++; } } } tbAutoItem.LayoutTables(); }
private void FillTable() { int count = 0; AutoCodeItems.RefreshCache(); AutoCodeConds.RefreshCache(); _listAutoCodeConds = AutoCodeConds.GetDeepCopy(); listForCode = AutoCodeItems.GetListForCode(AutoCodeCur.AutoCodeNum); tbAutoItem.ResetRows(listForCode.Count); tbAutoItem.SetGridColor(Color.Gray); tbAutoItem.SetBackGColor(Color.White); for (int i = 0; i < listForCode.Count; i++) { tbAutoItem.Cell[0, i] = ProcedureCodes.GetProcCode(listForCode[i].CodeNum).ProcCode; tbAutoItem.Cell[1, i] = ProcedureCodes.GetProcCode(listForCode[i].CodeNum).Descript; count = 0; for (int j = 0; j < _listAutoCodeConds.Count; j++) { if (_listAutoCodeConds[j].AutoCodeItemNum == listForCode[i].AutoCodeItemNum) { if (count != 0) { tbAutoItem.Cell[2, i] += ", "; } tbAutoItem.Cell[2, i] += _listAutoCodeConds[j].Cond.ToString(); count++; } } } tbAutoItem.LayoutTables(); }
private void butOK_Click(object sender, System.EventArgs e) { if (textDescript.Text == "") { MessageBox.Show(Lan.g(this, "You must type in a description.")); return; } if (listADA.Items.Count == 0 && listAutoCodes.SelectedIndices.Count == 0) { MessageBox.Show(Lan.g(this, "You must pick at least one Auto Code or Procedure Code.")); return; } foreach (int index in listAutoCodes.SelectedIndices) { AutoCode autoCode = _listShortDeep[index]; if (AutoCodeItems.GetListForCode(autoCode.AutoCodeNum).Count == 0) { //This AutoCode was saved with no AutoCodeItems attached, which is invalid. MessageBox.Show(this, Lan.g(this, "The following AutoCode has no associated Procedure Codes: ") + "\r\n" + autoCode.Description + "\r\n" + Lan.g(this, "AutoCode must be setup correctly before it can be used with a Quick Proc Button.")); return; } } //Point of no return. ProcButtonCur.Description = textDescript.Text; if (ProcButtonCur.Category != _listProcButtonCatDefs[comboCategory.SelectedIndex].DefNum) { //This will put it at the end of the order in the new category ProcButtonCur.ItemOrder = ProcButtons.GetForCat(_listProcButtonCatDefs[comboCategory.SelectedIndex].DefNum).Length; } ProcButtonCur.Category = _listProcButtonCatDefs[comboCategory.SelectedIndex].DefNum; ProcButtonCur.ButtonImage = POut.Bitmap((Bitmap)pictureBox.Image, System.Drawing.Imaging.ImageFormat.Png); ProcButtonCur.IsMultiVisit = checkMultiVisit.Checked; if (IsNew) { ProcButtonCur.ItemOrder = ProcButtons.GetCount(); ProcButtons.Insert(ProcButtonCur); } else { ProcButtons.Update(ProcButtonCur); } ProcButtonItems.DeleteAllForButton(ProcButtonCur.ProcButtonNum); ProcButtonItem item; for (int i = 0; i < listADA.Items.Count; i++) { item = new ProcButtonItem(); item.ProcButtonNum = ProcButtonCur.ProcButtonNum; item.CodeNum = ProcedureCodes.GetCodeNum(listADA.Items[i].ToString()); item.ItemOrder = i + 1; //not i++, that would mess up the itteration. ProcButtonItems.Insert(item); } for (int i = 0; i < listAutoCodes.SelectedIndices.Count; i++) { item = new ProcButtonItem(); item.ProcButtonNum = ProcButtonCur.ProcButtonNum; item.AutoCodeNum = _listShortDeep[listAutoCodes.SelectedIndices[i]].AutoCodeNum; item.ItemOrder = i + 1; //not i++, that would mess up the itteration. ProcButtonItems.Insert(item); } DialogResult = DialogResult.OK; }