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

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

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