Пример #1
0
        public static TdrError.ErrorType str2TdrDate(out uint date, string strDate)
        {
            DateTime time;

            TdrError.ErrorType type  = TdrError.ErrorType.TDR_NO_ERROR;
            TdrDate            date2 = new TdrDate();

            if (DateTime.TryParse(strDate, out time))
            {
                date2.nYear = (short)time.Year;
                date2.bMon  = (byte)time.Month;
                date2.bDay  = (byte)time.Day;
                date2.toDate(out date);
                return(type);
            }
            date = 0;
            return(TdrError.ErrorType.TDR_ERR_INVALID_TDRDATE_VALUE);
        }
Пример #2
0
        public static TdrError.ErrorType str2TdrDate(out uint date, string strDate)
        {
            TdrError.ErrorType result  = TdrError.ErrorType.TDR_NO_ERROR;
            TdrDate            tdrDate = new TdrDate();
            DateTime           dateTime;

            if (DateTime.TryParse(strDate, ref dateTime))
            {
                tdrDate.nYear = (short)dateTime.get_Year();
                tdrDate.bMon  = (byte)dateTime.get_Month();
                tdrDate.bDay  = (byte)dateTime.get_Day();
                tdrDate.toDate(out date);
            }
            else
            {
                date   = 0u;
                result = TdrError.ErrorType.TDR_ERR_INVALID_TDRDATE_VALUE;
            }
            return(result);
        }