예제 #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));
 }