static public long addTask(long userId, String name, String description, int expectedTomato, DateTime setTime, DateTime deadline, DateTime remindTime) { using (var db = SugarBase.GetIntance()) { Task newTask = new Task() { userId = userId, taskName = name, description = description, expectedTomato = expectedTomato, setTime = setTime, deadline = deadline, remindTime = remindTime, status = 0 }; long id = db.Insertable(newTask).ExecuteReturnIdentity(); return(id); } }
private static List <Task> getOneDayTask(List <Task> tasks, DateTime day) { List <Task> dayTasks = new List <Task>(); if (tasks != null && tasks.Count > 0) { for (int i = 0; i < tasks.Count; i++) { DateTime starttime = tasks[i].setTime; if (starttime != null) { if (day.Date == starttime.Date) { Task task = tasks[i]; dayTasks.Add(task); } } } } return(dayTasks); }