Beispiel #1
0
        public ActionResult DisplayCheckedTasks(int[] checkedRecords)
        {
            checkedRecords = checkedRecords ?? new int[] { };
            List <TaskViewModel> data = GetTasks().Where(o => checkedRecords.Contains(o.TaskID)).ToList();

            foreach (var tasks in data)
            {
                EmployeeTask empTask = new EmployeeTask();
                empTask.EmployeeID = Convert.ToInt32(Session["Assignee"]);
                empTask.TaskID     = tasks.TaskID;
                empTaskRepository.InsertOrUpdate(empTask);
                empTaskRepository.Save();
            }

            //Update Employee record for task assignment
            Employee emp = employeeRepository.Find(Convert.ToInt32(Session["Assignee"]));

            emp.IsTaskAssigned  = true;
            emp.AssignmentCount = emp.AssignmentCount + data.Count;
            employeeRepository.InsertOrUpdate(emp);
            employeeRepository.Save();

            //update Task record
            foreach (var task in data)
            {
                Task _task = taskRepository.Find(task.TaskID);
                _task.IsAssigned = true;
                taskRepository.InsertOrUpdate(_task);
                taskRepository.Save();
            }

            return(PartialView("CheckedTasks", data));
        }
        public ActionResult UpdateTask(EmployeeTaskViewModel taskModel)
        {
            EmployeeTask task = empTaskRepository.FindByTaskId(taskModel.TaskID);

            task.Efforts = taskModel.HoursSpent;
            empTaskRepository.InsertOrUpdate(task);
            empTaskRepository.Save();
            return(View(new GridModel(GetEmployeeTask())));
        }