private void UpdateTask(Task newTask) { String sqlReqStr = "UPDATE TASK SET NAME='" + newTask.Name + "',PARAM_COUNT='" + newTask.CountParameters + "',SELECTION_COUNT='" + newTask.CountSelections + "' "+ "WHERE ID='" + newTask.ID + "';"; sqlManager.SendUpdateRequest(sqlReqStr); }
public List<Task> GetTasksWithRequest(String req) { List<Task> res = null; SQLiteCommand cmd = new SQLiteCommand(conn); cmd.Transaction = trans; cmd.CommandText = req; try { SQLiteDataReader r = cmd.ExecuteReader(); string line = String.Empty; res = new List<Task>(); Task task; while (r.Read()) { task = new Task(); task.ID = int.Parse(string.Format("{0}", r["ID"])); task.CountParameters = int.Parse(string.Format("{0}", r["PARAM_COUNT"])); task.CountSelections = int.Parse(string.Format("{0}", r["SELECTION_COUNT"])); task.Name = r["NAME"].ToString(); res.Add(task); } r.Close(); } catch (SQLiteException ex) { Console.WriteLine(ex.Message); return null; } return res; }
private void DeleteTask(Task task) { String sqlReqStr = "DELETE FROM TASK WHERE ID='" + task.ID + "';"; sqlManager.SendDeleteRequest(sqlReqStr); sqlReqStr = "DELETE FROM SELECTION WHERE TASK_ID='" + task.ID + "';"; sqlManager.SendDeleteRequest(sqlReqStr); sqlReqStr = "DELETE FROM PARAM WHERE TASK_ID='" + task.ID + "';"; sqlManager.SendDeleteRequest(sqlReqStr); }