// The binding parameter is an ImportedFile public void ExecuteAddFileCommand() { bool containsExistingDataSets = false; if (SelectedImportedFile == null) { return; } if (SelectedImportedFile.RowType != ImportedFileRowTypes.Normal) { return; } if (WebsiteViewModel.Website.Datasets.Any()) { containsExistingDataSets = true; } WebsiteDatasets.Add(SelectedImportedFile); //var count = WebsiteViewModel.Website.Datasets.Count(); if (containsExistingDataSets) { Application.DoEvents(); Events.GetEvent <GenericNotificationEvent>().Publish("Dataset added. Please be sure to make relevant measure and report selections as you proceed"); } //Events.GetEvent<SelectedItemsForNewlyAddedDatasets>().Publish(true); // ??? SelectedImportedFile.IsSelected = WebsiteDatasets.Count > 0; // copy it before removing, then set selected to [0], then remove copy var temp = SelectedImportedFile; // always select the special row SelectedImportedFile = ImportedFiles[0]; ImportedFiles.Remove(temp); // If no more normal files remain, replace the special Please item with the special All item if (!ImportedFiles.Any(f => f.RowType == ImportedFileRowTypes.Normal)) { ImportedFiles[0].RowType = ImportedFileRowTypes.AllFilesAdded; } Manager.IsNewDatasetIncluded = true; var datasetType = SelectedImportedFile.DataSetFile.Name; Manager.IsTrendingYearUpdated = !string.IsNullOrEmpty(datasetType) && (datasetType.Contains("Inpatient Discharge") || datasetType.Contains("ED Treat And Release")); }
// The binding parameter is an ImportedFile public void ExecuteRemoveFileCommand(object param) { var file = param as IImportedFile; if (file == null) { return; } WebsiteDatasets.Remove(file); ImportedFiles.Add(file); // now there is at least 1 normal file in the dropdown, so show the Please message ImportedFiles[0].RowType = ImportedFileRowTypes.PleaseSelect; // always select the special row SelectedImportedFile = ImportedFiles[0]; // ??? file.IsSelected = WebsiteDatasets.Count > 0; Manager.IsNewDatasetIncluded = true; string datasetTypeName = null; if (file.DataSetFile.Dataset == null || file.DataSetFile.Dataset.ContentType == null) { var provider = ServiceLocator.Current.GetInstance <IDomainSessionFactoryProvider>(); using (var session = provider.SessionFactory.OpenStatelessSession()) { datasetTypeName = session.Query <Dataset>() .Where(d => d.Id == file.DataSetFile.DatasetId) .Select(d => d.ContentType.Name) .FirstOrDefault(); } } else { datasetTypeName = file.DataSetFile.Dataset.ContentType.Name; } Manager.IsTrendingYearUpdated = !string.IsNullOrEmpty(datasetTypeName) && (datasetTypeName.Contains("Inpatient Discharge") || datasetTypeName.Contains("ED Treat And Release")); }