private void butOK_Click(object sender, EventArgs e) { DateTime date; try { date = DateTime.Parse(textDate.Text); } catch { MsgBox.Show(this, "Date invalid"); return; } if (_snomedGoal == null) { MsgBox.Show(this, "Missing SNOMED CT goal"); return; } _ehrCarePlan.DatePlanned = date; _ehrCarePlan.SnomedEducation = _snomedGoal.SnomedCode; _ehrCarePlan.Instructions = textInstructions.Text; if (_ehrCarePlan.IsNew) { EhrCarePlans.Insert(_ehrCarePlan); } else { EhrCarePlans.Update(_ehrCarePlan); } DialogResult = DialogResult.OK; }
private void FillCarePlans() { gridCarePlans.BeginUpdate(); gridCarePlans.Columns.Clear(); int colDatePixCount = 66; int variablePixCount = gridCarePlans.Width - 10 - colDatePixCount; int colGoalPixCount = variablePixCount / 2; int colInstructionsPixCount = variablePixCount - colGoalPixCount; gridCarePlans.Columns.Add(new UI.ODGridColumn("Date", colDatePixCount)); gridCarePlans.Columns.Add(new UI.ODGridColumn("Goal", colGoalPixCount)); gridCarePlans.Columns.Add(new UI.ODGridColumn("Instructions", colInstructionsPixCount)); gridCarePlans.EndUpdate(); gridCarePlans.BeginUpdate(); gridCarePlans.Rows.Clear(); _listCarePlans = EhrCarePlans.Refresh(_patCur.PatNum); for (int i = 0; i < _listCarePlans.Count; i++) { UI.ODGridRow row = new UI.ODGridRow(); row.Cells.Add(_listCarePlans[i].DatePlanned.ToShortDateString()); //Date Snomed snomedEducation = Snomeds.GetByCode(_listCarePlans[i].SnomedEducation); if (snomedEducation == null) { row.Cells.Add(""); //We allow blank or "NullFlavor" SNOMEDCT codes when exporting CCDAs, so we allow them to be blank when displaying here as well. } else { row.Cells.Add(snomedEducation.Description); //GoalDescript } row.Cells.Add(_listCarePlans[i].Instructions); //Instructions gridCarePlans.Rows.Add(row); } gridCarePlans.EndUpdate(); }
private void butDelete_Click(object sender, EventArgs e) { if (_ehrCarePlan.IsNew) { DialogResult = DialogResult.Cancel; return; } EhrCarePlans.Delete(_ehrCarePlan.EhrCarePlanNum); DialogResult = DialogResult.OK; }