Exemplo n.º 1
0
        }         //end method

        /// <summary> This method takes in integer values for the year, month, day, hour, minute, seconds,
        /// and fractional seconds (going to the tenthousandths precision).
        /// The method performs validations and then sets the value in the object formatted as an
        /// HL7 time value with a precision that starts from the year and goes down to the tenthousandths
        /// of a second (YYYYMMDDHHMMSS.SSSS).
        /// The Gmt Offset will not be effected.
        /// Note: all of the precisions from tenths down to
        /// tenthousandths of a second are optional. If the precision goes below tenthousandths
        /// of a second then the second value will be rounded to the nearest tenthousandths of a second.
        /// </summary>
        public virtual void  setDateSecondPrecision(int yr, int mnth, int dy, int hr, int min, float sec)
        {
            try
            {
                //set the value of the date object to the input date value
                this.setDatePrecision(yr, mnth, dy);
                //create new time object is there isn't one
                if (tm == null)
                {
                    tm = new CommonTM();
                }
                //set the value of the time object to the second precision with the input values
                tm.setHourMinSecondPrecision(hr, min, sec);
            }
            //end try
            catch (DataTypeException e)
            {
                throw e;
            }
            //end catch
            catch (System.Exception e)
            {
                throw new DataTypeException("An unexpected exception ocurred", e);
            }     //end catch
        }         //end method
Exemplo n.º 2
0
        }         //end constructor

        /// <summary> This method takes in integer values for the year and month and day
        /// and performs validations, it then sets the value in the object
        /// formatted as an HL7 Time Stamp value with year&month&day precision (YYYYMMDD).
        ///
        /// </summary>
        public virtual void  setDatePrecision(int yr, int mnth, int dy)
        {
            try
            {
                //create date object if there isn't one
                if (dt == null)
                {
                    dt = new CommonDT();
                }
                //set the value of the date object to the input date value
                dt.setYearMonthDayPrecision(yr, mnth, dy);
                //clear the time value object
                tm = null;
            }
            //end try
            catch (DataTypeException e)
            {
                throw e;
            }
            //end catch
            catch (System.Exception e)
            {
                throw new DataTypeException("An unexpected exception ocurred", e);
            }     //end catch
        }         //end method
Exemplo n.º 3
0
        }         //end method

        /// <summary> Returns a string value representing the input Gregorian Calendar object in
        /// an Hl7 Time Format.
        /// </summary>
        public static System.String toHl7TMFormat(System.Globalization.GregorianCalendar cal)
        {
            System.String val = "";
            try
            {
                //set the input cal object so that it can report errors
                //on it's value
                //UPGRADE_ISSUE: Method 'java.util.Calendar.setLenient' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javautilCalendarsetLenient_boolean'"
                // UPGRADE_ISSUE: Commented out:cal.setLenient(false);
                //UPGRADE_TODO: Method 'java.util.Calendar.get' was converted to 'SupportClass.CalendarManager.Get' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilCalendarget_int'"
                int calHour = SupportClass.CalendarManager.manager.Get(cal, SupportClass.CalendarManager.HOUR_OF_DAY);
                //UPGRADE_TODO: Method 'java.util.Calendar.get' was converted to 'SupportClass.CalendarManager.Get' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilCalendarget_int'"
                int calMin = SupportClass.CalendarManager.manager.Get(cal, SupportClass.CalendarManager.MINUTE);
                //UPGRADE_TODO: Method 'java.util.Calendar.get' was converted to 'SupportClass.CalendarManager.Get' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilCalendarget_int'"
                int calSec = SupportClass.CalendarManager.manager.Get(cal, SupportClass.CalendarManager.SECOND);
                //UPGRADE_TODO: Method 'java.util.Calendar.get' was converted to 'SupportClass.CalendarManager.Get' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilCalendarget_int'"
                int calMilli = SupportClass.CalendarManager.manager.Get(cal, SupportClass.CalendarManager.MILLISECOND);
                //the inputs seconds and milli seconds should be combined into a float type
                float fractSec    = calMilli / 1000F;
                float calSecFloat = calSec + fractSec;
                //UPGRADE_TODO: Method 'java.util.Calendar.get' was converted to 'SupportClass.CalendarManager.Get' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilCalendarget_int'"
                //UPGRADE_ISSUE: Field 'java.util.Calendar.ZONE_OFFSET' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javautilCalendarZONE_OFFSET_f'"
                //UPGRADE_ISSUE: Field 'java.util.Calendar.DST_OFFSET' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javautilCalendarDST_OFFSET_f'"
                int calOffset = SupportClass.CalendarManager.manager.Get(cal, SupportClass.CalendarManager.ZONE_OFFSET) + SupportClass.CalendarManager.manager.Get(cal, SupportClass.CalendarManager.DST_OFFSET);
                //Note the input's Offset value is in milliseconds, we must convert it to
                //a 4 digit integer in the HL7 Offset format.
                int offSetSignInt;
                if (calOffset < 0)
                {
                    offSetSignInt = -1;
                }
                else
                {
                    offSetSignInt = 1;
                }
                //get the absolute value of the gmtOffSet
                int absGmtOffSet   = System.Math.Abs(calOffset);
                int gmtOffSetHours = absGmtOffSet / (3600 * 1000);
                int gmtOffSetMin   = (absGmtOffSet / 60000) % (60);
                //reset calOffset
                calOffset = ((gmtOffSetHours * 100) + gmtOffSetMin) * offSetSignInt;
                //Create an object of the TS class and populate it with the above values
                //then return the HL7 string value from the object
                CommonTM tm = new CommonTM();
                tm.setHourMinSecondPrecision(calHour, calMin, calSecFloat);
                tm.Offset = calOffset;
                val       = tm.Value;
            }
            // end try
            catch (DataTypeException e)
            {
                throw e;
            }
            //end catch
            catch (System.Exception e)
            {
                throw new DataTypeException("An unexpected exception ocurred", e);
            }     //end catch
            return(val);
        }         //end method
Exemplo n.º 4
0
 /// <summary> This method takes in integer values for the year, month, day, hour, minute, seconds,
 /// and fractional seconds (going to the tenthousandths precision).
 /// The method performs validations and then sets the value in the object formatted as an
 /// HL7 time value with a precision that starts from the year and goes down to the tenthousandths
 /// of a second (YYYYMMDDHHMMSS.SSSS).
 /// The Gmt Offset will not be effected.
 /// Note: all of the precisions from tenths down to
 /// tenthousandths of a second are optional. If the precision goes below tenthousandths
 /// of a second then the second value will be rounded to the nearest tenthousandths of a second.
 /// </summary>
 public virtual void setDateSecondPrecision(int yr, int mnth, int dy, int hr, int min, float sec)
 {
     try
     {
         //set the value of the date object to the input date value
         this.setDatePrecision(yr, mnth, dy);
         //create new time object is there isn't one
         if (tm == null)
         {
             tm = new CommonTM();
         }
         //set the value of the time object to the second precision with the input values
         tm.setHourMinSecondPrecision(hr, min, sec);
     }
         //end try
     catch (DataTypeException e)
     {
         throw e;
     }
         //end catch
     catch (System.Exception e)
     {
         throw new DataTypeException("An unexpected exception ocurred", e);
     } //end catch
 }
Exemplo n.º 5
0
 /// <summary> This method takes in integer values for the year and month and day
 /// and performs validations, it then sets the value in the object
 /// formatted as an HL7 Time Stamp value with year&month&day precision (YYYYMMDD).
 /// 
 /// </summary>
 public virtual void setDatePrecision(int yr, int mnth, int dy)
 {
     try
     {
         //create date object if there isn't one
         if (dt == null)
         {
             dt = new CommonDT();
         }
         //set the value of the date object to the input date value
         dt.setYearMonthDayPrecision(yr, mnth, dy);
         //clear the time value object
         tm = null;
     }
         //end try
     catch (DataTypeException e)
     {
         throw e;
     }
         //end catch
     catch (System.Exception e)
     {
         throw new DataTypeException("An unexpected exception ocurred", e);
     } //end catch
 }
Exemplo n.º 6
0
 /// <summary> Returns a string value representing the input Gregorian Calendar object in
 /// an Hl7 Time Format.
 /// </summary>
 public static System.String toHl7TMFormat(System.Globalization.GregorianCalendar cal)
 {
     System.String val = "";
     try
     {
         //set the input cal object so that it can report errors
         //on it's value
         //UPGRADE_ISSUE: Method 'java.util.Calendar.setLenient' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javautilCalendarsetLenient_boolean'"
         // UPGRADE_ISSUE: Commented out:cal.setLenient(false);
         //UPGRADE_TODO: Method 'java.util.Calendar.get' was converted to 'SupportClass.CalendarManager.Get' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilCalendarget_int'"
         int calHour = SupportClass.CalendarManager.manager.Get(cal, SupportClass.CalendarManager.HOUR_OF_DAY);
         //UPGRADE_TODO: Method 'java.util.Calendar.get' was converted to 'SupportClass.CalendarManager.Get' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilCalendarget_int'"
         int calMin = SupportClass.CalendarManager.manager.Get(cal, SupportClass.CalendarManager.MINUTE);
         //UPGRADE_TODO: Method 'java.util.Calendar.get' was converted to 'SupportClass.CalendarManager.Get' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilCalendarget_int'"
         int calSec = SupportClass.CalendarManager.manager.Get(cal, SupportClass.CalendarManager.SECOND);
         //UPGRADE_TODO: Method 'java.util.Calendar.get' was converted to 'SupportClass.CalendarManager.Get' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilCalendarget_int'"
         int calMilli = SupportClass.CalendarManager.manager.Get(cal, SupportClass.CalendarManager.MILLISECOND);
         //the inputs seconds and milli seconds should be combined into a float type
         float fractSec = calMilli / 1000F;
         float calSecFloat = calSec + fractSec;
         //UPGRADE_TODO: Method 'java.util.Calendar.get' was converted to 'SupportClass.CalendarManager.Get' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilCalendarget_int'"
         //UPGRADE_ISSUE: Field 'java.util.Calendar.ZONE_OFFSET' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javautilCalendarZONE_OFFSET_f'"
         //UPGRADE_ISSUE: Field 'java.util.Calendar.DST_OFFSET' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javautilCalendarDST_OFFSET_f'"
         int calOffset = SupportClass.CalendarManager.manager.Get(cal, SupportClass.CalendarManager.ZONE_OFFSET) + SupportClass.CalendarManager.manager.Get(cal, SupportClass.CalendarManager.DST_OFFSET);
         //Note the input's Offset value is in milliseconds, we must convert it to
         //a 4 digit integer in the HL7 Offset format.
         int offSetSignInt;
         if (calOffset < 0)
         {
             offSetSignInt = - 1;
         }
         else
         {
             offSetSignInt = 1;
         }
         //get the absolute value of the gmtOffSet
         int absGmtOffSet = System.Math.Abs(calOffset);
         int gmtOffSetHours = absGmtOffSet / (3600 * 1000);
         int gmtOffSetMin = (absGmtOffSet / 60000) % (60);
         //reset calOffset
         calOffset = ((gmtOffSetHours * 100) + gmtOffSetMin) * offSetSignInt;
         //Create an object of the TS class and populate it with the above values
         //then return the HL7 string value from the object
         CommonTM tm = new CommonTM();
         tm.setHourMinSecondPrecision(calHour, calMin, calSecFloat);
         tm.Offset = calOffset;
         val = tm.Value;
     }
         // end try
     catch (DataTypeException e)
     {
         throw e;
     }
         //end catch
     catch (System.Exception e)
     {
         throw new DataTypeException("An unexpected exception ocurred", e);
     } //end catch
     return val;
 }