public static void CreateTask(string taskName, int listId) { LinqToSQLDataContext db = new LinqToSQLDataContext(); //Create new Board TTask newTask = new TTask { TaskName = taskName, TaskList = listId }; //Add new Board to database db.TTasks.InsertOnSubmit(newTask); //Save changes to Database. try { db.SubmitChanges(); } catch (Exception e) { Console.WriteLine(e); } }
public static void DeleteTask(int taskId) { LinqToSQLDataContext db = new LinqToSQLDataContext(); //Get Board to be deleted TTask taskToBeDeleted = db.TTasks.FirstOrDefault(t => t.TasktId.Equals(taskId)); //Delete Board on database db.TTasks.DeleteOnSubmit(taskToBeDeleted); //Save changes to Database. try { db.SubmitChanges(); } catch (Exception e) { Console.WriteLine(e); } }
public static void UpdateTask(int taskId, string taskDescription, DateTime taskDue, int taskWho, int taskStatus) { LinqToSQLDataContext db = new LinqToSQLDataContext(); //Get Board to be deleted TTask taskToBeUpdated = db.TTasks.FirstOrDefault(t => t.TasktId.Equals(taskId)); taskToBeUpdated.TaskDescription = taskDescription; taskToBeUpdated.TaskDue = taskDue; taskToBeUpdated.TaskWho = taskWho; taskToBeUpdated.TaskStatus = taskStatus; //Save changes to Database. try { db.SubmitChanges(); } catch (Exception e) { Console.WriteLine(e); } }
private void detach_TTasks(TTask entity) { this.SendPropertyChanging(); entity.TStatus = null; }
private void attach_TTasks(TTask entity) { this.SendPropertyChanging(); entity.TStatus = this; }
partial void DeleteTTask(TTask instance);
partial void UpdateTTask(TTask instance);
partial void InsertTTask(TTask instance);