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