def add_task(title, description): current_time = str(datetime.datetime.now()) q = "INSERT INTO SE_DB.tasks(taskName, description, state, timeCreated) VALUES(\'" + title q = q + "/', /'" + description + "/'," + "/'Incomplete/'," + current_time + ");" c = db_util.db_open() db_util.db_execute(c, q) db_util.db_close(c)
def get_employee(employee_id): q = "SELECT lastName, firstName FROM SE_DB.employees WHERE ID = " + str( employee_id) + ";" c = db_util.db_open() employee = db_util.db_query(c, q) db_util.db_close(c) return employee
def update_task_state(taskID, new_state, employee): q = "UPDATE SE_DB.tasks SET state = \"" + new_state + "\"" if new_state == "Complete": current_time = str(datetime.datetime.now()) q = q + ", timeCompleted = \'" + current_time + "\'" elif new_state == "In Progress": q = q + ", employeeID = " + employee q = q + " WHERE taskID = " + taskID + ";" c = db_util.db_open() db_util.db_execute(c, q) db_util.db_close(c)
def modify_task(taskID, taskName=None, description=None, state=None, employeeID=None, timeCreated=None, timeCompleted=None): q = "UPDATE SE_DB.employees SET taskName = \"" + taskName + "\"" q = q + ", description = \"" + description + "\"" q = q + ", state = \"" + state + "\"" q = q + ", employeeID = \"" + employeeID + "\"" q = q + ", timeCreated = \"" + timeCreated + "\"" q = q + ", timeCompleted = \"" + timeCompleted + "\"" q = q + " WHERE taskID = " + taskID + ";" c = db_util.db_open() db_util.db_execute(c, q) db_util.db_close(c)
def get_incomplete_tasks(): q = "SELECT * FROM SE_DB.tasks WHERE state = \"Incomplete\";" c = db_util.db_open() tasks = db_util.db_query(c, q) db_util.db_close(c) return tasks
def get_inprogress_tasks(): q = "SELECT * FROM SE_DB.tasks WHERE state = \"In Progress\";" c = db_util.db_open() tasks = db_util.db_query(c, q) db_util.db_close(c) return tasks
def get_task(taskID): q = "SELECT * FROM SE_DB.tasks WHERE taskID = " + taskID + ";" c = db_util.db_open() task = db_util.db_query(c, q) db_util.db_close(c) return task
def get_employee_tasks(employeeID): q = "SELECT * FROM SE_DB.tasks WHERE state = \"In Progress\" AND employeeID = " + employeeID + ";" c = db_util.db_open() tasks = db_util.db_query(c, q) db_util.db_close(c) return tasks
def get_all_tasks(): q = "SELECT * FROM SE_DB.tasks;" c = db_util.db_open() tasks = db_util.db_query(c, q) db_util.db_close(c) return tasks