Ejemplo n.º 1
0
    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);
    }
Ejemplo n.º 2
0
    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);
    }
Ejemplo n.º 3
0
 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));
 }
Ejemplo n.º 4
0
    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");
        }
    }
Ejemplo n.º 5
0
    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);
    }
Ejemplo n.º 6
0
 public void settrrec(TRRec rec)
 {
     CurrentContext.Validate();
     try
     {
         TRRec store = new TRRec(rec.ID);
         store.FromAnotherObject(rec);
         if (store.IsModified())
         {
             store.Store();
         }
     } catch { }
 }
Ejemplo n.º 7
0
    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()));
    }
Ejemplo n.º 8
0
    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");
        }
    }
Ejemplo n.º 9
0
    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));
    }
Ejemplo n.º 10
0
 public List <TRStatistic> getTRStatistic(string start, string days)
 {
     return(TRRec.EnumTRStatistics(DateTime.ParseExact(start, defDateFormat, CultureInfo.InvariantCulture), Convert.ToInt32(days)));
 }
Ejemplo n.º 11
0
 public void deltrrec(int id)
 {
     TRRec.DelRec(id);
 }