internal void changeSubTaskName(int id, string newName) { newName.Replace("'", "\'"); string sql = string.Format($"UPDATE subtask SET subtask_name = '{newName}' WHERE id = {id}"); SQLiteExecutor.execute(sql); }
internal void changeDate(int taskId, DateTime?date) { List <Task> list = selectById(taskId); if (list.Count == 0) { return; } DateTime taskDate = list.ElementAt(0).TaskDate; string sql_update = string.Format($"update task set task_date = '{date.ToString().Split(' ')[0]} {taskDate.TimeOfDay}' where id = {taskId}"); SQLiteExecutor.execute(sql_update); }
private SubTask addParentSubTask(string sql, SubTask subTask) { //插入子任务 SQLiteExecutor.execute(sql); //获取刚插入的数据返回 string sql_select = string.Format("select id from subtask order by id desc limit 1"); SQLiteDataReader sQLiteDataReader = SQLiteExecutor.select(sql); if (!sQLiteDataReader.Read()) { return(subTask); } subTask.Id = sQLiteDataReader.GetInt32(0); return(subTask); }
public Task addNewTask(Task task) { string sql = string.Format($"INSERT INTO task(task_name,task_priority,task_state,task_description,task_date) VALUES ('{task.TaskName}','{task.Priority}','{task.TaskState}','{task.TaskDescription}','{task.TaskDate}')"); //插入子任务 SQLiteExecutor.execute(sql); //获取刚插入的数据返回 string sql_select = string.Format("select id from task order by id desc limit 1"); SQLiteDataReader sQLiteDataReader = SQLiteExecutor.select(sql); if (!sQLiteDataReader.Read()) { return(task); } task.TaskId = sQLiteDataReader.GetInt32(0); return(task); }
internal void changePriority(int taskId, int priority) { string sql_update = string.Format($"update task set task_priority = {priority} where id = {taskId}"); SQLiteExecutor.execute(sql_update); }
internal void changeDescription(int taskId, string description) { string sql_update = string.Format($"update task set task_description = '{description}' where id = {taskId}"); SQLiteExecutor.execute(sql_update); }
internal void changeName(int id, string newName) { string sql_update = string.Format($"update task set task_Name = '{newName}' where id = {id}"); SQLiteExecutor.execute(sql_update); }