public List <Task> GetAllTasks(Guid assigneeId, Guid priorityId, DateTime firstDate, DateTime lastDate) { using (TodoListDataContext dc = new TodoListDataContext()) { /* List<Task> tasks = dc.tTasks * .Where(t => assigneeId != Guid.Empty && t.AssigneeId == assigneeId) * .Where(t => priorityId != Guid.Empty && t.PriorityId == priorityId) * .Where(t => firstDate != DateTime.MinValue && t.StartDate >= firstDate) * .Where(t => lastDate != DateTime.MinValue && t.FinishDate <= lastDate) * .Select(t => CastTask(t)).ToList(); * return tasks; */ var q = dc.tTasks.Where(t => 1 == 1); if (assigneeId != Guid.Empty) { q = q.Where(t => t.AssigneeId == assigneeId); } if (priorityId != Guid.Empty) { q = q.Where(t => t.PriorityId == priorityId); } if (firstDate != DateTime.MinValue) { q = q.Where(t => t.StartDate >= firstDate); } if (lastDate != DateTime.MinValue) { q = q.Where(t => t.FinishDate <= lastDate); } var list = q.Select(t => CastTask(t)).ToList(); return(list); } }
public List <Tag> GetAllTags() { using (TodoListDataContext dc = new TodoListDataContext()) { return(dc.tTags.Select(t => CastTag(t)).ToList()); } }
public List <Priority> GetAllPriorities() { using (TodoListDataContext dc = new TodoListDataContext()) { return(dc.tPriorities.Select(p => CastPriority(p)).ToList()); } }
public List <State> GetAllStates() { using (TodoListDataContext dc = new TodoListDataContext()) { return(dc.tStates.Select(s => CastState(s)).ToList()); } }
public List <Assignee> GetAllAssignees() { using (TodoListDataContext dc = new TodoListDataContext()) { return(dc.tAssignees.Select(a => CastAssignee(a)).ToList()); } }
public List<Priority> GetAllPriorities() { using (TodoListDataContext dc = new TodoListDataContext()) { return dc.tPriorities.Select(p => CastPriority(p)).ToList(); } }
public List<Task> GetAllTasks(Guid assigneeId, Guid priorityId, DateTime firstDate, DateTime lastDate) { using (TodoListDataContext dc = new TodoListDataContext()) { /* List<Task> tasks = dc.tTasks .Where(t => assigneeId != Guid.Empty && t.AssigneeId == assigneeId) .Where(t => priorityId != Guid.Empty && t.PriorityId == priorityId) .Where(t => firstDate != DateTime.MinValue && t.StartDate >= firstDate) .Where(t => lastDate != DateTime.MinValue && t.FinishDate <= lastDate) .Select(t => CastTask(t)).ToList(); return tasks; */ var q = dc.tTasks.Where(t => 1 == 1); if (assigneeId != Guid.Empty) { q = q.Where(t => t.AssigneeId == assigneeId); } if (priorityId != Guid.Empty) { q = q.Where(t => t.PriorityId == priorityId); } if (firstDate != DateTime.MinValue) { q = q.Where(t => t.StartDate >= firstDate); } if (lastDate != DateTime.MinValue) { q = q.Where(t => t.FinishDate <= lastDate); } var list = q.Select(t => CastTask(t)).ToList(); return list; } }
public List<State> GetAllStates() { using (TodoListDataContext dc = new TodoListDataContext()) { return dc.tStates.Select(s => CastState(s)).ToList(); } }
public List<Assignee> GetAllAssignees() { using (TodoListDataContext dc = new TodoListDataContext()) { return dc.tAssignees.Select(a => CastAssignee(a)).ToList(); } }
public State GetStateById(Guid id) { State state; using (TodoListDataContext dc = new TodoListDataContext()) { var linqState = dc.tStates.SingleOrDefault(s => s.StateId == id); state = CastState(linqState); } return state; }
public Assignee GetAssigneeById(Guid id) { Assignee assignee; using (TodoListDataContext dc = new TodoListDataContext()) { var linqAssignee = dc.tAssignees.SingleOrDefault(a => a.AssigneeId == id); assignee = CastAssignee(linqAssignee); } return assignee; }
public Priority GetPriorityById(Guid id) { Priority priority; using (TodoListDataContext dc = new TodoListDataContext()) { var linqPriority = dc.tPriorities.SingleOrDefault(p => p.PriorityId == id); priority = CastPriority(linqPriority); } return priority; }
public Tag GetTagById(Guid id) { Tag tag; using (TodoListDataContext dc = new TodoListDataContext()) { var linqTag = dc.tTags.SingleOrDefault(t => t.TagId == id); tag = CastTag(linqTag); } return(tag); }
public Assignee GetAssigneeById(Guid id) { Assignee assignee; using (TodoListDataContext dc = new TodoListDataContext()) { var linqAssignee = dc.tAssignees.SingleOrDefault(a => a.AssigneeId == id); assignee = CastAssignee(linqAssignee); } return(assignee); }
public Priority GetPriorityById(Guid id) { Priority priority; using (TodoListDataContext dc = new TodoListDataContext()) { var linqPriority = dc.tPriorities.SingleOrDefault(p => p.PriorityId == id); priority = CastPriority(linqPriority); } return(priority); }
public State GetStateById(Guid id) { State state; using (TodoListDataContext dc = new TodoListDataContext()) { var linqState = dc.tStates.SingleOrDefault(s => s.StateId == id); state = CastState(linqState); } return(state); }
public Task GetTaskById(Guid id) { Task task; using (TodoListDataContext dc = new TodoListDataContext()) { var linqTask = dc.tTasks.SingleOrDefault(t => t.TaskId == id); task = CastTask(linqTask); } return(task); }
public List <Tag> GetTaskTags(Guid id) { using (TodoListDataContext dc = new TodoListDataContext()) { var tags = (from tag in dc.tTags join taskTag in dc.tTaskTags on tag.TagId equals taskTag.TagId where taskTag.TaskId == id select CastTag(tag)).ToList(); //select new Tag { Id = tag.TagId, Text = tag.Text }).ToList<Tag>(); return(tags); } }
public void AddTaskTag(Guid taskId, Guid tagId) { tTaskTag newTaskTag = new tTaskTag(); newTaskTag.TaskTagId = Guid.NewGuid(); newTaskTag.TaskId = taskId; newTaskTag.TagId = tagId; using (TodoListDataContext dc = new TodoListDataContext()) { dc.tTaskTags.InsertOnSubmit(newTaskTag); dc.SubmitChanges(); } }
public string GetTaskTagsToStr(Guid id) { using (TodoListDataContext dc = new TodoListDataContext()) { string strTags = ""; var tags = (from tag in dc.tTags join taskTag in dc.tTaskTags on tag.TagId equals taskTag.TagId where taskTag.TaskId == id orderby tag.Text select tag.Text).ToList(); strTags = String.Join(", ", tags); return(strTags); } }
public void EditTask(Guid taskId, DateTime startDate, DateTime finishDate, string title, string description, Guid priorityId, Guid assigneeId, string picturePath, Guid stateId) { using (TodoListDataContext dc = new TodoListDataContext()) { var editTask = dc.tTasks.SingleOrDefault(t => t.TaskId == taskId); //editTask.TaskId = taskId; editTask.StartDate = startDate; editTask.FinishDate = finishDate; editTask.Title = title; editTask.Description = description; editTask.PriorityId = priorityId; editTask.AssigneeId = assigneeId; editTask.Picture = picturePath; editTask.StateId = stateId; dc.SubmitChanges(); } }
public Guid AddTask(DateTime startDate, DateTime finishDate, string title, string description, Guid priorityId, Guid assigneeId, string picturePath, Guid stateId) { tTask newTask = new tTask(); newTask.TaskId = Guid.NewGuid(); newTask.StartDate = startDate; newTask.FinishDate = finishDate; newTask.Title = title; newTask.Description = description; newTask.PriorityId = priorityId; newTask.AssigneeId = assigneeId; newTask.Picture = picturePath; newTask.StateId = stateId; using (TodoListDataContext dc = new TodoListDataContext()) { dc.tTasks.InsertOnSubmit(newTask); dc.SubmitChanges(); } return newTask.TaskId; }
public Guid AddTask(DateTime startDate, DateTime finishDate, string title, string description, Guid priorityId, Guid assigneeId, string picturePath, Guid stateId) { tTask newTask = new tTask(); newTask.TaskId = Guid.NewGuid(); newTask.StartDate = startDate; newTask.FinishDate = finishDate; newTask.Title = title; newTask.Description = description; newTask.PriorityId = priorityId; newTask.AssigneeId = assigneeId; newTask.Picture = picturePath; newTask.StateId = stateId; using (TodoListDataContext dc = new TodoListDataContext()) { dc.tTasks.InsertOnSubmit(newTask); dc.SubmitChanges(); } return(newTask.TaskId); }
public TodoItemEditModel(TodoListDataContext context) { _context = context; }
public Task GetTaskById(Guid id) { Task task; using (TodoListDataContext dc = new TodoListDataContext()) { var linqTask = dc.tTasks.SingleOrDefault(t => t.TaskId == id); task = CastTask(linqTask); } return task; }
public UserRepository(TodoListDataContext context) { _context = context; }
public TodoItemDeleteModel(TodoListDataContext context) { _context = context; }
public Uow(TodoListDataContext context) { _context = context; }