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

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

Nokia's Siemens EWSD support class of 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.Text.RegularExpressions;
    6:  
    7: namespace Ia.Ftn.Cl.Models.Business.Siemens
    8: {
    9:     ////////////////////////////////////////////////////////////////////////////
   10:  
   11:     /// <summary publish="true">
   12:     /// Nokia's Siemens EWSD support class of Fixed Telecommunications Network (FTN) business model.
   13:     /// </summary>
   14:     /// 
   15:     /// <remarks> 
   16:     /// Copyright © 2018-2021 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   17:     ///
   18:     /// 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
   19:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   20:     ///
   21:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   22:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   23:     /// 
   24:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   25:     /// 
   26:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   27:     /// </remarks> 
   28:     public class Ewsd
   29:     {
   30:         private static Queue<int> serviceQueue = new Queue<int>();
   31:         private static Queue<ProvisioningWorkflow> synchronizationCommandQueue = new Queue<ProvisioningWorkflow>();
   32:  
   33:         private static Queue<ProvisioningWorkflow> synchronizationProvisioningWorkflowQueue = new Queue<ProvisioningWorkflow>();
   34:         private static Queue<ProvisioningWorkflow> serviceSuspentionSynchronizationProvisioningWorkflowQueue = new Queue<ProvisioningWorkflow>();
   35:  
   36:         /// <summary/>
   37:         public enum Opcode {
   38:             /// <summary/>
   39:             Dispsub,
   40:  
   41:             /// <summary/>
   42:             Cansub,
   43:  
   44:             /// <summary/>
   45:             UpdateSubXxx,
   46:  
   47:             /// <summary/>
   48:             SuspendTemp,
   49:  
   50:             /// <summary/>
   51:             Dispkeyword
   52:         };//, Crcpt, Disptime }
   53:  
   54:         /// <summary/>
   55:         public class ProvisioningWorkflow
   56:         {
   57:             /// <summary/>
   58:             public string Service { get; set; }
   59:  
   60:             /// <summary/>
   61:             public Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Pstn Pstn { get; set; }
   62:  
   63:             /// <summary/>
   64:             public string ReadCommand { get; set; }
   65:  
   66:             /// <summary/>
   67:             public string ServiceSuspensionCommand { get; set; }
   68:  
   69:             /// <summary/>
   70:             public string DeleteCommand { get; set; }
   71:  
   72:             /// <summary/>
   73:             public ProvisioningWorkflow()
   74:             {
   75:  
   76:             }
   77:         }
   78:  
   79:         public static List<string> ServiceSymbolList { get; } = new List<string>();
   80:  
   81:         ////////////////////////////////////////////////////////////////////////////
   82:  
   83:         /// <summary>
   84:         /// Response of Siemens EWSD
   85:         /// </summary>
   86:         public class Response
   87:         {
   88:             public int Service { get; set; }
   89:  
   90:             /// <summary/>
   91:             public bool IsSuccess { get { return ReturnCode == Ia.Ftn.Cl.Models.Business.Siemens.Ewsd.ResultCode.Successful; } }
   92:  
   93:             /// <summary/>
   94:             public bool IsProvisioned { get; set; }
   95:  
   96:             /// <summary/>
   97:             public Ia.Ftn.Cl.Models.Business.Siemens.Ewsd.ResultCode ReturnCode { get; set; }
   98:  
   99:             /// <summary/>
  100:             //public string Ctag { get; set; } // no need because the commad string is included in response body
  101:  
  102:             /// <summary/>
  103:             public DateTime DateTime { get; set; }
  104:  
  105:             /// <summary/>
  106:             public string CommandString { get; set; }
  107:  
  108:  
  109:             /// <summary/>
  110:             public int Dn { get; set; }
  111:  
  112:             /// <summary/>
  113:             public string Lac { get; set; }
  114:  
  115:             /// <summary/>
  116:             public string Eqn { get; set; }
  117:  
  118:             /// <summary/>
  119:             public string Cat { get; set; }
  120:  
  121:             /// <summary/>
  122:             public string Ltt { get; set; }
  123:  
  124:             /// <summary/>
  125:             public string Optrcl { get; set; }
  126:  
  127:             /// <summary/>
  128:             public string Subtrcl { get; set; }
  129:  
  130:             /// <summary/>
  131:             public string Numcal { get; set; }
  132:  
  133:             /// <summary/>
  134:             public string Orig1 { get; set; }
  135:  
  136:             /// <summary/>
  137:             public string Trarstr { get; set; }
  138:  
  139:             /// <summary/>
  140:             public string Lnatt { get; set; }
  141:  
  142:             /// <summary/>
  143:             public string Div { get; set; }
  144:  
  145:             /// <summary/>
  146:             public string Cos { get; set; }
  147:  
  148:             /// <summary/>
  149:             public string Addinf { get; set; }
  150:  
  151:             /// <summary/>
  152:             public string Numbch { get; set; }
  153:  
  154:             /// <summary/>
  155:             public string Ctdivi { get; set; }
  156:  
  157:             /// <summary/>
  158:             public string Blk { get; set; }
  159:  
  160:             /// <summary/>
  161:             public string Content { get; set; }
  162:  
  163:             /// <summary/>
  164:             public Ia.Ftn.Cl.Models.Business.Service.ServiceSupplementaryService ServiceSupplementaryService { get; set; }
  165:  
  166:             ////////////////////////////////////////////////////////////////////////////
  167:  
  168:             /// <summary>
  169:             ///
  170:             /// </summary>
  171:             public Response(string content)
  172:             {
  173:                 int jobNumber, jobEndNumber;
  174:                 string service, fileHead, fileFoot;
  175:                 Match match;
  176:                 Ia.Ftn.Cl.Models.Business.Service.ServiceSupplementaryService serviceSupplementaryService;
  177:                 Ia.Ftn.Cl.Models.Business.Siemens.Ewsd.ResultCode returnCode;
  178:  
  179:                 fileHead = "\r\n-----------------------------------------------------------------------------";
  180:                 fileFoot = "-----------------------------------------------------------------------------\r\n";
  181:  
  182:                 if (content.StartsWith(fileHead) && content.EndsWith(fileFoot))
  183:                 {
  184:                     content = content.Replace(fileHead, "");
  185:                     content = content.Replace(fileFoot, "");
  186:  
  187:                     match = Regex.Match(content, @"^\s+(\d+)\s+(.+)\s+(\d+)\s+$", RegexOptions.Singleline);
  188:  
  189:                     if (match.Success)
  190:                     {
  191:                         jobNumber = int.Parse(match.Groups[1].Value);
  192:                         jobEndNumber = int.Parse(match.Groups[3].Value);
  193:  
  194:                         if (jobNumber == jobEndNumber)
  195:                         {
  196:                             content = match.Groups[2].Value;
  197:  
  198:                             if (content.Contains("OBJECT NOT CONNECTED"))
  199:                             {
  200:                                 /*
  201:             9241                                                        MASKNO:10001 
  202:             COMMAND ERROR MESSAGE FOR DISPSUB      :  1 ERROR(S) 
  203:                                                                         MASKNO:10990 
  204:             OBJECT NOT CONNECTED                                                    
  205: 
  206:             CNTXT PAR.NAME PARAMETER VALUE 
  207:             -----+--------+--------------------------------------------------------- 
  208:                   DN       =<25420976>                                               
  209: 
  210: 
  211:             END JOB 9241
  212:                                  */
  213:  
  214:                                 match = Regex.Match(content, @"DN\s+=<(\d{8})>");
  215:  
  216:                                 if (match.Success)
  217:                                 {
  218:                                     service = match.Groups[1].Value;
  219:  
  220:                                     this.CommandString = @"DISPSUB:DN=" + service + ";";
  221:  
  222:                                     this.Service = int.Parse(service);
  223:  
  224:                                     this.IsProvisioned = false;
  225:  
  226:                                     returnCode = Ia.Ftn.Cl.Models.Business.Siemens.Ewsd.ResultCode.Successful;
  227:  
  228:                                     this.Dn = int.Parse(service);
  229:                                     this.Content = content;
  230:                                     this.ReturnCode = returnCode;
  231:                                 }
  232:                                 else
  233:                                 {
  234:                                     returnCode = Ia.Ftn.Cl.Models.Business.Siemens.Ewsd.ResultCode.Failed;
  235:  
  236:                                     this.Content = content;
  237:                                     this.ReturnCode = returnCode;
  238:                                 }
  239:                             }
  240:                             else if (content.Contains("OBJECT NOT A SUBSCRIBER"))
  241:                             {
  242:                                 match = Regex.Match(content, @"DN\s+=<(\d{8})>");
  243:  
  244:                                 if (match.Success)
  245:                                 {
  246:                                     service = match.Groups[1].Value;
  247:  
  248:                                     this.CommandString = @"DISPSUB:DN=" + service + ";";
  249:  
  250:                                     this.Service = int.Parse(service);
  251:  
  252:                                     this.IsProvisioned = true;
  253:  
  254:                                     returnCode = Ia.Ftn.Cl.Models.Business.Siemens.Ewsd.ResultCode.Successful;
  255:  
  256:                                     this.Dn = int.Parse(service);
  257:                                     this.Content = content;
  258:                                     this.ReturnCode = returnCode;
  259:  
  260:                                     serviceSupplementaryService = new Ia.Ftn.Cl.Models.Business.Service.ServiceSupplementaryService();
  261:                                     serviceSupplementaryService.IsPbx = true;
  262:  
  263:                                     this.ServiceSupplementaryService = serviceSupplementaryService;
  264:                                 }
  265:                                 else
  266:                                 {
  267:                                     returnCode = Ia.Ftn.Cl.Models.Business.Siemens.Ewsd.ResultCode.Failed;
  268:  
  269:                                     this.Content = content;
  270:                                     this.ReturnCode = returnCode;
  271:                                 }
  272:                             }
  273:                             else if (content.Contains("DISPSUB") && content.Contains("END JOB"))
  274:                             {
  275:  
  276:                                 /*
  277:             DISPSUB:DN=23833902;                                          
  278: 
  279:                                                                         MASKNO:03800 
  280:             LAC    = 01     DN     = 23833902     EQN    = 1350- 0- 4-30 
  281:                CAT      = MS                                            MASKNO:03774 
  282:                LTT      = COSLAC2                                       MASKNO:03789 
  283:                OPTRCL   = 2                                             MASKNO:03798 
  284:                NUMCAL   = 1                                             MASKNO:08641 
  285:                ORIG1    = 5                                 
  286:                DIV      = DIVI     DIVIMOD  DDVIN                       MASKNO:08598 
  287:                LNATT    = PB                                            MASKNO:03787 
  288:                COS      = ACTCW    CONF3    CWACT    PROP8    CLIP      MASKNO:03777 
  289:                           FSK                                          
  290: 
  291: 
  292:             END JOB 9232
  293:                                  */
  294:  
  295:                                 match = Regex.Match(content, @"DISPSUB:DN=(\d{8});");
  296:  
  297:                                 if (match.Success)
  298:                                 {
  299:                                     service = match.Groups[1].Value;
  300:  
  301:                                     this.CommandString = @"DISPSUB:DN=" + service + ";";
  302:  
  303:                                     this.Service = int.Parse(service);
  304:  
  305:                                     this.IsProvisioned = true;
  306:  
  307:                                     returnCode = Ia.Ftn.Cl.Models.Business.Siemens.Ewsd.ResultCode.Successful;
  308:  
  309:                                     this.Content = content;
  310:                                     this.ReturnCode = returnCode;
  311:  
  312:                                     this.ParseDispsub(content, out int dn, out string lac, out string eqn, out string cat, out string ltt, out string optrcl, out string subtrcl, out string numcal, out string orig1, out string trarstr, out string lnatt, out string div, out string cos, out string addinf, out string numbch, out string ctdivi, out string blk);
  313:                                     this.Dn = dn;
  314:                                     this.Lac = lac;
  315:                                     this.Eqn = eqn;
  316:                                     this.Cat = cat;
  317:                                     this.Ltt = ltt;
  318:                                     this.Optrcl = optrcl;
  319:                                     this.Subtrcl = subtrcl;
  320:                                     this.Numcal = numcal;
  321:                                     this.Orig1 = orig1;
  322:                                     this.Trarstr = trarstr;
  323:                                     this.Lnatt = lnatt;
  324:                                     this.Div = div;
  325:                                     this.Cos = cos;
  326:                                     this.Addinf = addinf;
  327:                                     this.Numbch = numbch;
  328:                                     this.Ctdivi = ctdivi;
  329:                                     this.Blk = blk;
  330:  
  331:                                     serviceSupplementaryService = Ia.Ftn.Cl.Models.Business.Siemens.Ewsd.ServiceSupplementaryServiceStateFromServiceNetManagerOutputString(content);
  332:  
  333:                                     this.ServiceSupplementaryService = serviceSupplementaryService;
  334:                                 }
  335:                                 else
  336:                                 {
  337:                                     returnCode = Ia.Ftn.Cl.Models.Business.Siemens.Ewsd.ResultCode.Failed;
  338:  
  339:                                     this.Content = content;
  340:                                     this.ReturnCode = returnCode;
  341:                                 }
  342:                             }
  343:                             else
  344:                             {
  345:                                 returnCode = Ia.Ftn.Cl.Models.Business.Siemens.Ewsd.ResultCode.NotAcceptedUnreasonableValue;
  346:  
  347:                                 this.Content = content;
  348:                                 this.ReturnCode = returnCode;
  349:                             }
  350:                         }
  351:                         else
  352:                         {
  353:                             returnCode = Ia.Ftn.Cl.Models.Business.Siemens.Ewsd.ResultCode.FileFormatError;
  354:  
  355:                             this.Content = content;
  356:                             this.ReturnCode = returnCode;
  357:                         }
  358:                     }
  359:                     else
  360:                     {
  361:                         returnCode = Ia.Ftn.Cl.Models.Business.Siemens.Ewsd.ResultCode.FileFormatError;
  362:  
  363:                         this.Content = content;
  364:                         this.ReturnCode = returnCode;
  365:                     }
  366:                 }
  367:                 else
  368:                 {
  369:                     returnCode = Ia.Ftn.Cl.Models.Business.Siemens.Ewsd.ResultCode.FileFormatError;
  370:  
  371:                     this.Content = content;
  372:                     this.ReturnCode = returnCode;
  373:                 }
  374:             }
  375:  
  376:             ////////////////////////////////////////////////////////////////////////////
  377:  
  378:             /// <summary>
  379:             ///
  380:             /// </summary>
  381:             private void ParseDispsub(string suscpOutputContent, out int dn, out string lac, out string eqn, out string cat, out string ltt, out string optrcl, out string subtrcl, out string numcal, out string orig1, out string trarstr, out string lnatt, out string div, out string cos, out string addinf, out string numbch, out string ctdivi, out string blk)
  382:             {
  383:                 int dn2;
  384:  
  385:                 using (StringReader stringReader = new StringReader(suscpOutputContent))
  386:                 {
  387:                     string line;
  388:                     dn = -1;
  389:                     lac = eqn = cat = ltt = optrcl = subtrcl = numcal = orig1 = trarstr = lnatt = div = cos = addinf = numbch = ctdivi = blk = string.Empty;
  390:  
  391:                     while ((line = stringReader.ReadLine()) != null)
  392:                     {
  393:                         // remove "MASKNO:03774"
  394:                         line = Regex.Replace(line, @"MASKNO:\d+\s+", "");
  395:  
  396:                         //DISPSUB:DN=23833902;
  397:                         if (line.StartsWith("DISPSUB")) dn = int.Parse(Regex.Match(line, @"^DISPSUB:DN=(\d{8});").Groups[1].Value);
  398:                         else if (line.StartsWith("LAC"))
  399:                         {
  400:                             lac = Regex.Match(line, @"LAC\s+=\s+(.+?)\s+").Groups[1].Value;
  401:  
  402:                             dn2 = int.Parse(Regex.Match(line, @"DN\s+=\s+(\d{8})\s+").Groups[1].Value);
  403:  
  404:                             if (dn != dn2) throw new ArgumentException("dn != dn2");
  405:  
  406:                             eqn = Regex.Match(line, @"EQN\s+=\s+(.+)\s+").Groups[1].Value;
  407:                         }
  408:                         else if (line.StartsWith("   CAT")) cat = ThreeSpaceTermEntryValue(line, "CAT");
  409:                         else if (line.StartsWith("   LTT")) ltt = ThreeSpaceTermEntryValue(line, "LTT");
  410:                         else if (line.StartsWith("   OPTRCL")) optrcl = ThreeSpaceTermEntryValue(line, "OPTRCL");
  411:                         else if (line.StartsWith("   SUBTRCL")) subtrcl = ThreeSpaceTermEntryValue(line, "SUBTRCL");
  412:                         else if (line.StartsWith("   NUMCAL")) numcal = ThreeSpaceTermEntryValue(line, "NUMCAL");
  413:                         else if (line.StartsWith("   ORIG1")) orig1 = ThreeSpaceTermEntryValue(line, "ORIG1");
  414:                         else if (line.StartsWith("   TRARSTR")) trarstr = ThreeSpaceTermEntryValue(line, "TRARSTR");
  415:                         else if (line.StartsWith("   LNATT")) lnatt = ThreeSpaceTermEntryValue(line, "LNATT");
  416:                         else if (line.StartsWith("   DIV")) div = ThreeSpaceTermEntryValue(line, "DIV");
  417:                         else if (line.StartsWith("   COS")) cos = ThreeSpaceTermEntryValue(line, "COS");
  418:                         else if (line.StartsWith("   ADDINF")) addinf = ThreeSpaceTermEntryValue(line, "ADDINF");
  419:                         else if (line.StartsWith("   NUMBCH")) numbch = ThreeSpaceTermEntryValue(line, "NUMBCH");
  420:                         else if (line.StartsWith("   CTDIVI")) ctdivi = ThreeSpaceTermEntryValue(line, "CTDIVI");
  421:                         else if (line.StartsWith("   BLK")) blk = ThreeSpaceTermEntryValue(line, "BLK");
  422:                         else
  423:                         {
  424:                         }
  425:                     }
  426:                 }
  427:             }
  428:  
  429:             ////////////////////////////////////////////////////////////////////////////
  430:             ////////////////////////////////////////////////////////////////////////////
  431:         }
  432:  
  433:         ////////////////////////////////////////////////////////////////////////////
  434:  
  435:         /// <summary>
  436:         ///
  437:         /// </summary>
  438:         private static string ThreeSpaceTermEntryValue(string line, string term)
  439:         {
  440:             string s;
  441:  
  442:             s = Regex.Match(line, @"^\s+" + term + @"\s+=\s+(.+)\s+").Groups[1].Value;
  443:  
  444:             s = s.Trim();
  445:  
  446:             // replace spaces with ','
  447:             s = Regex.Replace(s, @"\s+", ",");
  448:  
  449:             return s;
  450:         }
  451:  
  452:         ////////////////////////////////////////////////////////////////////////////
  453:  
  454:         /// <summary>
  455:         ///
  456:         /// </summary>
  457:         public enum ResultCode
  458:         {
  459:             Successful = 0,
  460:             Failed = 1,
  461:             ObjectNotASubscriber = 2,
  462:             ObjectNotConnected = 3,
  463:             NotAcceptedUnreasonableValue = 4,
  464:             NotAcceptedCommandUnknown = 5,
  465:             FileFormatError = 6,
  466:         }
  467:  
  468:         ////////////////////////////////////////////////////////////////////////////
  469:  
  470:         /// <summary>
  471:         ///
  472:         /// </summary>
  473:         public Ewsd() { }
  474:  
  475:         ////////////////////////////////////////////////////////////////////////////
  476:  
  477:         /// <summary>
  478:         ///
  479:         /// </summary>
  480:         public static int ProperlySelectedSingleServiceQueueServiceNumber(List<Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Pstn> pstnList)
  481:         {
  482:             int service;
  483:             List<int> list;
  484:  
  485:             service = 0;
  486:  
  487:             if (serviceQueue.Count == 0)
  488:             {
  489:                 list = AllPossibleServiceNumbersPreferablyNotInEwsdSubscriberWithinPstn(pstnList);
  490:  
  491:                 serviceQueue = new Queue<int>(list.Shuffle()); //.OrderBy(o => o));
  492:             }
  493:  
  494:             if (serviceQueue.Count > 0) service = serviceQueue.Dequeue();
  495:  
  496:             return service;
  497:         }
  498:  
  499:         ////////////////////////////////////////////////////////////////////////////
  500:  
  501:         /// <summary>
  502:         ///
  503:         /// </summary>
  504:         public static List<int> AllPossibleServiceNumbersPreferablyNotInEwsdSubscriberWithinPstn(List<Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Pstn> pstnList)
  505:         {
  506:             var allPossibleServiceNumbersWithinPstn = new List<int>();
  507:  
  508:             foreach (var pstn in pstnList)
  509:             {
  510:                 allPossibleServiceNumbersWithinPstn.AddRange(Ia.Ftn.Cl.Models.Data.Service.AllPossibleServiceNumbersWithinPstn(pstn.Name));
  511:             }
  512:  
  513:             var dnList = Ia.Ftn.Cl.Models.Data.Siemens.Subscriber.DnList();
  514:  
  515:             var list = allPossibleServiceNumbersWithinPstn.Except(dnList).ToList();
  516:  
  517:             // if list is empty then will use the all list
  518:             if (list.Count == 0) list = allPossibleServiceNumbersWithinPstn;
  519:  
  520:             var hashSet = new HashSet<int>(list);
  521:  
  522:             return hashSet.OrderBy(u => u).ToList();
  523:         }
  524:  
  525:         ////////////////////////////////////////////////////////////////////////////
  526:  
  527:         /// <summary>
  528:         ///
  529:         /// </summary>
  530:         public static ProvisioningWorkflow DeleteAndReadEwsdServiceQueueCommand(Ia.Ftn.Cl.Models.Business.Default.Procedure procedure)
  531:         {
  532:             ProvisioningWorkflow provisioningWorkflow;
  533:             List<ProvisioningWorkflow> list;
  534:  
  535:             provisioningWorkflow = null;
  536:  
  537:             if (synchronizationCommandQueue.Count == 0 && procedure == Ia.Ftn.Cl.Models.Business.Default.Procedure.InitializeOrIterate)
  538:             {
  539:                 list = Ia.Ftn.Cl.Models.Business.Siemens.Ewsd.DeleteAndReadEwsdServiceCommandList();
  540:  
  541:                 synchronizationCommandQueue = new Queue<ProvisioningWorkflow>(list); // don't shuffle because a modify command is followed by a read .Shuffle());
  542:             }
  543:  
  544:             if (synchronizationCommandQueue.Count > 0) provisioningWorkflow = synchronizationCommandQueue.Dequeue();
  545:  
  546:             return provisioningWorkflow;
  547:         }
  548:  
  549:         ////////////////////////////////////////////////////////////////////////////
  550:  
  551:         /// <summary>
  552:         ///
  553:         /// </summary>
  554:         public static List<ProvisioningWorkflow> DeleteAndReadEwsdServiceCommandList()
  555:         {
  556:             ProvisioningWorkflow provisioningWorkflow;
  557:             List<ProvisioningWorkflow> provisioningWorkflowList;
  558:  
  559:             provisioningWorkflowList = new List<ProvisioningWorkflow>();
  560:  
  561:             //var imsServiceToRouterVendorDictionary0 = Ia.Ftn.Cl.Model.Data.Service.ImsServiceToOntRouterVendorInAllowedToBeMigratedOltDictionary;
  562:             var imsServiceToRouterVendorDictionary = Ia.Ftn.Cl.Models.Data.Service.ImsServiceToOntAndMsanRouterVendorInAllowedToBeMigratedOltAndDomainDictionary;
  563:  
  564:             var ewsdSubscriberProvisionedServiceList = Ia.Ftn.Cl.Models.Data.Siemens.Subscriber.ProvisionedServiceList();
  565:  
  566:             // intersect lists
  567:             var list0 = ewsdSubscriberProvisionedServiceList.Intersect(imsServiceToRouterVendorDictionary.Keys).ToList();
  568:  
  569:             // will exclude exempt numbers
  570:             var serviceExemptionList = Ia.Ftn.Cl.Models.Data.Provision.ServiceOfServiceExemptFromProvisionProcessingList();
  571:  
  572:             var list = list0.Except(serviceExemptionList).ToList();
  573:  
  574:             foreach (string service in list)
  575:             {
  576:                 var pstn = Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.PstnFromService(service);
  577:  
  578:                 // delete
  579:                 provisioningWorkflowList.Add(new ProvisioningWorkflow
  580:                 {
  581:                     Service = service,
  582:                     Pstn = pstn,
  583:                     DeleteCommand = DeleteServiceCommand(pstn, service)
  584:                 });
  585:  
  586:                 // read
  587:                 provisioningWorkflowList.Add(provisioningWorkflow = new ProvisioningWorkflow
  588:                 {
  589:                     Service = service,
  590:                     Pstn = pstn,
  591:                     ReadCommand = ReadServiceCommand(pstn, service),
  592:                 });
  593:             }
  594:  
  595:             return provisioningWorkflowList;
  596:         }
  597:  
  598:         ////////////////////////////////////////////////////////////////////////////
  599:  
  600:         /// <summary>
  601:         ///
  602:         /// </summary>
  603:         public static ProvisioningWorkflow SynchronizeBetweenServiceRequestAdministrativeIssueAndSiemensEwsdPstnServiceProvisioningWorkflowItem()
  604:         {
  605:             ProvisioningWorkflow provisioningWorkflow;
  606:             List<ProvisioningWorkflow> list;
  607:  
  608:             provisioningWorkflow = null;
  609:  
  610:             if (serviceSuspentionSynchronizationProvisioningWorkflowQueue.Count == 0)
  611:             {
  612:                 list = Ia.Ftn.Cl.Models.Business.Siemens.Ewsd.ServiceSuspentionAndReadCommandSynchronizeBetweenServiceRequestAdministrativeIssueAndSiemensEwsdPstnServiceProvisioningWorkflowList();
  613:  
  614:                 serviceSuspentionSynchronizationProvisioningWorkflowQueue = new Queue<ProvisioningWorkflow>(list); // don't shuffle because a modify command is followed by a read .Shuffle());
  615:             }
  616:  
  617:             if (serviceSuspentionSynchronizationProvisioningWorkflowQueue.Count > 0) provisioningWorkflow = serviceSuspentionSynchronizationProvisioningWorkflowQueue.Dequeue();
  618:  
  619:             return provisioningWorkflow;
  620:         }
  621:  
  622:         ////////////////////////////////////////////////////////////////////////////
  623:  
  624:         /// <summary>
  625:         ///
  626:         /// </summary>
  627:         public static List<ProvisioningWorkflow> ServiceSuspentionAndReadCommandSynchronizeBetweenServiceRequestAdministrativeIssueAndSiemensEwsdPstnServiceProvisioningWorkflowList()
  628:         {
  629:             bool serviceSuspensionState;
  630:             ProvisioningWorkflow provisioningWorkflow;
  631:             List<ProvisioningWorkflow> provisioningWorkflowList;
  632:  
  633:             provisioningWorkflowList = new List<ProvisioningWorkflow>();
  634:  
  635:             Ia.Ftn.Cl.Models.Data.Provision.SiemensEwsdPstnServiceSuspensionMismatchBetweenServiceRequestAdministrativeIssueAndServiceServiceList(out List<string> serviceToSuspendList, out List<string> serviceToReleaseList, out _, out _);
  636:  
  637:             // will exclude exempt numbers
  638:             var serviceExemptionList = Ia.Ftn.Cl.Models.Data.Provision.ServiceOfServiceExemptFromProvisionProcessingList();
  639:  
  640:             serviceSuspensionState = true;
  641:  
  642:             foreach (var service in serviceToSuspendList)
  643:             {
  644:                 if (!serviceExemptionList.Contains(service))
  645:                 {
  646:                     var pstn = Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.PstnFromService(service);
  647:  
  648:                     provisioningWorkflowList.Add(new ProvisioningWorkflow
  649:                     {
  650:                         Service = service,
  651:                         Pstn = pstn,
  652:                         ServiceSuspensionCommand = ServiceSuspensionCommand(pstn, service, serviceSuspensionState),
  653:                     });
  654:  
  655:                     provisioningWorkflowList.Add(new ProvisioningWorkflow
  656:                     {
  657:                         Service = service,
  658:                         Pstn = pstn,
  659:                         ReadCommand = ReadServiceCommand(pstn, service)
  660:                     });
  661:                 }
  662:             }
  663:  
  664:  
  665:             serviceSuspensionState = false;
  666:  
  667:             foreach (var service in serviceToReleaseList)
  668:             {
  669:                 if (!serviceExemptionList.Contains(service))
  670:                 {
  671:                     var pstn = Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.PstnFromService(service);
  672:  
  673:                     provisioningWorkflowList.Add(new ProvisioningWorkflow
  674:                     {
  675:                         Service = service,
  676:                         Pstn = pstn,
  677:                         ServiceSuspensionCommand = ServiceSuspensionCommand(pstn, service, serviceSuspensionState),
  678:                     });
  679:  
  680:                     provisioningWorkflowList.Add(new ProvisioningWorkflow
  681:                     {
  682:                         Service = service,
  683:                         Pstn = pstn,
  684:                         ReadCommand = ReadServiceCommand(pstn, service)
  685:                     });
  686:                 }
  687:             }
  688:  
  689:             return provisioningWorkflowList;
  690:         }
  691:  
  692:         ////////////////////////////////////////////////////////////////////////////
  693:  
  694:         /// <summary>
  695:         /// 
  696:         /// </summary>
  697:         public static Ia.Ftn.Cl.Models.Business.Service.ServiceSupplementaryService ServiceSupplementaryServiceStateFromServiceNetManagerOutputString(string content)
  698:         {
  699:             string matchedText, line;
  700:             Match m;
  701:             Ia.Ftn.Cl.Models.Business.Service.ServiceSupplementaryService serviceSupplementaryService;
  702:  
  703:             serviceSupplementaryService = new Ia.Ftn.Cl.Models.Business.Service.ServiceSupplementaryService();
  704:  
  705:             /*
  706: ******************************************************************************************************
  707: Sample Subscriber Information:
  708: 
  709: QRN/QRN/KUWCPK1V5140P047/106                          19-06-26  10:39:40
  710: 3324  NetM         ROMMEL07           2816/03800 
  711: 
  712: DISPSUB:DN=25421113;                                          
  713: 
  714:                                                             MASKNO:03800 
  715: LAC    = 01     DN     = 25421113     EQN    =   20- 2-12-14 
  716:    CAT      = MS                                            MASKNO:03774 
  717:    OPTRCL   = 2                                             MASKNO:03798 
  718:    SUBTRCL  = 2   
  719:    NUMCAL   = 1                                             MASKNO:08641 
  720:    ORIG1    = 5                                 
  721:    TRARSTR  = TRACLACT                                      MASKNO:03803 
  722:    LNATT    = PB                                            MASKNO:03787 
  723:    COS      = CLIP     FSK                                  MASKNO:03777 
  724:    ADDINF   = KEYWORD                                       MASKNO:03772 
  725: 
  726: END JOB 3324
  727: 
  728: 
  729: ******************************************************************************************************
  730: 
  731:             OPTRCL   = 2 ---> WITHOUT INTERNATIONAL CALL ENTERED BY OPERATOR
  732: OPTRCL   = 0 ---> WITH INTERNATIONAL CALL ENTERED BY OPERATOR
  733: 
  734: SUBTRCL  = 2 ---> WITHOUT INTERNATIONAL CALL MODIFIED BY SUBSCRIBER
  735: SUBTRCL  = 0 ---> WITH INTERNATIONAL CALL MODIFIED BY SUBSCRIBER
  736: 
  737: TRARSTR  = ACTTRACL TRACLACT ---> TRAFFIC RESTRATION FEATURES IS ACTIVATED (SUBSCRIBER CAN OPEN AND CLOSE INTERNATIONAL CALL)
  738: 
  739: DIV      = DIVI     DIVIMOD  DDVIN  ---> DIVERSATION IMMIDIATE FEATURES IS ASSIGNED TO SUBSCRIBER
  740: DIV      = ACTDIVI -9793XXXX  ---> SUBSCRIBER IMMEDIATELY DIVERTED TO GIVEN NUMBER
  741: 
  742: COS      = ACTCW ---> CALL WAITING FEATURE ACTIVATED
  743: COS      = CWACT ---> CALL WAITING ACTIVATION/DEACTIVATION VIA SUBSCRIBER CONTROL INPUT
  744: COS      = CONF3 ---> 3 PARTY CALLFERENCING FEATURE ACTIVATED
  745: COS      = PROP8 ---> ALARM CALL SERVICE FEATURE IS ACTIVATED
  746: COS      = CLIP FSK ---> CALLER ID FEATURES IS ACTIVATED
  747: 
  748: ADDINF   = KEYWORD ---> SUBSCRIBER HAS PIN
  749:   NOTE: TO CHECK THE SUBSCRIBER PIN (PASSWORD) THE COMMAND IS 
  750:          DISPKEYWORD:DN=25421113;
  751:            
  752: BLK      = ACCSUSP  ---> SUBSCRIBER ACCOUNT SUSPENDED  NOT PAYING THE BILL
  753: BLK      = ADMIN    ---> SUBSCRIBER ACCOUNT SUSPENDED  NOT PAYING THE BILL
  754: BLK      = ADMIN1, ADMIN2, ADMIN3  ---> SUBSCRIBER ACCOUNT SUSPENDED OTHER REASON
  755:              */
  756:  
  757:  
  758:             /*
  759: 2019-12-26 06:07:42: ServiceSymbolList: Service symbol list: CAT = MS, LTT = COSLAC2, OPTRCL = 2, SU
  760: BTRCL = 2, NUMCAL = 1, ORIG1 = 5, DIV = DIVI DIVIMOD DDVIN, BLK = ACCSUSP, TRARSTR = ACTTRACL TRACLA
  761: CT, LNATT = PB, COS = ACTCW CONF3 CWACT PROP8 CLIP, OPTRCL = 0, BLK = ACCSUSP ADMIN1, ADDINF = KEYWO
  762: RD, COS = CLIP FSK, TRARSTR = TRACLACT, COS = CONF3 CWACT PROP8 CLIP FSK, DIV = ACTDIVI -22255408, C
  763: OS = ACTCW CWACT, DIV = ACTDIVI -1885050, DIV = ACTDIVI -98542783, SUBTRCL = 5, DIV = ACTDIVI -23630
  764: 149, DIV = ACTDIVI -97140405, DIV = ACTDIVI -98765061, LTT = COSLAC1, DIV = ACTDIVI -56660104, TRARS
  765: TR = REQSPORI REQSPTER, DIV = ACTDIVI -96608155, DIV = ACTDIVI -90070130, DIV = ACTDIVI -50867570, D
  766: IV = ACTDIVI -99066818, BLK = ADMIN1, COS = ACTCW CWACT CLIP FSK, DIV = ACTDIVI -55157777, DIV = ACT
  767: DIVI -22255407, DIV = ACTDIVI -60361542, DIV = ACTDIVI -23832042, BLK = ADMIN2, DIV = ACTDIVI -22255
  768: 406, DIV = ACTDIVI -97718256, DIV = ACTDIVI -25430752, DIV = ACTDIVI -23847000, DIV = ACTDIVI -94130
  769: 075, DIV = ACTDIVI -90070140, DIV = ACTDIVI -98941899, DIV = ACTDIVI -66165244, DIV = ACTDIVI -99000
  770: 064, DIV = ACTDIVI -99392712, DIV = ACTDIVI -99583218, DIV = ACTDIVI -90061187, TRARSTR = ACTTRACL T
  771: RACLACT TRACLMOD, DIV = ACTDIVI -66667641, DIV = ACTDIVI -99326080, DIV = ACTDIVI -55865281, DIV = A
  772: CTDIVI -94171955, DIV = ACTDIVI -22255495, DIV = DIVI -5610, COS = ACTCW CONF3 CWACT CLIP FSK, DIV =
  773:  ACTDIVI -50955607, DIV = ACTDIVI -22255496
  774:              */
  775:  
  776:             m = Regex.Match(content, @"DISPSUB:DN=(\d{8});");
  777:  
  778:             if (m.Success)
  779:             {
  780:                 matchedText = m.Groups[1].Value;
  781:  
  782:                 if (int.TryParse(matchedText, out int dn))
  783:                 {
  784:                     serviceSupplementaryService.Service = dn;
  785:  
  786:                     using (StringReader reader = new StringReader(content))
  787:                     {
  788:                         while ((line = reader.ReadLine()) != null)
  789:                         {
  790:                             // COS      = CLIP FSK ---> CALLER ID FEATURES IS ACTIVATED
  791:                             m = Regex.Match(line, @"COS.+CLIP.+FSK");
  792:                             if (m.Success) serviceSupplementaryService.SupplementaryServiceList.Add(Ia.Ftn.Cl.Models.Business.Service.SupplementaryService.CallerId);
  793:  
  794:                             // COS      = ACTCW ---> CALL WAITING FEATURE ACTIVATED
  795:                             m = Regex.Match(line, @"COS.+ACTCW");
  796:                             if (m.Success) serviceSupplementaryService.SupplementaryServiceList.Add(Ia.Ftn.Cl.Models.Business.Service.SupplementaryService.CallWaiting);
  797:  
  798:                             // COS      = CWACT ---> CALL WAITING ACTIVATION/DEACTIVATION VIA SUBSCRIBER CONTROL INPUT
  799:                             m = Regex.Match(line, @"COS.+CWACT");
  800:                             if (m.Success) serviceSupplementaryService.SupplementaryServiceList.Add(Ia.Ftn.Cl.Models.Business.Service.SupplementaryService.CallWaiting);
  801:  
  802:                             // COS      = CONF3 ---> 3 PARTY CALLFERENCING FEATURE ACTIVATED
  803:                             m = Regex.Match(line, @"COS.+CONF3");
  804:                             if (m.Success) serviceSupplementaryService.SupplementaryServiceList.Add(Ia.Ftn.Cl.Models.Business.Service.SupplementaryService.ConferenceCall);
  805:  
  806:                             // COS      = PROP8 ---> ALARM CALL SERVICE FEATURE IS ACTIVATED
  807:                             m = Regex.Match(line, @"COS.+PROP8");
  808:                             if (m.Success) serviceSupplementaryService.SupplementaryServiceList.Add(Ia.Ftn.Cl.Models.Business.Service.SupplementaryService.WakeupCall);
  809:  
  810:                             // DIV      = DIVI     DIVIMOD  DDVIN  ---> DIVERSATION IMMIDIATE FEATURES IS ASSIGNED TO SUBSCRIBER
  811:                             m = Regex.Match(line, @"DIV.+DIVI.+DIVIMOD.+DDVIN");
  812:                             if (m.Success) serviceSupplementaryService.SupplementaryServiceList.Add(Ia.Ftn.Cl.Models.Business.Service.SupplementaryService.CallForwarding);
  813:  
  814:                             // DIV      = ACTDIVI -9793XXXX  ---> SUBSCRIBER IMMEDIATELY DIVERTED TO GIVEN NUMBER
  815:                             m = Regex.Match(line, @"DIV\s+=.+ACTDIVI.+-(\d{8})");
  816:                             if (m.Success) serviceSupplementaryService.Pin = m.Value;
  817:  
  818:                             // OPTRCL   = 0 ---> WITH INTERNATIONAL CALL ENTERED BY OPERATOR
  819:                             // OPTRCL   = 2 ---> WITHOUT INTERNATIONAL CALL ENTERED BY OPERATOR
  820:                             m = Regex.Match(line, @"OPTRCL\s+=\s+0");
  821:                             if (m.Success) serviceSupplementaryService.SupplementaryServiceList.Add(Ia.Ftn.Cl.Models.Business.Service.SupplementaryService.InternationalCalling);
  822:  
  823:                             // TRARSTR  = ACTTRACL TRACLACT ---> TRAFFIC RESTRATION FEATURES IS ACTIVATED (SUBSCRIBER CAN OPEN AND CLOSE INTERNATIONAL CALL)
  824:                             m = Regex.Match(line, @"TRARSTR.+ACTTRACL.+TRACLACT");
  825:                             if (m.Success) serviceSupplementaryService.SupplementaryServiceList.Add(Ia.Ftn.Cl.Models.Business.Service.SupplementaryService.InternationalCallingUserControlled);
  826:  
  827:                             // SUBTRCL  = 0 ---> WITH INTERNATIONAL CALL MODIFIED BY SUBSCRIBER
  828:                             // SUBTRCL  = 2 ---> WITHOUT INTERNATIONAL CALL MODIFIED BY SUBSCRIBER
  829:                             m = Regex.Match(line, @"SUBTRCL\s+=\s+0");
  830:                             if (m.Success) serviceSupplementaryService.InternationalCallingUserControlledActivated = true;
  831:  
  832:                             // BLK      = ACCSUSP  ---> SUBSCRIBER ACCOUNT SUSPENDED  NOT PAYING THE BILL
  833:                             // BLK      = ADMIN    ---> SUBSCRIBER ACCOUNT SUSPENDED  NOT PAYING THE BILL
  834:                             // BLK      = ADMIN1, ADMIN2, ADMIN3  ---> SUBSCRIBER ACCOUNT SUSPENDED OTHER REASON
  835:                             m = Regex.Match(line, @"BLK\s+=.+[ACCSUSP|ADMIN]");
  836:                             if (m.Success)
  837:                             {
  838:                                 serviceSupplementaryService.ServiceAdministrativelySuspendedByBillingDepartment = true;
  839:                                 serviceSupplementaryService.SupplementaryServiceList.Add(Ia.Ftn.Cl.Models.Business.Service.SupplementaryService.ServiceSuspension);
  840:                             }
  841:                             m = Regex.Match(line, @"BLK\s+=.+[ADMIN1|ADMIN2|ADMIN3]");
  842:                             if (m.Success)
  843:                             {
  844:                                 serviceSupplementaryService.ServiceAdministrativelySuspendedForOtherReasons = true;
  845:                                 serviceSupplementaryService.SupplementaryServiceList.Add(Ia.Ftn.Cl.Models.Business.Service.SupplementaryService.ServiceSuspension);
  846:                             }
  847:  
  848:                             // ADDINF   = KEYWORD ---> SUBSCRIBER HAS PIN
  849:                             m = Regex.Match(line, @"ADDINF\s+=.+KEYWORD");
  850:                             if (m.Success) serviceSupplementaryService.SubscriberHasPin = true;
  851:                         }
  852:                     }
  853:  
  854:                     Ia.Ftn.Cl.Models.Business.Siemens.Ewsd.ExtractAndUpdateUniqueEwsdServiceSymbolListFromOutputContent(content);
  855:                 }
  856:                 else
  857:                 {
  858:                 }
  859:             }
  860:             else
  861:             {
  862:             }
  863:  
  864:             return serviceSupplementaryService;
  865:         }
  866:  
  867:         ////////////////////////////////////////////////////////////////////////////
  868:         ////////////////////////////////////////////////////////////////////////////
  869:  
  870:         /// <summary>
  871:         ///
  872:         /// </summary>
  873:         public static string ReadServiceCommand(Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Pstn pstn, string service)
  874:         {
  875:             return EwsdCommand(Opcode.Dispsub, service); // + "\r\n" + EwsdCommand(Opcode.Dispkeyword, service) + "\r\n";
  876:         }
  877:  
  878:         /*
  879:         ////////////////////////////////////////////////////////////////////////////
  880: 
  881:         /// <summary>
  882:         ///
  883:         /// </summary>
  884:         public static string RouteServiceCommand(Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.Pstn pstn, string service)
  885:         {
  886:             string s;
  887: 
  888:             if (!pstn.UsesNpServer) s = EwsdCommand(Opcode.Crcpt, service) + "\r\n";
  889:             else s = string.Empty;
  890: 
  891:             return s;
  892:         }
  893:         */
  894:  
  895:         ////////////////////////////////////////////////////////////////////////////
  896:  
  897:         /// <summary>
  898:         ///
  899:         /// </summary>
  900:         public static string DeleteServiceCommand(Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Pstn pstn, string service)
  901:         {
  902:             string s;
  903:  
  904:             /*if (!pstn.UsesNpServer)*/
  905:             s = EwsdCommand(Opcode.Cansub, service) + "\r\n";
  906:             //else s = string.Empty;
  907:  
  908:             return s;
  909:         }
  910:  
  911:         ////////////////////////////////////////////////////////////////////////////
  912:  
  913:         /// <summary>
  914:         ///
  915:         /// </summary>
  916:         public static string UpdateSupplementaryServiceCommand(string service, Ia.Ftn.Cl.Models.Business.Service.SupplementaryService supplementaryService, bool supplementaryServiceState)
  917:         {
  918:             string dn;
  919:             string command;
  920:  
  921:             dn = service;
  922:  
  923:             switch (supplementaryService)
  924:             {
  925:                 case (Ia.Ftn.Cl.Models.Business.Service.SupplementaryService.AbbriviatedCalling):
  926:                     {
  927:                         command = EwsdCommand(Opcode.UpdateSubXxx, dn);
  928:                         break;
  929:                     }
  930:                 case (Ia.Ftn.Cl.Models.Business.Service.SupplementaryService.CallerId):
  931:                     {
  932:                         command = EwsdCommand(Opcode.UpdateSubXxx, dn);
  933:                         break;
  934:                     }
  935:                 case (Ia.Ftn.Cl.Models.Business.Service.SupplementaryService.CallForwarding):
  936:                     {
  937:                         command = EwsdCommand(Opcode.UpdateSubXxx, dn);
  938:                         break;
  939:                     }
  940:                 case (Ia.Ftn.Cl.Models.Business.Service.SupplementaryService.CallWaiting):
  941:                     {
  942:                         command = EwsdCommand(Opcode.UpdateSubXxx, dn);
  943:                         break;
  944:                     }
  945:                 case (Ia.Ftn.Cl.Models.Business.Service.SupplementaryService.ConferenceCall):
  946:                     {
  947:                         command = EwsdCommand(Opcode.UpdateSubXxx, dn);
  948:                         break;
  949:                     }
  950:                 case (Ia.Ftn.Cl.Models.Business.Service.SupplementaryService.WakeupCall):
  951:                     {
  952:                         command = EwsdCommand(Opcode.UpdateSubXxx, dn);
  953:                         break;
  954:                     }
  955:                 case (Ia.Ftn.Cl.Models.Business.Service.SupplementaryService.InternationalCallingUserControlled):
  956:                     {
  957:                         command = EwsdCommand(Opcode.UpdateSubXxx, dn);
  958:                         break;
  959:                     }
  960:                 case (Ia.Ftn.Cl.Models.Business.Service.SupplementaryService.InternationalCalling):
  961:                     {
  962:                         command = EwsdCommand(Opcode.UpdateSubXxx, dn);
  963:                         break;
  964:                     }
  965:                 case (Ia.Ftn.Cl.Models.Business.Service.SupplementaryService.ServiceSuspension):
  966:                     {
  967:                         command = EwsdCommand(Opcode.UpdateSubXxx, dn);
  968:                         break;
  969:                     }
  970:                 default:
  971:                     {
  972:                         command = dn + ",unknown SupplementaryService: " + supplementaryServiceState.ToString().ToLower();
  973:                         break;
  974:                     }
  975:             }
  976:  
  977:             return command;
  978:         }
  979:  
  980:         ////////////////////////////////////////////////////////////////////////////
  981:  
  982:         /// <summary>
  983:         ///
  984:         /// </summary>
  985:         public static string ServiceSuspensionCommand(Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Pstn pstn, string service, bool serviceSuspensionState)
  986:         {
  987:             string command;
  988:  
  989:             /*if (!pstn.UsesNpServer)*/
  990:             if (serviceSuspensionState) command = EwsdCommand(Opcode.SuspendTemp, service, true) + "\r\n"; // suspend
  991:             else command = EwsdCommand(Opcode.SuspendTemp, service, false) + "\r\n"; // release
  992:             //else s = string.Empty;
  993:  
  994:             return command;
  995:         }
  996:  
  997:         ////////////////////////////////////////////////////////////////////////////
  998:         ////////////////////////////////////////////////////////////////////////////
  999:  
 1000:         /// <summary>
 1001:         ///
 1002:         /// </summary>
 1003:         public static string EwsdCommand(Opcode opcode, string dn)
 1004:         {
 1005:             string command;
 1006:  
 1007:             if (opcode == Opcode.Dispsub) command = "DISPSUB:DN=" + dn + ";";
 1008:             else if (opcode == Opcode.Dispkeyword) command = "DISPKEYWORD:DN=" + dn + ";";
 1009:             else if (opcode == Opcode.Cansub) command = "CANSUB:DN=" + dn + ";";
 1010:             else if (opcode == Opcode.UpdateSubXxx) command = "DISPSUB:DN=" + dn + ";";
 1011:             //else if (opcode == Opcode.Crcpt) command = "CRCPT:CODE=" + dn + ",DEST=QRNTOHUAWEI,ORIG1=DEF;";
 1012:             //else if (opcode == Opcode.Disptime) command = "DISPTIME;";
 1013:             else
 1014:             {
 1015:                 throw new System.ArgumentOutOfRangeException("EwsdCommand(): Opcode unrecognized. ");
 1016:             }
 1017:  
 1018:             return command;
 1019:         }
 1020:  
 1021:         ////////////////////////////////////////////////////////////////////////////
 1022:  
 1023:         /// <summary>
 1024:         ///
 1025:         /// </summary>
 1026:         public static string EwsdCommand(Opcode opcode, string dn, bool b)
 1027:         {
 1028:             string command;
 1029:  
 1030:             if (opcode == Opcode.SuspendTemp) command = "SuspendTemp:DN=" + dn + ",Temp=" + b + ";";
 1031:             else if (opcode == Opcode.UpdateSubXxx) command = "DISPSUB:DN=" + dn + ";";
 1032:             else
 1033:             {
 1034:                 throw new System.ArgumentOutOfRangeException("EwsdCommand(): Opcode unrecognized. ");
 1035:             }
 1036:  
 1037:             return command;
 1038:         }
 1039:  
 1040:         ////////////////////////////////////////////////////////////////////////////
 1041:  
 1042:         /// <summary>
 1043:         /// Extract unique EWSD service symbols into array 
 1044:         /// </summary>
 1045:         public static void ExtractAndUpdateUniqueEwsdServiceSymbolListFromOutputContent(string outputContent)
 1046:         {
 1047:             string s;
 1048:             MatchCollection matchCollection;
 1049:  
 1050:             matchCollection = Regex.Matches(outputContent, @"\r\n   [\w]{1,}\s+= .+[^\r\n]");
 1051:  
 1052:             if (matchCollection.Count > 0)
 1053:             {
 1054:                 foreach (Match match in matchCollection)
 1055:                 {
 1056:                     s = Regex.Replace(match.Value, @"MASKNO:\d+", "");
 1057:                     s = Regex.Replace(s, @"\s+", " ");
 1058:                     s = s.Trim();
 1059:  
 1060:                     if (!ServiceSymbolList.Contains(s))
 1061:                     {
 1062:                         ServiceSymbolList.Add(s);
 1063:                     }
 1064:                 }
 1065:             }
 1066:         }
 1067:  
 1068:         ////////////////////////////////////////////////////////////////////////////
 1069:         ////////////////////////////////////////////////////////////////////////////
 1070:  
 1071:         /// <summary>
 1072:         ///
 1073:         /// </summary>
 1074:         public static string SpecialHandlingAndModificationOfPstnName(string pstnName)
 1075:         {
 1076:             // change JBL, SSB, FHH to QRN because they are just RSUs following QRN
 1077:             string modifiedPstnName;
 1078:  
 1079:             if (pstnName == "JBL") modifiedPstnName = "QRN";
 1080:             //else if (pstnName == "SSB") modifiedPstnName = "QRN"; // SSB is decommissioned
 1081:             else if (pstnName == "FHH") modifiedPstnName = "QRN";
 1082:             else if (pstnName == "WAF") modifiedPstnName = "QRN";
 1083:             else if (pstnName == "ZOR") modifiedPstnName = "QRN";
 1084:             else if (pstnName == "AMD") modifiedPstnName = "QRN";
 1085:             else if (pstnName == "RKK") modifiedPstnName = "QRN";
 1086:             else if (pstnName == "SHB") modifiedPstnName = "QRN";
 1087:             else if (pstnName == "UHN") modifiedPstnName = "QRN";
 1088:             else if (pstnName == "ABD") modifiedPstnName = "TECB";
 1089:             else modifiedPstnName = pstnName;
 1090:  
 1091:             return modifiedPstnName;
 1092:         }
 1093:  
 1094:         ////////////////////////////////////////////////////////////////////////////
 1095:         ////////////////////////////////////////////////////////////////////////////    
 1096:     }
 1097: }
 1098: