public static TaskList GetRequiredTaskList(CMSDataContext Db, string name, int pid) { var list = Db.TaskLists.SingleOrDefault(tl => tl.CreatedBy == pid && tl.Name == name); if (list == null) { list = new TaskList { CreatedBy = pid, Name = name }; Db.TaskLists.InsertOnSubmit(list); Db.SubmitChanges(); } return list; }
public void AddList(string name) { var Db = DbUtil.Db; var txt = name.ToLower(); if (string.Compare(txt, STR_InBox, true) == 0 || string.Compare(txt, "personal", true) == 0) return; if (Db.TaskLists.Count(t => t.Name == name && t.CreatedBy == PeopleId) > 0) return; var list = new TaskList {Name = name, CreatedBy = PeopleId}; Db.TaskLists.InsertOnSubmit(list); Db.SubmitChanges(); }