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

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

Access support class for Fixed Telecommunications Network (FTN) business model.

    1: using System;
    2: using System.Linq;
    3: using System.Text.RegularExpressions;
    4:  
    5: namespace Ia.Ftn.Cl.Models.Business
    6: {
    7:     ////////////////////////////////////////////////////////////////////////////
    8:  
    9:     /// <summary publish="true">
   10:     /// Access support class for Fixed Telecommunications Network (FTN) business model.
   11:     /// </summary>
   12:     /// 
   13:     /// <remarks> 
   14:     /// Copyright © 2006-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   15:     ///
   16:     /// 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
   17:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   18:     ///
   19:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   20:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   21:     /// 
   22:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   23:     /// 
   24:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   25:     /// </remarks> 
   26:     public class Access
   27:     {
   28:         private const int fixedLengthOfId = 16;
   29:  
   30:         ////////////////////////////////////////////////////////////////////////////
   31:  
   32:         /// <summary>
   33:         ///
   34:         /// </summary>
   35:         public static int FixedLengthOfId { get { return fixedLengthOfId; } }
   36:  
   37:         /// <summary/>
   38:         public Access() { }
   39:  
   40:         ////////////////////////////////////////////////////////////////////////////
   41:  
   42:         /// <summary>
   43:         ///
   44:         /// </summary>
   45:         public static string AccessId(int oltId, int ponNumber, int ontNumber)
   46:         {
   47:             var id = oltId.ToString() + ponNumber.ToString().PadLeft(4, '0') + ontNumber.ToString().PadLeft(3, '0');
   48:  
   49:             if (id.Length != fixedLengthOfId)
   50:             {
   51:                 throw new ArgumentOutOfRangeException(@"AccessId(): Id length is not " + fixedLengthOfId);
   52:             }
   53:  
   54:             return id;
   55:         }
   56:  
   57:         ////////////////////////////////////////////////////////////////////////////
   58:  
   59:         /// <summary>
   60:         ///
   61:         /// </summary>
   62:         public static string AccessId(string ontId)
   63:         {
   64:             string id;
   65:  
   66:             var ont = Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OntById(ontId);
   67:  
   68:             if (ont != null) id = AccessId(ont.Pon.PonGroup.Olt.Id, ont.Pon.Number, ont.Number);
   69:             else id = "0";
   70:  
   71:             return id;
   72:         }
   73:  
   74:         ////////////////////////////////////////////////////////////////////////////
   75:  
   76:         /// <summary>
   77:         ///
   78:         /// </summary>
   79:         public static string Name(Ia.Ftn.Cl.Models.Access access)
   80:         {
   81:             string name;
   82:  
   83:             name = Name(access.Id);
   84:  
   85:             return name;
   86:         }
   87:  
   88:         ////////////////////////////////////////////////////////////////////////////
   89:  
   90:         /// <summary>
   91:         ///
   92:         /// </summary>
   93:         public static string Name(string accessId)
   94:         {
   95:             string name;
   96:  
   97:             var dictionary = Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OntAccessIdToOntAccessNameDictionary;
   98:  
   99:             if (!string.IsNullOrEmpty(accessId))
  100:             {
  101:                 if (dictionary.ContainsKey(accessId))
  102:                 {
  103:                     name = dictionary[accessId];
  104:                 }
  105:                 else name = string.Empty;
  106:             }
  107:             else name = string.Empty;
  108:  
  109:             return name;
  110:         }
  111:  
  112:         /*
  113:         ////////////////////////////////////////////////////////////////////////////
  114: 
  115:         /// <summary>
  116:         ///
  117:         /// </summary>
  118:         public static string Name(string accessId)
  119:         {
  120:             string name;
  121:             int oltId, ponNumber, ontNumber;
  122: 
  123:             ExtractOltIdAndPonNumberAndOntNumberFromAccessId(accessId, out oltId, out ponNumber, out ontNumber);
  124: 
  125:             if (oltId > 0 && ponNumber > 0 && ontNumber > 0)
  126:             {
  127:                 name = (from o in Ia.Ftn.Cl.Model.Data.NetworkDesignDocument.OntList where o.Pon.PonGroup.Olt.Id == oltId && o.Pon.Number == ponNumber && o.Number == ontNumber select o.Access.Name).SingleOrDefault();
  128:             }
  129:             else name = string.Empty;
  130: 
  131:             return name;
  132:         }
  133:         */
  134:  
  135:         ////////////////////////////////////////////////////////////////////////////
  136:  
  137:         /// <summary>
  138:         ///
  139:         /// </summary>
  140:         public static string Name(string areaSymbol, int pon, int ont)
  141:         {
  142:             string name;
  143:  
  144:             name = areaSymbol + "." + pon + "." + ont;
  145:  
  146:             return name;
  147:         }
  148:  
  149:         ////////////////////////////////////////////////////////////////////////////
  150:  
  151:         /// <summary>
  152:         ///
  153:         /// </summary>
  154:         private static void ExtractOltIdAndPonNumberAndOntNumberFromAccessId(string accessId, out int oltId, out int ponNumber, out int ontNumber)
  155:         {
  156:             string s;
  157:  
  158:             if (!string.IsNullOrEmpty(accessId))
  159:             {
  160:                 s = accessId.Substring(accessId.Length - 3, 3);
  161:  
  162:                 if (int.TryParse(s, out ontNumber))
  163:                 {
  164:                     accessId = accessId.Remove(accessId.Length - 3, 3);
  165:  
  166:                     s = accessId.Substring(accessId.Length - 4, 4);
  167:  
  168:                     if (int.TryParse(s, out ponNumber))
  169:                     {
  170:                         s = accessId.Remove(accessId.Length - 4, 4);
  171:  
  172:                         if (int.TryParse(s, out oltId))
  173:                         {
  174:  
  175:                         }
  176:                         else oltId = ponNumber = ontNumber = 0;
  177:                     }
  178:                     else oltId = ponNumber = ontNumber = 0;
  179:                 }
  180:                 else oltId = ponNumber = ontNumber = 0;
  181:             }
  182:             else oltId = ponNumber = ontNumber = 0;
  183:         }
  184:  
  185:         ////////////////////////////////////////////////////////////////////////////
  186:  
  187:         /// <summary>
  188:         ///
  189:         /// </summary>
  190:         public static void ExtractOltIdAndPonNumberAndOntNumberFromOntName(string accessName, out int oltId, out int pon, out int ontInternalNumber)
  191:         {
  192:             // below: this expects accessName in exact format like SUR.12.3
  193:             int ponNumber;
  194:             string ponGroupSymbol;
  195:             string[] sp;
  196:  
  197:             sp = accessName.Split('.');
  198:  
  199:             ponGroupSymbol = sp[0];
  200:             pon = ponNumber = int.Parse(sp[1]);
  201:             ontInternalNumber = int.Parse(sp[2]);
  202:  
  203:             oltId = (from Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Pon p in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.PonList where p.PonGroup.Symbol == ponGroupSymbol && p.Number == ponNumber select p.PonGroup.Olt.Id).SingleOrDefault();
  204:         }
  205:  
  206:         ////////////////////////////////////////////////////////////////////////////
  207:  
  208:         /// <summary>
  209:         ///
  210:         /// </summary>
  211:         public static string SqlInsertCommand(Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont nddOnt, int areaId, string block, string street, string premisesOld, string premisesNew, string paci)
  212:         {
  213:             string id, sa, odf;
  214:             string userId;
  215:             DateTime dateTime;
  216:  
  217:             id = Ia.Ftn.Cl.Models.Business.Access.AccessId(nddOnt.Pon.PonGroup.Olt.Id, nddOnt.Pon.Number, nddOnt.Number);
  218:             odf = string.Empty;
  219:             userId = string.Empty;
  220:             dateTime = DateTime.UtcNow.AddHours(3);
  221:  
  222:             // Id Olt Pon Ont Odf AreaId  Block Street  PremisesOld PremisesNew Created Updated UserId
  223:             // 102010101001001 102010101   1   1   NULL    50502   8   17  271 22  2014 - 11 - 18 10:17:17.000 2015 - 03 - 12 12:25:45.680 4E42E245 - 2BAF - 4C11 - B4BF - 4D681123999F
  224:  
  225:             sa = @"insert into Accesses (Id,Olt,Pon,Ont,Odf,AreaId,Block,Street,PremisesOld,PremisesNew,Paci,Created,Updated,UserId) values ('" + id + "'," + nddOnt.Pon.PonGroup.Olt.Id + "," + nddOnt.Pon.Number + "," + nddOnt.Number + ",'" + odf + "'," + areaId + "," + block + ",'" + street + "','" + premisesOld + "','" + premisesNew + "','" + paci + "','" + dateTime + "','" + dateTime + "','" + userId.ToString() + "')";
  226:  
  227:             return sa;
  228:         }
  229:  
  230:         ////////////////////////////////////////////////////////////////////////////
  231:  
  232:         /// <summary>
  233:         ///
  234:         /// </summary>
  235:         public static Ia.Ftn.Cl.Models.Access Create(Ia.Ftn.Cl.Models.Business.MessageQueue.Application sender, string input, string kuwaitFtnAreaSymbol, string block, string street, string premisesOld, string premisesNew, string odf, string paci, string note, StaffIdentityUser staffIdentityUser, out Ia.Cl.Models.Result result)
  236:         {
  237:             string accessName;
  238:             Ia.Ftn.Cl.Models.Access access;
  239:             Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont nddOnt;
  240:             Ia.Ftn.Cl.Models.Business.Service.KuwaitFtnArea kuwaitFtnArea;
  241:  
  242:             result = new Ia.Cl.Models.Result();
  243:             access = null;
  244:  
  245:             if (Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.AccessNameIsWithinAllowedOntList(input, out accessName))
  246:             {
  247:                 nddOnt = Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OntByAccessName(accessName);
  248:  
  249:                 if (nddOnt != null)
  250:                 {
  251:                     kuwaitFtnArea = Ia.Ftn.Cl.Models.Data.Service.KuwaitFtnAreaBySymbol(kuwaitFtnAreaSymbol);
  252:  
  253:                     if (kuwaitFtnArea != null)
  254:                     {
  255:                         access = new Ia.Ftn.Cl.Models.Access
  256:                         {
  257:                             Id = Ia.Ftn.Cl.Models.Business.Access.AccessId(nddOnt.Pon.PonGroup.Olt.Id, nddOnt.Pon.Number, nddOnt.Number),
  258:                             AreaId = kuwaitFtnArea.Id,
  259:                             Block = block,
  260:                             Street = street,
  261:                             PremisesOld = premisesOld,
  262:                             PremisesNew = premisesNew,
  263:                             Paci = paci,
  264:                             Note = note,
  265:                             Olt = nddOnt.Pon.PonGroup.Olt.Id,
  266:                             Odf = odf,
  267:                             Pon = nddOnt.Pon.Number,
  268:                             Ont = nddOnt.Number,
  269:                             StaffIdentityUser = staffIdentityUser
  270:                         };
  271:  
  272:                         Ia.Ftn.Cl.Models.Data.Access.Create(access, out result);
  273:  
  274:                         if (result.IsSuccessful)
  275:                         {
  276:                             Ia.Ftn.Cl.Models.Data.MessageQueue.SecretaryApplication.Enqueue(sender, Ia.Ftn.Cl.Models.Business.MessageQueue.Process.AccessCreated, nddOnt.Access.Name);
  277:  
  278:                             Ia.Ftn.Cl.Models.Data.MessageQueue.SecretaryApplication.Enqueue(sender, Ia.Ftn.Cl.Models.Business.MessageQueue.Process.ReadAccess, nddOnt.Access.Name);
  279:                         }
  280:                     }
  281:                     else
  282:                     {
  283:                         result.AddError("kuwaitFtnArea is null. ");
  284:                     }
  285:                 }
  286:                 else
  287:                 {
  288:                     result.AddError("nddOnt is null. ");
  289:                 }
  290:             }
  291:             else
  292:             {
  293:                 result.AddError("The ONT \"" + accessName + "\" does not belong to the network. ");
  294:             }
  295:  
  296:             return access;
  297:         }
  298:  
  299:         ////////////////////////////////////////////////////////////////////////////
  300:  
  301:         /// <summary>
  302:         ///
  303:         /// </summary>
  304:         public static Ia.Ftn.Cl.Models.Access CreateObject(string input, string kuwaitFtnAreaSymbol, string block, string street, string premisesOld, string premisesNew, string odf, string paci, string note, StaffIdentityUser staffIdentityUser, out Ia.Cl.Models.Result result)
  305:         {
  306:             string accessName;
  307:             Ia.Ftn.Cl.Models.Access access;
  308:             Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont nddOnt;
  309:             Ia.Ftn.Cl.Models.Business.Service.KuwaitFtnArea kuwaitFtnArea;
  310:  
  311:             result = new Ia.Cl.Models.Result();
  312:  
  313:             access = null;
  314:  
  315:             if (Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.AccessNameIsWithinAllowedOntList(input, out accessName))
  316:             {
  317:                 nddOnt = Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OntByAccessName(accessName);
  318:  
  319:                 if (nddOnt != null)
  320:                 {
  321:                     kuwaitFtnArea = Ia.Ftn.Cl.Models.Data.Service.KuwaitFtnAreaBySymbol(kuwaitFtnAreaSymbol);
  322:  
  323:                     if (kuwaitFtnArea != null)
  324:                     {
  325:                         access = new Ia.Ftn.Cl.Models.Access
  326:                         {
  327:                             Id = Ia.Ftn.Cl.Models.Business.Access.AccessId(nddOnt.Pon.PonGroup.Olt.Id, nddOnt.Pon.Number, nddOnt.Number),
  328:                             AreaId = kuwaitFtnArea.Id,
  329:                             Block = block,
  330:                             Street = street,
  331:                             PremisesOld = premisesOld,
  332:                             PremisesNew = premisesNew,
  333:                             Paci = paci,
  334:                             Note = note,
  335:                             Olt = nddOnt.Pon.PonGroup.Olt.Id,
  336:                             Odf = odf,
  337:                             Pon = nddOnt.Pon.Number,
  338:                             Ont = nddOnt.Number,
  339:                             Created = DateTime.UtcNow.AddHours(3),
  340:                             Updated = DateTime.UtcNow.AddHours(3),
  341:                             StaffIdentityUser = staffIdentityUser
  342:                         };
  343:                     }
  344:                     else
  345:                     {
  346:                         result.AddError("kuwaitFtnArea is null. ");
  347:                     }
  348:                 }
  349:                 else
  350:                 {
  351:                     result.AddError("nddOnt is null. ");
  352:                 }
  353:             }
  354:             else
  355:             {
  356:                 result.AddError("The ONT \"" + accessName + "\" does not belong to the network (الجهاز لا ينتمي للشبكة). ");
  357:             }
  358:  
  359:             return access;
  360:         }
  361:  
  362:         ////////////////////////////////////////////////////////////////////////////
  363:  
  364:         /// <summary>
  365:         ///
  366:         /// </summary>
  367:         public static void Delete(Ia.Ftn.Cl.Models.Business.MessageQueue.Application sender, string inputAccessName, string userId, out Ia.Cl.Models.Result result)
  368:         {
  369:             string accessName, r;
  370:             Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont nddOnt;
  371:  
  372:             result = new Ia.Cl.Models.Result();
  373:  
  374:             if (Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.AccessNameIsWithinAllowedOntList(inputAccessName, out accessName))
  375:             {
  376:                 nddOnt = Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OntByAccessName(accessName);
  377:  
  378:                 if (nddOnt != null)
  379:                 {
  380:                     try
  381:                     {
  382:                         /*
  383: --update ServiceRequestServices set Access_Id = null where Access_Id = '1040101010009013'
  384: --update EmsOnts set Access_Id = null where Access_Id = '1040101010009013'
  385: --update EmsDevs set Access_Id = null where Access_Id = '1060205011321001'
  386: --update Onts set Access_Id = null where Access_Id = '1040101010009013'
  387: --update Service2s set Access_Id = null where Access_Id = '1060205011321001'
  388: 
  389: --delete from Events where Ont_Id = (select id from Onts where Access_Id = '1040101010009013')
  390: 
  391: --delete from ServiceRequestOntDetails where ServiceRequestOnts _Id = (select id from ServiceRequestOnts where Access_Id = '1040101010009013')
  392: --delete from ServiceRequestOnts where Access_Id = '1040101010009013'
  393: 
  394: --delete from Accesses where id = '1040101010009013'
  395:                          */
  396:                         Ia.Ftn.Cl.Models.Data.ServiceRequestService.NullifyAccessIdByAccessId(nddOnt.Access.Id, out r);
  397:  
  398:                         Ia.Ftn.Cl.Models.Data.Huawei.Ont.NullifyAccessIdByAccessId(nddOnt.Access.Id, out r);
  399:  
  400:                         Ia.Ftn.Cl.Models.Data.Huawei.Dev.NullifyAccessIdByAccessId(nddOnt.Access.Id, out r);  // for MDUs
  401:  
  402:                         Ia.Ftn.Cl.Models.Data.Nokia.Ont.NullifyAccessIdByAccessId(nddOnt.Access.Id, out r);
  403:  
  404:                         Ia.Ftn.Cl.Models.Data.Service2.NullifyAccessIdByAccessId(nddOnt.Access.Id, out r);
  405:  
  406:                         Ia.Ftn.Cl.Models.Data.Event.DeleteByAccessId(nddOnt.Access.Id, out r);
  407:  
  408:                         Ia.Ftn.Cl.Models.Data.ServiceRequestOntDetail.DeleteByAccessId(nddOnt.Access.Id, out r);
  409:  
  410:                         Ia.Ftn.Cl.Models.Data.ServiceRequestOnt.DeleteByAccessId(nddOnt.Access.Id, out r);
  411:  
  412:                         Ia.Ftn.Cl.Models.Data.Access.Delete(nddOnt.Access.Id, out result);
  413:  
  414:                         if (result.IsSuccessful)
  415:                         {
  416:                             Ia.Ftn.Cl.Models.Data.MessageQueue.SecretaryApplication.Enqueue(sender, Ia.Ftn.Cl.Models.Business.MessageQueue.Process.ReadAccess, nddOnt.Access.Name);
  417:                         }
  418:                         else
  419:                         {
  420:                             result.AddError("Error in Ia.Ftn.Cl.Model.Data.Access.Delete(): " + result);
  421:                         }
  422:                     }
  423:                     catch (Exception e)
  424:                     {
  425:                         result.AddError("Error in Ia.Ftn.Cl.Model.Business.Access.Delete(): inputAccessName: " + inputAccessName + ", exception string: " + e.ToString());
  426:                     }
  427:                 }
  428:                 else
  429:                 {
  430:                     result.AddError("nddOnt is null. ");
  431:                 }
  432:             }
  433:             else
  434:             {
  435:                 result.AddError("The ONT \"" + accessName + "\" does not belong to the network (الجهاز لا ينتمي للشبكة). ");
  436:             }
  437:         }
  438:  
  439:         ////////////////////////////////////////////////////////////////////////////
  440:  
  441:         /// <summary>
  442:         ///
  443:         /// </summary>
  444:         public static void DeleteByAccessId(string accessId, string userId, out Ia.Cl.Models.Result result)
  445:         {
  446:             result = new Ia.Cl.Models.Result();
  447:  
  448:             Ia.Ftn.Cl.Models.Data.Access.Delete(accessId, out result);
  449:         }
  450:  
  451:         ////////////////////////////////////////////////////////////////////////////
  452:  
  453:         /// <summary>
  454:         ///
  455:         /// </summary>
  456:         public static string NormalizeBlockEntry(string input)
  457:         {
  458:             string s;
  459:  
  460:             if (!string.IsNullOrEmpty(input))
  461:             {
  462:                 if (int.TryParse(input, out int i))
  463:                 {
  464:                     s = i.ToString();
  465:                 }
  466:                 else s = string.Empty;
  467:             }
  468:             else s = string.Empty;
  469:  
  470:             return s;
  471:         }
  472:  
  473:         ////////////////////////////////////////////////////////////////////////////
  474:  
  475:         /// <summary>
  476:         ///
  477:         /// </summary>
  478:         public static string NormalizeStreetEntry(string input)
  479:         {
  480:             string s;
  481:  
  482:             if (!string.IsNullOrEmpty(input))
  483:             {
  484:                 s = input.ToLower();
  485:  
  486:                 if (s == "na") s = string.Empty;
  487:                 else if (s == "n/a") s = string.Empty;
  488:                 else if (s == "0") s = string.Empty;
  489:                 else if (s == "#") s = string.Empty;
  490:  
  491:                 s = s.Replace("#", "");
  492:  
  493:                 s = s.TrimStart('0');
  494:             }
  495:             else s = string.Empty;
  496:  
  497:             return s;
  498:         }
  499:  
  500:         ////////////////////////////////////////////////////////////////////////////
  501:  
  502:         /// <summary>
  503:         ///
  504:         /// </summary>
  505:         public static string NormalizePremisesEntry(string input)
  506:         {
  507:             string s;
  508:  
  509:             if (!string.IsNullOrEmpty(input))
  510:             {
  511:                 s = input.ToLower();
  512:  
  513:                 if (s == "na") s = string.Empty;
  514:                 else if (s == "n/a") s = string.Empty;
  515:                 else if (s == "0") s = string.Empty;
  516:                 else if (s == "#") s = string.Empty;
  517:  
  518:                 s = s.Replace("#", "");
  519:  
  520:                 s = s.TrimStart('0');
  521:  
  522:             }
  523:             else s = string.Empty;
  524:  
  525:             return s;
  526:         }
  527:  
  528:         ////////////////////////////////////////////////////////////////////////////
  529:  
  530:         /// <summary>
  531:         ///
  532:         /// </summary>
  533:         public static string NormalizePaciEntry(string input)
  534:         {
  535:             if (!string.IsNullOrEmpty(input))
  536:             {
  537:                 if (Regex.IsMatch(input, @"\d{8}")) { }
  538:                 else input = string.Empty;
  539:             }
  540:             else input = string.Empty;
  541:  
  542:             return input;
  543:         }
  544:  
  545:         ////////////////////////////////////////////////////////////////////////////
  546:  
  547:         /// <summary>
  548:         ///
  549:         /// </summary>
  550:         public static bool PaciIsInAValidFormat(string paci)
  551:         {
  552:             bool isValid;
  553:  
  554:             /*
  555: select substring(paci,1,2), count(0) from Accesses 
  556: where paci is not null and paci <> '00000000' --and len(paci) = 8
  557: group by substring(paci,1,2)
  558: order by substring(paci,1,2)
  559: 
  560: (No column name)    (No column name)
  561:     2    1
  562: 10    3
  563: 11    3367
  564: 12    1318
  565: 13    1575
  566: 14    2069
  567: 15    2535
  568: 16    1267
  569: 17    709
  570: 18    1795
  571: 19    2891
  572: 20    4319
  573: 21    1587
  574: 25    1
  575: 26    1
  576: 29    1
  577: 34    1
  578: 50    1
  579: 51    1
  580: 55    1
  581: 65    2
  582: 90    714
  583: 91    156
  584: 92    299
  585: 93    546
  586: 94    672
  587: 95    3875
  588: 96    13
  589: 97    3
  590: 98    2
  591: 99    6
  592:             */
  593:  
  594:             if (!string.IsNullOrEmpty(paci))
  595:             {
  596:                 isValid = Regex.IsMatch(paci, @"^[123456789]\d{7}$") == true;
  597:             }
  598:             else isValid = false;
  599:  
  600:             return isValid;
  601:         }
  602:  
  603:         ////////////////////////////////////////////////////////////////////////////
  604:  
  605:         /// <summary>
  606:         ///
  607:         /// </summary>
  608:         public static string NormalizeOntSerialNumberEntry(string input)
  609:         {
  610:             string serial;
  611:  
  612:             if (!string.IsNullOrEmpty(input))
  613:             {
  614:                 serial = input.ToUpper();
  615:             }
  616:             else serial = string.Empty;
  617:  
  618:             return serial;
  619:         }
  620:  
  621:         ////////////////////////////////////////////////////////////////////////////
  622:  
  623:         /// <summary>
  624:         ///
  625:         /// </summary>
  626:         public static bool AccessNameIsInAValidFormat(string accessName)
  627:         {
  628:             bool isValid;
  629:  
  630:             if (!string.IsNullOrEmpty(accessName))
  631:             {
  632:                 accessName = accessName.ToUpper();
  633:  
  634:                 isValid = Regex.IsMatch(accessName, @"^[a-zA-Z]{3}\s+\d{1,4}\s+\d{1,3}$") // SLA 1 1
  635:                     || Regex.IsMatch(accessName, @"^[a-zA-Z]{3}\.\d{1,4}\.\d{1,3}$") // SLA.1.1
  636:                     || Regex.IsMatch(accessName, @"^[a-zA-Z]{3}\/\d{1,4}\/\d{1,3}$") // SLA/1/1
  637:                     || Regex.IsMatch(accessName, @"^[a-zA-Z]{3}-\d{1,4}-\d{1,3}$"); // SLA-1-1
  638:             }
  639:             else isValid = false;
  640:  
  641:             return isValid;
  642:         }
  643:  
  644:         ////////////////////////////////////////////////////////////////////////////
  645:  
  646:         /// <summary>
  647:         ///
  648:         /// </summary>
  649:         public static bool PonNameIsInValidFormat(string ponName)
  650:         {
  651:             bool isValid;
  652:  
  653:             if (!string.IsNullOrEmpty(ponName))
  654:             {
  655:                 isValid = Regex.IsMatch(ponName, @"^[a-zA-Z]{3}\s+\d{1,4}$") // SLA 1
  656:                     || Regex.IsMatch(ponName, @"^[a-zA-Z]{3}\.\d{1,4}$") // SLA.1
  657:                     || Regex.IsMatch(ponName, @"^[a-zA-Z]{3}\/\d{1,4}$") // SLA/1
  658:                     || Regex.IsMatch(ponName, @"^[a-zA-Z]{3}-\d{1,4}$"); // SLA-1
  659:             }
  660:             else isValid = false;
  661:  
  662:             return isValid;
  663:         }
  664:  
  665:         ////////////////////////////////////////////////////////////////////////////
  666:         ////////////////////////////////////////////////////////////////////////////
  667:     }
  668:  
  669:     ////////////////////////////////////////////////////////////////////////////
  670:     ////////////////////////////////////////////////////////////////////////////
  671: }