Example #1
0
 public static void CreateTask(Task task)
 {
     using (TimeTrackerDbEntities context = new TimeTrackerDbEntities())
     {
         context.Tasks.Add(task);
         context.SaveChanges();
     }
 }
Example #2
0
 public TaskViewModel(Task task, string statusMess = null)
 {
     Id = task.Id;
     Title = task.Title;
     Description = task.Description;
     StartDate = task.StartDate;
     WorkedHoursCurrent = task.WorkedHoursCurrent;
     StatusId = task.StatusId;
     StatusMess = statusMess;
 }
Example #3
0
 public static void CreateTask(string t, string d, int s, DateTime? sd = null, DateTime? ed = null)
 {
     using (TimeTrackerDbEntities context = new TimeTrackerDbEntities())
     {
         Task task = new Task();
         task.Title = t;
         task.Description = d;
         task.StatusId = s;
         task.StartDate = sd;
         task.EndDate = ed;
         context.Tasks.Add(task);
         context.SaveChanges();
     }
 }
Example #4
0
 public TaskModel(Task task)
 {
     Title = task.Title;
     Description = task.Description;
     StatusId = task.StatusId;
 }
Example #5
0
        //
        // GET: /Task/Details/5
        public ViewResult Details(int id)
        {
            List<UsersTask> usrTsk = UserTasksUtility.GetAllUsersOnTask(id);
            List<UserTaskViewModel> usrTskViewModel = new List<UserTaskViewModel>(usrTsk.Count);

            User usr = new User();
            Task task = new Task();

            foreach (UsersTask item in usrTsk)
            {
                usr = UserUtility.GetUserById(item.UserID);
                task = TaskUtility.GetTaskById(item.TaskId);

                if (item.WorkedHours.HasValue)
                {
                    usrTskViewModel.Add(new UserTaskViewModel(usr.UserId, usr.UserName, usr.FirstName, usr.LastName, task.Id, task.Title, (int)item.WorkedHours.Value));
                }
                else
                {
                    usrTskViewModel.Add(new UserTaskViewModel(usr.UserId, usr.UserName, usr.FirstName, usr.LastName, task.Id, task.Title, 0));
                }

            }

            return View(usrTskViewModel);
        }
        public ActionResult ShowAll(int id)
        {
            List<WorkingCard> allCards = WorkingCardUtility.GetAllByUserName(id);

            List<WorkingCardModel> resultCards = new List<WorkingCardModel>(allCards.Count());

            Task tsk = new Task();
            foreach (WorkingCard item in allCards)
            {
                tsk = TaskUtility.GetTaskById(item.TaskId);
                resultCards.Add(new WorkingCardModel(item.Id, item.StartDate, item.WorkingHours, item.Description, item.IsFilled.Value, tsk.Title));
            }

            return View(resultCards);
        }