Exemple #1
0
        static internal Vocabulary GetVocabulary(this Term term, int vocabularyId)
        {
            IVocabularyController ctl = CommonLibrary.Entities.Content.Common.Util.GetVocabularyController();

            return((from v in ctl.GetVocabularies()
                    where v.VocabularyId == vocabularyId
                    select v)
                   .SingleOrDefault());
        }
Exemple #2
0
        public static IVocabularyController GetVocabularyController()
        {
            IVocabularyController ctl = ComponentFactory.GetComponent <IVocabularyController>();

            if (ctl == null)
            {
                ctl = new VocabularyController();
                ComponentFactory.RegisterComponentInstance <IVocabularyController>(ctl);
            }
            return(ctl);
        }
        public CreateVocabularyPresenter(ICreateVocabularyView createView, IVocabularyController vocabularyController, IScopeTypeController scopeTypeController) : base(createView)
        {
            Requires.NotNull("vocabularyController", vocabularyController);
            Requires.NotNull("scopeTypeController", scopeTypeController);

            _vocabularyController = vocabularyController;
            _scopeTypeController  = scopeTypeController;

            View.Save            += Save;
            View.Model.Vocabulary = GetVocabulary();
        }
        public EditVocabularyPresenter(IEditVocabularyView editView, IVocabularyController vocabularyController, ITermController termController) : base(editView)
        {
            Requires.NotNull("vocabularyController", vocabularyController);
            Requires.NotNull("termController", termController);

            _vocabularyController = vocabularyController;
            _termController       = termController;

            View.AddTerm    += AddTerm;
            View.CancelTerm += CancelTerm;
            View.Delete     += DeleteVocabulary;
            View.DeleteTerm += DeleteTerm;
            View.Save       += SaveVocabulary;
            View.SaveTerm   += SaveTerm;
            View.SelectTerm += SelectTerm;
        }
Exemple #5
0
        /// <summary>
        /// Gets the terms by vocabulary name.
        /// </summary>
        /// <param name="vocabularyName">Name of the vocabulary.</param>
        /// <returns>term collection</returns>
        /// <exception cref="System.ArgumentException">vocabularyName is empty.</exception>
        public IQueryable <Term> GetTermsByVocabulary(string vocabularyName)
        {
            //Argument Contract
            Requires.NotNullOrEmpty("vocabularyName", vocabularyName);

            IVocabularyController vocabularyController = Util.GetVocabularyController();
            Vocabulary            vocabulary           = (vocabularyController.GetVocabularies()
                                                          .Cast <Vocabulary>().Where(v => v.Name == vocabularyName))
                                                         .SingleOrDefault();

            if (vocabulary == null)
            {
                throw new ArgumentException("Vocabulary does not exist.", "vocabularyName");
            }

            return(GetTermsByVocabulary(vocabulary.VocabularyId));
        }
        /// <summary>
        /// Gets the vocabulary.
        /// </summary>
        /// <param name="term">The term.</param>
        /// <param name="vocabularyId">The vocabulary id.</param>
        /// <returns>Vocabulary</returns>
        internal static Vocabulary GetVocabulary(this Term term, int vocabularyId)
        {
            IVocabularyController ctl = Util.GetVocabularyController();

            return((from v in ctl.GetVocabularies() where v.VocabularyId == vocabularyId select v).SingleOrDefault());
        }
        public VocabularyListPresenter(IVocabularyListView listView, IVocabularyController vocabularyController) : base(listView)
        {
            Requires.NotNull("vocabularyController", vocabularyController);

            _vocabularyController = vocabularyController;
        }
 public VocabularyNameValidator(IVocabularyController vocabularyController)
 {
     _vocabularyController = vocabularyController;
 }
Exemple #9
0
 public VocabularyNameValidator(IVocabularyController vocabularyController)
 {
     _vocabularyController = vocabularyController;
 }