Exemple #1
0
        public static TdrError.ErrorType str2TdrTime(out uint time, string strTime)
        {
            DateTime time2;

            TdrError.ErrorType type  = TdrError.ErrorType.TDR_NO_ERROR;
            TdrTime            time3 = new TdrTime();

            if (DateTime.TryParse(strTime, out time2))
            {
                time3.nHour = (short)time2.TimeOfDay.Hours;
                time3.bMin  = (byte)time2.TimeOfDay.Minutes;
                time3.bSec  = (byte)time2.TimeOfDay.Seconds;
                time3.toTime(out time);
                return(type);
            }
            time = 0;
            return(TdrError.ErrorType.TDR_ERR_INVALID_TDRTIME_VALUE);
        }
Exemple #2
0
        public static TdrError.ErrorType str2TdrTime(out uint time, string strTime)
        {
            TdrError.ErrorType result  = TdrError.ErrorType.TDR_NO_ERROR;
            TdrTime            tdrTime = new TdrTime();
            DateTime           dateTime;

            if (DateTime.TryParse(strTime, ref dateTime))
            {
                tdrTime.nHour = (short)dateTime.get_TimeOfDay().get_Hours();
                tdrTime.bMin  = (byte)dateTime.get_TimeOfDay().get_Minutes();
                tdrTime.bSec  = (byte)dateTime.get_TimeOfDay().get_Seconds();
                tdrTime.toTime(out time);
            }
            else
            {
                time   = 0u;
                result = TdrError.ErrorType.TDR_ERR_INVALID_TDRTIME_VALUE;
            }
            return(result);
        }