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

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:  using System;
   5:  using System.Globalization;
   6:   
   7:  namespace Ia.Ngn.Cl.Model.Business
   8:  {
   9:      ////////////////////////////////////////////////////////////////////////////
  10:   
  11:      /// <summary publish="true">
  12:      /// Service Request Type support class of Next Generation Network'a (NGN's) business model.
  13:      /// </summary>
  14:      /// 
  15:      /// <remarks> 
  16:      /// Copyright © 2006-2019 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet Applications - Kuwait. All Rights Reserved.
  17:      ///
  18:      /// 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
  19:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  20:      ///
  21:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  22:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  23:      /// 
  24:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  25:      /// 
  26:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  27:      /// </remarks> 
  28:      public partial class ServiceRequestType
  29:      {
  30:          /// <summary/>
  31:          public ServiceRequestType() { }
  32:   
  33:          ////////////////////////////////////////////////////////////////////////////    
  34:   
  35:          /// <summary>
  36:          ///
  37:          /// </summary>
  38:          public static string OracleSqlCommandForGivenDateTime(DateTime dateTime)
  39:          {
  40:              string sql;
  41:   
  42:              sql = @"select SRV_REQ_FIPER_TECH.SRV_REQ_ID, SRV_REQ_FIPER_TECH.TECH_TYPE_ID, SRV_REQ_FIPER_TECH.VAL from SRV_REQ_FIPER left outer join SRV_REQ_FIPER_TECH on SRV_REQ_FIPER_TECH.SRV_REQ_ID = SRV_REQ_FIPER.SRV_REQ_ID where REQ_DATE >= '" + dateTime.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture) + @"' and REQ_DATE < '" + dateTime.AddDays(1).ToString("dd/MM/yyyy", CultureInfo.InvariantCulture) + @"' and SRV_REQ_FIPER_TECH.SRV_REQ_ID is not null and SRV_REQ_FIPER_TECH.TECH_TYPE_ID is not null and SRV_REQ_FIPER_TECH.VAL is not null order by SRV_REQ_FIPER.SRV_REQ_ID asc";
  43:   
  44:              return sql;
  45:          }
  46:   
  47:          ////////////////////////////////////////////////////////////////////////////    
  48:   
  49:          /// <summary>
  50:          ///
  51:          /// </summary>
  52:          public static string OracleSqlCommandForServiceRequestIdRange(Tuple<int, int> startEndRange)
  53:          {
  54:              return OracleSqlCommandForServiceRequestIdRange(startEndRange.Item1, startEndRange.Item2);
  55:          }
  56:   
  57:          ////////////////////////////////////////////////////////////////////////////    
  58:   
  59:          /// <summary>
  60:          ///
  61:          /// </summary>
  62:          public static string OracleSqlCommandForServiceRequestIdRange(int start, int end)
  63:          {
  64:              string sql;
  65:   
  66:              sql = @"select SRV_REQ_FIPER_TECH.SRV_REQ_ID, SRV_REQ_FIPER_TECH.TECH_TYPE_ID, SRV_REQ_FIPER_TECH.VAL from SRV_REQ_FIPER left outer join SRV_REQ_FIPER_TECH on SRV_REQ_FIPER_TECH.SRV_REQ_ID = SRV_REQ_FIPER.SRV_REQ_ID where SRV_REQ_FIPER_TECH.SRV_REQ_ID >= " + start + " and SRV_REQ_FIPER_TECH.SRV_REQ_ID <= " + end + " and SRV_REQ_FIPER_TECH.SRV_REQ_ID is not null and SRV_REQ_FIPER_TECH.TECH_TYPE_ID is not null and SRV_REQ_FIPER_TECH.VAL is not null order by SRV_REQ_FIPER.SRV_REQ_ID asc";
  67:   
  68:              return sql;
  69:          }
  70:   
  71:          ////////////////////////////////////////////////////////////////////////////    
  72:   
  73:          /// <summary>
  74:          ///
  75:          /// </summary>
  76:          public static string OracleSqlCommandForServiceRequestByService(string service)
  77:          {
  78:              string sql;
  79:   
  80:              if (!string.IsNullOrEmpty(service))
  81:              {
  82:                  sql = @"select SRV_REQ_FIPER_TECH.SRV_REQ_ID, SRV_REQ_FIPER_TECH.TECH_TYPE_ID, SRV_REQ_FIPER_TECH.VAL from SRV_REQ_FIPER 
  83:  left outer join SRV_REQ_FIPER_TECH on SRV_REQ_FIPER_TECH.SRV_REQ_ID = SRV_REQ_FIPER.SRV_REQ_ID 
  84:  where SRV_REQ_FIPER.SRV_NO = " + service + @" and SRV_REQ_FIPER_TECH.SRV_REQ_ID is not null and SRV_REQ_FIPER_TECH.TECH_TYPE_ID is not null and SRV_REQ_FIPER_TECH.VAL is not null 
  85:  order by SRV_REQ_FIPER.SRV_REQ_ID asc";
  86:              }
  87:              else sql = string.Empty;
  88:   
  89:              return sql;
  90:          }
  91:   
  92:          ////////////////////////////////////////////////////////////////////////////
  93:   
  94:          /// <summary>
  95:          ///
  96:          /// </summary>
  97:          public static List<int> ChangedNumberList()
  98:          {
  99:              List<int> numberList;
 100:              List<string> stringNumberList;
 101:   
 102:              numberList = new List<int>();
 103:   
 104:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 105:              {
 106:                  stringNumberList = (from srt in db.ServiceRequestTypes where srt.TypeId == 11 select srt.Value).ToList();
 107:              }
 108:   
 109:              if (stringNumberList.Count > 0)
 110:              {
 111:                  foreach (string u in stringNumberList)
 112:                  {
 113:                      if (int.TryParse(u, out int i)) numberList.Add(i);
 114:                  }
 115:              }
 116:              else
 117:              {
 118:              }
 119:   
 120:              return numberList;
 121:          }
 122:   
 123:          ////////////////////////////////////////////////////////////////////////////
 124:   
 125:          /// <summary>
 126:          ///
 127:          /// </summary>
 128:          public static List<int> ChangedNumberList(List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList)
 129:          {
 130:              int i;
 131:              List<int> numberList;
 132:              List<string> stringNumberList;
 133:   
 134:              numberList = new List<int>();
 135:              stringNumberList = (from srt in serviceRequestTypeList where srt.TypeId == 11 select srt.Value).ToList();
 136:   
 137:              if (stringNumberList.Count > 0)
 138:              {
 139:                  foreach (string u in stringNumberList)
 140:                  {
 141:                      if (int.TryParse(u, out i)) numberList.Add(i);
 142:                  }
 143:              }
 144:              else
 145:              {
 146:              }
 147:   
 148:              return numberList;
 149:          }
 150:   
 151:          ////////////////////////////////////////////////////////////////////////////
 152:   
 153:          /// <summary>
 154:          ///
 155:          /// </summary>
 156:          public static Ia.Ngn.Cl.Model.Access ExtractAccess(int serviceRequestId, List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList)
 157:          {
 158:              Ia.Ngn.Cl.Model.Access access;
 159:              List<Ia.Ngn.Cl.Model.ServiceRequestType> subtypeSrtList;
 160:   
 161:              subtypeSrtList = (from srt in serviceRequestTypeList where srt.ServiceRequest.Id == serviceRequestId select srt).ToList();
 162:   
 163:              access = ExtractAccess(subtypeSrtList);
 164:   
 165:              return access;
 166:          }
 167:   
 168:          ////////////////////////////////////////////////////////////////////////////
 169:   
 170:          /// <summary>
 171:          ///
 172:          /// </summary>
 173:          private static Ia.Ngn.Cl.Model.Access ExtractAccess(List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList)
 174:          {
 175:              int oltId, ponNumber, ontNumber;
 176:              Dictionary<int, string> typeDictionary;
 177:              Ia.Ngn.Cl.Model.Access access;
 178:   
 179:              typeDictionary = TypeDictionary(serviceRequestTypeList);
 180:   
 181:              Ia.Ngn.Cl.Model.Business.Default.ExtractAccessNameWithValidSymbolAndLegalFormatForPonAndOntFromDictionaryValueList(typeDictionary, out oltId, out ponNumber, out ontNumber);
 182:   
 183:              access = Ia.Ngn.Cl.Model.Data.Access.Read(oltId, ponNumber, ontNumber);
 184:   
 185:              return access;
 186:          }
 187:   
 188:          ////////////////////////////////////////////////////////////////////////////
 189:   
 190:          /// <summary>
 191:          ///
 192:          /// </summary>
 193:          public static Ia.Ngn.Cl.Model.Access ExtractAccess(Ia.Ngn.Cl.Model.Ngn db, string value)
 194:          {
 195:              int oltId, ponNumber, ontNumber;
 196:              Dictionary<int, string> typeDictionary;
 197:              Ia.Ngn.Cl.Model.Access access;
 198:   
 199:              typeDictionary = new Dictionary<int, string>(1);
 200:              typeDictionary.Add(1, value);
 201:   
 202:              Ia.Ngn.Cl.Model.Business.Default.ExtractAccessNameWithValidSymbolAndLegalFormatForPonAndOntFromDictionaryValueList(typeDictionary, out oltId, out ponNumber, out ontNumber);
 203:   
 204:              access = Ia.Ngn.Cl.Model.Data.Access.Read(db, oltId, ponNumber, ontNumber);
 205:   
 206:              return access;
 207:          }
 208:   
 209:          ////////////////////////////////////////////////////////////////////////////
 210:   
 211:          /// <summary>
 212:          ///
 213:          /// </summary>
 214:          public static Dictionary<int, string> TypeDictionary(List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList)
 215:          {
 216:              Dictionary<int, string> typeDictionary;
 217:   
 218:              typeDictionary = new Dictionary<int, string>(63); // <serviceRequestType> <typeList> <type> has about 63 types max
 219:   
 220:              foreach (Ia.Ngn.Cl.Model.ServiceRequestType serviceRequestType in serviceRequestTypeList)
 221:              {
 222:                  typeDictionary.Add(serviceRequestType.TypeId, serviceRequestType.Value);
 223:              }
 224:   
 225:              return typeDictionary;
 226:          }
 227:   
 228:          ////////////////////////////////////////////////////////////////////////////    
 229:          ////////////////////////////////////////////////////////////////////////////    
 230:      }
 231:   
 232:      ////////////////////////////////////////////////////////////////////////////
 233:      ////////////////////////////////////////////////////////////////////////////
 234:  }