Ejemplo n.º 1
0
        public JsonResult GetTasksForSchedule(ScheduleFilterViewModel scheduleFilterViewModel)
        {
            var scheduleTasksViewModel = new ScheduleTasksViewModel
            {
                ScheduleIsCompact = UserSessionData.ScheduleIsCompact
            };

            DateTime currentUserRegistrationDate = UserSessionData.DateRegistered;

            if (currentUserRegistrationDate.Year == scheduleFilterViewModel.FromDate.Year &&
                currentUserRegistrationDate.Month == scheduleFilterViewModel.FromDate.Month)
            {
                scheduleTasksViewModel.IsLastLoad = true;
            }

            var allTasks = _taskService.GetAllForSchedule(WebSecurity.CurrentUserId, scheduleFilterViewModel.FromDate, scheduleFilterViewModel.ToDate);

            scheduleTasksViewModel.Tasks = (from task in allTasks
                                            select new TaskViewModel
            {
                Id = task.Id,
                Title = task.Title,
                ShortTitle = task.ShortTitle,
                Description = task.Description,
                DurationMinutes = task.DurationMinutes,
                Repetitions = task.Repetitions,
                Theme = (TaskTheme)task.Theme,
                ThemeName = ((TaskTheme)task.Theme).ToString().ToLower(),
                Order = task.Order,
                CompletedTaskItems = (from completedTaskItem in task.CompletedTaskItems
                                      select new TaskItemViewModel
                {
                    Id = completedTaskItem.Id,
                    TaskId = completedTaskItem.TaskId,
                    Date = completedTaskItem.Date,
                    DurationMinutes = completedTaskItem.DurationMinutes,
                    Repetitions = completedTaskItem.Repetitions
                }).ToList()
            }).OrderBy(x => x.Order).ToList();

            return(Json(_validationHelper.ModelStateToJsonResult(ModelState, scheduleTasksViewModel), JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        public void OnPost(ScheduleFilterViewModel model)
        {
            listEmployee = GetData <Employee> .GetList("http://localhost:37919/api/Employee/GetEmployeeSendMail/1");

            listInterviewer = ApiIntergration.GetData <Employee> .GetList("http://localhost:37919/api/Employee/GetEmployeeStatus/13");

            listPositions = ApiIntergration.GetData <Positions> .GetList("http://localhost:37919/api/Position/GetAll");

            listTitle = ApiIntergration.GetData <Title> .GetList("http://localhost:37919/api/Title/GetAll");

            if (model.EmployeeName != null)
            {
                listEmployee = listEmployee.Where(x => x.EmployeeName.Contains("" + model.EmployeeName + "")).ToList();
            }
            if (model.Position != 0)
            {
                listEmployee = listEmployee.Where(x => x.PositionId == model.Position).ToList();
            }

            if (model.Title != 0)
            {
                listEmployee = listEmployee.Where(x => x.TitleId == model.Title).ToList();
            }
            if (model.InterviewAddress != null)
            {
                listEmployee = listEmployee.Where(x => x.InterviewAddress == model.InterviewAddress).ToList();
            }
            if (model.Start != DateTime.MinValue)
            {
                listEmployee = listEmployee.Where(x => x.InterviewTime > model.Start).ToList();
            }
            if (model.End != DateTime.MinValue)
            {
                listEmployee = listEmployee.Where(x => x.InterviewTime < model.End).ToList();
            }
        }