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

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.Wa.Models.Data
    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 Portfolio
   30:     {
   31:         private static XDocument xd;
   32:         private static List<Portfolio> portfolioList;
   33:  
   34:         ////////////////////////////////////////////////////////////////////////////
   35:  
   36:         /// <summary>
   37:         /// 
   38:         /// </summary>
   39:         public string Title { get; set; }
   40:  
   41:         ////////////////////////////////////////////////////////////////////////////
   42:  
   43:         /// <summary>
   44:         /// 
   45:         /// </summary>
   46:         public string Description { get; set; }
   47:  
   48:         ////////////////////////////////////////////////////////////////////////////
   49:  
   50:         /// <summary>
   51:         /// 
   52:         /// </summary>
   53:         public string Technology { get; set; }
   54:  
   55:         ////////////////////////////////////////////////////////////////////////////
   56:  
   57:         /// <summary>
   58:         /// 
   59:         /// </summary>
   60:         public string CaptureImage { get; set; }
   61:  
   62:         ////////////////////////////////////////////////////////////////////////////
   63:  
   64:         /// <summary>
   65:         /// 
   66:         /// </summary>
   67:         public string NavigateUrl { get; set; }
   68:  
   69:         ////////////////////////////////////////////////////////////////////////////
   70:  
   71:         /// <summary>
   72:         /// 
   73:         /// </summary>
   74:         public Portfolio() { }
   75:  
   76:         ////////////////////////////////////////////////////////////////////////////
   77:  
   78:         /// <summary>
   79:         /// 
   80:         /// </summary>
   81:         public static Portfolio Random
   82:         {
   83:             get
   84:             {
   85:                 int count = List.Count;
   86:  
   87:                 return List[Ia.Cl.Models.Default.Random(count)];
   88:             }
   89:         }
   90:  
   91:         ////////////////////////////////////////////////////////////////////////////
   92:  
   93:         /// <summary>
   94:         /// 
   95:         /// </summary>
   96:         public static List<Portfolio> NgossList
   97:         {
   98:             get
   99:             {
  100:                 return (from l in List where l.Technology.Contains("NGOSS") select l).ToList();
  101:             }
  102:         }
  103:  
  104:         ////////////////////////////////////////////////////////////////////////////
  105:  
  106:         /// <summary>
  107:         /// 
  108:         /// </summary>
  109:         public static List<Portfolio> TelegramList
  110:         {
  111:             get
  112:             {
  113:                 return (from l in List where l.Technology.Contains("Telegram") select l).ToList();
  114:             }
  115:         }
  116:  
  117:         ////////////////////////////////////////////////////////////////////////////
  118:  
  119:         /// <summary>
  120:         /// 
  121:         /// </summary>
  122:         public static List<Portfolio> WindowsFormApplicationList
  123:         {
  124:             get
  125:             {
  126:                 return (from l in List where l.Technology.Contains("WFA") select l).ToList();
  127:             }
  128:         }
  129:  
  130:         ////////////////////////////////////////////////////////////////////////////
  131:  
  132:         /// <summary>
  133:         /// 
  134:         /// </summary>
  135:         public static List<Portfolio> List
  136:         {
  137:             get
  138:             {
  139:                 if (portfolioList == null || portfolioList.Count == 0)
  140:                 {
  141:                     Portfolio portfolio;
  142:  
  143:                     portfolioList = new List<Portfolio>();
  144:  
  145:                     foreach (XElement xe in XDocument.Element("portfolio").Element("portfolioList").Elements("portfolio"))
  146:                     {
  147:                         portfolio = new Portfolio();
  148:  
  149:                         portfolio.Title = xe.Element("title").Value;
  150:                         portfolio.Description = xe.Element("description").Value;
  151:                         portfolio.Technology = xe.Element("technology").Value;
  152:                         portfolio.CaptureImage = xe.Element("captureImage").Value;
  153:                         portfolio.NavigateUrl = xe.Element("navigateUrl").Value;
  154:  
  155:                         portfolioList.Add(portfolio);
  156:                     }
  157:                 }
  158:  
  159:                 return portfolioList;
  160:             }
  161:         }
  162:  
  163:         ////////////////////////////////////////////////////////////////////////////
  164:  
  165:         /// <summary>
  166:         /// 1. Change the "Build Action" property of your XML file from "Content" to "Embedded Resource".
  167:         /// 2. Add "using System.Reflection".
  168:         /// 3. Manifest resource stream will start with the project namespace, the location of XML file.
  169:         /// 
  170:         /// </summary>
  171:  
  172:         private static XDocument XDocument
  173:         {
  174:             get
  175:             {
  176:                 Assembly assembly;
  177:                 StreamReader streamReader;
  178:  
  179:                 xd = null;
  180:                 assembly = Assembly.GetExecutingAssembly();
  181:                 streamReader = new StreamReader(assembly.GetManifestResourceStream("Ia.Wa.Models.Data.portfolio.xml"));
  182:  
  183:                 try
  184:                 {
  185:                     if (streamReader.Peek() != -1)
  186:                     {
  187:                         xd = System.Xml.Linq.XDocument.Load(streamReader);
  188:                     }
  189:                 }
  190:                 catch (Exception)
  191:                 {
  192:                 }
  193:                 finally
  194:                 {
  195:                 }
  196:  
  197:                 return xd;
  198:             }
  199:         }
  200:  
  201:         ////////////////////////////////////////////////////////////////////////////
  202:         ////////////////////////////////////////////////////////////////////////////
  203:     }
  204:  
  205:     ////////////////////////////////////////////////////////////////////////////
  206:     ////////////////////////////////////////////////////////////////////////////
  207: }