Exemple #1
0
        /// <summary>
        /// Ctor with parameters
        /// </summary>
        /// <param name="name">Name</param>
        /// <param name="printDate">Pront Date</param>
        /// <param name="baseCategory">Base category</param>
        /// <param name="innerCategory">Inner category</param>
        public AbstractItem
        (
            string name,
            DateTime printDate,
            eBaseCategory baseCategory,
            eInnerCategory innerCategory
        )
        {
            ISBN = Guid.NewGuid();
            if (name != null)
            {
                _name = name;
            }
            if (printDate != null)
            {
                _printDate = printDate;
            }

            /////////////   CHECK THE CATEGORIES Validity  //////////////
            if (Categories.CategoriesDictionary.ContainsKey(baseCategory))
            {
                var catList = Categories.CategoriesDictionary.FirstOrDefault(p => p.Key == baseCategory);
                if (catList.Value.Contains(innerCategory))
                {
                    BaseCategory  = baseCategory;
                    InnerCategory = innerCategory;
                }
            }
            /////////////   CHECK THE CATEGORIES Validity  //////////////

            PrintDate = printDate;
        }
 /// <summary>
 /// Find Items by Inner category which taken from
 /// relative Base category by Categories dictionary
 /// </summary>
 /// <param name="baseCategory">eBaseCategory Enum</param>
 /// <param name="innerCategory">eInnerCategory Enum</param>
 /// <returns>List of the AbstractItem's found</returns>
 public List <AbstractItem> FindInnerByBaseCategory(eBaseCategory baseCategory,
                                                    eInnerCategory innerCategory)
 {
     return(Items.Where(i => i.BaseCategory == baseCategory && i.InnerCategory == innerCategory).ToList());
 }
 /// <summary>
 /// Find Items by Base category
 /// </summary>
 /// <param name="baseCategory">eBaseCategory Enum</param>
 /// <returns>List of the AbstractItem's found</returns>
 public List <AbstractItem> FindByBaseCategory(eBaseCategory baseCategory)
 {
     return(Items.Where(i => i.BaseCategory == baseCategory).ToList());
 }