Ejemplo n.º 1
0
        public ActionResult ReportByInstructionsDG(string departmentId, DateTime?dateValue)
        {
            IEnumerable <TaskList> taskLists = unit.TaskLists.GetTaskListsWithRelations();

            ViewBag.Today = DateTime.Now.ToString("yyyy-MM");
            if (User.IsInRole("admin"))
            {
                ViewBag.Departments = new SelectList(
                    unit.Departments.GetAll(),
                    "DepartmentId",
                    "Name"
                    );
                if (departmentId != null)
                {
                    var taskList = new List <ReportByInstructionsDGViewModel>();

                    ReportByInstructionsDGViewModel model;
                    foreach (TaskList item in taskLists)
                    {
                        model = new ReportByInstructionsDGViewModel
                        {
                            TaskName         = item.TaskName,
                            AverageMark      = item.AverageMark,
                            CommentEmployees = item.CommentEmployees
                        };

                        taskList.Add(model);
                    }
                    return(View(taskList));
                }
                return(View());
            }
            else
            {
                ViewBag.Departments = new SelectList(
                    unit.Departments.GetAvailableDepartments(User.Identity.GetUserId()),
                    "DepartmentId",
                    "Name"
                    );
                if (departmentId != null)
                {
                    var taskList = new List <ReportByInstructionsDGViewModel>();

                    ReportByInstructionsDGViewModel model;
                    foreach (TaskList item in taskLists)
                    {
                        model = new ReportByInstructionsDGViewModel
                        {
                            TaskName         = item.TaskName,
                            AverageMark      = item.AverageMark,
                            CommentEmployees = item.CommentEmployees
                        };

                        taskList.Add(model);
                    }
                    return(View(taskList));
                }
                return(View());
            }
        }
Ejemplo n.º 2
0
        public ActionResult PartialReportByInstructionsDG(string departmentId, DateTime?dateValue)
        {
            if (departmentId == "")
            {
                return(PartialView());
            }
            IEnumerable <TaskList> taskLists = unit.TaskLists
                                               .GetTaskListsByDepartmentId(Guid.Parse(departmentId), dateValue);
            var taskList = new List <ReportByInstructionsDGViewModel>();
            ReportByInstructionsDGViewModel model;

            foreach (var item in taskLists)
            {
                model = new ReportByInstructionsDGViewModel
                {
                    TaskName         = item.TaskName,
                    AverageMark      = item.AverageMark,
                    CommentEmployees = item.CommentEmployees
                };

                taskList.Add(model);
            }
            return(PartialView(taskList));
        }