/*public Dictionary<WorkScheduleValidationType, WorkScheduleValidationTypeMessage> ValidationsByType { * get { return _validationsByType; } * set * { * _validationsByType = value; * OnPropertyChanged("ValidationsByType"); * } * }*/ #endregion #region Métodos public void LoadValidation_DoWork(object sender, DoWorkEventArgs e) { if (IsLoading) { return; } try { EnableLoadingProgress("Validando escala"); string agencyId = "SAMU"; WorkScheduleImported = new WorkScheduleImportTemplateModel(); RevortValidationList = new ObservableCollection <ReportValidationItemModel>(); if (this.IsPeriodicWorkSchedule) { if (!ValidatePeriodicWorkScheduleFilter()) { DisableLoadingProgress(); return; } } //WorkScheduleImported.WorkScheduleForUnitList List <WorkScheduleForUnitModel> workScheduleList = UnitForceMapBusiness.ExtractWorkSchedule(this.FullPathFile).ToList <WorkScheduleForUnitModel>(); if (this.IsPeriodicWorkSchedule) { bool hasError = false; if (workScheduleList.Where(ws => String.IsNullOrEmpty(ws.DateFrequence)).Count() > 0) { DisableLoadingProgress(); MessageBox.Show("A frequência de datas deve ser informada em todas as escalas da planilha.\nFavor verificar a planilha de importação."); return; } CompleteWithPeriodicWorkSchedule(workScheduleList, ref hasError); if (hasError || (IsUpdatingWorkSchedule && !ValidateUpdatingWorkSchedule())) { DisableLoadingProgress(); return; } } else { WorkScheduleImported.WorkScheduleForUnitList = workScheduleList; } ReportValidation = new ReportValidationModel(); ReportValidationBusiness.UpdateReportValidation(WorkScheduleImported, _workShiftList, agencyId, ReportValidation); if (IsUpdatingWorkSchedule) { this.ReportValidation.ReportValidationItemList.RemoveAll( r => r.WorkScheduleValidationType == WorkScheduleValidationType.CONFLICT_WITH_PREVIOUS_DATA || r.WorkScheduleValidationType == WorkScheduleValidationType.DATA_SHOULD_BE_FILLED || r.WorkScheduleValidationType == WorkScheduleValidationType.INVALID_CREW_FORMATION); } EnableImporting = !ReportValidationBusiness.AreThereErrorMessages(this.ReportValidation); } catch (SheetNotFoundException exception) { WorkScheduleImported.WorkScheduleForUnitList = new List <WorkScheduleForUnitModel>(); ReportValidation = new ReportValidationModel(); EnableImporting = false; ReportValidation.AddReportItem(WorkScheduleValidationType.SHEET_NAME_NOT_FOUND, WorkScheduleImportTemplateModel.WORK_SCHEDULE_MAIN_SHEET_NAME.ToUpper()); } catch (Exception exception) { WorkScheduleImported.WorkScheduleForUnitList = new List <WorkScheduleForUnitModel>(); ReportValidation = new ReportValidationModel(); EnableImporting = false; MessageBox.Show(String.Format("Erro durante a validação do arquivo: {0}", exception.Message)); //ShowMessage(String.Format("Erro durante a validação do arquivo: {0}", exception.Message)); return; } finally { DisableLoadingProgress(); } }