Exemplo n.º 1
0
        public static TdrError.ErrorType tdrDate2Str(ref TdrVisualBuf buf, UInt32 date)
        {
            TdrError.ErrorType ret     = TdrError.ErrorType.TDR_NO_ERROR;
            TdrDate            tdrDate = new TdrDate();

            ret = tdrDate.parse(date);
            if (TdrError.ErrorType.TDR_NO_ERROR == ret)
            {
                ret = buf.sprintf("{0:d4}-{1:d2}-{2:d2}", tdrDate.nYear, tdrDate.bMon, tdrDate.bDay);
            }
            else
            {
#if (DEBUG)
                StackTrace st = new StackTrace(true);
                for (int i = 0; i < st.FrameCount; i++)
                {
                    if (null != st.GetFrame(i).GetFileName())
                    {
                        Console.WriteLine(st.GetFrame(i).ToString());
                    }
                }
#endif
                ret = TdrError.ErrorType.TDR_ERR_INVALID_TDRDATE_VALUE;
            }

            return(ret);
        }
Exemplo n.º 2
0
        public static TdrError.ErrorType str2TdrDate(out UInt32 date, string strDate)
        {
            TdrError.ErrorType ret = TdrError.ErrorType.TDR_NO_ERROR;
            DateTime           dt;
            TdrDate            tdrDate = new TdrDate();

            if (DateTime.TryParse(strDate, out dt))
            {
                tdrDate.nYear = (short)dt.Year;
                tdrDate.bMon  = (byte)dt.Month;
                tdrDate.bDay  = (byte)dt.Day;

                tdrDate.toDate(out date);
            }
            else
            {
#if (DEBUG)
                StackTrace st = new StackTrace(true);
                for (int i = 0; i < st.FrameCount; i++)
                {
                    if (null != st.GetFrame(i).GetFileName())
                    {
                        Console.WriteLine(st.GetFrame(i).ToString());
                    }
                }
#endif
                date = 0;
                ret  = TdrError.ErrorType.TDR_ERR_INVALID_TDRDATE_VALUE;
            }

            return(ret);
        }
Exemplo n.º 3
0
 public TdrDateTime(ulong datetime)
 {
     tdrDate = new TdrDate((uint)(datetime & 0xFFFFFFFF));
     tdrTime = new TdrTime((uint)((datetime >> 32) & 0xFFFFFFFF));
 }
Exemplo n.º 4
0
 public TdrDateTime()
 {
     tdrDate = new TdrDate();
     tdrTime = new TdrTime();
 }