)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Skip Navigation LinksHome » Code Library » Administration

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

Administration support class of Optical Fiber Network (OFN) business model.

    1: using System;
    2: using System.Collections.Generic;
    3: using System.Linq;
    4: using System.Text;
    5:  
    6: namespace Ia.Ngn.Cl.Model.Business
    7: {
    8:     ////////////////////////////////////////////////////////////////////////////
    9:  
   10:     /// <summary publish="true">
   11:     /// Administration support class of Optical Fiber Network (OFN) business model.
   12:     /// </summary>
   13:     /// 
   14:     /// <remarks> 
   15:     /// Copyright © 2006-2021 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   16:     ///
   17:     /// 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
   18:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   19:     ///
   20:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   21:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   22:     /// 
   23:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   24:     /// 
   25:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   26:     /// </remarks> 
   27:     public class Administration
   28:     {
   29:         private const int initialFrameworkListLength = 100;
   30:  
   31:         /// <summary/>
   32:         public static DateTime OfficialMorningStartOfWorkTime = DateTime.Parse("08:00"); // DateTime.Parse("07:00");
   33:  
   34:         /// <summary/>
   35:         public static DateTime OfficialMorningEndOfWorkTime = DateTime.Parse("14:00");
   36:  
   37:         /// <summary/>
   38:         public static DateTime OfficialEveningStartOfWorkTime = DateTime.MinValue;// DateTime.Parse("16:00");
   39:  
   40:         /// <summary/>
   41:         public static DateTime OfficialEveningEndOfWorkTime = DateTime.MinValue; // DateTime.Parse("20:00");
   42:  
   43:  
   44:         /// <summary/>
   45:         public static DateTime EarliestServiceRequestDate = DateTime.Parse("2000-01-01");
   46:  
   47:         /// <summary/>
   48:         public static DateTime SqlFriendlyJanuary1st1753NullDateTime = new DateTime(1753, 1, 1);
   49:  
   50:         /// <summary/>
   51:         public static DateTime EarliestRequestDateTime = new DateTime(1970, 1, 1);
   52:  
   53:         /// <summary/>
   54:         public static int InitialFrameworkListLength { get { return initialFrameworkListLength; } }
   55:  
   56:         /// <summary/>
   57:         public static bool ServiceSuspensionIsEnabled = true;
   58:  
   59:         ////////////////////////////////////////////////////////////////////////////
   60:  
   61:         /// <summary>
   62:         ///
   63:         /// </summary>
   64:         private static string LogoImagePng
   65:         {
   66:             get
   67:             {
   68:                 return "27.png";
   69:             }
   70:         }
   71:  
   72:         ////////////////////////////////////////////////////////////////////////////
   73:  
   74:         /// <summary>
   75:         ///
   76:         /// </summary>
   77:         public static string LogoImageUrl
   78:         {
   79:             get
   80:             {
   81:                 return "~/image/telegram/ftth-logo/" + LogoImagePng;
   82:             }
   83:         }
   84:  
   85:         ////////////////////////////////////////////////////////////////////////////
   86:  
   87:         /// <summary>
   88:         ///
   89:         /// </summary>
   90:         public static string LogoHtmlImageUrl
   91:         {
   92:             get
   93:             {
   94:                 return "../../image/telegram/ftth-logo/" + LogoImagePng;
   95:             }
   96:         }
   97:  
   98:         ////////////////////////////////////////////////////////////////////////////
   99:  
  100:         /// <summary>
  101:         ///
  102:         /// </summary>
  103:         public static string LogoImageAbsolutePathUrl
  104:         {
  105:             get
  106:             {
  107:                 return Ia.Cl.Model.Default.AbsolutePath() + @"image\telegram\ftth-logo\" + LogoImagePng;
  108:             }
  109:         }
  110:  
  111:         ////////////////////////////////////////////////////////////////////////////
  112:  
  113:         /// <summary>
  114:         ///
  115:         /// </summary>
  116:         public static string OfficialWorkingTimeString()
  117:         {
  118:             string officialMorningStartOfWorkTime, officialMorningEndOfWorkTime, officialEveningStartOfWorkTime, officialEveningEndOfWorkTime;
  119:             string officialMorningWorkTime, officialEveningWorkTime;
  120:  
  121:             officialMorningStartOfWorkTime = Ia.Ngn.Cl.Model.Business.Administration.OfficialMorningStartOfWorkTime != DateTime.MinValue ? Ia.Ngn.Cl.Model.Business.Administration.OfficialMorningStartOfWorkTime.ToString("HH:mm") : string.Empty;
  122:             officialMorningEndOfWorkTime = Ia.Ngn.Cl.Model.Business.Administration.OfficialMorningEndOfWorkTime != DateTime.MinValue ? Ia.Ngn.Cl.Model.Business.Administration.OfficialMorningEndOfWorkTime.ToString("HH:mm") : string.Empty;
  123:             officialEveningStartOfWorkTime = Ia.Ngn.Cl.Model.Business.Administration.OfficialEveningStartOfWorkTime != DateTime.MinValue ? Ia.Ngn.Cl.Model.Business.Administration.OfficialEveningStartOfWorkTime.ToString("HH:mm") : string.Empty;
  124:             officialEveningEndOfWorkTime = Ia.Ngn.Cl.Model.Business.Administration.OfficialEveningEndOfWorkTime != DateTime.MinValue ? Ia.Ngn.Cl.Model.Business.Administration.OfficialEveningEndOfWorkTime.ToString("HH:mm") : string.Empty;
  125:  
  126:             if (!string.IsNullOrEmpty(officialMorningStartOfWorkTime) && !string.IsNullOrEmpty(officialMorningEndOfWorkTime))
  127:             {
  128:                 officialMorningWorkTime = officialMorningStartOfWorkTime + "-" + officialMorningEndOfWorkTime;
  129:             }
  130:             else officialMorningWorkTime = string.Empty;
  131:  
  132:             if (!string.IsNullOrEmpty(officialEveningStartOfWorkTime) && !string.IsNullOrEmpty(officialEveningEndOfWorkTime))
  133:             {
  134:                 officialEveningWorkTime = officialEveningStartOfWorkTime + "-" + officialEveningEndOfWorkTime;
  135:             }
  136:             else officialEveningWorkTime = string.Empty;
  137:  
  138:             var officialWorkingTimeString = (officialMorningWorkTime + " " + officialEveningWorkTime).Trim();
  139:  
  140:             return officialWorkingTimeString;
  141:         }
  142:  
  143:         ////////////////////////////////////////////////////////////////////////////
  144:  
  145:         /// <summary>
  146:         ///
  147:         /// </summary>
  148:         public class Framework
  149:         {
  150:             public Framework() { }
  151:  
  152:             public enum TestType
  153:             {
  154:                 وزارة_شؤون_الخدمات,
  155:                 قطاع_الاتصالات_والخدمات_المساندة,
  156:                 إدارة_شبكة_الألياف_الضوئية,
  157:                 مراقبة_الدعم_الفنى_للشبكة,
  158:                 قسم_الدعم_الفني_للشبكة
  159:             };
  160:  
  161:             /// <summary/>
  162:             public int Id { get; set; }
  163:  
  164:             /// <summary/>
  165:             public int Level { get; set; }
  166:  
  167:             /// <summary/>
  168:             public Guid Guid { get; set; }
  169:  
  170:             /// <summary/>
  171:             public string Type { get; set; }
  172:  
  173:             /// <summary/>
  174:             public string Name { get; set; }
  175:  
  176:             /// <summary/>
  177:             public string ArabicName { get; set; }
  178:  
  179:             /// <summary/>
  180:             public string Phone { get; set; }
  181:  
  182:             /// <summary/>
  183:             public string ColoredArabicName { get; set; }
  184:  
  185:             /// <summary/>
  186:             public Framework Parent { get; set; }
  187:  
  188:             /// <summary/>
  189:             public List<Framework> Ancestors { get; set; }
  190:  
  191:             /// <summary/>
  192:             public List<Framework> AncestorsOrSelf { get; set; }
  193:  
  194:             /// <summary/>
  195:             public List<Framework> Siblings { get; set; }
  196:  
  197:             /// <summary/>
  198:             public List<Framework> SiblingsOrSelf { get; set; }
  199:  
  200:             /// <summary/>
  201:             public List<Framework> Children { get; set; }
  202:  
  203:             /// <summary/>
  204:             public List<Framework> ChildrenOrSelf { get; set; }
  205:  
  206:             /// <summary/>
  207:             public List<Framework> Descendants { get; set; }
  208:  
  209:             /// <summary/>
  210:             public List<Framework> DescendantsOrSelf { get; set; }
  211:  
  212:             /// <summary/>
  213:             public List<Authority> Authorities { get; set; }
  214:  
  215:             /// <summary/>
  216:             public List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Site> Sites { get; set; }
  217:  
  218:             /// <summary/>
  219:             //public Ia.Cl.Model.Identity.User Role { get; set; }
  220:  
  221:             ////////////////////////////////////////////////////////////////////////////    
  222:  
  223:             /// <summary>
  224:             ///
  225:             /// </summary>
  226:             public static bool operator ==(Framework fa, Framework fb)
  227:             {
  228:                 bool b;
  229:  
  230:                 // if both are null, or both are same instance, return true.
  231:                 if (System.Object.ReferenceEquals(fa, fb)) b = true;
  232:                 // if one is null, but not both, return false.
  233:                 else if (((object)fa == null) || ((object)fb == null)) b = false;
  234:                 // true if the fields match:
  235:                 else b = fa.Id == fb.Id;
  236:  
  237:                 return b;
  238:             }
  239:  
  240:             ////////////////////////////////////////////////////////////////////////////    
  241:  
  242:             /// <summary>
  243:             ///
  244:             /// </summary>
  245:             public static bool operator !=(Framework fa, Framework fb)
  246:             {
  247:                 return !(fa == fb);
  248:             }
  249:  
  250:             ////////////////////////////////////////////////////////////////////////////    
  251:  
  252:             /// <summary>
  253:             ///
  254:             /// </summary>
  255:             public string FullyQualifiedArabicName
  256:             {
  257:                 get
  258:                 {
  259:                     string s;
  260:  
  261:                     s = string.Empty;
  262:  
  263:                     foreach (var f in this.Ancestors) s += f.ArabicName + " | ";
  264:  
  265:                     s = s + this.ArabicName;
  266:  
  267:                     return s;
  268:                 }
  269:             }
  270:  
  271:             ////////////////////////////////////////////////////////////////////////////
  272:  
  273:             /// <summary>
  274:             ///
  275:             /// </summary>
  276:             public override bool Equals(object value)
  277:             {
  278:                 return value != null && Equals(value as Framework);
  279:             }
  280:  
  281:             ////////////////////////////////////////////////////////////////////////////    
  282:  
  283:             /// <summary>
  284:             ///
  285:             /// </summary>
  286:             public int FrameworkId(int parentId, int frameworkId)
  287:             {
  288:                 return parentId * 10 + frameworkId;
  289:             }
  290:  
  291:             ////////////////////////////////////////////////////////////////////////////    
  292:  
  293:             /// <summary>
  294:             ///
  295:             /// </summary>
  296:             public static int ParentId(long frameworkId)
  297:             {
  298:                 int i;
  299:                 string s;
  300:  
  301:                 s = frameworkId.ToString();
  302:  
  303:                 if (s.Length > 2)
  304:                 {
  305:                     s = s.Substring(0, s.Length - 2);
  306:  
  307:                     i = (int.TryParse(s, out i)) ? i : 0;
  308:                 }
  309:                 else i = 0;
  310:  
  311:                 return i;
  312:             }
  313:  
  314:             ////////////////////////////////////////////////////////////////////////////    
  315:  
  316:             /// <summary>
  317:             ///
  318:             /// </summary>
  319:             public string ArabicNameBracketParentArabicNameBracket
  320:             {
  321:                 get
  322:                 {
  323:                     string name;
  324:  
  325:                     if (Parent != null) name = ArabicName + " (" + Parent.ArabicName + ")";
  326:                     else name = ArabicName;
  327:  
  328:                     return name;
  329:                 }
  330:             }
  331:  
  332:             ////////////////////////////////////////////////////////////////////////////    
  333:  
  334:             /// <summary>
  335:             ///
  336:             /// </summary>
  337:             public static List<Guid> CustomerServiceSectorSectionDivisionFrameworkAndStaffGuidList()
  338:             {
  339:                 return FrameworkAndStaffGuidList("قطاع خدمات المشتركين");
  340:             }
  341:  
  342:             ////////////////////////////////////////////////////////////////////////////    
  343:  
  344:             /// <summary>
  345:             ///
  346:             /// </summary>
  347:             public static List<Guid> TelephoneNetworkMaintenanceDepartmentFrameworkAndStaffGuidList()
  348:             {
  349:                 return FrameworkAndStaffGuidList("إدارة صيانة الشبكة الهاتفية");
  350:             }
  351:  
  352:             ////////////////////////////////////////////////////////////////////////////    
  353:  
  354:             /// <summary>
  355:             ///
  356:             /// </summary>
  357:             public static List<Guid> NokiaFrameworkAndStaffGuidList()
  358:             {
  359:                 return FrameworkAndStaffGuidList("نوكيا");
  360:             }
  361:  
  362:             ////////////////////////////////////////////////////////////////////////////    
  363:  
  364:             /// <summary>
  365:             ///
  366:             /// </summary>
  367:             public static List<Guid> HuaweiFrameworkAndStaffGuidList()
  368:             {
  369:                 return FrameworkAndStaffGuidList("هواوي");
  370:             }
  371:  
  372:             ////////////////////////////////////////////////////////////////////////////    
  373:  
  374:             /// <summary>
  375:             ///
  376:             /// </summary>
  377:             public static List<Guid> FrameworkAndStaffGuidList(string frameworkArabicName)
  378:             {
  379:                 var frameworkList = (from f in Ia.Ngn.Cl.Model.Data.Administration.FrameworkList
  380:                                      where f.ArabicName == frameworkArabicName || f.Ancestors.Any(u => u.ArabicName == frameworkArabicName)
  381:                                      select f.Guid).ToList();
  382:  
  383:                 var staffList = (from s in Ia.Ngn.Cl.Model.Data.Staff.List
  384:                                  where frameworkList.Contains(s.Framework.Guid) || s.Framework.Ancestors.Any(u => frameworkList.Contains(u.Guid))
  385:                                  select s.UserId).ToList();
  386:  
  387:                 var list = frameworkList.Union(staffList).ToList();
  388:  
  389:                 return list;
  390:             }
  391:  
  392:             ////////////////////////////////////////////////////////////////////////////    
  393:  
  394:             /// <summary>
  395:             ///
  396:             /// </summary>
  397:             public static List<Guid> FrameworkAndStaffGuidList(int frameworkId)
  398:             {
  399:                 var frameworkList = (from f in Ia.Ngn.Cl.Model.Data.Administration.FrameworkList
  400:                                      where f.Id == frameworkId || f.Ancestors.Any(u => u.Id == frameworkId)
  401:                                      select f.Guid).ToList();
  402:  
  403:                 var staffList = (from s in Ia.Ngn.Cl.Model.Data.Staff.List
  404:                                  where frameworkList.Contains(s.Framework.Guid) || s.Framework.Ancestors.Any(u => frameworkList.Contains(u.Guid))
  405:                                  select s.UserId).ToList();
  406:  
  407:                 var list = frameworkList.Union(staffList).ToList();
  408:  
  409:                 return list;
  410:             }
  411:  
  412:             ////////////////////////////////////////////////////////////////////////////    
  413:  
  414:             /// <summary>
  415:             ///
  416:             /// </summary>
  417:             public static List<Guid> FrameworkAndStaffGuidList()
  418:             {
  419:                 var frameworkList = (from f in Ia.Ngn.Cl.Model.Data.Administration.FrameworkList
  420:                                      select f.Guid).ToList();
  421:  
  422:                 var staffList = (from s in Ia.Ngn.Cl.Model.Data.Staff.List
  423:                                  where frameworkList.Contains(s.Framework.Guid) || s.Framework.Ancestors.Any(u => frameworkList.Contains(u.Guid))
  424:                                  select s.UserId).ToList();
  425:  
  426:                 var list = frameworkList.Union(staffList).ToList();
  427:  
  428:                 return list;
  429:             }
  430:  
  431:             ////////////////////////////////////////////////////////////////////////////    
  432:             ////////////////////////////////////////////////////////////////////////////    
  433:         }
  434:  
  435:         ////////////////////////////////////////////////////////////////////////////
  436:  
  437:         /// <summary>
  438:         ///
  439:         /// </summary>
  440:         public class Category
  441:         {
  442:             /// <summary/>
  443:             public Category() { }
  444:             /// <summary/>
  445:             public string Name { get; set; }
  446:             /// <summary/>
  447:             public string Description { get; set; }
  448:             /// <summary/>
  449:             public string Regex { get; set; }
  450:             /// <summary/>
  451:             public string Color { get; set; }
  452:         }
  453:  
  454:         ////////////////////////////////////////////////////////////////////////////
  455:  
  456:         /// <summary>
  457:         ///
  458:         /// </summary>
  459:         public class StaffFramework
  460:         {
  461:             private bool isStaff;
  462:  
  463:             /// <summary/>
  464:             public StaffFramework() { }
  465:             /// <summary/>
  466:             public Guid Guid { get; set; }
  467:             /// <summary/>
  468:             public long FrameworkId { get; set; }
  469:             /// <summary/>
  470:             public string Name { get; set; }
  471:             /// <summary/>
  472:             public bool IsStaff
  473:             {
  474:                 get { return isStaff; }
  475:                 set { isStaff = true; }
  476:             }
  477:             /// <summary/>
  478:             public bool IsFramework
  479:             {
  480:                 get { return !isStaff; }
  481:                 set { isStaff = false; }
  482:             }
  483:         }
  484:  
  485:  
  486:         ////////////////////////////////////////////////////////////////////////////
  487:         ////////////////////////////////////////////////////////////////////////////
  488:  
  489:         /// <summary>
  490:         ///
  491:         /// </summary>
  492:         public class Statistic
  493:         {
  494:             /// <summary/>
  495:             public Statistic() { }
  496:  
  497:             public class Site
  498:             {
  499:                 /// <summary/>
  500:                 public string Id { get; set; }
  501:  
  502:                 /// <summary/>
  503:                 public string Name { get; set; }
  504:  
  505:                 /// <summary/>
  506:                 public string NameArabicName { get; set; }
  507:  
  508:                 /// <summary/>
  509:                 public string KuwaitAreaNameListString { get; set; }
  510:  
  511:                 /// <summary/>
  512:                 public string PstnDomainListString { get; set; }
  513:  
  514:                 /// <summary/>
  515:                 public string DomainListString { get; set; }
  516:  
  517:                 /// <summary/>
  518:                 public string SymbolListString { get; set; }
  519:  
  520:                 /// <summary/>
  521:                 public int FiberAccessCapacity { get; set; }
  522:  
  523:                 /// <summary/>
  524:                 public int FiberServiceCapacity { get; set; }
  525:  
  526:                 /// <summary/>
  527:                 public int FiberService { get; set; }
  528:  
  529:                 /// <summary/>
  530:                 public int NokiaService { get; set; }
  531:  
  532:                 /// <summary/>
  533:                 public int HuaweiService { get; set; }
  534:  
  535:                 /// <summary/>
  536:                 public string FiberServiceText { get; set; }
  537:  
  538:                 /// <summary/>
  539:                 public int Service { get; set; }
  540:  
  541:                 /// <summary/>
  542:                 public string ServiceText { get; set; }
  543:  
  544:                 /// <summary/>
  545:                 public string MsanDomainListString { get; set; }
  546:  
  547:                 /// <summary/>
  548:                 public int MsanServiceCapacity { get; set; }
  549:  
  550:                 /// <summary/>
  551:                 public int MsanService { get; set; }
  552:  
  553:                 /// <summary/>
  554:                 public string MsanServiceText { get; set; }
  555:  
  556:                 /// <summary/>
  557:                 public int PstnService { get; set; }
  558:  
  559:                 /// <summary/>
  560:                 public int EricssonPstnService { get; set; }
  561:  
  562:                 /// <summary/>
  563:                 public int SiemensPstnService { get; set; }
  564:  
  565:                 /// <summary/>
  566:                 public string EricssonSiemensPstnServiceText { get; set; }
  567:  
  568:                 ////////////////////////////////////////////////////////////////////////////
  569:  
  570:                 /// <summary>
  571:                 ///
  572:                 /// </summary>
  573:                 public string ToSimpleTextString()
  574:                 {
  575:                     StringBuilder sb;
  576:  
  577:                     sb = new StringBuilder();
  578:  
  579:                     sb.AppendLine("Site: " + this.NameArabicName);
  580:                     sb.AppendLine("Areas: " + this.KuwaitAreaNameListString);
  581:                     sb.AppendLine("PSTN Domains: " + this.PstnDomainListString);
  582:                     sb.AppendLine("PSTN Service (Ericsson/Siemens): " + this.EricssonSiemensPstnServiceText);
  583:                     sb.AppendLine("MSAN Domains: " + this.MsanDomainListString);
  584:                     sb.AppendLine("MSAN Service Capacity: " + this.MsanServiceCapacity);
  585:                     sb.AppendLine("MSAN Service: " + this.MsanServiceText);
  586:                     sb.AppendLine("Domains: " + this.DomainListString);
  587:                     sb.AppendLine("Symbols: " + this.SymbolListString);
  588:                     sb.AppendLine("Fiber Access Capacity: " + this.FiberAccessCapacity);
  589:                     sb.AppendLine("Fiber Service Capacity: " + this.FiberServiceCapacity);
  590:                     sb.AppendLine("Fiber Service (Nokia/Huawei): " + this.FiberServiceText);
  591:                     sb.AppendLine("Service: " + this.ServiceText);
  592:  
  593:                     return sb.ToString();
  594:                 }
  595:  
  596:                 ////////////////////////////////////////////////////////////////////////////
  597:                 ////////////////////////////////////////////////////////////////////////////
  598:             }
  599:  
  600:             public class KuwaitArea
  601:             {
  602:                 /// <summary/>
  603:                 public KuwaitArea() { }
  604:  
  605:                 /// <summary/>
  606:                 public KuwaitArea(string name, string arabicName)
  607:                 {
  608:                     this.Name = name + " (" + arabicName + ")";
  609:                 }
  610:  
  611:                 /// <summary/>
  612:                 public string Id { get; set; }
  613:  
  614:                 /// <summary/>
  615:                 public string Name { get; set; }
  616:  
  617:                 /// <summary/>
  618:                 public string Symbol { get; set; }
  619:  
  620:                 /// <summary/>
  621:                 public int AccessCapacity { get; set; }
  622:  
  623:                 /// <summary/>
  624:  
  625:                 public int NokiaOnt { get; set; }
  626:                 /// <summary/>
  627:  
  628:                 public int HuaweiOnt { get; set; }
  629:                 /// <summary/>
  630:  
  631:                 public string NokiaHuaweiOnt { get; set; }
  632:  
  633:                 /// <summary/>
  634:                 public int NokiaAccess { get; set; }
  635:  
  636:                 /// <summary/>
  637:                 public int HuaweiAccess { get; set; }
  638:  
  639:                 /// <summary/>
  640:                 public string NokiaHuaweiAccess { get; set; }
  641:  
  642:                 /// <summary/>
  643:                 public int ServiceRequestService { get; set; }
  644:  
  645:                 /// <summary/>
  646:                 public int Service { get; set; }
  647:  
  648:                 /// <summary/>
  649:                 public int NokiaService { get; set; }
  650:  
  651:                 /// <summary/>
  652:                 public int HuaweiService { get; set; }
  653:  
  654:                 /// <summary/>
  655:                 public string NokiaHuaweiService { get; set; }
  656:  
  657:                 /// <summary/>
  658:                 public int AccessReady { get; set; }
  659:  
  660:                 /// <summary/>
  661:                 public int AccessUsed { get; set; }
  662:  
  663:                 /// <summary/>
  664:                 public string AccessReadyUsed { get; set; }
  665:  
  666:                 ////////////////////////////////////////////////////////////////////////////
  667:  
  668:                 /// <summary>
  669:                 ///
  670:                 /// </summary>
  671:                 public string ToSimpleTextString()
  672:                 {
  673:                     StringBuilder sb;
  674:  
  675:                     sb = new StringBuilder();
  676:  
  677:                     sb.AppendLine("Name: " + this.Name);
  678:                     sb.AppendLine("Symbol: " + this.Symbol);
  679:                     sb.AppendLine("Access Capacity: " + this.AccessCapacity);
  680:                     sb.AppendLine("Access (Nokia/Huawei): " + this.NokiaHuaweiAccess);
  681:                     sb.AppendLine("ONT/ONU (Nokia/Huawei): " + this.NokiaHuaweiOnt);
  682:                     sb.AppendLine("Access (Ready/Used): " + this.AccessReadyUsed);
  683:                     sb.AppendLine("Service Request Services: " + this.ServiceRequestService);
  684:                     sb.AppendLine("Service (Nokia/Huawei): " + this.NokiaHuaweiService);
  685:  
  686:                     return sb.ToString();
  687:                 }
  688:  
  689:                 ////////////////////////////////////////////////////////////////////////////
  690:                 ////////////////////////////////////////////////////////////////////////////
  691:             }
  692:         }
  693:  
  694:         ////////////////////////////////////////////////////////////////////////////
  695:  
  696:         /// <summary>
  697:         ///
  698:         /// </summary>
  699:         public Administration() { }
  700:  
  701:         /// <summary/>
  702:         public static bool NowIsOfficialWorkingTime
  703:         {
  704:             get
  705:             {
  706:                 bool b;
  707:                 DateTime now;
  708:  
  709:                 now = DateTime.UtcNow.AddHours(3);
  710:  
  711:                 b = now.DayOfWeek != DayOfWeek.Friday && now.DayOfWeek != DayOfWeek.Saturday &&
  712:                     (
  713:                     now.TimeOfDay >= OfficialMorningStartOfWorkTime.TimeOfDay && now.TimeOfDay < OfficialMorningEndOfWorkTime.TimeOfDay
  714:                     ||
  715:                     now.TimeOfDay >= OfficialEveningStartOfWorkTime.TimeOfDay && now.TimeOfDay < OfficialEveningEndOfWorkTime.TimeOfDay
  716:                     );
  717:  
  718:                 return b;
  719:             }
  720:         }
  721:  
  722:         ////////////////////////////////////////////////////////////////////////////    
  723:  
  724:         /// <summary>
  725:         /// Tests a given Guid value to see if it has a special format used in framework items. Framework ites will have 00000000- prefixed to them
  726:         /// </summary>
  727:         public static bool IsFrameworkGuid(Guid guid)
  728:         {
  729:             bool isFrameworkGuid;
  730:  
  731:             isFrameworkGuid = (guid.ToString().Substring(0, 9) == "00000000-") ? true : false;
  732:  
  733:             return isFrameworkGuid;
  734:         }
  735:  
  736:         ////////////////////////////////////////////////////////////////////////////    
  737:  
  738:         /// <summary>
  739:         ///
  740:         /// </summary>
  741:         public static List<Ia.Ngn.Cl.Model.Business.Administration.Framework> FrameworkListOfAllowedReportAssignsByStaff(Ia.Ngn.Cl.Model.Staff staff)
  742:         {
  743:             List<Ia.Ngn.Cl.Model.Business.Administration.Framework> frameworkList;
  744:  
  745:             frameworkList = new List<Ia.Ngn.Cl.Model.Business.Administration.Framework>();
  746:  
  747:             frameworkList.AddRange(staff.Framework.Children);
  748:             frameworkList.AddRange(staff.Framework.Siblings);
  749:  
  750:             return frameworkList;
  751:         }
  752:  
  753:         ////////////////////////////////////////////////////////////////////////////    
  754:  
  755:         /// <summary>
  756:         ///
  757:         /// </summary>
  758:         public static bool FrameworkHasAHead(Ia.Ngn.Cl.Model.Business.Administration.Framework framework)
  759:         {
  760:             bool hasHead;
  761:  
  762:             if (framework != null)
  763:             {
  764:                 hasHead = (from s in Ia.Ngn.Cl.Model.Data.Staff.List where s.Framework.Id == framework.Id select s).Any(u => u.IsHead);
  765:             }
  766:             else hasHead = false;
  767:  
  768:             return hasHead;
  769:         }
  770:  
  771:         ////////////////////////////////////////////////////////////////////////////
  772:  
  773:         /// <summary>
  774:         ///
  775:         /// </summary>
  776:         public class StaffContact
  777:         {
  778:             private Ia.Ngn.Cl.Model.Staff staff;
  779:             private Ia.Ngn.Cl.Model.Contact contact;
  780:             private string email;
  781:             private string apiKey;
  782:             private Guid userId;
  783:  
  784:             /// <summary/>
  785:             public StaffContact() { }
  786:  
  787:             /// <summary/>
  788:             public Ia.Ngn.Cl.Model.Staff Staff
  789:             {
  790:                 get
  791:                 {
  792:                     return staff;
  793:                 }
  794:  
  795:                 set
  796:                 {
  797:                     staff = value;
  798:  
  799:                     var v = this.FullName;
  800:                     var w = this.Email;
  801:                     var x = this.UserId;
  802:                     var y = this.ApiKey;
  803:                 }
  804:             }
  805:  
  806:             /// <summary/>
  807:             public Ia.Ngn.Cl.Model.Contact Contact
  808:             {
  809:                 get
  810:                 {
  811:                     return contact;
  812:                 }
  813:  
  814:                 set
  815:                 {
  816:                     contact = value;
  817:  
  818:                     var v = this.FullName;
  819:                     var w = this.Email;
  820:                     var x = this.UserId;
  821:                     var y = this.ApiKey;
  822:                 }
  823:             }
  824:  
  825:             /// <summary/>
  826:             public string FullName
  827:             {
  828:                 get
  829:                 {
  830:                     string name;
  831:  
  832:                     if (staff != null) name = staff.FullName;
  833:                     else if (contact != null) name = contact.FullName;
  834:                     else name = string.Empty;
  835:  
  836:                     return name;
  837:                 }
  838:             }
  839:  
  840:             /// <summary/>
  841:             public string Email
  842:             {
  843:                 get
  844:                 {
  845:                     if (staff != null && staff.User != null) email = staff.User.Email;
  846:                     else if (contact != null) email = contact.Email;
  847:                     else email = string.Empty;
  848:  
  849:                     return email;
  850:                 }
  851:             }
  852:  
  853:             /// <summary/>
  854:             public Guid UserId
  855:             {
  856:                 get
  857:                 {
  858:                     if (staff != null) userId = staff.UserId;
  859:                     else if (contact != null) userId = contact.UserId;
  860:                     else userId = Guid.Empty;
  861:  
  862:                     return userId;
  863:                 }
  864:             }
  865:  
  866:             /// <summary/>
  867:             public string ApiKey
  868:             {
  869:                 get
  870:                 {
  871:                     if (staff != null && staff.User != null) apiKey = UserId.ToString().Substring(0, 8);
  872:                     else if (contact != null) apiKey = UserId.ToString().Substring(0, 8);
  873:                     else apiKey = string.Empty;
  874:  
  875:                     return apiKey;
  876:                 }
  877:             }
  878:  
  879:             /// <summary/>
  880:             public bool IsApproved
  881:             {
  882:                 get
  883:                 {
  884:                     return !string.IsNullOrEmpty(email); // && contact.IsApproved;
  885:                 }
  886:             }
  887:  
  888:             ////////////////////////////////////////////////////////////////////////////
  889:             ////////////////////////////////////////////////////////////////////////////    
  890:         }
  891:     }
  892:  
  893:     ////////////////////////////////////////////////////////////////////////////
  894:     ////////////////////////////////////////////////////////////////////////////   
  895: }