コード例 #1
0
        public IActionResult EditUnitType(int unitTypeId)
        {
            var model = new EditUnitTypeView();

            model.UnitType = _unitsService.GetUnitTypeById(unitTypeId);

            var states = new List <CustomState>();

            states.Add(new CustomState
            {
                Name = "Standard Actions"
            });
            states.AddRange(_customStateService.GetAllActiveUnitStatesForDepartment(DepartmentId));
            model.States             = states;
            model.UnitCustomStatesId = model.UnitType.CustomStatesId.GetValueOrDefault();

            return(View(model));
        }
コード例 #2
0
        public IActionResult GetUnitStatusesLevelsForDepartment(bool includeAny, int unitTypeId)
        {
            List <PersonnelStatusJson> personnelStauses = new List <PersonnelStatusJson>();
            CustomState customState = null;

            var unitType = _unitsService.GetUnitTypeById(unitTypeId);

            if (unitType.CustomStatesId.HasValue && unitType.CustomStatesId.Value > 0)
            {
                customState = _customStateService.GetCustomSateById(unitType.CustomStatesId.Value);
            }

            if (includeAny)
            {
                personnelStauses.Add(new PersonnelStatusJson()
                {
                    Id = -1, Name = "Any"
                });
            }

            if (customState != null)
            {
                foreach (var detail in customState.GetActiveDetails())
                {
                    var status = new PersonnelStatusJson();
                    status.Id   = detail.CustomStateDetailId;
                    status.Name = detail.ButtonText;

                    personnelStauses.Add(status);
                }
            }
            else
            {
                personnelStauses.Add(new PersonnelStatusJson()
                {
                    Id = 0, Name = "Available"
                });
                personnelStauses.Add(new PersonnelStatusJson()
                {
                    Id = 1, Name = "Delayed"
                });
                personnelStauses.Add(new PersonnelStatusJson()
                {
                    Id = 2, Name = "Unavailable"
                });
                personnelStauses.Add(new PersonnelStatusJson()
                {
                    Id = 3, Name = "Committed"
                });
                personnelStauses.Add(new PersonnelStatusJson()
                {
                    Id = 4, Name = "Out Of Service"
                });
                personnelStauses.Add(new PersonnelStatusJson()
                {
                    Id = 5, Name = "Responding"
                });
                personnelStauses.Add(new PersonnelStatusJson()
                {
                    Id = 6, Name = "On Scene"
                });
                personnelStauses.Add(new PersonnelStatusJson()
                {
                    Id = 7, Name = "Staging"
                });
                personnelStauses.Add(new PersonnelStatusJson()
                {
                    Id = 8, Name = "Returning"
                });
                personnelStauses.Add(new PersonnelStatusJson()
                {
                    Id = 9, Name = "Cancelled"
                });
                personnelStauses.Add(new PersonnelStatusJson()
                {
                    Id = 10, Name = "Released"
                });
                personnelStauses.Add(new PersonnelStatusJson()
                {
                    Id = 11, Name = "Manual"
                });
                personnelStauses.Add(new PersonnelStatusJson()
                {
                    Id = 12, Name = "Enroute"
                });
            }

            return(Json(personnelStauses));
        }