Esempio n. 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());
     }
 }
Esempio n. 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());
     }
 }
Esempio n. 3
0
 public static DateTime?ToNDateTime(byte[] arrBytes, int intOffset = 0)
 {
     return(arrBytes[intOffset++] == ISNULL ? (DateTime?)null : BitConverterExtension.ToDateTime(arrBytes, intOffset));
 }
Esempio n. 4
0
 public static decimal?ToNDecimal(byte[] arrBytes, int intOffset = 0)
 {
     return(arrBytes[intOffset++] == ISNULL ? (decimal?)null : BitConverterExtension.ToDecimal(arrBytes, intOffset));
 }