예제 #1
0
        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);
            }
        }
예제 #2
0
 public List <Tag> GetAllTags()
 {
     using (TodoListDataContext dc = new TodoListDataContext())
     {
         return(dc.tTags.Select(t => CastTag(t)).ToList());
     }
 }
예제 #3
0
 public List <Priority> GetAllPriorities()
 {
     using (TodoListDataContext dc = new TodoListDataContext())
     {
         return(dc.tPriorities.Select(p => CastPriority(p)).ToList());
     }
 }
예제 #4
0
 public List <State> GetAllStates()
 {
     using (TodoListDataContext dc = new TodoListDataContext())
     {
         return(dc.tStates.Select(s => CastState(s)).ToList());
     }
 }
예제 #5
0
 public List <Assignee> GetAllAssignees()
 {
     using (TodoListDataContext dc = new TodoListDataContext())
     {
         return(dc.tAssignees.Select(a => CastAssignee(a)).ToList());
     }
 }
예제 #6
0
 public List<Priority> GetAllPriorities()
 {
     using (TodoListDataContext dc = new TodoListDataContext())
     {
         return dc.tPriorities.Select(p => CastPriority(p)).ToList();
     }
 }
예제 #7
0
        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;
            }
        }
예제 #8
0
 public List<State> GetAllStates()
 {
     using (TodoListDataContext dc = new TodoListDataContext())
     {
         return dc.tStates.Select(s => CastState(s)).ToList();
     }
 }
예제 #9
0
 public List<Assignee> GetAllAssignees()
 {
     using (TodoListDataContext dc = new TodoListDataContext())
     {
         return dc.tAssignees.Select(a => CastAssignee(a)).ToList();
     }
 }
예제 #10
0
 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;
 }
예제 #11
0
 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;
 }
예제 #12
0
 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;
 }
예제 #13
0
        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);
        }
예제 #14
0
        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);
        }
예제 #15
0
        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);
        }
예제 #16
0
        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);
        }
예제 #17
0
        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);
        }
예제 #18
0
 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);
     }
 }
예제 #19
0
        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();
            }
        }
예제 #20
0
        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);
            }
        }
예제 #21
0
        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();
            }
        }
예제 #22
0
        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();
            }
        }
예제 #23
0
        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;
        }
예제 #24
0
        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;
 }
예제 #26
0
 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;
 }
예제 #27
0
 public UserRepository(TodoListDataContext context)
 {
     _context = context;
 }
예제 #28
0
 public TodoItemDeleteModel(TodoListDataContext context)
 {
     _context = context;
 }
예제 #29
0
파일: Uow.cs 프로젝트: RobertoHGMV/TodoList
 public Uow(TodoListDataContext context)
 {
     _context = context;
 }