BootstrapAdmin/Bootstrap.DataAccess.SQLite/Task.cs

41 lines
1.5 KiB
C#
Raw Normal View History

2018-10-19 23:09:52 +08:00
using Longbow;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
namespace Bootstrap.DataAccess.SQLite
{
public class Task : DataAccess.Task
{
/// <summary>
/// 查询所有任务
/// </summary>
/// <returns></returns>
public override IEnumerable<DataAccess.Task> RetrieveTasks()
{
string sql = "select t.*, u.DisplayName from Tasks t inner join Users u on t.UserName = u.UserName order by AssignTime desc limit 1000";
List<DataAccess.Task> tasks = new List<DataAccess.Task>();
DbCommand cmd = DbAccessManager.DBAccess.CreateCommand(CommandType.Text, sql);
using (DbDataReader reader = DbAccessManager.DBAccess.ExecuteReader(cmd))
2018-10-19 23:09:52 +08:00
{
while (reader.Read())
2018-10-19 23:09:52 +08:00
{
tasks.Add(new DataAccess.Task()
2018-10-19 23:09:52 +08:00
{
2018-10-30 13:07:29 +08:00
Id = reader[0].ToString(),
TaskName = (string)reader[1],
AssignName = (string)reader[2],
UserName = (string)reader[3],
TaskTime = LgbConvert.ReadValue(reader[4], 0),
TaskProgress = (double)reader[5],
AssignTime = LgbConvert.ReadValue(reader[6], DateTime.MinValue),
AssignDisplayName = (string)reader[7]
});
2018-10-19 23:09:52 +08:00
}
}
return tasks;
2018-10-19 23:09:52 +08:00
}
}
}