public override object ConvertSQLToCSharp(ISessionInterface session, object a) { if (a == null) { return(null); } switch (base.TypeCode) { case 0x5b: { long seconds = ((TimestampData)a).GetSeconds(); seconds = UtlDateTime.ConvertTicksToTimeZone(session.GetTimeZone(), seconds * 0x989680L) / 0x989680L; return(new DateTime(UtlDateTime.GetNormalisedDate(seconds) * 0x989680L)); } case 0x5c: { long seconds = ((TimeData)a).GetSeconds(); seconds = UtlDateTime.ConvertTicksToTimeZone(session.GetTimeZone(), seconds * 0x989680L) / 0x989680L; return(new DateTime(UtlDateTime.GetNormalisedTime(seconds) * 0x989680L)); } case 0x5d: { TimestampData data = (TimestampData)a; long seconds = data.GetSeconds(); seconds = UtlDateTime.ConvertTicksToTimeZone(session.GetTimeZone(), seconds * 0x989680L) / 0x989680L; return(new DateTime((seconds * 0x989680L) + (data.GetNanos() / 100))); } case 0x5e: { TimeData data2 = (TimeData)a; return(new DateTime(UtlDateTime.GetNormalisedTime((long)(data2.GetSeconds() + data2.GetZone())) * 0x989680L)); } case 0x5f: { TimestampData data3 = (TimestampData)a; return(new DateTime((data3.GetSeconds() * 0x989680L) + (data3.GetNanos() / 100))); } } throw Error.RuntimeError(0xc9, "DateTimeType"); }
public object GetValue(long seconds, int nanos, int zoneSeconds) { switch (base.TypeCode) { case 0x5b: seconds = UtlDateTime.GetNormalisedDate(seconds + zoneSeconds); return(new TimestampData(seconds)); case 0x5c: seconds = UtlDateTime.GetNormalisedTime(seconds + zoneSeconds); return(new TimeData(seconds, nanos)); case 0x5d: return(new TimestampData(seconds + zoneSeconds, nanos)); case 0x5e: seconds = UtlDateTime.GetNormalisedTime(seconds); return(new TimeData((long)((int)seconds), nanos, zoneSeconds)); case 0x5f: return(new TimestampData(seconds, nanos, zoneSeconds)); } throw Error.RuntimeError(0xc9, "DateTimeType"); }
public override object ConvertCSharpToSQL(ISessionInterface session, object a) { int zoneSeconds; long normalisedTime; if (a == null) { return(null); } DateTime?nullable = a as DateTime?; if (!nullable.HasValue) { throw Error.GetError(0x15b9); } DateTime time = nullable.Value; switch (base.TypeCode) { case 0x5b: return(new TimestampData(UtlDateTime.GetNormalisedDate(UtlDateTime.ConvertTicksFromTimeZone(session.GetTimeZone(), time.Ticks) / 0x989680L))); case 0x5c: case 0x5e: zoneSeconds = 0; if (base.TypeCode != 0x5c) { normalisedTime = time.Ticks / 0x989680L; zoneSeconds = session.GetZoneSeconds(); break; } normalisedTime = UtlDateTime.ConvertTicksFromTimeZone(session.GetTimeZone(), time.Ticks) / 0x989680L; break; case 0x5d: case 0x5f: { long ticks; int zoneSeconds = 0; if (base.TypeCode != 0x5d) { ticks = time.Ticks; zoneSeconds = session.GetZoneSeconds(); } else { ticks = UtlDateTime.ConvertTicksFromTimeZone(session.GetTimeZone(), time.Ticks); } long num7 = ticks / 0x989680L; int num8 = ((int)(ticks - (num7 * 0x989680L))) * 100; return(new TimestampData(ticks / 0x989680L, DTIType.NormaliseFraction(num8, base.Scale), zoneSeconds)); } default: throw Error.GetError(0x15b9); } normalisedTime = UtlDateTime.GetNormalisedTime(normalisedTime); int fraction = (int)((time.Ticks * 100L) - (normalisedTime * 0x3b9aca00L)); return(new TimeData((long)((int)normalisedTime), DTIType.NormaliseFraction(fraction, base.Scale), zoneSeconds)); }