public static HDateTimeRange lastYear(HTimeZone tz) { var firstOfYear = new DateTime(DateTime.Today.Year, 1, 1).AddYears(-1); return(M.Map(new HaystackDateTimeRange( new HaystackDateTime(firstOfYear, M.Map(tz)), new HaystackDateTime(firstOfYear.AddYears(1), M.Map(tz))))); }
public static HVal decode(string type, string val) { if ("Bin".CompareTo(type) == 0) { return(HBin.make(val)); } return(M.Map(new HaystackXString(val, type))); }
public static HDateTimeRange lastWeek(HTimeZone tz) { var firstOfWeek = DateTime.Today.AddDays(DayOfWeek.Sunday - DateTime.Today.DayOfWeek).AddDays(-7); return(M.Map(new HaystackDateTimeRange( new HaystackDateTime(firstOfWeek, M.Map(tz)), new HaystackDateTime(firstOfWeek.AddDays(7), M.Map(tz))))); }
public static HDateTimeRange lastMonth(HTimeZone tz) { var firstOfMonth = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1).AddMonths(-1); return(M.Map(new HaystackDateTimeRange( new HaystackDateTime(firstOfMonth, M.Map(tz)), new HaystackDateTime(firstOfMonth.AddMonths(1), M.Map(tz))))); }
public bool CompareItems(List <HVal> items) { if (items.Count != Source.Count) { return(false); } bool bRet = true; for (int i = 0; i < items.Count; i++) { if (!items[i].hequals(M.Map(Source[i]))) { bRet = false; } } return(bRet); }
public HDateTime midnight(HTimeZone tz) => M.Map(new HaystackDateTime(Source.Value, M.Map(tz)));
public HCol(int iIndex, string name, HDict meta) { Source = new HaystackColumn(iIndex, name, M.Map(meta)); }
public static HCoord make(string s) => M.Map(ZincReader.ReadValue <HaystackCoordinate>(s));
public override string toJson() => HaysonWriter.ToHayson(M.Map(this));
public static HTimeZone make(TimeZoneInfo dntzi, bool bChecked) => M.Checked(() => M.Map(new HaystackTimeZone(dntzi)), bChecked);
public override void Add(string key, HVal value) => Source.Add(key, M.Map(value));
public static HDef make(string val) => M.Map(ZincReader.ReadValue <HaystackDefinition>(val));
public static HXStr encode(object val) { return(M.Map(new HaystackXString(nameof(val), val.ToString()))); }
public static HDate today() => M.Map(new HaystackDate(DateTime.Today));
public static HDate make(DateTime dt) => M.Map(new HaystackDate(dt));
public static HDate make(int year, int month, int day) => M.Map(new HaystackDate(year, month, day));
public static HTime make(string s) => M.Map(ZincReader.ReadValue <HaystackTime>(s));
public static HTime make(DateTime dt) => M.Map(new HaystackTime(dt.TimeOfDay));
public HDict(IDictionary <string, HVal> map) { Source = new HaystackDictionary(map.ToDictionary(kv => kv.Key, kv => M.Map(kv.Value))); }
public static HRef make(string val) => M.Map(new HaystackReference(val));
public HDict ToDict() => M.Map(Source);
internal HGrid(HDict meta, List <HCol> cols, List <List <HVal> > rowLists) { Source = new HaystackGrid(cols.Select(M.Map).ToList(), rowLists.Select(l => l.Select(M.Map).ToArray()).ToList(), M.Map(meta)); }
public static HTimeZone make(string name, bool bChecked) => M.Checked(() => M.Map(new HaystackTimeZone(name)), bChecked);
public HRow row(int row) => M.Map(Source.Row(row));
public override string toZinc() => ZincWriter.ToZinc(M.Map(this));
public HCol col(int index) => M.Map(Source.Column(index));
public static HUri make(string val) => M.Map(new HaystackUri(val));
public HCol col(string name) => M.Map(Source.Column(name));
public static HCoord make(double dblLat, double dblLng) => M.Map(new HaystackCoordinate((decimal)dblLat, (decimal)dblLng));
public HCol col(string name, bool bchecked) => M.Checked(() => M.Map(Source.Column(name)), bchecked);