Exemplo 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);
    }
Exemplo 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);
    }