public GetDailys ( System.DateTime start, System.DateTime end ) : List |
||
start | System.DateTime | |
end | System.DateTime | |
return | List |
public List<Daily> GetDailys(DateTime start, DateTime end)
{
List<Daily> result = null;
DataTable dt = new DataTable();
string sql = @"SELECT D.* FROM DAILY D WHERE D.DATE BETWEEN @START AND @END ORDER BY D.DATE ASC";
using (DbCommand cmd = _database.GetSqlStringCommand(sql))
{
_database.AddInParameter(cmd, "@START", DbType.Date, start);
_database.AddInParameter(cmd, "@END", DbType.Date, end);
using (IDataReader reader = _database.ExecuteReader(cmd))
{
dt.Load(reader);
}
}
if (dt != null && dt.Rows.Count > 0)
{
result = dt.ToList<Daily>();
}
return result;
}
/// <summary> /// 获取日消费清单 /// </summary> /// <param name="start"></param> /// <param name="end"></param> /// <returns></returns> public List <Daily> GetDailys(DateTime start, DateTime end) { List <Daily> result = null; try { result = _service.GetDailys(start, end); } catch (Exception e) { _log.Error("GetDailys(DateTime start, DateTime end)", e); throw new Exception("获取日消费清单出错"); } return(result); }