public static List <TRRec> EnumPersonal(int id, DateTime start, int days, string text) { List <TRRec> ls = new List <TRRec>(); DateTime end = (new DateTime(start.Year, start.Month, start.Day)).AddDays(days); string textflt = ""; if (!string.IsNullOrEmpty(text)) { textflt = string.Format(" AND CONTAINS({0}, '{1}')", _done, text); } string where = string.Format(" WHERE [{0}] = '{1}' AND [{2}] >= '{3}' AND [{2}] <= '{4}' {5} ORDER BY {2} DESC", _perid, id, _dat, start.ToString(DBHelper.SQLDateFormat), end.ToString(DBHelper.SQLDateFormat), textflt); foreach (DataRow r in (new TRRec()).GetRecords(where)) { TRRec rec = new TRRec(); rec.Load(r); ls.Add(rec); } return(ls); }
public static List <TRRec> Enum(DateTime[] d) { List <TRRec> ls = new List <TRRec>(); if (d.Length < 1) { return(ls); } string where = ""; foreach (var date in d) { if (!string.IsNullOrEmpty(where)) { where += " OR "; } else { where = " WHERE "; } where += string.Format(" [{0}] = '{1}' ", _dat, date.ToString(DBHelper.SQLDateFormat)); } foreach (DataRow r in (new TRRec()).GetRecords(where)) { TRRec rec = new TRRec(); rec.Load(r); ls.Add(rec); } return(ls); }
public List <TRRec> getreports4Person(int personid, string start, int days, string text) { if (!CurrentContext.Valid) { return(new List <TRRec>()); } return(TRRec.EnumPersonal(personid, DateTime.ParseExact(start, defDateFormat, CultureInfo.InvariantCulture), days, text)); }
public void addrec(string date, string lastday) { DateTime d = DateTime.ParseExact(date, defDateFormat, CultureInfo.InvariantCulture); TRRec r = TRRec.GetRec(d, CurrentContext.User.ID); if (r == null) { TRRec.NewRec(d, CurrentContext.User.ID, lastday == "True"); } }
public TRRec gettrrec(string date) { if (!CurrentContext.Valid) { return(null); } DateTime d = DateTime.ParseExact(date, defDateFormat, CultureInfo.InvariantCulture); TRRec r = TRRec.GetRec(d, CurrentContext.User.ID); return(r); }
public void settrrec(TRRec rec) { CurrentContext.Validate(); try { TRRec store = new TRRec(rec.ID); store.FromAnotherObject(rec); if (store.IsModified()) { store.Store(); } } catch { } }
public List <TRRec> getreports(List <string> dates) { if (!CurrentContext.Valid || dates.Count < 1) { return(new List <TRRec>()); } List <DateTime> datetimes = new List <DateTime>(); foreach (var d in dates) { datetimes.Add(DateTime.ParseExact(d, defDateFormat, CultureInfo.InvariantCulture)); } return(TRRec.Enum(datetimes.ToArray())); }
public void todayrrec(string lastday) { if (!CurrentContext.Valid) { return; } DateTime d = DateTime.Today; TRRec r = TRRec.GetRec(d, CurrentContext.User.ID); if (r == null) { TRRec.NewRec(d, CurrentContext.User.ID, lastday == "True"); } }
public static string GetRecString() { if (!CurrentContext.Valid) { return(""); } DateTime d = DateTime.Today; TRRec r = TRRec.GetRec(d, CurrentContext.User.ID); if (r != null) { r.DONE = Uri.EscapeDataString(r.DONE); for (int i = 0; i < r.TASKSEVENTS.Count; i++) { r.TASKSEVENTS[i].DEFECT.SUMMARY = Uri.EscapeDataString(r.TASKSEVENTS[i].DEFECT.SUMMARY); } } return(JsonConvert.SerializeObject(r)); }
public List <TRStatistic> getTRStatistic(string start, string days) { return(TRRec.EnumTRStatistics(DateTime.ParseExact(start, defDateFormat, CultureInfo.InvariantCulture), Convert.ToInt32(days))); }
public void deltrrec(int id) { TRRec.DelRec(id); }