public CriteriaGroupEditorViewModel(CriteriaGroup group)
        {
            this.crgroup = group;

            Criteria = new ObservableCollection <CriterionEditorViewModel>();

            CriteriaGroup = new CriteriaGroupViewModel(crgroup);
            tester        = new ExistanceTester <CriteriaGroup>(crgroup, CriteriaGroup, Session);
            tester.Test();

            (crgroup as IEditableObject).BeginEdit();

            Title          = "Редактор группы критериев";
            HelpTopic      = "";
            WithHelpButton = false;
        }
Пример #2
0
        public WordEditorViewModel(Word word)
        {
            Contract.Requires(word != null);

            this.word = word;
            oldTitle  = word.Title;
            (word as IEditableObject).BeginEdit();

            Word = new WordViewModel(word);
            //Нельзя ввести слово, которое уже есть в словарях врача.
            tester = new ExistanceTester <Word>(word, Word, Session,
                                                extraTest: w => AuthorityController.CurrentDoctor.Words.Contains(w));
            tester.Test();

            Title          = "Редактирование слова";
            HelpTopic      = "addword";
            WithHelpButton = true;
        }
Пример #3
0
        public VocabularyEditorViewModel(Vocabulary voc)
        {
            Contract.Requires(voc != null);

            this.voc = voc;
            (voc as IEditableObject).BeginEdit();

            Templates        = new ObservableCollection <string>();
            TooLongTemplates = new ObservableCollection <string>();

            Vocabulary = new VocabularyViewModel(voc);
            tester     = new ExistanceTester <Vocabulary>(voc, Vocabulary, Session);
            tester.Test();

            Title          = "Редактор словаря";
            HelpTopic      = "editVocabulary";
            WithHelpButton = false;

            TemplatesString = string.Join(Environment.NewLine, voc.GetOrderedTemplateTitles());
        }
Пример #4
0
        public CriterionEditorViewModel(Criterion cr)
        {
            this.criterion = cr;
            loader         = new JsonOptionsLoader();

            QueryEditor = new QueryEditorViewModel(Session);

            Criterion = new CriterionViewModel(criterion);
            tester    = new ExistanceTester <Criterion>(cr, Criterion, Session);
            tester.Test();

            var opt = loader.ReadOptions(criterion.Options, Session);

            QueryEditor.SetOptions(opt);

            (criterion as IEditableObject).BeginEdit();

            Title          = "Редактор критерия";
            HelpTopic      = "editcriterion";
            WithHelpButton = false;
        }
Пример #5
0
        public SpecialityEditorViewModel(Speciality spec)
        {
            Contract.Requires(spec != null);
            this.spec           = spec;
            spec.BlocksChanged += spec_BlocksChanged;
            spec.VocsChanged   += spec_VocsChanged;
            blocksBeforeEdit    = new List <IcdBlock>(spec.IcdBlocks);

            (spec as IEditableObject).BeginEdit();

            Chapters     = new AsyncObservableCollection <DiagnosisViewModel>();
            SpecChapters = new AsyncObservableCollection <DiagnosisViewModel>();
            AllVocs      = new ObservableCollection <VocabularyViewModel>();
            SpecVocs     = new ObservableCollection <VocabularyViewModel>();

            Speciality = new SpecialityViewModel(spec);
            tester     = new ExistanceTester <Speciality>(spec, Speciality, Session);
            tester.Test();

            CreateDiagnosisSearch();
            DiagnosisSearch.Filter.Clear();
            SpecDiagnosisSearch.Filter.Clear();

            VocabularyQuery.NonCustom(Session)()
            .ForAll(x =>
            {
                if (x.Specialities.Contains(spec))
                {
                    SpecVocs.Add(new VocabularyViewModel(x));
                }
                else
                {
                    AllVocs.Add(new VocabularyViewModel(x));
                }
            });

            Title          = "Редактор специальности";
            HelpTopic      = "editspeciality";
            WithHelpButton = false;
        }
Пример #6
0
        public UomEditorViewModel(Uom uom)
        {
            Contract.Requires(uom != null);
            this.uom = uom;

            Types   = new List <UomType>(EntityQuery <UomType> .All(Session)());
            Formats = new ObservableCollection <UomFormat>(uom.Formats);

            (uom as IEditableObject).BeginEdit();
            Uom        = new UomViewModel(uom);
            Uom.IsBase = false; // не делать новые единицы базовыми по умолчанию

            // Нельзя добавить единицу с таким же описанием или обозначением в группе.
            var customEqTest = (Expression <Func <Uom, bool> >)((x) => (x.Description == uom.Description || x.Abbr == uom.Abbr) && x.Type == uom.Type);

            tester = new ExistanceTester <Uom>(uom, Uom, Session, customEqTest);
            tester.Test();

            Title          = "Единица";
            HelpTopic      = "edituom";
            WithHelpButton = false;
        }