)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Home » Code Library » Category (Ia.Simple.Cl.Models.Data.SmartDeals)

Public general use code classes and xml files that we've compiled and used over the years:

    1: using System;
    2: using System.Collections.Generic;
    3: using System.IO;
    4: using System.Linq;
    5: using System.Reflection;
    6: using System.Xml.Linq;
    7:  
    8: namespace Ia.Simple.Cl.Models.Data.SmartDeals
    9: {
   10:     ////////////////////////////////////////////////////////////////////////////
   11:  
   12:     /// <summary publish="true">
   13:     ///
   14:     /// </summary>
   15:     /// 
   16:     /// <remarks> 
   17:     /// Copyright © 2006-2025 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   18:     ///
   19:     /// This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
   20:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   21:     ///
   22:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   23:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   24:     /// 
   25:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   26:     /// 
   27:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   28:     /// </remarks> 
   29:     public class Category
   30:     {
   31:         private static List<Category> list;
   32:  
   33:         private static readonly object objectLock = new object();
   34:  
   35:         /// <summary/>
   36:         public int Id { get; set; }
   37:  
   38:         /// <summary/>
   39:         public string ArabicName { get; set; }
   40:  
   41:         /// <summary/>
   42:         public virtual ICollection<Product> Products
   43:         {
   44:             get
   45:             {
   46:                 return (from p in Ia.Simple.Cl.Models.Data.SmartDeals.Product.List where p.Category == this select p).ToList();
   47:             }
   48:         }
   49:  
   50:         /// <summary/>
   51:         public Category() { }
   52:  
   53:         ////////////////////////////////////////////////////////////////////////////
   54:  
   55:         /// <summary>
   56:         /// 
   57:         /// </summary>
   58:         public static List<Category> List
   59:         {
   60:             get
   61:             {
   62:                 if (list == null || list.Count == 0)
   63:                 {
   64:                     lock (objectLock)
   65:                     {
   66:                         list = new List<Category>();
   67:  
   68:                         foreach (XElement xe in Ia.Simple.Cl.Models.Data.SmartDeals.Default.XDocument.Element("smartDeals").Elements("categories").Elements("category"))
   69:                         {
   70:                             var category = new Category();
   71:  
   72:                             category.Id = int.Parse(xe.Attribute("id").Value);
   73:                             category.ArabicName = xe.Attribute("arabicName").Value;
   74:  
   75:                             list.Add(category);
   76:                         }
   77:                     }
   78:                 }
   79:  
   80:                 return list;
   81:             }
   82:         }
   83:  
   84:         ////////////////////////////////////////////////////////////////////////////
   85:         ////////////////////////////////////////////////////////////////////////////
   86:     }
   87:  
   88:     ////////////////////////////////////////////////////////////////////////////
   89:     ////////////////////////////////////////////////////////////////////////////
   90: }