コード例 #1
0
        /// <summary>
        /// Saves the mapping.
        /// </summary>
        private void SaveMapping()
        {
            ConfigurationService.HospitalRegion.AddStates(SelectedStates.OfType <SelectListItem>().Select(item => item.Text).ToArray(), true);

            ConfigurationService.HospitalRegion.SelectedRegionType = SelectedRegionType;
            ConfigurationService.Save();

            MonahrqContext.ReportingStatesContext = SelectedStates.OfType <SelectListItem>().Select(item => item.Text).ToList();
            MonahrqContext.SelectedRegionType     = SelectedRegionType;

            if (SelectedRegionType != typeof(CustomRegion))
            {
                var sessionProvider = ServiceLocator.Current.GetInstance <IDomainSessionFactoryProvider>();
                //Task.Factory.StartNew(() =>
                //    {
                try
                {
                    ClearRegions(sessionProvider, SelectedRegionType,
                                 SelectedStates.OfType <SelectListItem>().ToArray());
                }
                catch (Exception exc)
                {
                    Logger.Write(exc);
                }
                //});
            }
        }
コード例 #2
0
        /// <summary>
        /// Refreshes this instance.
        /// </summary>
        public void Refresh()
        {
            var configService = ServiceLocator.Current.GetInstance <IConfigurationService>();

            ReferenceExists     = !IsInitialMapping;
            CurrentMappingBasis = configService.HospitalRegion;
            if (SelectedStates != null)
            {
                SelectedStates.OfType <SelectListItem>().ToList().ForEach(OnRemoveStateCommand);
            }
            RaisePropertyChanged(() => SelectedStates);
            CurrentMappingBasis.DefaultStates
            .OfType <string>()
            .ToList()
            .ForEach(ab =>
            {
                var toAdd = AvailableStates.OfType <SelectListItem>().FirstOrDefault(kvp => kvp.Value != null && kvp.Value.ToString().EqualsIgnoreCase(ab));
                if (toAdd != null)
                {
                    AddStateToContext(toAdd);
                }
            });
            RaisePropertyChanged(() => AvailableStates);
            SelectedRegionType = CurrentMappingBasis.SelectedRegionType ?? typeof(object);
            RaisePropertyChanged(() => SelectedRegionType);
        }
コード例 #3
0
        public override RouteModifier OnNext()
        {
            //next step is
            Context.ContextStates     = SelectedStates.OfType <State>();
            Context.ContextRegionType = RegionTypes.CurrentItem as Type;
            Context.LoadData();

            DataContextObject.Reset();
            return(base.OnNext());
        }