Example #1
0
        public CustomUnitOutOfServiceVM(string UnitId)
        {
            List <OutOfServiceTypeModel.OutOfServiceSpecialType> SpecialTypes = new List <OutOfServiceTypeModel.OutOfServiceSpecialType>();

            SpecialTypes.Add(OutOfServiceTypeModel.OutOfServiceSpecialType.NORMAL);
            SpecialTypes.Add(OutOfServiceTypeModel.OutOfServiceSpecialType.TECH_STOP);
            SpecialTypes.Add(OutOfServiceTypeModel.OutOfServiceSpecialType.NO_OPERATIONAL_SELECTABLE);

            this.UnitId = UnitId;

            OutTypeList = EventTypeBusiness.GetOutTypeList(SpecialTypes);
        }
 public object DeleteEventType([FromBody] EventTypeUpdateParam PM)
 {
     try
     {
         EventTypeBusiness b = new EventTypeBusiness();
         var Result          = b.DeleteEventType(PM);
         return(Result);
     }
     catch (Exception e)
     {
         return(new Error()
         {
             IsError = true, Message = e.Message
         });
     }
 }
 public object AddEventType([FromBody] EventTypeParam obj)
 {
     try
     {
         EventTypeBusiness save = new EventTypeBusiness();
         var result             = save.SaveEventType(obj);
         return(result);
     }
     catch (Exception e)
     {
         return(new Error()
         {
             IsError = true, Message = e.Message
         });
     }
 }
        public object UpdateEventType(EventTypeUpdateParam b)
        {
            try
            {
                EventTypeBusiness type = new EventTypeBusiness();
                var Result             = type.EventTypeUpdate(b);

                return(Result);
            }
            catch (Exception e)
            {
                return(new Error()
                {
                    IsError = true, Message = e.Message
                });
            }
        }
        public object GetEventTypeInfo(UserCredential uc)
        {
            try
            {
                EventTypeBusiness events = new EventTypeBusiness();
                var Result = events.GetEventType(uc);

                return(Result);
            }
            catch (Exception e)
            {
                return(new Error()
                {
                    IsError = true, Message = e.Message
                });
            }
        }
        public object GetSingleEventInfo(EventMasterUpdateParam b)
        {
            try
            {
                EventTypeBusiness type = new EventTypeBusiness();
                var Result             = type.GetSingleEvent(b);

                return(Result);
            }
            catch (Exception e)
            {
                return(new Error()
                {
                    IsError = true, Message = e.Message
                });
            }
        }
Example #7
0
        public bool LoadData()
        {
            try
            {
                //INICIALMENTE SETADO COMO NÃO ENCONTRADO, ABAIXO SE ENCONTRAR REGISTRO SETA PARA OUTRO.
                this.EventSituation = EventSituationEnum.NotFound;
                this.VictimData     = new VictimModel();

                this.ReasonList = EventTypeBusiness.GetDispositionCodeList(true);

                if (this.ReasonList.Count == 0)
                {
                    return(false);
                }

                this.SituationFoundList  = EventTypeBusiness.GetEventTypeList();
                this.HospitalList        = SamuBusiness.GetHospitalList();
                this.DisplayHospitalList = HospitalList;
                this.IsNotUram           = (UnitBusiness.GetUnitType(this.UnitId) != "URAM");

                UnitWithRetainedStretcherModel unitWithRetainedStretcher = null;
                //TODO: Temporário: Voltar para ativar recurso de Maca Retida

                /*    RetainedStretcherBusiness.GetUnitsWithRetainedStretcher("SAMU", PersonBusiness.GetCurrentUser(), this.UnitId, isOnlyWithStatusRetainedStretcher: false)
                 *  .FirstOrDefault();*/

                this.HasNotRetainedStretcher = unitWithRetainedStretcher == null ? true : false;

                HospitalTypeList = HospitalList.Select(p => p.HospitalGroup).Distinct().ToList();

                _dispositionNotFoundTypeCode = CadBusiness.GetCadParameterListItem("sisgraph", "SubmissionWindowParams", "DispositionNotFoundCode");
                _dispositionRemovedTypeCode  = CadBusiness.GetCadParameterListItem("sisgraph", "SubmissionWindowParams", "DispositionRemovedCode");
                //_dispositionRetainedStretcher = CadBusiness.GetCadParameterListItem("sisgraph", "SubmissionWindowParams", "DispositionRetainedStretcher");

                if (_dispositionNotFoundTypeCode == null || _dispositionRemovedTypeCode == null) //|| _dispositionRetainedStretcher == null
                {
                    throw new Exception("Não foi possível carregar os parâmetros do ICAD.");
                }

                if (_isSubmitted)
                {
                    SubmissionModel loadedSubmissionModel = SubmissionBusiness.GetLoadedSubmission(UnitId, AgencyEventId);

                    if (loadedSubmissionModel == null)
                    {
                        //{
                        //    throw new Exception("Dados de finalização não encontrados.");
                        //}
                        loadedSubmissionModel = new SubmissionModel();

                        loadedSubmissionModel.DispositionCode = _dispositionRemovedTypeCode;

                        this.EventSituation = EventSituationEnum.Removed;

                        this.HospitalHasChanged = true;
                    }
                    else
                    {
                        //ToString: complete
                        if (loadedSubmissionModel.DispositionCode == _dispositionNotFoundTypeCode)
                        {
                            this.EventSituation = EventSituationEnum.NotFound;
                        }
                        else if (loadedSubmissionModel.DispositionCode == _dispositionRemovedTypeCode)
                        {
                            this.EventSituation = EventSituationEnum.Removed;
                        }
                        //else if (loadedSubmissionModel.DispositionCode == _dispositionRetainedStretcher)
                        //    this.EventSituation = EventSituationEnum.RetainedStretcher;
                        else
                        {
                            this.EventSituation = EventSituationEnum.ResolvedOnLocal;
                        }



                        this.SelectedReason = loadedSubmissionModel.SelectedReason;

                        this.AsExpected = loadedSubmissionModel.AsExpected;

                        this.VictimData = loadedSubmissionModel.Victim;

                        if (!string.IsNullOrEmpty(loadedSubmissionModel.Victim.SituationFound.Key))
                        {
                            this.VictimData.SituationFound = SituationFoundList.Where(p => p.Key == loadedSubmissionModel.Victim.SituationFound.Key).FirstOrDefault();
                        }

                        if (loadedSubmissionModel.SelectedHospital != null)
                        {
                            this.SelectedHospitalType = loadedSubmissionModel.SelectedHospital.HospitalGroup;

                            this.SelectedHospital = HospitalList.Where(p => p.Cnes == loadedSubmissionModel.SelectedHospital.Cnes).FirstOrDefault();
                        }

                        this.Remarks = loadedSubmissionModel.Remarks;
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                logger.Error("Ocorreu um erro carregando a ViewModel da janela de finalização de evento.", ex);

                throw new Exception("Falha ao carregar dados de finalização");
            }
        }