Changeset 1514 for Scheduling/trunk/cs


Ignore:
Timestamp:
Aug 9, 2012, 6:21:39 PM (12 years ago)
Author:
Sam Habiel
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/CGDocument.cs

    r1174 r1514  
    961961            string sLen = sp.TotalMinutes.ToString();
    962962            string sPatID = rApptInfo.PatientID.ToString();
    963             string sNote = rApptInfo.Note;
     963            string sNote = stripC30C31(rApptInfo.Note);
    964964            string sResource = rApptInfo.Resource;
    965965
     
    10041004        }
    10051005
     1006        /// <summary>
     1007        /// Replaces ascii 30 and 31 as they are used as delimiters. Funny users can crash the program.
     1008        /// </summary>
     1009        /// <param name="s">Input String</param>
     1010        /// <returns>Output Stripped String</returns>
     1011        public string stripC30C31(string s)
     1012        {
     1013            if (s != null && s.Length > 0)
     1014            {
     1015                System.Text.StringBuilder sb = new System.Text.StringBuilder(s.Length);
     1016                foreach (char c in s)
     1017                {
     1018                    sb.Append(((c==30)||(c==31)) ? ' ' : c);
     1019                }
     1020                s = sb.ToString();
     1021            }
     1022
     1023            return s;
     1024        }
     1025
    10061026        public void EditAppointment(CGAppointment pAppt, string sNote)
    10071027        {
     
    10091029            {
    10101030                int nApptID = pAppt.AppointmentKey;
    1011                 string sSql = "BSDX EDIT APPOINTMENT^" + nApptID.ToString() + "^" + sNote;
     1031                string sSql = "BSDX EDIT APPOINTMENT^" + nApptID.ToString() + "^" + stripC30C31(sNote);
    10121032
    10131033                System.Data.DataTable dtAppt = m_DocManager.RPMSDataTable(sSql, "EditAppointment");
Note: See TracChangeset for help on using the changeset viewer.