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

Integrated Applications Programming Company

Skip Navigation Links

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

Provision support class of Next Generation Network'a (NGN's) business model.

   1:  using System;
   2:  using System.Collections.Generic;
   3:  using System.Data;
   4:  using System.Linq;
   5:   
   6:  namespace Ia.Ngn.Cl.Model.Business
   7:  {
   8:      ////////////////////////////////////////////////////////////////////////////
   9:   
  10:      /// <summary publish="true">
  11:      /// Provision support class of Next Generation Network'a (NGN's) business model.
  12:      /// </summary>
  13:      /// 
  14:      /// <remarks> 
  15:      /// Copyright © 2019-2020 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
  16:      ///
  17:      /// 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
  18:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  19:      ///
  20:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  21:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  22:      /// 
  23:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  24:      /// 
  25:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  26:      /// </remarks> 
  27:      /// <summary/>
  28:   
  29:      ////////////////////////////////////////////////////////////////////////////
  30:   
  31:      /// <summary>
  32:      ///
  33:      /// </summary>
  34:      public class Procedure
  35:      {
  36:          private int parameter;
  37:          private List<Ia.Ngn.Cl.Model.Business.Procedure.Process> list;
  38:          private Func<List<Ia.Ngn.Cl.Model.Business.Procedure.Process>> noParametersFunction;
  39:          private Func<int, List<Ia.Ngn.Cl.Model.Business.Procedure.Process>> oneIntParameterFunction;
  40:   
  41:          private Queue<Ia.Ngn.Cl.Model.Business.Procedure.Process> queue = new Queue<Ia.Ngn.Cl.Model.Business.Procedure.Process>();
  42:   
  43:          /// <summary/>
  44:          public enum ProcessType { Create, CreateRead, Read, Update, UpdateRead, Delete, DeleteRead, None };
  45:   
  46:          /// <summary/>
  47:          public int Count { get; private set; }
  48:   
  49:          /// <summary/>
  50:          public int OriginalCount { get; private set; }
  51:   
  52:          /// <summary/>
  53:          public string ProgressCounterString { get; private set; }
  54:   
  55:          /// <summary/>
  56:          public class Process
  57:          {
  58:              /// <summary/>
  59:              public string ServiceId { get; set; }
  60:   
  61:              /// <summary/>
  62:              public string Service { get; set; }
  63:   
  64:              /// <summary/>
  65:              public int Port { get; set; }
  66:   
  67:              /// <summary/>
  68:              public string AccessName { get; set; }
  69:   
  70:              /// <summary/>
  71:              public Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont Ont { get; set; }
  72:   
  73:              /// <summary/>
  74:              public Ia.Ngn.Cl.Model.Business.Huawei.Ont.FamilyType EmsOntFamilyType;
  75:   
  76:              /// <summary/>
  77:              public Ia.Ngn.Cl.Model.Business.Default.Protocol Protocol;
  78:   
  79:              /// <summary/>
  80:              public Procedure.ProcessType Type { get; set; }
  81:   
  82:              /// <summary/>
  83:              public DateTime DateTime { get; set; }
  84:   
  85:              /// <summary/>
  86:              public Process()
  87:              {
  88:   
  89:              }
  90:          }
  91:   
  92:          /// <summary/>
  93:          public Queue<Process> ProcessQueue { get { return queue; } }
  94:   
  95:          /// <summary/>
  96:          public List<Process> ProcessList { get; set; }
  97:   
  98:          ////////////////////////////////////////////////////////////////////////////
  99:   
 100:          /// <summary>
 101:          ///
 102:          /// </summary>
 103:          public Procedure(Func<List<Ia.Ngn.Cl.Model.Business.Procedure.Process>> function)
 104:          {
 105:              noParametersFunction = function;
 106:          }
 107:   
 108:          ////////////////////////////////////////////////////////////////////////////
 109:   
 110:          /// <summary>
 111:          ///
 112:          /// </summary>
 113:          public Procedure(int n, Func<int, List<Ia.Ngn.Cl.Model.Business.Procedure.Process>> function)
 114:          {
 115:              parameter = n;
 116:   
 117:              oneIntParameterFunction = function;
 118:          }
 119:   
 120:          ////////////////////////////////////////////////////////////////////////////
 121:   
 122:          /// <summary>
 123:          ///
 124:          /// </summary>
 125:          public Process NextProcess()
 126:          {
 127:              Process process;
 128:   
 129:              if (queue.Count == 0)
 130:              {
 131:                  if (noParametersFunction != null) list = noParametersFunction();
 132:                  else if (oneIntParameterFunction != null) list = oneIntParameterFunction(parameter);
 133:                  else throw new Exception("Undefined function");
 134:   
 135:                  queue = new Queue<Process>(list.OrderByDescending(l => l.DateTime)); // don't shuffle
 136:   
 137:                  OriginalCount = queue.Count;
 138:              }
 139:   
 140:              if (queue.Count > 0) process = queue.Dequeue();
 141:              else process = new Process { Type = Procedure.ProcessType.None };
 142:   
 143:              ProgressCounterString = "(" + queue.Count + "/" + OriginalCount + ")";
 144:   
 145:              Count = queue.Count;
 146:   
 147:              return process;
 148:          }
 149:   
 150:          ////////////////////////////////////////////////////////////////////////////
 151:          ////////////////////////////////////////////////////////////////////////////
 152:      }
 153:   
 154:      ////////////////////////////////////////////////////////////////////////////
 155:      ////////////////////////////////////////////////////////////////////////////   
 156:  }