CreateAppointment and EditAppointment now call stripC30C31 to remove ascii 30 and ascii 31 from the note. Windows Input allows users to enter either of these from the Unicode menu, causing the program to crash when it tries to parse the note as the 30 and 31 are used as the delimiters for the data coming from Mumps.

Fixes bug EHS#0000282.
This commit is contained in:
sam 2012-08-09 22:21:39 +00:00
parent 944999a279
commit d821206743
1 changed files with 22 additions and 2 deletions

View File

@ -960,7 +960,7 @@ namespace IndianHealthService.ClinicalScheduling
TimeSpan sp = rApptInfo.EndTime - rApptInfo.StartTime;
string sLen = sp.TotalMinutes.ToString();
string sPatID = rApptInfo.PatientID.ToString();
string sNote = rApptInfo.Note;
string sNote = stripC30C31(rApptInfo.Note);
string sResource = rApptInfo.Resource;
string sApptID;
@ -1003,12 +1003,32 @@ namespace IndianHealthService.ClinicalScheduling
return nApptID;
}
/// <summary>
/// Replaces ascii 30 and 31 as they are used as delimiters. Funny users can crash the program.
/// </summary>
/// <param name="s">Input String</param>
/// <returns>Output Stripped String</returns>
public string stripC30C31(string s)
{
if (s != null && s.Length > 0)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder(s.Length);
foreach (char c in s)
{
sb.Append(((c==30)||(c==31)) ? ' ' : c);
}
s = sb.ToString();
}
return s;
}
public void EditAppointment(CGAppointment pAppt, string sNote)
{
try
{
int nApptID = pAppt.AppointmentKey;
string sSql = "BSDX EDIT APPOINTMENT^" + nApptID.ToString() + "^" + sNote;
string sSql = "BSDX EDIT APPOINTMENT^" + nApptID.ToString() + "^" + stripC30C31(sNote);
System.Data.DataTable dtAppt = m_DocManager.RPMSDataTable(sSql, "EditAppointment");