)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Home » Code Library » Procedure (Ia.Ftn.Cl.Model.Business)

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

Provision support class of Fixed Telecommunications Network (FTN) business model.

    1: using System;
    2: using System.Collections.Generic;
    3: using System.Data;
    4: using System.Linq;
    5:  
    6: namespace Ia.Ftn.Cl.Model.Business
    7: {
    8:     ////////////////////////////////////////////////////////////////////////////
    9:  
   10:     /// <summary publish="true">
   11:     /// Provision support class of Fixed Telecommunications Network (FTN) 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 intParameter;
   37:         //private List<string> listStringParameter;
   38:         private List<Ia.Ftn.Cl.Model.Business.Procedure.Process> list;
   39:         private Func<List<Ia.Ftn.Cl.Model.Business.Procedure.Process>> noParametersFunction;
   40:         private Func<int, List<Ia.Ftn.Cl.Model.Business.Procedure.Process>> intParameterFunction;
   41:         private Func<int, List<string>, List<Ia.Ftn.Cl.Model.Business.Procedure.Process>> intAndListStringParameterFunction;
   42:  
   43:         private Queue<Ia.Ftn.Cl.Model.Business.Procedure.Process> queue = new Queue<Ia.Ftn.Cl.Model.Business.Procedure.Process>();
   44:  
   45:         /// <summary/>
   46:         public enum ProcessType { Create, CreateRead, Read, Update, UpdateRead, Delete, DeleteRead, None };
   47:  
   48:         /// <summary/>
   49:         public int Count { get; private set; }
   50:  
   51:         /// <summary/>
   52:         public int OriginalCount { get; private set; }
   53:  
   54:         /// <summary/>
   55:         public string ProgressCounterString { get; private set; }
   56:  
   57:         /// <summary/>
   58:         public class Process
   59:         {
   60:             /// <summary/>
   61:             public string ServiceId { get; set; }
   62:  
   63:             /// <summary/>
   64:             public string Service { get; set; }
   65:  
   66:             /// <summary/>
   67:             public int Port { get; set; }
   68:  
   69:             /// <summary/>
   70:             public string AccessName { get; set; }
   71:  
   72:             /// <summary/>
   73:             public Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.Ont Ont { get; set; }
   74:  
   75:             /// <summary/>
   76:             public Ia.Ftn.Cl.Model.Business.Huawei.Ont.FamilyType EmsOntFamilyType;
   77:  
   78:             /// <summary/>
   79:             public Ia.Ftn.Cl.Model.Huawei.EmsVoipPstnUser EmsVoipPstnUser;
   80:  
   81:             /// <summary/>
   82:             public Ia.Ftn.Cl.Model.Business.Huawei.VoipPstnUser.DidFnSnPnDn EmsVoipPstnUserDidFnSnPnDn;
   83:  
   84:             /// <summary/>
   85:             public Ia.Ftn.Cl.Model.Business.Default.Protocol Protocol;
   86:  
   87:             /// <summary/>
   88:             public Procedure.ProcessType Type { get; set; }
   89:  
   90:             /// <summary/>
   91:             public DateTime DateTime { get; set; }
   92:  
   93:             /// <summary/>
   94:             public Process()
   95:             {
   96:  
   97:             }
   98:         }
   99:  
  100:         /// <summary/>
  101:         public Queue<Process> ProcessQueue { get { return queue; } }
  102:  
  103:         /// <summary/>
  104:         public List<Process> ProcessList { get; set; }
  105:  
  106:         ////////////////////////////////////////////////////////////////////////////
  107:  
  108:         /// <summary>
  109:         ///
  110:         /// </summary>
  111:         public Procedure(Func<List<Ia.Ftn.Cl.Model.Business.Procedure.Process>> function)
  112:         {
  113:             noParametersFunction = function;
  114:         }
  115:  
  116:         ////////////////////////////////////////////////////////////////////////////
  117:  
  118:         /// <summary>
  119:         ///
  120:         /// </summary>
  121:         public Procedure(int n, Func<int, List<Ia.Ftn.Cl.Model.Business.Procedure.Process>> function)
  122:         {
  123:             intParameter = n;
  124:  
  125:             intParameterFunction = function;
  126:         }
  127:  
  128:         ////////////////////////////////////////////////////////////////////////////
  129:  
  130:         /// <summary>
  131:         ///
  132:         /// </summary>
  133:         public Procedure(int n, Func<int, List<string>, List<Ia.Ftn.Cl.Model.Business.Procedure.Process>> function)
  134:         {
  135:             intParameter = n;
  136:  
  137:             //listStringParameter = list;
  138:  
  139:             intAndListStringParameterFunction = function;
  140:         }
  141:  
  142:         ////////////////////////////////////////////////////////////////////////////
  143:  
  144:         /// <summary>
  145:         ///
  146:         /// </summary>
  147:         public Process NextProcess()
  148:         {
  149:             Process process;
  150:  
  151:             if (queue.Count == 0)
  152:             {
  153:                 if (noParametersFunction != null) list = noParametersFunction();
  154:                 else if (intParameterFunction != null) list = intParameterFunction(intParameter);
  155:                 else throw new Exception("Undefined function");
  156:  
  157:                 queue = new Queue<Process>(list); // don't shuffle
  158:  
  159:                 OriginalCount = queue.Count;
  160:             }
  161:  
  162:             if (queue.Count > 0) process = queue.Dequeue();
  163:             else process = new Process { Type = Procedure.ProcessType.None };
  164:  
  165:             ProgressCounterString = "(" + queue.Count + "/" + OriginalCount + ")";
  166:  
  167:             Count = queue.Count;
  168:  
  169:             return process;
  170:         }
  171:  
  172:         ////////////////////////////////////////////////////////////////////////////
  173:  
  174:         /// <summary>
  175:         ///
  176:         /// </summary>
  177:         public Process NextProcess(List<string> priorityServiceList)
  178:         {
  179:             Process process;
  180:  
  181:             if (queue.Count == 0)
  182:             {
  183:                 if (noParametersFunction != null) list = noParametersFunction();
  184:                 else if (intParameterFunction != null) list = intParameterFunction(intParameter);
  185:                 else if (intAndListStringParameterFunction != null) list = intAndListStringParameterFunction(intParameter, priorityServiceList);
  186:                 else throw new Exception("Undefined function");
  187:  
  188:                 queue = new Queue<Process>(list); // don't shuffle
  189:  
  190:                 OriginalCount = queue.Count;
  191:             }
  192:  
  193:             if (queue.Count > 0) process = queue.Dequeue();
  194:             else process = new Process { Type = Procedure.ProcessType.None };
  195:  
  196:             ProgressCounterString = "(" + queue.Count + "/" + OriginalCount + ")";
  197:  
  198:             Count = queue.Count;
  199:  
  200:             return process;
  201:         }
  202:  
  203:         ////////////////////////////////////////////////////////////////////////////
  204:         ////////////////////////////////////////////////////////////////////////////
  205:     }
  206:  
  207:     ////////////////////////////////////////////////////////////////////////////
  208:     ////////////////////////////////////////////////////////////////////////////   
  209: }