Esempio n. 1
0
        public ViewModelAlergicAnevrizmList(NavigationController controller) : base(controller)
        {
            VisOfNothingFaund = Visibility.Collapsed;
            MessageBus.Default.Subscribe("SetClearAlergicAnevrizmList", SetClear);
            MessageBus.Default.Subscribe("SetAlergicAnevrizmListBecauseOFEdit", SetDRecomendationListBecauseOFEdit);
            TextOFNewType = "Новый анамнез";
            HeaderText    = "Аллергологический анамнез";
            AddButtonText = "Другой аллергологический анамнез";

            DataSourceList = new ObservableCollection <AlergicAnevrizmListDataSource>();
            foreach (var RecomendationsType in Data.AlergicAnevrizm.GetAll)
            {
                DataSourceList.Add(new AlergicAnevrizmListDataSource(RecomendationsType));
            }

            ToPhysicalCommand = new DelegateCommand(
                () =>
            {
                FilterText = "";
                ObservableCollection <AlergicAnevrizmListDataSource> DataSourceListBuffer = new ObservableCollection <AlergicAnevrizmListDataSource>();
                foreach (var Data in FullCopy)
                {
                    if (Data.IsChecked == true)
                    {
                        DataSourceListBuffer.Add(Data);
                    }
                }
                MessageBus.Default.Call("SetAlergicAnevrizmListList", this, DataSourceListBuffer);
                Controller.NavigateTo <ViewModelAdditionalInfoPatient>();
            }
                );
            SaveChangesCommand = new DelegateCommand(
                () =>
            {
                Controller.NavigateTo <ViewModelAdditionalInfoPatient>();
            }
                );



            CurrentPanelViewModel = new AlergicAnevrizmPanelViewModel(this);
            OpenCommand           = new DelegateCommand(() =>
            {
                CurrentPanelViewModel.ClearPanel();
                CurrentPanelViewModel.PanelOpened = true;
            });

            SaveCommand = new DelegateCommand(() =>
            {
                FilterText  = "";
                var newType = CurrentPanelViewModel.GetPanelType();
                if (!string.IsNullOrWhiteSpace(newType.Str))
                {
                    CurrentPanelViewModel.PanelOpened = false;

                    Handled = false;

                    Data.AlergicAnevrizm.Add((newType));

                    Data.Complete();
                    var DataSourceListbuf = DataSourceList;
                    DataSourceList        = new ObservableCollection <AlergicAnevrizmListDataSource>();
                    FullCopy  = new List <AlergicAnevrizmListDataSource>();
                    bool test = true;
                    foreach (var HirurgInterupType in Data.AlergicAnevrizm.GetAll)
                    {
                        foreach (var x in DataSourceList)
                        {
                            if (x.Data.Str == HirurgInterupType.Str)
                            {
                                test = false;
                            }
                        }
                        if (test)
                        {
                            DataSourceList.Add(new AlergicAnevrizmListDataSource(HirurgInterupType));
                            FullCopy.Add(new AlergicAnevrizmListDataSource(HirurgInterupType));
                        }
                    }

                    foreach (var DiagnosisType in DataSourceListbuf)
                    {
                        if (DiagnosisType.IsChecked.Value)
                        {
                            DataSourceList.Where(s => s.Data.Id == DiagnosisType.Data.Id).ToList()[0].IsChecked = true;
                        }
                    }

                    Controller.NavigateTo <ViewModelAlergicAnevrizmList>();
                }
                else
                {
                    MessageBox.Show("Не все поля заполнены");
                }
            });
            RevertCommand = new DelegateCommand(() =>
            {
                CurrentPanelViewModel.PanelOpened = false;
                Handled = false;
            });
        }
        public ViewModelAnticogulanyList(NavigationController controller) : base(controller)
        {
            MessageBus.Default.Subscribe("SetClearAnticogulanyList", SetClear);
            MessageBus.Default.Subscribe("SetAlergicAnticogulanyBecauseOFEdit", SetDRecomendationListBecauseOFEdit);
            TextOFNewType = "Новый антикогулянт";
            HeaderText    = "Антикогулянт";
            AddButtonText = "Другой антикогулянт";

            DataSourceList = new ObservableCollection <AnticogulanyListDataSource>();
            foreach (var RecomendationsType in Data.Anticogulants.GetAll)
            {
                DataSourceList.Add(new AnticogulanyListDataSource(RecomendationsType));
            }

            ToPhysicalCommand = new DelegateCommand(
                () =>
            {
                ObservableCollection <AnticogulanyListDataSource> DataSourceListBuffer = new ObservableCollection <AnticogulanyListDataSource>();
                foreach (var Data in DataSourceList)
                {
                    if (Data.IsChecked == true)
                    {
                        DataSourceListBuffer.Add(Data);
                    }
                }
                MessageBus.Default.Call("SetAnticogulantList", this, DataSourceListBuffer);
                Controller.NavigateTo <ViewModelAddEpicriz>();
            }
                );
            SaveChangesCommand = new DelegateCommand(
                () =>
            {
                Controller.NavigateTo <ViewModelAddEpicriz>();
            }
                );



            CurrentPanelViewModel = new AlergicAnevrizmPanelViewModel(this);
            OpenCommand           = new DelegateCommand(() =>
            {
                CurrentPanelViewModel.ClearPanel();
                CurrentPanelViewModel.PanelOpened = true;
            });

            SaveCommand = new DelegateCommand(() =>
            {
                var newType = CurrentPanelViewModel.GetPanelType();
                if (!string.IsNullOrWhiteSpace(newType.Str))
                {
                    CurrentPanelViewModel.PanelOpened = false;

                    Handled = false;

                    Data.AlergicAnevrizm.Add((newType));

                    Data.Complete();
                    var DataSourceListbuf = DataSourceList;
                    DataSourceList        = new ObservableCollection <AnticogulanyListDataSource>();
                    FullCopy = new List <AnticogulanyListDataSource>();
                    foreach (var HirurgInterupType in Data.Anticogulants.GetAll)
                    {
                        DataSourceList.Add(new AnticogulanyListDataSource(HirurgInterupType));
                        FullCopy.Add(new AnticogulanyListDataSource(HirurgInterupType));
                    }

                    foreach (var DiagnosisType in DataSourceListbuf)
                    {
                        if (DiagnosisType.IsChecked.Value)
                        {
                            DataSourceList.Where(s => s.Data.Id == DiagnosisType.Data.Id).ToList()[0].IsChecked = true;
                        }
                    }

                    Controller.NavigateTo <ViewModelAlergicAnevrizmList>();
                }
                else
                {
                    MessageBox.Show("Не все поля заполнены");
                }
            });
            RevertCommand = new DelegateCommand(() =>
            {
                CurrentPanelViewModel.PanelOpened = false;
                Handled = false;
            });
        }