Esempio n. 1
0
        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());
        }