شركة التطبيقات المتكاملة لتصميم النظم البرمجية الخاصة

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » ServiceRequestType

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

Service Request Type support class of Next Generation Network'a (NGN's) business model.

   1:  using System.Collections.Generic;
   2:  using System.Linq;
   3:  using System.Data;
   4:   
   5:  namespace Ia.Ngn.Cl.Model.Business
   6:  {
   7:      ////////////////////////////////////////////////////////////////////////////
   8:   
   9:      /// <summary publish="true">
  10:      /// Service Request Type support class of Next Generation Network'a (NGN's) business model.
  11:      /// </summary>
  12:      /// 
  13:      /// <remarks> 
  14:      /// Copyright © 2006-2019 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet Applications - Kuwait. All Rights Reserved.
  15:      ///
  16:      /// 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
  17:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  18:      ///
  19:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  20:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  21:      /// 
  22:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  23:      /// 
  24:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  25:      /// </remarks> 
  26:      public partial class ServiceRequestType
  27:      {
  28:          /// <summary/>
  29:          public ServiceRequestType() { }
  30:   
  31:          ////////////////////////////////////////////////////////////////////////////
  32:   
  33:          /// <summary>
  34:          ///
  35:          /// </summary>
  36:          public static List<int> ChangedNumberList()
  37:          {
  38:              List<int> numberList;
  39:              List<string> stringNumberList;
  40:   
  41:              numberList = new List<int>();
  42:   
  43:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
  44:              {
  45:                  stringNumberList = (from srt in db.ServiceRequestTypes where srt.TypeId == 11 select srt.Value).ToList();
  46:              }
  47:   
  48:              if (stringNumberList.Count > 0)
  49:              {
  50:                  foreach (string u in stringNumberList)
  51:                  {
  52:                      if (int.TryParse(u, out int i)) numberList.Add(i);
  53:                  }
  54:              }
  55:              else
  56:              {
  57:              }
  58:   
  59:              return numberList;
  60:          }
  61:   
  62:          ////////////////////////////////////////////////////////////////////////////
  63:   
  64:          /// <summary>
  65:          ///
  66:          /// </summary>
  67:          public static List<int> ChangedNumberList(List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList)
  68:          {
  69:              int i;
  70:              List<int> numberList;
  71:              List<string> stringNumberList;
  72:   
  73:              numberList = new List<int>();
  74:              stringNumberList = (from srt in serviceRequestTypeList where srt.TypeId == 11 select srt.Value).ToList();
  75:   
  76:              if (stringNumberList.Count > 0)
  77:              {
  78:                  foreach (string u in stringNumberList)
  79:                  {
  80:                      if (int.TryParse(u, out i)) numberList.Add(i);
  81:                  }
  82:              }
  83:              else
  84:              {
  85:              }
  86:   
  87:              return numberList;
  88:          }
  89:   
  90:          ////////////////////////////////////////////////////////////////////////////
  91:   
  92:          /// <summary>
  93:          ///
  94:          /// </summary>
  95:          public static Ia.Ngn.Cl.Model.Access ExtractAccess(int serviceRequestId, List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList)
  96:          {
  97:              Ia.Ngn.Cl.Model.Access access;
  98:              List<Ia.Ngn.Cl.Model.ServiceRequestType> subtypeSrtList;
  99:   
 100:              subtypeSrtList = (from srt in serviceRequestTypeList where srt.ServiceRequest.Id == serviceRequestId select srt).ToList();
 101:   
 102:              access = ExtractAccess(subtypeSrtList);
 103:   
 104:              return access;
 105:          }
 106:   
 107:          ////////////////////////////////////////////////////////////////////////////
 108:   
 109:          /// <summary>
 110:          ///
 111:          /// </summary>
 112:          private static Ia.Ngn.Cl.Model.Access ExtractAccess(List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList)
 113:          {
 114:              int oltId, ponNumber, ontNumber;
 115:              Dictionary<int, string> typeDictionary;
 116:              Ia.Ngn.Cl.Model.Access access;
 117:   
 118:              typeDictionary = TypeDictionary(serviceRequestTypeList);
 119:   
 120:              Ia.Ngn.Cl.Model.Business.Default.ExtractAccessNameWithValidSymbolAndLegalFormatForPonAndOntFromDictionaryValueList(typeDictionary, out oltId, out ponNumber, out ontNumber);
 121:   
 122:              access = Ia.Ngn.Cl.Model.Data.Access.Read(oltId, ponNumber, ontNumber);
 123:   
 124:              return access;
 125:          }
 126:   
 127:          ////////////////////////////////////////////////////////////////////////////
 128:   
 129:          /// <summary>
 130:          ///
 131:          /// </summary>
 132:          public static Ia.Ngn.Cl.Model.Access ExtractAccess(Ia.Ngn.Cl.Model.Ngn db, string value)
 133:          {
 134:              int oltId, ponNumber, ontNumber;
 135:              Dictionary<int, string> typeDictionary;
 136:              Ia.Ngn.Cl.Model.Access access;
 137:   
 138:              typeDictionary = new Dictionary<int, string>(1);
 139:              typeDictionary.Add(1, value);
 140:   
 141:              Ia.Ngn.Cl.Model.Business.Default.ExtractAccessNameWithValidSymbolAndLegalFormatForPonAndOntFromDictionaryValueList(typeDictionary, out oltId, out ponNumber, out ontNumber);
 142:   
 143:              access = Ia.Ngn.Cl.Model.Data.Access.Read(db, oltId, ponNumber, ontNumber);
 144:   
 145:              return access;
 146:          }
 147:   
 148:          ////////////////////////////////////////////////////////////////////////////
 149:   
 150:          /// <summary>
 151:          ///
 152:          /// </summary>
 153:          public static Dictionary<int, string> TypeDictionary(List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList)
 154:          {
 155:              Dictionary<int, string> typeDictionary;
 156:   
 157:              typeDictionary = new Dictionary<int, string>(63); // <serviceRequestType> <typeList> <type> has about 63 types max
 158:   
 159:              foreach (Ia.Ngn.Cl.Model.ServiceRequestType serviceRequestType in serviceRequestTypeList)
 160:              {
 161:                  typeDictionary.Add(serviceRequestType.TypeId, serviceRequestType.Value);
 162:              }
 163:   
 164:              return typeDictionary;
 165:          }
 166:   
 167:          ////////////////////////////////////////////////////////////////////////////    
 168:          ////////////////////////////////////////////////////////////////////////////    
 169:      }
 170:   
 171:      ////////////////////////////////////////////////////////////////////////////
 172:      ////////////////////////////////////////////////////////////////////////////
 173:  }