Example #1
0
        public IActionResult Compose()
        {
            ComposeMessageModel model = new ComposeMessageModel();

            model.Department = _departmentsService.GetDepartmentByUserId(UserId);
            model.User       = _usersService.GetUserById(UserId);
            model.Types      = model.MessageType.ToSelectList();

            var shifts = _shiftsService.GetAllShiftsByDepartment(DepartmentId);

            model.Shifts = new SelectList(shifts, "ShiftId", "Name");

            model.Message = new Message();

            return(View(FillComposeMessageModel(model)));
        }
Example #2
0
        public List <ShiftResult> GetShifts()
        {
            var results = new List <ShiftResult>();

            var shifts = _shiftsService.GetAllShiftsByDepartment(DepartmentId);

            foreach (var s in shifts)
            {
                var shift = new ShiftResult();
                shift.Id    = s.ShiftId;
                shift.Name  = s.Name;
                shift.Code  = s.Code;
                shift.Color = s.Color;
                shift.SType = s.ScheduleType;
                shift.AType = s.AssignmentType;

                if (s.Personnel != null)
                {
                    shift.PCount = s.Personnel.Count;
                }

                if (s.Groups != null)
                {
                    shift.GCount = s.Groups.Count;
                }

                var nextDay = s.GetNextShiftDayforDateTime(DateTime.UtcNow);

                if (nextDay != null)
                {
                    shift.NextDay   = nextDay.Day.ToString("O");
                    shift.NextDayId = nextDay.ShiftDayId;
                }

                if (s.Personnel != null && s.Personnel.Any(x => x.UserId == UserId))
                {
                    shift.InShift = true;
                }

                results.Add(shift);
            }

            return(results);
        }