Esempio n. 1
0
        public void LoadData()
        {
            _cadStationList = CadBusiness.GetCadStationList("SAMU");
            GroupList       = _cadStationList.Select(s => s.DispatchGroup).Distinct().ToList();

            SelectedUnit          = CopyUnit(BackupUnit);
            SelectedDispatchGroup = SelectedUnit.Station.DispatchGroup;

            LoadCrewMembersControl();

            LoadUnitInitialData();
        }
Esempio n. 2
0
        private void LoginSelectedUnit()
        {
            if (!CadBusiness.UnitInService(SelectedTargetUnitId, RemarkText))
            {
                throw new Exception();
            }

            UnitForceMapModel unit = UnitForceMapBusiness.GetCurrentUnitForceMap(SelectedTargetUnitId);

            if (UnitForceMapBusiness.UpdateUnitForceMap(unit) == null)
            {
                throw new Exception();
            }
        }
Esempio n. 3
0
 public void UpdateEventWithSelectedHospital()
 {
     try
     {
         string currentUserName = CadBusiness.GetCurrentFullUserName();
         string remark          = String.Format("Deslocamento autorizado por Dr(a) {0}, em {1}, para hospital {2}",
                                                currentUserName, DateTime.Now.ToString("dd/MM/yyyy HH:mm"), SelectedHospital.Name);
         CadBusiness.AddEventRemark(this._agencyEventId, remark);
         return;
     }
     catch (Exception exception)
     {
         MessageBox.Show("Ocorreu um erro ao inserir o comentário na ocorrência", "Atenção!", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
 }
Esempio n. 4
0
        public static void UpdateReportValidation(WorkScheduleImportTemplateModel workScheduleTemplate, List <WorkShiftModel> availableWorkshiftList, string currentAgencyId, ReportValidationModel repotValidationModel)
        {
            string        returnMessage;
            List <string> validUnitList          = new List <string>();
            List <string> validStationIdList     = new List <string>();
            List <int>    validEmployeeIdNumList = new List <int>();
            List <string> validEmployeeIdList    = new List <string>();

            List <WorkScheduleUnitModel> workScheduleUnitList = new List <WorkScheduleUnitModel>();

            validUnitList          = UnitBusiness.GetActiveUnitsId(currentAgencyId);
            validStationIdList     = CadBusiness.GetCadStationList(currentAgencyId).Select(cs => cs.StationId).ToList <string>();
            validEmployeeIdNumList = GetEmployeeIds(currentAgencyId);

            foreach (int emp in validEmployeeIdNumList)
            {
                validEmployeeIdList.Add(emp.ToString());
            }

            List <DateTime> dateTimeListFromWorkSchedule      = workScheduleTemplate.WorkScheduleForUnitList.Where(ws => ws.ShiftDate.HasValue).Select(ws => ws.ShiftDate.Value).Distinct().ToList <DateTime>();
            List <string>   workshifLabelListfromWorkSchedule = workScheduleTemplate.WorkScheduleForUnitList.Select(ws => ws.WorkshiftLabel).Distinct().ToList <string>();

            workScheduleTemplate.UpdateReportValidationBasedOnNewData(ref repotValidationModel, validStationIdList, validEmployeeIdList, validUnitList, availableWorkshiftList);

            foreach (DateTime date in dateTimeListFromWorkSchedule)
            {
                foreach (WorkShiftModel workShift in availableWorkshiftList.Where(ws => workshifLabelListfromWorkSchedule.Contains(ws.Label)))
                {
                    workScheduleUnitList = WorkScheduleBusiness.GetWorkScheduleList(null, date, workShift, WorkShiftModel.ShiftTime.Forward, (int)FilterTypeEnum.ALL, out returnMessage)
                                           .Where(uf => uf.Driver != null || uf.Doctor != null || uf.Nurse != null || uf.FirstAuxiliar != null || uf.SecondAuxiliar != null || uf.ThirdAuxiliar != null)
                                           .ToList <WorkScheduleUnitModel>();
                    workScheduleTemplate.UpdateReportValidationBasedOnOldData(ref repotValidationModel, availableWorkshiftList, workScheduleUnitList);
                }
            }

            repotValidationModel.JoinIdsOfReportValidationList();

            UpdateWorkScheduleWithErrors(repotValidationModel, workScheduleTemplate);

            if (repotValidationModel.ReportValidationItemList.Count == 0)
            {
                repotValidationModel.AddReportItem(WorkScheduleValidationType.VALIDATED, Properties.Resources.ALERT_MESSAGE_WHEN_NO_ERRORS);
            }
        }
Esempio n. 5
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");
            }
        }