)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Home » Code Library » Access (Ia.Ftn.Cl.Model.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.Model.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.Model.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.Model.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.Model.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.Model.Business.NetworkDesignDocument.Pon p in Ia.Ftn.Cl.Model.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.Model.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.Model.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.Model.Access Create(Ia.Ftn.Cl.Model.Business.Msmq.Application sender, string input, string kuwaitFtnAreaSymbol, string block, string street, string premisesOld, string premisesNew, string odf, string paci, string note, string userId, out Ia.Cl.Models.Result result)
  236:         {
  237:             string accessName;
  238:             Ia.Ftn.Cl.Model.Access access;
  239:             Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt;
  240:             Ia.Ftn.Cl.Model.Business.Service.KuwaitFtnArea kuwaitFtnArea;
  241:  
  242:             result = new Ia.Cl.Models.Result();
  243:             access = null;
  244:  
  245:             if (Ia.Ftn.Cl.Model.Data.NetworkDesignDocument.AccessNameIsWithinAllowedOntList(input, out accessName))
  246:             {
  247:                 nddOnt = Ia.Ftn.Cl.Model.Data.NetworkDesignDocument.OntByAccessName(accessName);
  248:  
  249:                 if (nddOnt != null)
  250:                 {
  251:                     kuwaitFtnArea = Ia.Ftn.Cl.Model.Data.Service.KuwaitFtnAreaBySymbol(kuwaitFtnAreaSymbol);
  252:  
  253:                     if (kuwaitFtnArea != null)
  254:                     {
  255:                         access = new Ia.Ftn.Cl.Model.Access
  256:                         {
  257:                             Id = Ia.Ftn.Cl.Model.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:                             UserId = userId
  270:                         };
  271:  
  272:                         Ia.Ftn.Cl.Model.Data.Access.Create(access, out result);
  273:  
  274:                         if (result.IsSuccessful)
  275:                         {
  276:                             Ia.Ftn.Cl.Model.Data.Msmq.SecretaryApplication.Enqueue(sender, Ia.Ftn.Cl.Model.Business.Msmq.Process.AccessCreated, nddOnt.Access.Name);
  277:  
  278:                             Ia.Ftn.Cl.Model.Data.Msmq.SecretaryApplication.Enqueue(sender, Ia.Ftn.Cl.Model.Business.Msmq.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.Model.Access CreateObject(string input, string kuwaitFtnAreaSymbol, string block, string street, string premisesOld, string premisesNew, string odf, string paci, string note, string userId, out Ia.Cl.Models.Result result)
  305:         {
  306:             string accessName;
  307:             Ia.Ftn.Cl.Model.Access access;
  308:             Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt;
  309:             Ia.Ftn.Cl.Model.Business.Service.KuwaitFtnArea kuwaitFtnArea;
  310:  
  311:             result = new Ia.Cl.Models.Result();
  312:  
  313:             access = null;
  314:  
  315:             if (Ia.Ftn.Cl.Model.Data.NetworkDesignDocument.AccessNameIsWithinAllowedOntList(input, out accessName))
  316:             {
  317:                 nddOnt = Ia.Ftn.Cl.Model.Data.NetworkDesignDocument.OntByAccessName(accessName);
  318:  
  319:                 if (nddOnt != null)
  320:                 {
  321:                     kuwaitFtnArea = Ia.Ftn.Cl.Model.Data.Service.KuwaitFtnAreaBySymbol(kuwaitFtnAreaSymbol);
  322:  
  323:                     if (kuwaitFtnArea != null)
  324:                     {
  325:                         access = new Ia.Ftn.Cl.Model.Access
  326:                         {
  327:                             Id = Ia.Ftn.Cl.Model.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:                             UserId = userId
  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.Model.Business.Msmq.Application sender, string inputAccessName, string userId, out Ia.Cl.Models.Result result)
  368:         {
  369:             string accessName, r;
  370:             Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt;
  371:  
  372:             result = new Ia.Cl.Models.Result();
  373:  
  374:             if (Ia.Ftn.Cl.Model.Data.NetworkDesignDocument.AccessNameIsWithinAllowedOntList(inputAccessName, out accessName))
  375:             {
  376:                 nddOnt = Ia.Ftn.Cl.Model.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.Model.Data.ServiceRequestService.NullifyAccessIdByAccessId(nddOnt.Access.Id, out r);
  397:  
  398:                         Ia.Ftn.Cl.Model.Data.Huawei.Ont.NullifyAccessIdByAccessId(nddOnt.Access.Id, out r);
  399:  
  400:                         Ia.Ftn.Cl.Model.Data.Huawei.Dev.NullifyAccessIdByAccessId(nddOnt.Access.Id, out r);  // for MDUs
  401:  
  402:                         Ia.Ftn.Cl.Model.Data.Nokia.Ont.NullifyAccessIdByAccessId(nddOnt.Access.Id, out r);
  403:  
  404:                         Ia.Ftn.Cl.Model.Data.Service2.NullifyAccessIdByAccessId(nddOnt.Access.Id, out r);
  405:  
  406:                         Ia.Ftn.Cl.Model.Data.Event.DeleteByAccessId(nddOnt.Access.Id, out r);
  407:  
  408:                         Ia.Ftn.Cl.Model.Data.ServiceRequestOntDetail.DeleteByAccessId(nddOnt.Access.Id, out r);
  409:  
  410:                         Ia.Ftn.Cl.Model.Data.ServiceRequestOnt.DeleteByAccessId(nddOnt.Access.Id, out r);
  411:  
  412:                         Ia.Ftn.Cl.Model.Data.Access.Delete(nddOnt.Access.Id, out result);
  413:  
  414:                         if (result.IsSuccessful)
  415:                         {
  416:                             Ia.Ftn.Cl.Model.Data.Msmq.SecretaryApplication.Enqueue(sender, Ia.Ftn.Cl.Model.Business.Msmq.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.Model.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
  467:                 {
  468:                     s = input.TrimStart('0');
  469:                 }
  470:             }
  471:             else
  472:             {
  473:                 s = string.Empty;
  474:             }
  475:  
  476:             return s;
  477:         }
  478:  
  479:         ////////////////////////////////////////////////////////////////////////////
  480:  
  481:         /// <summary>
  482:         ///
  483:         /// </summary>
  484:         public static string NormalizeStreetEntry(string input)
  485:         {
  486:             string s;
  487:  
  488:             s = input.ToLower();
  489:  
  490:             if (s == "na") s = string.Empty;
  491:             else if (s == "n/a") s = string.Empty;
  492:             else if (s == "0") s = string.Empty;
  493:             else if (s == "#") s = string.Empty;
  494:  
  495:             s = s.Replace("#", "");
  496:  
  497:             s = s.TrimStart('0');
  498:  
  499:             return s;
  500:         }
  501:  
  502:         ////////////////////////////////////////////////////////////////////////////
  503:  
  504:         /// <summary>
  505:         ///
  506:         /// </summary>
  507:         public static string NormalizePremisesEntry(string input)
  508:         {
  509:             string s;
  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:             return s;
  523:         }
  524:  
  525:         ////////////////////////////////////////////////////////////////////////////
  526:  
  527:         /// <summary>
  528:         ///
  529:         /// </summary>
  530:         public static string NormalizePaciEntry(string input)
  531:         {
  532:             if (Regex.IsMatch(input, @"\d{8}")) { }
  533:             else input = string.Empty;
  534:  
  535:             return input;
  536:         }
  537:  
  538:         ////////////////////////////////////////////////////////////////////////////
  539:  
  540:         /// <summary>
  541:         ///
  542:         /// </summary>
  543:         public static bool PaciIsInAValidFormat(string paci)
  544:         {
  545:             /*
  546: select substring(paci,1,2), count(0) from Accesses 
  547: where paci is not null and paci <> '00000000' --and len(paci) = 8
  548: group by substring(paci,1,2)
  549: order by substring(paci,1,2)
  550: 
  551: (No column name)    (No column name)
  552:     2    1
  553: 10    3
  554: 11    3367
  555: 12    1318
  556: 13    1575
  557: 14    2069
  558: 15    2535
  559: 16    1267
  560: 17    709
  561: 18    1795
  562: 19    2891
  563: 20    4319
  564: 21    1587
  565: 25    1
  566: 26    1
  567: 29    1
  568: 34    1
  569: 50    1
  570: 51    1
  571: 55    1
  572: 65    2
  573: 90    714
  574: 91    156
  575: 92    299
  576: 93    546
  577: 94    672
  578: 95    3875
  579: 96    13
  580: 97    3
  581: 98    2
  582: 99    6
  583:             */
  584:  
  585:             var isValid = Regex.IsMatch(paci, @"^[123456789]\d{7}$") == true;
  586:  
  587:             return isValid;
  588:         }
  589:  
  590:         ////////////////////////////////////////////////////////////////////////////
  591:  
  592:         /// <summary>
  593:         ///
  594:         /// </summary>
  595:         public static string NormalizeOntSerialNumberEntry(string input)
  596:         {
  597:             string serial;
  598:  
  599:             serial = input.ToUpper();
  600:  
  601:             return serial;
  602:         }
  603:  
  604:         ////////////////////////////////////////////////////////////////////////////
  605:  
  606:         /// <summary>
  607:         ///
  608:         /// </summary>
  609:         public static bool AccessNameIsInAValidFormat(string accessName)
  610:         {
  611:             bool isValid;
  612:  
  613:             accessName = accessName.ToUpper();
  614:  
  615:             isValid = Regex.IsMatch(accessName, @"^[a-zA-Z]{3}\s+\d{1,4}\s+\d{1,3}$") // SLA 1 1
  616:                 || Regex.IsMatch(accessName, @"^[a-zA-Z]{3}\.\d{1,4}\.\d{1,3}$") // SLA.1.1
  617:                 || Regex.IsMatch(accessName, @"^[a-zA-Z]{3}\/\d{1,4}\/\d{1,3}$") // SLA/1/1
  618:                 || Regex.IsMatch(accessName, @"^[a-zA-Z]{3}-\d{1,4}-\d{1,3}$"); // SLA-1-1
  619:  
  620:             return isValid;
  621:         }
  622:  
  623:         ////////////////////////////////////////////////////////////////////////////
  624:  
  625:         /// <summary>
  626:         ///
  627:         /// </summary>
  628:         public static bool PonNameIsInValidFormat(string ponName)
  629:         {
  630:             bool isValid;
  631:  
  632:             isValid = Regex.IsMatch(ponName, @"^[a-zA-Z]{3}\s+\d{1,4}$") // SLA 1
  633:                 || Regex.IsMatch(ponName, @"^[a-zA-Z]{3}\.\d{1,4}$") // SLA.1
  634:                 || Regex.IsMatch(ponName, @"^[a-zA-Z]{3}\/\d{1,4}$") // SLA/1
  635:                 || Regex.IsMatch(ponName, @"^[a-zA-Z]{3}-\d{1,4}$"); // SLA-1
  636:  
  637:             return isValid;
  638:         }
  639:  
  640:         ////////////////////////////////////////////////////////////////////////////
  641:         ////////////////////////////////////////////////////////////////////////////
  642:     }
  643:  
  644:     ////////////////////////////////////////////////////////////////////////////
  645:     ////////////////////////////////////////////////////////////////////////////
  646: }