public override Theme.Controls.Wizard.Helpers.RouteModifier OnNext() { MonahrqContext.CheckIfConnectedToInternet(); var abbvStates = AvailableStates.Where(x => x.IsSelected).Select(x => ((EntityViewModel <State, int>)x.Model).Data).Distinct(); //if (!HospitalRegion.Default.IsDefined) // HospitalRegion.Default.SelectedRegionType = typeof(CustomRegion); // HospitalRegion.Default.DefaultStates = new StringCollection(); //var contextStates = HospitalRegion.Default.SelectedStates.ToList(); var selectedStates = abbvStates as List <State> ?? abbvStates.ToList(); //selectedStates.ForEach(s => // { // //if (contextStates.All(s1 => s1.Abbreviation != s.Abbreviation)) // //{ // // contextStates.Add(s); // //} // }); //HospitalRegion.Default.DefaultStates.AddRange(selectedStates.Select(x => x.Abbreviation).ToArray()); //HospitalRegion.Default.SelectedStates = contextStates.ToList(); //HospitalRegion.Default.Save(); DataContextObject.DatasetItem.File = Title; DataContextObject.DatasetItem.DateImported = DateTime.Now; if (DataContextObject.DatasetItem.IsPersisted) { DataContextObject.DatasetItem.IsFinished = true; } DataContextObject.DatasetItem.ProviderStates = string.Join(",", selectedStates.Select(x => x.Abbreviation).ToArray()); DataContextObject.DatasetItem.UseRealtimeData = PhysicianManagementOption[1] == SelectedManagement; // TODO: we might not need to call Save until the Wizard finishes, but if not, we'll need to set ContentType and CurrentContentItem anyway. DataContextObject.SaveImportEntry(DataContextObject.DatasetItem); DataContextObject.File = new FileProgress { FileName = SelectedFile, LinesDone = 0, PercentComplete = 0, TotalLines = 0, }; DataContextObject.SelectedStates = AvailableStates.Where(x => x.IsSelected).Select(x => x.Value.ToString()).ToList(); DataContextObject.IsPhysicianManagedInMONAHRQ = PhysicianManagementOption[0] == SelectedManagement; return(base.OnNext()); }
public SelectSourceViewModel(WizardContext context) : base(context) { BaseDataService = ServiceLocator.Current.GetInstance <IBaseDataService>(); EventAggregator = ServiceLocator.Current.GetInstance <IEventAggregator>(); ConfigurationService = ServiceLocator.Current.GetInstance <IConfigurationService>(); SelectFileCommand = new DelegateCommand(SelectFile); DeleteFileCommand = new DelegateCommand <string>(DeleteFile); if (!DataContextObject.ExistingDatasetId.HasValue || DataContextObject.ExistingDatasetId.Value <= 0) { DataContextObject.DatasetItem = new Dataset(); } else { using (var session = DataContextObject.Provider.SessionFactory.OpenSession()) { DataContextObject.DatasetItem = session.Query <Dataset>() .FirstOrDefault(ds => ds.Id == DataContextObject.ExistingDatasetId) ?? new Dataset(); } } AvailableStates = BaseDataService.States(state => state.Name != null) .Where(x => x.Data != null) .Select(x => new SelectListItem { Text = x.Data.Name, Model = x, Value = x.Data.Abbreviation }).ToList(); SelectedManagement = PhysicianManagementOption[0]; PropertyChanged += (o, e) => { if (e.PropertyName.Equals("SelectedManagement")) { IsValid(); } }; MonahrqContext.CheckIfConnectedToInternet(); EventAggregator.GetEvent <InternetConnectionEvent>().Subscribe(e => { ShowInternetDropMessage = (e == ConnectionState.OffLine); }); }
public override bool IsValid() { if (string.IsNullOrEmpty(Title) || AvailableStates.All(x => !x.IsSelected) || Title.Length >= 200) { return(false); } if (!MonahrqContext.CheckIfConnectedToInternet()) { return(false); } //if (!SelectedManagement.EqualsIgnoreCase(RealTimeManagement)) return false; return(true); }