示例#1
0
 public static byte[] GetBytes(DateTime?dtVal)
 {
     if (dtVal.HasValue)
     {
         List <byte> arrRet = new List <byte> {
             NOTNULL
         };
         arrRet.AddRange(BitConverterExtension.GetBytes((DateTime)dtVal));
         return(arrRet.ToArray());
     }
     else
     {
         List <byte> arrRet = new List <byte> {
             ISNULL
         };
         arrRet.AddRange(BitConverterExtension.GetBytes(DateTime.UtcNow));
         return(arrRet.ToArray());
     }
 }
示例#2
0
 public static byte[] GetBytes(decimal?decVal)
 {
     if (decVal.HasValue)
     {
         List <byte> arrRet = new List <byte> {
             NOTNULL
         };
         arrRet.AddRange(BitConverterExtension.GetBytes((decimal)decVal));
         return(arrRet.ToArray());
     }
     else
     {
         List <byte> arrRet = new List <byte> {
             ISNULL
         };
         arrRet.AddRange(BitConverterExtension.GetBytes((decimal)0));
         return(arrRet.ToArray());
     }
 }
示例#3
0
 public static DateTime?ToNDateTime(byte[] arrBytes, int intOffset = 0)
 {
     return(arrBytes[intOffset++] == ISNULL ? (DateTime?)null : BitConverterExtension.ToDateTime(arrBytes, intOffset));
 }
示例#4
0
 public static decimal?ToNDecimal(byte[] arrBytes, int intOffset = 0)
 {
     return(arrBytes[intOffset++] == ISNULL ? (decimal?)null : BitConverterExtension.ToDecimal(arrBytes, intOffset));
 }