Example #1
0
        }         //end constructor

        /// <summary> This method takes in integer values for the hour and minute and performs validations,
        /// it then sets the value field formatted as an HL7 time value
        /// with hour&minute precision (HHMM).
        /// </summary>
        public virtual void  setHourMinutePrecision(int hr, int min)
        {
            try
            {
                this.HourPrecision = hr;
                //validate input minute value
                if ((min < 0) || (min > 59))
                {
                    System.String     msg = "The minute value of the TM datatype must be >=0 and <=59";
                    DataTypeException e   = new DataTypeException(msg);
                    throw e;
                }                 //end if
                minute        = min;
                second        = 0;
                fractionOfSec = 0;
                offSet        = 0;
                //Here the offset is not defined, we should omit showing it in the
                //return value from the getValue() method
                omitOffsetFg  = 'y';
                value_Renamed = value_Renamed + DataTypeUtil.preAppendZeroes(min, 2);
            }
            //end try
            catch (DataTypeException e)
            {
                throw e;
            }
            //end catch
            catch (System.Exception e)
            {
                //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                throw new DataTypeException(e.Message);
            }     //end catch
        }         //end method
Example #2
0
        }         //end method

        /// <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 date value with year&month&day precision (YYYYMMDD).
        /// </summary>
        public virtual void  setYearMonthDayPrecision(int yr, int mnth, int dy)
        {
            try
            {
                System.Globalization.GregorianCalendar cal = new System.Globalization.GregorianCalendar();
                SupportClass.CalendarManager.manager.Clear(cal);
                //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);

                //ensure that the year field is four digits long
                if (System.Convert.ToString(yr).Length != 4)
                {
                    System.String     msg = "The input year value must be four digits long";
                    DataTypeException e   = new DataTypeException(msg);
                    throw e;
                }
                //validate the input month/day combination
                SupportClass.CalendarManager.manager.Set(cal, yr, (mnth - 1), dy);
                SupportClass.CalendarManager.manager.GetDateTime(cal);                 //for error detection
                year          = yr;
                month         = mnth;
                day           = dy;
                value_Renamed = System.Convert.ToString(yr) + DataTypeUtil.preAppendZeroes(mnth, 2) + DataTypeUtil.preAppendZeroes(dy, 2);
            }
            catch (DataTypeException e)
            {
                throw e;
            }
            //end catch
            catch (System.Exception e)
            {
                throw new DataTypeException("An unexpected exception ocurred", e);
            }     //end catch
        }         //end method
Example #3
0
        }         //end method

        /// <summary> This method takes in integer values for the hour, minute, seconds, and fractional seconds
        /// (going to the tenthousandths precision).
        /// The method performs validations and then sets the value field formatted as an
        /// HL7 time value with a precision that starts from the hour and goes down to the tenthousandths
        /// of a second (HHMMSS.SSSS).
        /// 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  setHourMinSecondPrecision(int hr, int min, float sec)
        {
            try
            {
                this.setHourMinutePrecision(hr, min);
                //multiply the seconds input value by 10000 and round the result
                //then divide the number by tenthousand and store it back.
                //This will round the fractional seconds to the nearest tenthousandths
                //UPGRADE_TODO: Method 'java.lang.Math.round' was converted to 'System.Math.Round' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javalangMathround_float'"
                int secMultRound = (int)System.Math.Round((double)(10000F * sec));
                sec = secMultRound / 10000F;
                //Now store the second and fractional component
                //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
                second = (int)System.Math.Floor(sec);
                //validate input seconds value
                if ((second < 0) || (second >= 60))
                {
                    System.String     msg = "The (rounded) second value of the TM datatype must be >=0 and <60";
                    DataTypeException e   = new DataTypeException(msg);
                    throw e;
                }                 //end if
                int fractionOfSecInt = (int)(secMultRound - (second * 10000));
                fractionOfSec = fractionOfSecInt / 10000F;
                System.String fractString = "";
                //Now convert the fractionOfSec field to a string without the leading zero
                if (fractionOfSec != 0.0F)
                {
                    fractString = (fractionOfSec.ToString()).Substring(1);
                }                 //end if
                //Now update the value field
                offSet = 0;
                //Here the offset is not defined, we should omit showing it in the
                //return value from the getValue() method
                omitOffsetFg  = 'y';
                value_Renamed = value_Renamed + DataTypeUtil.preAppendZeroes(second, 2) + fractString;
            }
            //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
Example #4
0
 /// <summary> This method takes in integer values for the year and month and performs validations,
 /// it then sets the value field formatted as an HL7 date
 /// value with year&month precision (YYYYMM).
 /// Note: The first month = 1 = January.
 /// </summary>
 public virtual void setYearMonthPrecision(int yr, int mnth)
 {
     try
     {
         System.Globalization.GregorianCalendar cal = new System.Globalization.GregorianCalendar();
         SupportClass.CalendarManager.manager.Clear(cal);
         //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);
         //ensure that the year field is four digits long
         if (System.Convert.ToString(yr).Length != 4)
         {
             System.String msg = "The input year value must be four digits long";
             DataTypeException e = new DataTypeException(msg);
             throw e;
         }
         //validate the input month
         //GregorianCalendar cal = new GregorianCalendar(yr,(mnth-1),1);
         SupportClass.CalendarManager.manager.Set(cal, yr, (mnth - 1), 1);
         SupportClass.CalendarManager.manager.GetDateTime(cal); //for error detection
         year = yr;
         month = mnth;
         day = 0;
         value_Renamed = System.Convert.ToString(yr) + DataTypeUtil.preAppendZeroes(mnth, 2);
     }
     catch (DataTypeException e)
     {
         throw e;
     }
         //end catch
     catch (System.Exception e)
     {
         throw new DataTypeException("An unexpected exception ocurred", e);
     } //end catch
 }
Example #5
0
 /// <summary> This method takes in integer values for the hour and minute and performs validations,
 /// it then sets the value field formatted as an HL7 time value
 /// with hour&minute precision (HHMM).
 /// </summary>
 public virtual void setHourMinutePrecision(int hr, int min)
 {
     try
     {
         this.HourPrecision = hr;
         //validate input minute value
         if ((min < 0) || (min > 59))
         {
             System.String msg = "The minute value of the TM datatype must be >=0 and <=59";
             DataTypeException e = new DataTypeException(msg);
             throw e;
         } //end if
         minute = min;
         second = 0;
         fractionOfSec = 0;
         offSet = 0;
         //Here the offset is not defined, we should omit showing it in the
         //return value from the getValue() method
         omitOffsetFg = 'y';
         value_Renamed = value_Renamed + DataTypeUtil.preAppendZeroes(min, 2);
     }
         //end try
     catch (DataTypeException e)
     {
         throw e;
     }
         //end catch
     catch (System.Exception e)
     {
         //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
         throw new DataTypeException(e.Message);
     } //end catch
 }
Example #6
0
 /// <summary> This method takes in integer values for the hour, minute, seconds, and fractional seconds
 /// (going to the tenthousandths precision).
 /// The method performs validations and then sets the value field formatted as an
 /// HL7 time value with a precision that starts from the hour and goes down to the tenthousandths
 /// of a second (HHMMSS.SSSS).
 /// 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 setHourMinSecondPrecision(int hr, int min, float sec)
 {
     try
     {
         this.setHourMinutePrecision(hr, min);
         //multiply the seconds input value by 10000 and round the result
         //then divide the number by tenthousand and store it back.
         //This will round the fractional seconds to the nearest tenthousandths
         //UPGRADE_TODO: Method 'java.lang.Math.round' was converted to 'System.Math.Round' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javalangMathround_float'"
         int secMultRound = (int) System.Math.Round((double) (10000F * sec));
         sec = secMultRound / 10000F;
         //Now store the second and fractional component
         //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
         second = (int) System.Math.Floor(sec);
         //validate input seconds value
         if ((second < 0) || (second >= 60))
         {
             System.String msg = "The (rounded) second value of the TM datatype must be >=0 and <60";
             DataTypeException e = new DataTypeException(msg);
             throw e;
         } //end if
         int fractionOfSecInt = (int) (secMultRound - (second * 10000));
         fractionOfSec = fractionOfSecInt / 10000F;
         System.String fractString = "";
         //Now convert the fractionOfSec field to a string without the leading zero
         if (fractionOfSec != 0.0F)
         {
             fractString = (fractionOfSec.ToString()).Substring(1);
         } //end if
         //Now update the value field
         offSet = 0;
         //Here the offset is not defined, we should omit showing it in the
         //return value from the getValue() method
         omitOffsetFg = 'y';
         value_Renamed = value_Renamed + DataTypeUtil.preAppendZeroes(second, 2) + fractString;
     }
         //end try
     catch (DataTypeException e)
     {
         throw e;
     }
         //end catch
     catch (System.Exception e)
     {
         throw new DataTypeException("An unexpected exception ocurred", e);
     } //end catch
 }