)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Skip Navigation Links

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

MinistryDatabase support class for Optical Fiber Network (OFN) business model.

    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.Ngn.Cl.Model.Business.Mdaa
    9: {
   10:     ////////////////////////////////////////////////////////////////////////////
   11:  
   12:     /// <summary publish="true">
   13:     /// MinistryDatabase support class for Optical Fiber Network (OFN) business model.
   14:     /// </summary>
   15:     /// 
   16:     /// <remarks> 
   17:     /// Copyright © 2021-2022 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 MinistryDatabase
   30:     {
   31:         private static List<Ia.Ngn.Cl.Model.Business.Service.HundredsSubdomain> properlySelectedHundredsSubdomainList = new List<Ia.Ngn.Cl.Model.Business.Service.HundredsSubdomain>();
   32:  
   33:         public static List<string> OracleSystemTableList = new List<string> { "WKSYS", "SYSTEM", "SYS", "OLAPSYS", "MDSYS", "EXFSYS", "CTXSYS" };
   34:  
   35:         /// <summary/>
   36:         public struct ServiceState
   37:         {
   38:             /// <summary/>
   39:             public ServiceState(Ia.Ngn.Cl.Model.Business.Service.HundredsSubdomain hundredsSubdomain, int serviceCategoryId, int customerCategoryId, string service, int serial, float balance)
   40:             {
   41:                 this.HundredsSubdomainId = hundredsSubdomain.Id;
   42:                 this.ServiceCategoryId = serviceCategoryId;
   43:                 this.CustomerCategoryId = customerCategoryId;
   44:                 this.Service = service;
   45:                 this.Serial = serial;
   46:                 this.Balance = balance;
   47:             }
   48:  
   49:             /// <summary/>
   50:             public string HundredsSubdomainId { get; set; }
   51:  
   52:             /// <summary/>
   53:             public int ServiceCategoryId { get; set; }
   54:  
   55:             /// <summary/>
   56:             public int CustomerCategoryId { get; set; }
   57:  
   58:             /// <summary/>
   59:             public string Service { get; set; }
   60:  
   61:             /// <summary/>
   62:             public int Serial { get; set; }
   63:  
   64:             /// <summary/>
   65:             public float Balance { get; set; }
   66:         }
   67:  
   68:         /// <summary/>
   69:         public struct ServiceTransaction
   70:         {
   71:             /// <summary/>
   72:             public ServiceTransaction(string service, int serial, long transactionId, DateTime transactionDateTime)
   73:             {
   74:                 this.Service = service;
   75:                 this.Serial = serial;
   76:                 this.TransactionId = transactionId;
   77:                 this.TransactionDateTime = transactionDateTime;
   78:             }
   79:  
   80:             /// <summary/>
   81:             public string Service { get; }
   82:  
   83:             /// <summary/>
   84:             public int Serial { get; }
   85:  
   86:             /// <summary/>
   87:             public long TransactionId { get; }
   88:  
   89:             /// <summary/>
   90:             public DateTime TransactionDateTime { get; }
   91:         }
   92:  
   93:         ////////////////////////////////////////////////////////////////////////////
   94:  
   95:         /// <summary>
   96:         ///
   97:         /// </summary>
   98:         public class Table
   99:         {
  100:             /// <summary/>
  101:             public Table() { }
  102:  
  103:             /// <summary/>
  104:             public string Name;
  105:  
  106:             /// <summary/>
  107:             public string Schema;
  108:         }
  109:  
  110:         ////////////////////////////////////////////////////////////////////////////
  111:  
  112:         /// <summary>
  113:         ///
  114:         /// </summary>
  115:         public MinistryDatabase() { }
  116:  
  117:         ////////////////////////////////////////////////////////////////////////////    
  118:  
  119:         /// <summary>
  120:         ///
  121:         /// </summary>
  122:         public static string AlterSessionOfCustomerDepartmentOracleDatabase
  123:         {
  124:             get
  125:             {
  126:                 return @"alter session set nls_date_format = 'DD/MM/YYYY HH24:MI:SS'";
  127:             }
  128:         }
  129:  
  130:         ////////////////////////////////////////////////////////////////////////////
  131:  
  132:         /// <summary>
  133:         ///
  134:         /// </summary>
  135:         public static Ia.Ngn.Cl.Model.Business.Service.HundredsSubdomain ProperlySelectedHundredsSubdomainListItem(ref int referenceIndex, out int itemIndex, out int listCount)
  136:         {
  137:             Ia.Ngn.Cl.Model.Business.Service.HundredsSubdomain hundredsSubdomain;
  138:  
  139:             if (properlySelectedHundredsSubdomainList.JustStartedOrRolledOver())
  140:             {
  141:                 properlySelectedHundredsSubdomainList = Ia.Ngn.Cl.Model.Data.Service.HundredsSubdomainListWithinOfnList;
  142:             }
  143:  
  144:             hundredsSubdomain = properlySelectedHundredsSubdomainList.Next(ref referenceIndex, out itemIndex, out listCount);
  145:  
  146:             return hundredsSubdomain;
  147:         }
  148:  
  149:         ////////////////////////////////////////////////////////////////////////////    
  150:  
  151:         /// <summary>
  152:         ///
  153:         /// </summary>
  154:         public static bool ServiceHadCrossedAdministrativeDisconnectionBalanceThreshold(int serviceCategoryId, int customerCategoryId, float balance)
  155:         {
  156:             bool crossedThreshold;
  157:  
  158:             /*
  159: Service category:
  160:       <category id="3" arabicName="هاتف" />
  161: 
  162: Customer category:
  163:       <category id="1" arabicName="أفراد"/>
  164:       <category id="2" arabicName="جهات حكومية" />
  165:       <category id="3" arabicName="جهات تجارية" />
  166:       <category id="4" arabicName="هيئات دبلوماسية"/>
  167:       <category id="5" arabicName="أفراد عسكريين" />
  168:       <category id="6" arabicName="أفراد دبلوماسيين" />
  169:       <category id="7" arabicName="جهات دولية" />
  170:       <category id="8" arabicName="مؤسسات تجارية" />
  171:       <category id="9" arabicName="بنك مركزي" />
  172:       <category id="10" arabicName="جهات أخرى" />
  173:       <category id="100" arabicName="غير معرف" />
  174:     </categoryList>
  175:              */
  176:  
  177:             if (serviceCategoryId == 3)
  178:             {
  179:                 // <category id="1" arabicName="أفراد"/>
  180:                 if (customerCategoryId == 0 && balance > 70) crossedThreshold = true;
  181:  
  182:                 // <category id="2" arabicName="جهات حكومية" />
  183:                 else if (customerCategoryId == 2 && balance > 140) crossedThreshold = true;
  184:  
  185:                 // <category id="3" arabicName="جهات تجارية" />
  186:                 else if (customerCategoryId == 3 && balance > 140) crossedThreshold = true;
  187:  
  188:                 // <category id="4" arabicName="هيئات دبلوماسية"/>
  189:                 else if (customerCategoryId == 4 && balance > 140) crossedThreshold = true;
  190:  
  191:                 // <category id="5" arabicName="أفراد عسكريين" />
  192:                 else if (customerCategoryId == 5 && balance > 70) crossedThreshold = true;
  193:  
  194:                 // <category id="6" arabicName="أفراد دبلوماسيين" />
  195:                 else if (customerCategoryId == 6 && balance > 70) crossedThreshold = true;
  196:  
  197:                 // <category id="7" arabicName="جهات دولية" />
  198:                 else if (customerCategoryId == 7 && balance > 140) crossedThreshold = true;
  199:  
  200:                 // <category id="8" arabicName="مؤسسات تجارية" />
  201:                 else if (customerCategoryId == 8 && balance > 140) crossedThreshold = true;
  202:  
  203:                 // <category id="9" arabicName="بنك مركزي" />
  204:                 else if (customerCategoryId == 9 && balance > 140) crossedThreshold = true;
  205:  
  206:                 // <category id="10" arabicName="جهات أخرى" />
  207:                 else if (customerCategoryId == 10 && balance > 140) crossedThreshold = true;
  208:  
  209:                 // <category id="100" arabicName="غير معرف" />
  210:                 else if (customerCategoryId == 100 && balance > 140) crossedThreshold = true;
  211:  
  212:                 else crossedThreshold = false;
  213:             }
  214:             else crossedThreshold = false;
  215:  
  216:             return crossedThreshold;
  217:         }
  218:  
  219:         ////////////////////////////////////////////////////////////////////////////    
  220:         ////////////////////////////////////////////////////////////////////////////    
  221:     }
  222:  
  223:     ////////////////////////////////////////////////////////////////////////////
  224:     ////////////////////////////////////////////////////////////////////////////
  225: }