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

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

    1: using Microsoft.AspNetCore.Mvc.Rendering;
    2: using System.Net;
    3:  
    4: namespace Ia.Ftn.Wa.Models.Provision.Migration
    5: {
    6:     ////////////////////////////////////////////////////////////////////////////
    7:  
    8:     /// <summary publish="true">
    9:     ///
   10:     /// </summary>
   11:     /// 
   12:     /// <remarks> 
   13:     /// Copyright © 2006-2025 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   14:     ///
   15:     /// 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
   16:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   17:     ///
   18:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   19:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   20:     /// 
   21:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   22:     /// 
   23:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   24:     /// </remarks> 
   25:     public static class Manage
   26:     {
   27:         private static bool migrationIsSuspended = true;
   28:  
   29:         ////////////////////////////////////////////////////////////////////////////
   30:  
   31:         /// <summary>
   32:         ///
   33:         /// </summary>
   34:         public static void ViewModel(ref Ia.Ftn.Wa.Models.Provision.Migration.ManageViewModel manageViewModel)
   35:         {
   36:             bool isAllowed;
   37:             //Ia.Cl.Models.Result result;
   38:  
   39:             //result = new Ia.Cl.Models.Result();
   40:             manageViewModel.Result = new Ia.Cl.Models.Result();
   41:             //manageViewModel.ReviewResult = new Ia.Cl.Models.Result();
   42:  
   43:             manageViewModel.AllowedToBeMigratedOltSymbolListLiteral = Ia.Ftn.Cl.Models.Business.Migration.AllowedToBeMigratedOltListString();
   44:  
   45:  
   46:             migrationIsSuspended = MigrationIsSuspendedDueToAxeAndEwsdConnectivityIssues(ref manageViewModel);
   47:  
   48:             var allowedToBeMigratedOltSymbolList = Ia.Ftn.Cl.Models.Business.Service.AllowedToBeMigratedOltSymbolList;
   49:             allowedToBeMigratedOltSymbolList.RemoveAll(u => u == "SSR");
   50:             allowedToBeMigratedOltSymbolList = allowedToBeMigratedOltSymbolList.Distinct().ToList();
   51:  
   52:             var list0 = new List<string>();
   53:             foreach (var kuwaitFtnArea in Ia.Ftn.Cl.Models.Data.Service.KuwaitFtnAreaList)
   54:             {
   55:                 if (allowedToBeMigratedOltSymbolList.Contains(kuwaitFtnArea.Symbol))
   56:                 {
   57:                     list0.Add(kuwaitFtnArea.ArabicName);
   58:                 }
   59:             }
   60:             manageViewModel.KuwaitFtnAreaListLabel = string.Join(", ", list0.ToArray().OrderBy(u => u.ToString()));
   61:  
   62:             if (!Ia.Ftn.Cl.Models.Business.Administration.NowIsOfficialWorkingTime)
   63:             {
   64:                 manageViewModel.ReviewButtonEnabled = false;
   65:                 var officialWorkingTimeString = Ia.Ftn.Cl.Models.Business.Administration.OfficialWorkingTimeString();
   66:  
   67:                 var s = "Migration is enabled during official working hours only, Sunday to Thursday " + officialWorkingTimeString + " (عملية الترحيل متاحة خلال ساعات العمل الرسمية فقط)";
   68:                 //manageViewModel.ReviewResult.AddError(s);
   69:                 manageViewModel.Result.AddError(s);
   70:             }
   71:             else if (migrationIsSuspended)
   72:             {
   73:                 manageViewModel.ReviewButtonEnabled = false;
   74:  
   75:                 var s = "Migration is suspended due to loss of connectivity to Siemens EWSD and/or Ericsson AXE (تم تعليق الترحيل بسبب انقطاع الرابط مع مقاسم سيمنس و/أو أريكسون النحاسية)";
   76:                 //manageViewModel.ReviewResult.AddError(s);
   77:                 manageViewModel.Result.AddError(s);
   78:             }
   79:             else
   80:             {
   81:                 isAllowed = (Ia.Ftn.Cl.Models.Business.Authority.StaffCanMigratePremisesFromPstnToFiber(manageViewModel.CurrentStaffIdentityUser)) ? true : false;
   82:  
   83:                 if (isAllowed)
   84:                 {
   85:                     manageViewModel.ReviewButtonEnabled = true;
   86:  
   87:                     manageViewModel.ReviewStaffNameLabel = manageViewModel.CurrentStaffIdentityUser.FullName;
   88:                 }
   89:                 else
   90:                 {
   91:                     manageViewModel.ReviewButtonEnabled = false;
   92:  
   93:                     manageViewModel.Result.AddError("You are not authorized to conduct migrations (لست مخولاً بتنفيذ عمليات ترحيل)");
   94:                 }
   95:             }
   96:         }
   97:  
   98:         ////////////////////////////////////////////////////////////////////////////
   99:  
  100:         /// <summary>
  101:         ///
  102:         /// </summary>
  103:         public static void Post(ref Ia.Ftn.Wa.Models.Provision.Migration.ManageViewModel manageViewModel, string commandName)
  104:         {
  105:             if (commandName == "review") ReviewEligibility(ref manageViewModel);
  106:             else if (commandName == "migrate") Migrate(ref manageViewModel);
  107:             else
  108:             {
  109:             }
  110:         }
  111:  
  112:         /*
  113:         ////////////////////////////////////////////////////////////////////////////
  114: 
  115:         /// <summary>
  116:         ///
  117:         /// </summary>
  118:         private static async Task HearbeatsAsync(ref Ia.Ftn.Wa.Models.Provision.Migration.ManageViewModel manageViewModel)
  119:         {
  120:             int withinLastNMinutes = 20;
  121:             var axe = "ia.ftn.axe.ca";
  122:             var ewsd = "ia.ftn.netmanager.ca";
  123: 
  124:             var dateTime = DateTime.UtcNow.AddHours(3).AddMinutes(-withinLastNMinutes);
  125: 
  126:             var heartbeats = await Ia.Ftn.Cl.Models.Business.Heartbeat.HearbeatsAsync();
  127: 
  128:             var axeAndEwsdAreAlive = (from h in heartbeats where h.Created > dateTime && h.Name == axe select h).Count() > 0
  129:                 && (from h in heartbeats where h.Created > dateTime && h.Name == ewsd select h).Count() > 0;
  130: 
  131:             //migrationIsSuspended = !axeAndEwsdAreAlive;
  132: 
  133:             Page_ViewModel(ref manageViewModel);
  134:         }
  135:         */
  136:  
  137:         ////////////////////////////////////////////////////////////////////////////
  138:  
  139:         /// <summary>
  140:         ///
  141:         /// </summary>
  142:         private static void ReviewEligibility(ref Ia.Ftn.Wa.Models.Provision.Migration.ManageViewModel manageViewModel)
  143:         {
  144:             bool isEligibleForMigration, doDisplayReview;
  145:             string accessNameInput, serviceListInput, accessName;
  146:             List<string> pstnToFiberMigrationServiceList, reviewServiceList;
  147:             Ia.Cl.Models.Result reviewEligibilityResult;
  148:  
  149:             accessNameInput = manageViewModel.AccessNameInput;
  150:             serviceListInput = manageViewModel.ServiceListInput;
  151:  
  152:             isEligibleForMigration = Ia.Ftn.Cl.Models.Business.Migration.ReviewEligibility(manageViewModel.CurrentStaffIdentityUser, accessNameInput, serviceListInput, out accessName, out pstnToFiberMigrationServiceList, out doDisplayReview, out reviewServiceList, out reviewEligibilityResult);
  153:  
  154:             if (doDisplayReview) DisplayReview(ref manageViewModel, accessName, reviewServiceList);
  155:  
  156:             if (isEligibleForMigration)
  157:             {
  158:                 manageViewModel.AccessNameHidden = accessName;
  159:                 manageViewModel.PstnToFiberMigrationServiceListHidden = string.Join(",", pstnToFiberMigrationServiceList);
  160:  
  161:                 manageViewModel.MigrateLabel = "Select the service number(s) you believe to be correct only, to be migrated to access " + accessName + " (اختر أرقام الخدمة التي ترى أنها صحيحة فقط للترحيل إلى الجهاز الرقمي الجديد)";
  162:  
  163:                 var access = Ia.Ftn.Cl.Models.Data.Access.ReadByAccessName(accessName);
  164:  
  165:                 manageViewModel.AccessNameLabel = accessName + ": " + access.ArabicAddress;
  166:  
  167:                 manageViewModel.MigrateStaffNameLabel = manageViewModel.CurrentStaffIdentityUser.FullName;
  168:  
  169:                 manageViewModel.MigrateButtonEnabled = true;
  170:                 manageViewModel.MigrateCheckBoxEnabled = true;
  171:                 manageViewModel.MigratePanelVisible = true;
  172:  
  173:                 ServiceCheckBoxList_ViewModel(ref manageViewModel, pstnToFiberMigrationServiceList);
  174:             }
  175:             else
  176:             {
  177:                 manageViewModel.AccessNameHidden = string.Empty;
  178:                 manageViewModel.PstnToFiberMigrationServiceListHidden = string.Empty;
  179:  
  180:                 manageViewModel.MigrateButtonEnabled = false;
  181:                 manageViewModel.MigrateCheckBoxEnabled = false;
  182:                 manageViewModel.MigratePanelVisible = false;
  183:             }
  184:  
  185:             manageViewModel.ReviewResult = reviewEligibilityResult;
  186:         }
  187:  
  188:         ////////////////////////////////////////////////////////////////////////////
  189:  
  190:         /// <summary>
  191:         ///
  192:         /// </summary>
  193:         private static void ServiceCheckBoxList_ViewModel(ref Ia.Ftn.Wa.Models.Provision.Migration.ManageViewModel manageViewModel, List<string> serviceList)
  194:         {
  195:             var list = ServiceCheckBoxSelectListItemList(ref manageViewModel, serviceList);
  196:  
  197:             manageViewModel.ServiceCheckBoxList = new List<SelectListItem>(list); //, "Value", "Text");
  198:         }
  199:  
  200:         ////////////////////////////////////////////////////////////////////////////
  201:  
  202:         /// <summary>
  203:         ///
  204:         /// </summary>
  205:         private static List<SelectListItem> ServiceCheckBoxSelectListItemList(ref Ia.Ftn.Wa.Models.Provision.Migration.ManageViewModel manageViewModel, List<string> serviceList)
  206:         {
  207:             List<SelectListItem> serviceCheckBoxSelectListItemList;
  208:  
  209:             serviceCheckBoxSelectListItemList = new List<SelectListItem>();
  210:  
  211:             foreach (var service in serviceList)
  212:             {
  213:                 var serviceRequestList = Ia.Ftn.Cl.Models.Data.ServiceRequest.List(service);
  214:  
  215:                 if (serviceRequestList.Any(u => u.Number.ToString() == service))
  216:                 {
  217:                     var serviceRequest = (from sr in serviceRequestList where sr.Number.ToString() == service select sr).OrderByDescending(u => u.Id).FirstOrDefault();
  218:  
  219:                     serviceCheckBoxSelectListItemList.Add(new SelectListItem { Text = service + ": " + serviceRequest.CustomerName + " (" + serviceRequest.CustomerAddress + ")", Value = service });
  220:                 }
  221:                 else
  222:                 {
  223:                     var serviceRequestHistoryList = Ia.Ftn.Cl.Models.Data.ServiceRequestHistory.List(service);
  224:  
  225:                     if (serviceRequestHistoryList.Any(u => u.Number.ToString() == service))
  226:                     {
  227:                         var serviceRequestHistory = (from sr in serviceRequestHistoryList where sr.Number.ToString() == service select sr).OrderByDescending(u => u.Id).FirstOrDefault();
  228:  
  229:                         var status = Ia.Ftn.Cl.Models.Data.ServiceRequest.SystemCode[serviceRequestHistory.Status].ToString();
  230:                         var startDateTime = serviceRequestHistory.StartDateTime.ToString("yyyy-MM-dd");
  231:                         var requestDateTime = serviceRequestHistory.ServiceDateTime.ToString("yyyy-MM-dd");
  232:                         var serviceName = Ia.Ftn.Cl.Models.Data.ServiceRequest.ServiceSortedList[serviceRequestHistory.ServiceId].ToString();
  233:  
  234:                         serviceCheckBoxSelectListItemList.Add(new SelectListItem { Text = service + ": status: " + status + ", start: " + startDateTime + ", request: " + requestDateTime + ", service: " + serviceName, Value = service });
  235:                     }
  236:                     else
  237:                     {
  238:                         serviceCheckBoxSelectListItemList.Add(new SelectListItem { Text = service + ": There are no recent nor historic work orders (لا توجد أوامر عمل حديثة أو تاريخية)", Value = service });
  239:                     }
  240:                 }
  241:             }
  242:  
  243:             return serviceCheckBoxSelectListItemList;
  244:         }
  245:  
  246:         ////////////////////////////////////////////////////////////////////////////
  247:  
  248:         /// <summary>
  249:         ///
  250:         /// </summary>
  251:         private static void DisplayReview(ref Ia.Ftn.Wa.Models.Provision.Migration.ManageViewModel manageViewModel, string accessName, List<string> serviceList)
  252:         {
  253:             List<Ia.Ftn.Cl.Models.Ui.Service2> service2List;
  254:             List<Ia.Ftn.Cl.Models.Ui.Nokia.Subscriber> subscriberList;
  255:             List<Ia.Ftn.Cl.Models.Ui.Huawei.Sbr> sbrList;
  256:             List<Ia.Ftn.Cl.Models.Ericsson.AxeSubscriber> axeSubscriberList;
  257:             List<Ia.Ftn.Cl.Models.Siemens.EwsdSubscriber> ewsdSubscriberList;
  258:             List<Ia.Ftn.Cl.Models.Access> accessList;
  259:             List<Ia.Ftn.Cl.Models.Ui.ServiceRequestService> serviceRequestServiceList;
  260:             List<Ia.Ftn.Cl.Models.ServiceRequest> serviceRequestList;
  261:             List<Ia.Ftn.Cl.Models.ServiceRequestAdministrativeIssue> serviceRequestAdministrativeIssueList;
  262:             List<Ia.Ftn.Cl.Models.ServiceRequestHistory> serviceRequestHistoryList;
  263:             List<Ia.Ftn.Cl.Models.ServiceRequestOnt> serviceRequestOntList;
  264:  
  265:             Ia.Ftn.Cl.Models.Business.Maintenance.Find.MigrationReview(manageViewModel.CurrentStaffIdentityUser.Framework, accessName, serviceList, out service2List, out subscriberList, out sbrList, out axeSubscriberList, out ewsdSubscriberList, out accessList, out serviceRequestServiceList, out serviceRequestList, out serviceRequestAdministrativeIssueList, out serviceRequestHistoryList, out serviceRequestOntList, out Ia.Cl.Models.Result result);
  266:  
  267:             if (result.IsSuccessful)
  268:             {
  269:                 manageViewModel.ServiceList = service2List;
  270:                 manageViewModel.SubscriberList = subscriberList;
  271:                 manageViewModel.SbrList = sbrList;
  272:                 manageViewModel.AxeSubscriberList = axeSubscriberList;
  273:                 manageViewModel.EwsdSubscriberList = ewsdSubscriberList;
  274:  
  275:                 manageViewModel.AccessList = accessList;
  276:                 manageViewModel.ServiceRequestServiceList = serviceRequestServiceList;
  277:  
  278:                 if (serviceRequestList != null) manageViewModel.ServiceRequestList = serviceRequestList.OrderBy(sr => sr.Id).ToList();
  279:                 else manageViewModel.ServiceRequestList = serviceRequestList;
  280:  
  281:                 if (serviceRequestHistoryList != null) manageViewModel.ServiceRequestHistoryList = serviceRequestHistoryList.OrderBy(sr => sr.ServiceDateTime).ToList();
  282:                 else manageViewModel.ServiceRequestHistoryList = serviceRequestHistoryList;
  283:  
  284:                 manageViewModel.ServiceRequestOntList = serviceRequestOntList;
  285:             }
  286:             else
  287:             {
  288:             }
  289:         }
  290:  
  291:         ////////////////////////////////////////////////////////////////////////////
  292:  
  293:         /// <summary>
  294:         ///
  295:         /// </summary>
  296:         private static void Migrate(ref Ia.Ftn.Wa.Models.Provision.Migration.ManageViewModel manageViewModel)
  297:         {
  298:             bool isEligibleForMigration, doDisplayReview;
  299:             string accessNameInput, serviceListInput, accessName, accessNameFromViewState;
  300:             List<string> pstnToFiberMigrationServiceList, reviewServiceList, pstnToFiberMigrationServiceListFromViewState, selectedPstnToFiberMigrationServiceList;
  301:             Ia.Cl.Models.Result result, reviewEligibilityResult, migrateFromPstnToFiberResult;
  302:  
  303:             selectedPstnToFiberMigrationServiceList = new List<string>();
  304:  
  305:             result = new Ia.Cl.Models.Result();
  306:             migrateFromPstnToFiberResult = new Ia.Cl.Models.Result();
  307:  
  308:             accessNameInput = manageViewModel.AccessNameInput;
  309:             serviceListInput = manageViewModel.ServiceListInput;
  310:  
  311:             isEligibleForMigration = Ia.Ftn.Cl.Models.Business.Migration.ReviewEligibility(manageViewModel.CurrentStaffIdentityUser, accessNameInput, serviceListInput, out accessName, out pstnToFiberMigrationServiceList, out doDisplayReview, out reviewServiceList, out reviewEligibilityResult);
  312:  
  313:             if (doDisplayReview) DisplayReview(ref manageViewModel, accessName, reviewServiceList);
  314:  
  315:             if (isEligibleForMigration)
  316:             {
  317:                 // below: check if the values are similar to ViewState
  318:  
  319:                 accessNameFromViewState = (!string.IsNullOrEmpty(manageViewModel.AccessNameHidden)) ? manageViewModel.AccessNameHidden : string.Empty;
  320:                 pstnToFiberMigrationServiceListFromViewState = (!string.IsNullOrEmpty(manageViewModel.PstnToFiberMigrationServiceListHidden)) ? manageViewModel.PstnToFiberMigrationServiceListHidden.Split(',').ToList() : new List<string>();
  321:  
  322:                 if (accessNameFromViewState == accessName && pstnToFiberMigrationServiceList.Count == pstnToFiberMigrationServiceListFromViewState.Count)
  323:                 {
  324:                     // collect checked boxes
  325:                     foreach (SelectListItem item in manageViewModel.ServiceCheckBoxList)
  326:                     {
  327:                         if (item.Selected) selectedPstnToFiberMigrationServiceList.Add(item.Value);
  328:                     }
  329:  
  330:                     if (selectedPstnToFiberMigrationServiceList.Count > 0)
  331:                     {
  332:                         if (manageViewModel.MigrateCheckBoxSelectedValue)
  333:                         {
  334:                             MigrateFromPstnToFiber(ref manageViewModel, accessName, selectedPstnToFiberMigrationServiceList, out migrateFromPstnToFiberResult);
  335:  
  336:                             if (migrateFromPstnToFiberResult.IsSuccessful)
  337:                             {
  338:                                 manageViewModel.MigrateButtonEnabled = false;
  339:                                 manageViewModel.MigrateCheckBoxSelectedValue = false;
  340:                                 manageViewModel.MigrateCheckBoxEnabled = false;
  341:                             }
  342:                             else
  343:                             {
  344:                                 manageViewModel.MigrateButtonEnabled = true;
  345:                                 manageViewModel.MigrateCheckBoxEnabled = true;
  346:                             }
  347:                         }
  348:                         else
  349:                         {
  350:                             migrateFromPstnToFiberResult.AddError("You must read and agree to checkbox comments (تحتاج لقراءة وللموافقة على المذكور في مربع الاختيار)");
  351:                         }
  352:                     }
  353:                     else
  354:                     {
  355:                         migrateFromPstnToFiberResult.AddError("You did not select any services to migrate (لم تختر أي رقم للترحيل)");
  356:                     }
  357:                 }
  358:                 else
  359:                 {
  360:                     migrateFromPstnToFiberResult.AddError("Review data and current migration data are inconsistent. Try to review process again (حصل تغيير في معلومات الترحيل خلال الدقائق الاخيرة. أعد عملية المراجعة من جديد)");
  361:  
  362:                     manageViewModel.AccessNameHidden = string.Empty;
  363:                     manageViewModel.PstnToFiberMigrationServiceListHidden = string.Empty;
  364:  
  365:                     manageViewModel.MigrateButtonEnabled = false;
  366:                     manageViewModel.MigrateCheckBoxEnabled = false;
  367:                     manageViewModel.MigratePanelVisible = false;
  368:                 }
  369:             }
  370:             else
  371:             {
  372:                 migrateFromPstnToFiberResult.AddError("Review is not eligible for migration");
  373:  
  374:                 manageViewModel.AccessNameHidden = string.Empty;
  375:                 manageViewModel.PstnToFiberMigrationServiceListHidden = string.Empty;
  376:  
  377:                 manageViewModel.MigrateButtonEnabled = false;
  378:                 manageViewModel.MigrateCheckBoxEnabled = false;
  379:                 manageViewModel.MigratePanelVisible = false;
  380:             }
  381:  
  382:             //result.AddResult(reviewEligibilityResult); not important to report in migration
  383:             result.AddResult(migrateFromPstnToFiberResult);
  384:  
  385:             manageViewModel.MigrateResult = result;
  386:         }
  387:  
  388:         ////////////////////////////////////////////////////////////////////////////
  389:  
  390:         /// <summary>
  391:         ///
  392:         /// </summary>
  393:         private static void MigrateFromPstnToFiber(ref Ia.Ftn.Wa.Models.Provision.Migration.ManageViewModel manageViewModel, string accessName, List<string> serviceList, out Ia.Cl.Models.Result result)
  394:         {
  395:             bool overrideRouterDomainRestriction = false;
  396:             string accessId;
  397:  
  398:             result = new Ia.Cl.Models.Result();
  399:  
  400:             var nddOnt = Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OntByAccessName(accessName);
  401:  
  402:             if (nddOnt != null)
  403:             {
  404:                 accessId = nddOnt.Access.Id;
  405:                 var accessVendor = nddOnt.Pon.PonGroup.Olt.Odf.Vendor;
  406:  
  407:                 if (accessVendor == Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor.Nokia)
  408:                 {
  409:                     var ont = Ia.Ftn.Cl.Models.Data.Nokia.Ont.Read(nddOnt.Id);
  410:  
  411:                     if (ont != null)
  412:                     {
  413:                         foreach (string service in serviceList)
  414:                         {
  415:                             Ia.Ftn.Cl.Models.Data.MessageQueue.SecretaryApplication.Enqueue(Ia.Ftn.Cl.Models.Business.MessageQueue.Application.FtnApplication, Ia.Ftn.Cl.Models.Business.MessageQueue.Process.DeleteReadServiceAccess, service, nddOnt.Access.Name, overrideRouterDomainRestriction, manageViewModel.CurrentStaffIdentityUser.Id);
  416:  
  417:                             Ia.Ftn.Cl.Models.Data.ServiceRequestService.UpdateServiceRequestServiceAccess(service, accessId, manageViewModel.CurrentStaffIdentityUser.Id, out Ia.Cl.Models.Result r);
  418:  
  419:                             result.AddResult(r);
  420:                         }
  421:  
  422:                         result.AddSuccess("The service number(s) " + string.Join(", ", serviceList) + " was/were migrated from PSTN/MSAN to Fiber successfully to access " + accessName + " (تم ترحيل رقم أو أرقام الخدمة إلى الجهاز الرقمي الجديد بشكل صحيح)");
  423:                     }
  424:                     else result.AddError(@"Ont is null, does not exist for access: " + accessName);
  425:                 }
  426:                 else if (accessVendor == Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor.Huawei)
  427:                 {
  428:                     var emsOnt = Ia.Ftn.Cl.Models.Data.Huawei.Ont.Read(nddOnt.Id);
  429:  
  430:                     if (emsOnt != null)
  431:                     {
  432:                         foreach (string service in serviceList)
  433:                         {
  434:                             Ia.Ftn.Cl.Models.Data.MessageQueue.SecretaryApplication.Enqueue(Ia.Ftn.Cl.Models.Business.MessageQueue.Application.FtnApplication, Ia.Ftn.Cl.Models.Business.MessageQueue.Process.DeleteReadServiceAccess, service, nddOnt.Access.Name, overrideRouterDomainRestriction, manageViewModel.CurrentStaffIdentityUser.Id);
  435:  
  436:                             Ia.Ftn.Cl.Models.Data.ServiceRequestService.UpdateServiceRequestServiceAccess(service, accessId, manageViewModel.CurrentStaffIdentityUser.Id, out Ia.Cl.Models.Result r);
  437:  
  438:                             result.AddResult(r);
  439:                         }
  440:  
  441:                         result.AddSuccess("The service number(s) " + string.Join(", ", serviceList) + " was/were migrated from PSTN/MSAN to Fiber successfully to access " + accessName + " (تم ترحيل رقم أو أرقام الخدمة إلى الجهاز الرقمي الجديد بشكل صحيح)");
  442:                     }
  443:                     else result.AddError(@"EmsOnt is null, does not exist for access: " + accessName);
  444:                 }
  445:                 else throw new Exception("accessVendor is unknown");
  446:             }
  447:             else throw new Exception("NDD ONT is null");
  448:         }
  449:  
  450:         ////////////////////////////////////////////////////////////////////////////
  451:  
  452:         /// <summary>
  453:         ///
  454:         /// </summary>
  455:         private static bool MigrationIsSuspendedDueToAxeAndEwsdConnectivityIssues(ref Ia.Ftn.Wa.Models.Provision.Migration.ManageViewModel manageViewModel)
  456:         {
  457:             bool isSuspended;
  458:             int withinLastNMinutes = 20;
  459:  
  460:             var dictionary = Ia.Ftn.Wa.Models.Business.Default.HeartbeatAssemblyNameToCreatedDateTimeDictionary;
  461:  
  462:             if (dictionary.Count > 0)
  463:             {
  464:                 isSuspended = !Ia.Ftn.Cl.Models.Business.Heartbeat.AxeAndEwsdAreActive(dictionary, withinLastNMinutes);
  465:             }
  466:             else isSuspended = true;
  467:  
  468:             return isSuspended;
  469:         }
  470:  
  471:         ////////////////////////////////////////////////////////////////////////////
  472:         ////////////////////////////////////////////////////////////////////////////
  473:     }
  474:  
  475:     ////////////////////////////////////////////////////////////////////////////
  476:     ////////////////////////////////////////////////////////////////////////////
  477: }