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

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

    1: using Microsoft.AspNetCore.Identity;
    2:  
    3: namespace Ia.Ftn.Wa.Models.Administration
    4: {
    5:     ////////////////////////////////////////////////////////////////////////////
    6:  
    7:     /// <summary publish="true">
    8:     ///
    9:     /// </summary>
   10:     /// 
   11:     /// <remarks> 
   12:     /// Copyright © 2006-2025 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   13:     ///
   14:     /// 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
   15:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   16:     ///
   17:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   18:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   19:     /// 
   20:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   21:     /// 
   22:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   23:     /// </remarks> 
   24:     public class AreaReadiness
   25:     {
   26:         ////////////////////////////////////////////////////////////////////////////
   27:  
   28:         /// <summary>
   29:         ///
   30:         /// </summary>
   31:         public static List<Ia.Ftn.Wa.Models.Administration.AreaReadinessViewModel> AreaReadinessList()
   32:         {
   33:             bool b;
   34:             List<Ia.Ftn.Wa.Models.Administration.AreaReadinessViewModel> readinessList;
   35:  
   36:             readinessList = new List<Ia.Ftn.Wa.Models.Administration.AreaReadinessViewModel>();
   37:  
   38:  
   39:             var kuwaitAreaList = Ia.Cl.Models.Kuwait.KuwaitAreaList;
   40:  
   41:             // - entry in NDD document with complete olts, sip or not,...etc.
   42:             // - symbol in service.xml with kuwait-area.xml idea and equivalent name format from cust dept service request
   43:             // <area id="60603" serviceRequestAddressProvinceAreaName="حولى ميدان حولي" symbol="MHL" />
   44:             var kuwaitFtnAreaList = Ia.Ftn.Cl.Models.Data.Service.KuwaitFtnAreaList;
   45:  
   46:             var siteList = Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.SiteList;
   47:             var oltList = Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OltList;
   48:             var ponGroupList = Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.PonGroupList;
   49:  
   50:             // - access in customer service database in service requests, and service request history, for domains
   51:             var serviceRequestDomainList = Ia.Ftn.Cl.Models.Data.ServiceRequest.ServiceRequestDomainList;
   52:             var serviceRequestHistoryDomainList = Ia.Ftn.Cl.Models.Data.ServiceRequestHistory.ServiceRequestHistoryDomainList;
   53:  
   54:             // - pstn access and possible msan or sps, or softx access for brown fields
   55:  
   56:             var pstnDomainList = Ia.Ftn.Cl.Models.Data.Service.PstnDomainList;
   57:             var msanDomainList = Ia.Ftn.Cl.Models.Data.Service.MsanDomainList;
   58:             var axePstnDomainList = Ia.Ftn.Cl.Models.Data.Service.AxePstnDomainList;
   59:             var ewsdPstnDomainList = Ia.Ftn.Cl.Models.Data.Service.EwsdPstnDomainList;
   60:  
   61:             // - in list of allowed to be migrated or provisioned
   62:             var allowedToBeMigratedOltSymbolList = Ia.Ftn.Cl.Models.Business.Service.AllowedToBeMigratedOltSymbolList;
   63:             var allowedToBeProvisionedSymbolList = Ia.Ftn.Cl.Models.Business.Service.AllowedToBeProvisionedOltSymbolList;
   64:  
   65:             // - permission in administration.xml for specific frameworks.
   66:             var frameworkList = Ia.Ftn.Cl.Models.Data.Administration.FrameworkList;
   67:  
   68:             foreach (var kuwaitArea in kuwaitAreaList.OrderBy(u => u.Name))
   69:             {
   70:                 var readiness = new Ia.Ftn.Wa.Models.Administration.AreaReadinessViewModel();
   71:  
   72:                 readiness.NameArabicName = kuwaitArea.Name + " (" + kuwaitArea.ArabicName + ")";
   73:  
   74:                 var symbol = (from k in kuwaitFtnAreaList
   75:                               where k.Id == kuwaitArea.Id && !string.IsNullOrEmpty(k.Symbol)
   76:                               select k.Symbol).SingleOrDefault();
   77:  
   78:                 if (!string.IsNullOrEmpty(symbol))
   79:                 {
   80:                     readiness.IsInKuwaitFtnAreaList = Ia.Cl.Models.Default.YesNoInArabic(true);
   81:  
   82:                     var site = (from si in siteList
   83:                                 where si.AreaSymbolList.Contains(symbol)
   84:                                 select si).FirstOrDefault(); //.SingleOrDefault(); problem with MGF in two sites
   85:  
   86:                     b = site != null;
   87:  
   88:                     if (b)
   89:                     {
   90:                         readiness.IsInSite = Ia.Cl.Models.Default.YesNoInArabic(true);
   91:  
   92:                         b = site.Routers.Any(u => u.DomainList.Any(u0 => serviceRequestDomainList.Contains(u0) && serviceRequestHistoryDomainList.Contains(u0)));
   93:                         if (b) readiness.IsInServiceRequestAndServiceRequestHistoryDomainList = Ia.Cl.Models.Default.YesNoInArabic(true);
   94:                         else readiness.IsInServiceRequestAndServiceRequestHistoryDomainList = Ia.Cl.Models.Default.YesNoInArabic(false);
   95:  
   96:                         var fieldType = (from o in oltList where o.Symbol == symbol select o.FieldType).FirstOrDefault();
   97:  
   98:                         readiness.AreaFieldType = Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.FieldTypeColoredString(fieldType);
   99:  
  100:  
  101:                         if (fieldType == Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.FieldType.Brown)
  102:                         {
  103:                             if (site.DomainList.Any(u => pstnDomainList.Contains(u)) || site.DomainList.Any(u => msanDomainList.Contains(u)))
  104:                             {
  105:                                 readiness.IsInPstnOrMsanDomainList = Ia.Cl.Models.Default.YesNoInArabic(true);
  106:                             }
  107:                             else readiness.IsInPstnOrMsanDomainList = Ia.Cl.Models.Default.YesNoInArabic(false);
  108:                         }
  109:                         else //if (fieldType ==  Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.FieldType.Green)
  110:                         {
  111:                             readiness.IsInPstnOrMsanDomainList = Ia.Cl.Models.Default.YesNoInArabic(false);
  112:                         }
  113:  
  114:  
  115:                         b = allowedToBeProvisionedSymbolList.Contains(symbol);
  116:  
  117:                         if (b)
  118:                         {
  119:                             readiness.IsInAllowedToBeProvisionedSymbolList = Ia.Cl.Models.Default.YesNoInArabic(true);
  120:  
  121:                             if (fieldType == Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.FieldType.Brown)
  122:                             {
  123:                                 if (site.DomainList.Any(u => pstnDomainList.Contains(u)) || site.DomainList.Any(u => msanDomainList.Contains(u)))
  124:                                 {
  125:                                     var v = (from a in allowedToBeMigratedOltSymbolList
  126:                                              where a.Contains(symbol)
  127:                                              select a).FirstOrDefault();
  128:  
  129:                                     b = v != null;
  130:                                     if (b) readiness.IsInAllowedToBeMigratedSymbolList = Ia.Cl.Models.Default.YesNoInArabic(true);
  131:                                     else readiness.IsInAllowedToBeMigratedSymbolList = Ia.Cl.Models.Default.YesNoInArabic(false);
  132:                                 }
  133:                                 else
  134:                                 {
  135:                                     readiness.IsInAllowedToBeMigratedSymbolList = Ia.Cl.Models.Default.YesNoInArabic(null);
  136:                                 }
  137:                             }
  138:                             else //if (fieldType ==  Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.FieldType)
  139:                             {
  140:                                 readiness.IsInAllowedToBeMigratedSymbolList = Ia.Cl.Models.Default.YesNoInArabic(null);
  141:                             }
  142:  
  143:                             var w = (from f in frameworkList
  144:                                      where f.Sites.Any(u => u.Name == site.Name)
  145:                                      select f).FirstOrDefault();
  146:  
  147:                             b = w != null;
  148:                             if (b) readiness.IsInFrameworkAdministration = Ia.Cl.Models.Default.YesNoInArabic(true);
  149:                             else readiness.IsInFrameworkAdministration = Ia.Cl.Models.Default.YesNoInArabic(false);
  150:                         }
  151:                         else
  152:                         {
  153:                             readiness.IsInAllowedToBeProvisionedSymbolList = Ia.Cl.Models.Default.YesNoInArabic(false);
  154:                             readiness.IsInAllowedToBeMigratedSymbolList = Ia.Cl.Models.Default.YesNoInArabic(null);
  155:                             readiness.IsInFrameworkAdministration = Ia.Cl.Models.Default.YesNoInArabic(null);
  156:                         }
  157:  
  158:  
  159:  
  160:  
  161:                     }
  162:                     else
  163:                     {
  164:                         readiness.IsInSite = Ia.Cl.Models.Default.YesNoInArabic(false);
  165:                         readiness.IsInServiceRequestAndServiceRequestHistoryDomainList = Ia.Cl.Models.Default.YesNoInArabic(null);
  166:                         readiness.AreaFieldType = Ia.Cl.Models.Default.YesNoInArabic(null); // just to produce colored لا ينطبق
  167:                         readiness.IsInAllowedToBeProvisionedSymbolList = Ia.Cl.Models.Default.YesNoInArabic(null);
  168:                         readiness.IsInAllowedToBeMigratedSymbolList = Ia.Cl.Models.Default.YesNoInArabic(null);
  169:                         readiness.IsInPstnOrMsanDomainList = Ia.Cl.Models.Default.YesNoInArabic(null);
  170:                         readiness.IsInFrameworkAdministration = Ia.Cl.Models.Default.YesNoInArabic(null);
  171:                     }
  172:                 }
  173:                 else
  174:                 {
  175:                     readiness.IsInKuwaitFtnAreaList = Ia.Cl.Models.Default.YesNoInArabic(false);
  176:                     readiness.IsInSite = Ia.Cl.Models.Default.YesNoInArabic(null);
  177:                     readiness.IsInServiceRequestAndServiceRequestHistoryDomainList = Ia.Cl.Models.Default.YesNoInArabic(null);
  178:                     readiness.AreaFieldType = Ia.Cl.Models.Default.YesNoInArabic(null); // just to produce colored لا ينطبق
  179:                     readiness.IsInAllowedToBeProvisionedSymbolList = Ia.Cl.Models.Default.YesNoInArabic(null);
  180:                     readiness.IsInAllowedToBeMigratedSymbolList = Ia.Cl.Models.Default.YesNoInArabic(null);
  181:                     readiness.IsInPstnOrMsanDomainList = Ia.Cl.Models.Default.YesNoInArabic(null);
  182:                     readiness.IsInFrameworkAdministration = Ia.Cl.Models.Default.YesNoInArabic(null);
  183:                 }
  184:  
  185:                 readinessList.Add(readiness);
  186:             }
  187:  
  188:             return readinessList.ToList();
  189:         }
  190:  
  191:         ////////////////////////////////////////////////////////////////////////////
  192:         ////////////////////////////////////////////////////////////////////////////
  193:     }
  194:  
  195:     ////////////////////////////////////////////////////////////////////////////
  196:     ////////////////////////////////////////////////////////////////////////////
  197: }