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

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

Default support class for Fixed Telecommunications Network (FTN) ui model.

    1: using Ia.Cl.Models;
    2: using Microsoft.AspNetCore.Identity;
    3: using System;
    4: using System.Collections.Generic;
    5: using System.Configuration;
    6: using System.Linq;
    7: using System.Net;
    8: using System.Text;
    9: using System.Text.RegularExpressions;
   10:  
   11: namespace Ia.Ftn.Cl.Models.Ui
   12: {
   13:     ////////////////////////////////////////////////////////////////////////////
   14:  
   15:     /// <summary publish="true">
   16:     /// Default support class for Fixed Telecommunications Network (FTN) ui model.
   17:     /// </summary>
   18:     /// 
   19:     /// <remarks> 
   20:     /// Copyright © 2006-2022 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   21:     ///
   22:     /// 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
   23:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   24:     ///
   25:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   26:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   27:     /// 
   28:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   29:     /// 
   30:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   31:     /// </remarks> 
   32:     public class Default
   33:     {
   34:         private static List<string> lightBackgroundColorList, darkBackgroundColorList;
   35:         private static List<ColorAndItsSuitableBackground> colorAndItsSuitableBackgroundList;
   36:  
   37:         /// <summary/>
   38:         public enum ViewButtonColumnType
   39:         {
   40:             /// <summary/>
   41:             NoButtons,
   42:  
   43:             /// <summary/>
   44:             HistoryButton,
   45:  
   46:             /// <summary/>
   47:             DeleteAndDeleteOffButton,
   48:  
   49:             /// <summary/>
   50:             DeleteAndDeleteOffAndDeleteChildOffAndHistoryButtons,
   51:  
   52:             /// <summary/>
   53:             DeleteAndDeleteOffAndDeleteChildOffButtons,
   54:  
   55:             /// <summary/>
   56:             DeleteAndEditAndCancelAndUpdateButtons
   57:         }
   58:  
   59:         ////////////////////////////////////////////////////////////////////////////
   60:  
   61:         /// <summary>
   62:         ///
   63:         /// </summary>
   64:         public static string MailTop()
   65:         {
   66:             var siteName = Ia.Cl.Models.ApplicationConfiguration.GetSetting("AppSettings:SiteName");
   67:             var companyName = Ia.Cl.Models.ApplicationConfiguration.GetSetting("AppSettings:CompanyName");
   68:  
   69:             return @"
   70: <!DOCTYPE html>
   71: <html xmlns=""http://www.w3.org/1999/xhtml"" >
   72: <head>
   73: <title>" + siteName + @": " + companyName + @"</title>
   74: <style>
   75: html { direction:ltr; }
   76: body { background:#fff;margin:5px;padding:0px;color:DarkBlue; }
   77: body,td,th,a,input.button_ia,input,textarea,option,select,pre { font:9pt normal #000066 ""Tahoma"";font-family:Tahoma;text-decoration:none; }
   78: a:link { color:#0000ff;text-decoration:none; }
   79: a:visited { color:#0000ff;text-decoration:none; }
   80: a:hover { color:#ff8888;text-decoration:none; }
   81: hr { color:rgb(204,204,204); }
   82: p { line-height:18px;margin-top:9px;margin-bottom:9px; }
   83: table.form { }
   84: table.form td { }
   85: </style>
   86: </head>
   87: <body>
   88: <p>
   89: <b>" + siteName + @"</b>: 
   90: <b>" + companyName + @"</b>
   91: </p>
   92: ";
   93:         }
   94:  
   95:         ////////////////////////////////////////////////////////////////////////////
   96:  
   97:         /// <summary>
   98:         ///
   99:         /// </summary>
  100:         public static string PlainMailTop()
  101:         {
  102:             var siteName = Ia.Cl.Models.ApplicationConfiguration.GetSetting("AppSettings:SiteName");
  103:             var companyName = Ia.Cl.Models.ApplicationConfiguration.GetSetting("AppSettings:CompanyName");
  104:  
  105:             return siteName + "\t\r\n" + companyName + @"
  106:  
  107: ";
  108:             // above: "\t\r\n" is very important to produce good email format
  109:         }
  110:  
  111:         ////////////////////////////////////////////////////////////////////////////
  112:  
  113:         /// <summary>
  114:         ///
  115:         /// </summary>
  116:         public static string MailBottom()
  117:         {
  118:             return @"
  119: </body>
  120: </html>
  121: ";
  122:         }
  123:  
  124:         ////////////////////////////////////////////////////////////////////////////
  125:  
  126:         /// <summary>
  127:         ///
  128:         /// </summary>
  129:         public static string PlainMailBottom()
  130:         {
  131:             return string.Empty;
  132:         }
  133:  
  134:         ////////////////////////////////////////////////////////////////////////////
  135:         ////////////////////////////////////////////////////////////////////////////
  136:  
  137:         /// <summary>
  138:         ///
  139:         /// </summary>
  140:         public static string DisplayDisabledTextIfTrue(bool isDisabled)
  141:         {
  142:             string text;
  143:  
  144:             if (isDisabled) text = "disabled";
  145:             else text = string.Empty;
  146:  
  147:             return text;
  148:         }
  149:  
  150:         ////////////////////////////////////////////////////////////////////////////
  151:         ////////////////////////////////////////////////////////////////////////////
  152:  
  153:         /// <summary>
  154:         ///
  155:         /// </summary>
  156:         public struct ColorAndItsSuitableBackground
  157:         {
  158:             public string Name, Background;
  159:  
  160:             public ColorAndItsSuitableBackground(string name, string background)
  161:             {
  162:                 Name = name;
  163:                 Background = background;
  164:             }
  165:         }
  166:  
  167:         ////////////////////////////////////////////////////////////////////////////
  168:  
  169:         /// <summary>
  170:         ///
  171:         /// </summary>
  172:         public static List<string> LightBackgroundColorList
  173:         {
  174:             get
  175:             {
  176:                 //if (lightBackgroundColorList == null || lightBackgroundColorList.Count == 0)
  177:                 //{
  178:                 lightBackgroundColorList = new List<string>(200);
  179:  
  180:                 foreach (ColorAndItsSuitableBackground c in ColorAndItsSuitableBackgroundList)
  181:                 {
  182:                     if (c.Background == "light") lightBackgroundColorList.Add(c.Name);
  183:                 }
  184:                 //}
  185:  
  186:                 return lightBackgroundColorList;
  187:             }
  188:         }
  189:  
  190:         ////////////////////////////////////////////////////////////////////////////
  191:  
  192:         /// <summary>
  193:         ///
  194:         /// </summary>
  195:         public static List<string> DarkBackgroundColorList
  196:         {
  197:             get
  198:             {
  199:                 //if (darkBackgroundColorList == null || darkBackgroundColorList.Count == 0)
  200:                 //{
  201:                 darkBackgroundColorList = new List<string>(200);
  202:  
  203:                 foreach (ColorAndItsSuitableBackground c in ColorAndItsSuitableBackgroundList)
  204:                 {
  205:                     if (c.Background == "dark") darkBackgroundColorList.Add(c.Name);
  206:                 }
  207:                 //}
  208:  
  209:                 return darkBackgroundColorList;
  210:             }
  211:         }
  212:  
  213:         ////////////////////////////////////////////////////////////////////////////
  214:  
  215:         /// <summary>
  216:         ///
  217:         /// </summary>
  218:         public static List<ColorAndItsSuitableBackground> ColorAndItsSuitableBackgroundList
  219:         {
  220:             get
  221:             {
  222:                 //if (colorAndSuitableBackgroundList == null || colorAndSuitableBackgroundList.Count == 0)
  223:                 //{
  224:                 colorAndItsSuitableBackgroundList = new List<ColorAndItsSuitableBackground>(200)
  225:                         {
  226:                             new ColorAndItsSuitableBackground("AliceBlue", "dark"),
  227:                             new ColorAndItsSuitableBackground("AliceBlue", "dark"),
  228:                             new ColorAndItsSuitableBackground("AntiqueWhite", "dark"),
  229:                             new ColorAndItsSuitableBackground("Aqua", "dark"),
  230:                             new ColorAndItsSuitableBackground("Aquamarine", "dark"),
  231:                             new ColorAndItsSuitableBackground("Azure", "dark"),
  232:                             new ColorAndItsSuitableBackground("Beige", "dark"),
  233:                             new ColorAndItsSuitableBackground("Bisque", "dark"),
  234:                             new ColorAndItsSuitableBackground("Black", "light"),
  235:                             new ColorAndItsSuitableBackground("BlanchedAlmond", "dark"),
  236:                             new ColorAndItsSuitableBackground("Blue", "light"),
  237:                             new ColorAndItsSuitableBackground("BlueViolet", "light"),
  238:                             new ColorAndItsSuitableBackground("Brown", "light"),
  239:                             new ColorAndItsSuitableBackground("BurlyWood", "dark"),
  240:                             new ColorAndItsSuitableBackground("CadetBlue", "light"),
  241:                             new ColorAndItsSuitableBackground("Chartreuse", "dark"),
  242:                             new ColorAndItsSuitableBackground("Chocolate", "light"),
  243:                             new ColorAndItsSuitableBackground("Coral", "dark"),
  244:                             new ColorAndItsSuitableBackground("CornFlowerBlue", "dark"),
  245:                             new ColorAndItsSuitableBackground("Cornsilk", "dark"),
  246:                             new ColorAndItsSuitableBackground("Crimson", "light"),
  247:                             new ColorAndItsSuitableBackground("Cyan", "dark"),
  248:                             new ColorAndItsSuitableBackground("DarkBlue", "light"),
  249:                             new ColorAndItsSuitableBackground("DarkCyan", "light"),
  250:                             new ColorAndItsSuitableBackground("DarkGoldenrod", "light"),
  251:                             new ColorAndItsSuitableBackground("DarkGray", "dark"),
  252:                             new ColorAndItsSuitableBackground("DarkGreen", "light"),
  253:                             new ColorAndItsSuitableBackground("DarkKhaki", "dark"),
  254:                             new ColorAndItsSuitableBackground("DarkMagenta", "light"),
  255:                             new ColorAndItsSuitableBackground("DarkOliveGreen", "light"),
  256:                             new ColorAndItsSuitableBackground("DarkOrange", "dark"),
  257:                             new ColorAndItsSuitableBackground("DarkOrchid", "light"),
  258:                             new ColorAndItsSuitableBackground("DarkRed", "light"),
  259:                             new ColorAndItsSuitableBackground("DarkSalmon", "dark"),
  260:                             new ColorAndItsSuitableBackground("DarkSeaGreen", "dark"),
  261:                             new ColorAndItsSuitableBackground("DarkSlateBlue", "light"),
  262:                             new ColorAndItsSuitableBackground("DarkSlateGray", "light"),
  263:                             new ColorAndItsSuitableBackground("DarkTurquoise", "light"),
  264:                             new ColorAndItsSuitableBackground("DarkViolet", "light"),
  265:                             new ColorAndItsSuitableBackground("DeepPink", "light"),
  266:                             new ColorAndItsSuitableBackground("DeepSkyBlue", "light"),
  267:                             new ColorAndItsSuitableBackground("DimGray", "light"),
  268:                             new ColorAndItsSuitableBackground("DodgerBlue", "light"),
  269:                             new ColorAndItsSuitableBackground("Firebrick", "light"),
  270:                             new ColorAndItsSuitableBackground("FloralWhite", "dark"),
  271:                             new ColorAndItsSuitableBackground("ForestGreen", "light"),
  272:                             new ColorAndItsSuitableBackground("Fuchsia", "dark"),
  273:                             new ColorAndItsSuitableBackground("Gainsboro", "dark"),
  274:                             new ColorAndItsSuitableBackground("GhostWhite", "dark"),
  275:                             new ColorAndItsSuitableBackground("Gold", "dark"),
  276:                             new ColorAndItsSuitableBackground("Goldenrod", "dark"),
  277:                             new ColorAndItsSuitableBackground("Gray", "light"),
  278:                             new ColorAndItsSuitableBackground("Green", "light"),
  279:                             new ColorAndItsSuitableBackground("GreenYellow", "dark"),
  280:                             new ColorAndItsSuitableBackground("Honeydew", "dark"),
  281:                             new ColorAndItsSuitableBackground("HotPink", "dark"),
  282:                             new ColorAndItsSuitableBackground("IndianRed", "light"),
  283:                             new ColorAndItsSuitableBackground("Indigo", "light"),
  284:                             new ColorAndItsSuitableBackground("Ivory", "dark"),
  285:                             new ColorAndItsSuitableBackground("Khaki", "dark"),
  286:                             new ColorAndItsSuitableBackground("Lavender", "dark"),
  287:                             new ColorAndItsSuitableBackground("LavenderBlush", "dark"),
  288:                             new ColorAndItsSuitableBackground("LawnGreen", "dark"),
  289:                             new ColorAndItsSuitableBackground("LemonChiffon", "dark"),
  290:                             new ColorAndItsSuitableBackground("LightBlue", "dark"),
  291:                             new ColorAndItsSuitableBackground("LightCoral", "dark"),
  292:                             new ColorAndItsSuitableBackground("LightCyan", "dark"),
  293:                             new ColorAndItsSuitableBackground("LightGoldenRodYellow", "dark"),
  294:                             new ColorAndItsSuitableBackground("LightGray", "dark"),
  295:                             new ColorAndItsSuitableBackground("LightGreen", "dark"),
  296:                             new ColorAndItsSuitableBackground("LightPink", "dark"),
  297:                             new ColorAndItsSuitableBackground("LightSalmon", "dark"),
  298:                             new ColorAndItsSuitableBackground("LightSeaGreen", "light"),
  299:                             new ColorAndItsSuitableBackground("LightSkyBlue", "dark"),
  300:                             new ColorAndItsSuitableBackground("LightSlateGray", "light"),
  301:                             new ColorAndItsSuitableBackground("LightSteelBlue", "dark"),
  302:                             new ColorAndItsSuitableBackground("LightYellow", "dark"),
  303:                             new ColorAndItsSuitableBackground("Lime", "dark"),
  304:                             new ColorAndItsSuitableBackground("LimeGreen", "dark"),
  305:                             new ColorAndItsSuitableBackground("Linen", "dark"),
  306:                             new ColorAndItsSuitableBackground("Magenta", "dark"),
  307:                             new ColorAndItsSuitableBackground("Maroon", "light"),
  308:                             new ColorAndItsSuitableBackground("MediumAquamarine", "dark"),
  309:                             new ColorAndItsSuitableBackground("MediumBlue", "light"),
  310:                             new ColorAndItsSuitableBackground("MediumOrchid", "dark"),
  311:                             new ColorAndItsSuitableBackground("MediumPurple", "dark"),
  312:                             new ColorAndItsSuitableBackground("MediumSeaGreen", "light"),
  313:                             new ColorAndItsSuitableBackground("MediumSlateBlue", "light"),
  314:                             new ColorAndItsSuitableBackground("MediumSpringGreen", "light"),
  315:                             new ColorAndItsSuitableBackground("MediumTurquoise", "dark"),
  316:                             new ColorAndItsSuitableBackground("MediumVioletRed", "light"),
  317:                             new ColorAndItsSuitableBackground("MidnightBlue", "light"),
  318:                             new ColorAndItsSuitableBackground("MintCream", "dark"),
  319:                             new ColorAndItsSuitableBackground("MistyRose", "dark"),
  320:                             new ColorAndItsSuitableBackground("Moccasin", "dark"),
  321:                             new ColorAndItsSuitableBackground("NavajoWhite", "dark"),
  322:                             new ColorAndItsSuitableBackground("Navy", "light"),
  323:                             new ColorAndItsSuitableBackground("OldLace", "dark"),
  324:                             new ColorAndItsSuitableBackground("Olive", "light"),
  325:                             new ColorAndItsSuitableBackground("OliveDrab", "light"),
  326:                             new ColorAndItsSuitableBackground("Orange", "dark"),
  327:                             new ColorAndItsSuitableBackground("OrangeRed", "light"),
  328:                             new ColorAndItsSuitableBackground("Orchid", "dark"),
  329:                             new ColorAndItsSuitableBackground("PaleGoldenrod", "dark"),
  330:                             new ColorAndItsSuitableBackground("PaleGreen", "dark"),
  331:                             new ColorAndItsSuitableBackground("PaleTurquoise", "dark"),
  332:                             new ColorAndItsSuitableBackground("PaleVioletRed", "dark"),
  333:                             new ColorAndItsSuitableBackground("PapayaWhip", "dark"),
  334:                             new ColorAndItsSuitableBackground("PeachPuff", "dark"),
  335:                             new ColorAndItsSuitableBackground("Peru", "light"),
  336:                             new ColorAndItsSuitableBackground("Pink", "dark"),
  337:                             new ColorAndItsSuitableBackground("Plum", "dark"),
  338:                             new ColorAndItsSuitableBackground("PowderBlue", "dark"),
  339:                             new ColorAndItsSuitableBackground("Purple", "light"),
  340:                             new ColorAndItsSuitableBackground("Red", "light"),
  341:                             new ColorAndItsSuitableBackground("RosyBrown", "dark"),
  342:                             new ColorAndItsSuitableBackground("RoyalBlue", "light"),
  343:                             new ColorAndItsSuitableBackground("SaddleBrown", "light"),
  344:                             new ColorAndItsSuitableBackground("Salmon", "dark"),
  345:                             new ColorAndItsSuitableBackground("SandyBrown", "dark"),
  346:                             new ColorAndItsSuitableBackground("SeaGreen", "light"),
  347:                             new ColorAndItsSuitableBackground("SeaShell", "dark"),
  348:                             new ColorAndItsSuitableBackground("Sienna", "light"),
  349:                             new ColorAndItsSuitableBackground("Silver", "dark"),
  350:                             new ColorAndItsSuitableBackground("SkyBlue", "dark"),
  351:                             new ColorAndItsSuitableBackground("SlateBlue", "light"),
  352:                             new ColorAndItsSuitableBackground("SlateGray", "light"),
  353:                             new ColorAndItsSuitableBackground("Snow", "dark"),
  354:                             new ColorAndItsSuitableBackground("SpringGreen", "dark"),
  355:                             new ColorAndItsSuitableBackground("SteelBlue", "light"),
  356:                             new ColorAndItsSuitableBackground("Tan", "dark"),
  357:                             new ColorAndItsSuitableBackground("Teal", "light"),
  358:                             new ColorAndItsSuitableBackground("Thistle", "dark"),
  359:                             new ColorAndItsSuitableBackground("Tomato", "dark"),
  360:                             //colorAndSuitableBackgroundList.Add(new ColorAndSuitableBackground("Transparent", "light"));
  361:                             new ColorAndItsSuitableBackground("Turquoise", "dark"),
  362:                             new ColorAndItsSuitableBackground("Violet", "dark"),
  363:                             new ColorAndItsSuitableBackground("Wheat", "dark"),
  364:                             new ColorAndItsSuitableBackground("White", "dark"),
  365:                             new ColorAndItsSuitableBackground("WhiteSmoke", "dark"),
  366:                             new ColorAndItsSuitableBackground("Yellow", "dark"),
  367:                             new ColorAndItsSuitableBackground("YellowGreen", "light")
  368:                         };
  369:                 //}
  370:  
  371:                 return colorAndItsSuitableBackgroundList.ToList();
  372:             }
  373:         }
  374:  
  375:         ////////////////////////////////////////////////////////////////////////////   
  376:  
  377:         /// <summary>
  378:         ///
  379:         /// </summary>
  380:         public static void RemoveAllComments(ref StringBuilder sb)
  381:         {
  382:             string s;
  383:  
  384:             s = Regex.Replace(sb.ToString(), @"#.+", string.Empty);
  385:  
  386:             s = Regex.Replace(s, @"[\r\n]{2,}", "\r\n");
  387:  
  388:             sb = new StringBuilder(s);
  389:         }
  390:  
  391:         ////////////////////////////////////////////////////////////////////////////   
  392:  
  393:         /// <summary>
  394:         ///
  395:         /// </summary>
  396:         public static void ConvertArrayListContentToString(List<string> list, ref StringBuilder sb, ref string result)
  397:         {
  398:             if (list != null && list.Count > 0)
  399:             {
  400:                 sb = new StringBuilder(list.Count * 1000);
  401:  
  402:                 foreach (string u in list) sb.Append(u + "\n");
  403:  
  404:                 result = string.Empty;
  405:             }
  406:             else
  407:             {
  408:                 sb = new StringBuilder(1);
  409:  
  410:                 result = "Success: No records were found. ";
  411:             }
  412:         }
  413:  
  414:         ////////////////////////////////////////////////////////////////////////////   
  415:  
  416:         /// <summary>
  417:         ///
  418:         /// </summary>
  419:         public static void ConvertListContentToString(List<string> list, ref StringBuilder sb, ref string result)
  420:         {
  421:             if (list != null && list.Count > 0)
  422:             {
  423:                 sb = new StringBuilder(list.Count * 1000);
  424:  
  425:                 foreach (string u in list) sb.Append(u + "\n");
  426:  
  427:                 result = string.Empty;
  428:             }
  429:             else
  430:             {
  431:                 sb = new StringBuilder(1);
  432:  
  433:                 result = "Success: No records were found. ";
  434:             }
  435:         }
  436:  
  437:         ////////////////////////////////////////////////////////////////////////////
  438:         ////////////////////////////////////////////////////////////////////////////
  439:  
  440:         /// <summary>
  441:         ///
  442:         /// </summary>
  443:         public static string View(object item, string name)
  444:         {
  445:             ViewButtonColumnType buttonColumnType;
  446:  
  447:             buttonColumnType = ViewButtonColumnType.NoButtons;
  448:  
  449:             return View(item, name, buttonColumnType, null);
  450:         }
  451:  
  452:         ////////////////////////////////////////////////////////////////////////////
  453:  
  454:         /// <summary>
  455:         ///
  456:         /// </summary>
  457:         public static string View(object item, ViewButtonColumnType buttonColumnType)
  458:         {
  459:             return View(item, null, buttonColumnType, null);
  460:         }
  461:  
  462:         ////////////////////////////////////////////////////////////////////////////
  463:  
  464:         /// <summary>
  465:         ///
  466:         /// </summary>
  467:         public static string View(object item, ViewButtonColumnType buttonColumnType, Ia.Ftn.Cl.Models.StaffIdentityUser currentStaffIdentityUser)
  468:         {
  469:             return View(item, null, buttonColumnType, currentStaffIdentityUser);
  470:         }
  471:  
  472:         ////////////////////////////////////////////////////////////////////////////
  473:  
  474:         /// <summary>
  475:         ///
  476:         /// </summary>
  477:         public static string View(object item, Ia.Ftn.Cl.Models.StaffIdentityUser currentStaffIdentityUser)
  478:         {
  479:             ViewButtonColumnType buttonColumnType;
  480:  
  481:             // below: default is no buttons
  482:             buttonColumnType = ViewButtonColumnType.NoButtons;
  483:  
  484:             return View(item, null, buttonColumnType, currentStaffIdentityUser);
  485:         }
  486:  
  487:         ////////////////////////////////////////////////////////////////////////////
  488:  
  489:         /// <summary>
  490:         ///
  491:         /// </summary>
  492:         public static string View(object item, string name, Ia.Ftn.Cl.Models.StaffIdentityUser currentStaffIdentityUser)
  493:         {
  494:             ViewButtonColumnType buttonColumnType;
  495:  
  496:             // below: default is no buttons
  497:             buttonColumnType = ViewButtonColumnType.NoButtons;
  498:  
  499:             return View(item, name, buttonColumnType, currentStaffIdentityUser);
  500:         }
  501:  
  502:         ////////////////////////////////////////////////////////////////////////////
  503:  
  504:         /// <summary>
  505:         ///
  506:         /// </summary>
  507:         public static string View(object item, string name, ViewButtonColumnType buttonColumnType)
  508:         {
  509:             return View(item, name, buttonColumnType, null);
  510:         }
  511:  
  512:         ////////////////////////////////////////////////////////////////////////////
  513:         ////////////////////////////////////////////////////////////////////////////
  514:  
  515:         /// <summary>
  516:         ///
  517:         /// </summary>
  518:         public static string View(object item, string propertyName, ViewButtonColumnType buttonColumnType, Ia.Ftn.Cl.Models.StaffIdentityUser currentStaffIdentityUser)
  519:         {
  520:             bool itemKnown;
  521:             int areaId;
  522:             string itemFullName, s, text, labelText, hyperLinkText, hyperLinkNavigateUrl, hyperLinkTargetBlank, textBoxText, ImageUrl, ImageToolTip, firstAndMiddleNameBracketFrameworkArabicNameAndFrameworkParentArabicNameBracket, arabicNameBracketParentArabicNameBracket;
  523:             string userId;//, _userId;
  524:             List<Ia.Ftn.Cl.Models.StaffIdentityUser> userList;
  525:  
  526:             labelText = string.Empty;
  527:             hyperLinkText = string.Empty;
  528:             hyperLinkNavigateUrl = string.Empty;
  529:             hyperLinkTargetBlank = string.Empty;
  530:             textBoxText = string.Empty;
  531:  
  532:             ImageUrl = string.Empty;
  533:             ImageToolTip = string.Empty;
  534:  
  535:  
  536:             // below: initialize according to ID of parent
  537:             Ia.Ftn.Cl.Models.Report report;
  538:             Ia.Ftn.Cl.Models.ReportHistory reportHistory;
  539:             Ia.Ftn.Cl.Models.ServiceRequest serviceRequest;
  540:             Ia.Ftn.Cl.Models.ServiceRequestHistory serviceRequestHistory;
  541:             Ia.Ftn.Cl.Models.ServiceRequestOnt serviceRequestOnt;
  542:             Ia.Ftn.Cl.Models.ServiceRequestOntDetail serviceRequestOntDetail;
  543:             Ia.Ftn.Cl.Models.ServiceRequestAdministrativeIssue serviceRequestAdministrativeIssue;
  544:             Ia.Ftn.Cl.Models.Ui.Huawei.Sbr sbr;
  545:             Ia.Ftn.Cl.Models.Huawei.Owsbr owsbr;
  546:             Ia.Ftn.Cl.Models.Huawei.Seruattr seruattr;
  547:             Ia.Ftn.Cl.Models.Ericsson.AxeSubscriber axeSubscriber;
  548:             Ia.Ftn.Cl.Models.Siemens.EwsdSubscriber ewsdSubscriber;
  549:             Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont nddOnt;
  550:             Ia.Ftn.Cl.Models.Ont ont;
  551:             Ia.Ftn.Cl.Models.OntOntPots ontOntPots;
  552:             Ia.Ftn.Cl.Models.Ui.ServiceRequestService serviceRequestService;
  553:             Ia.Ftn.Cl.Models.Access access;
  554:             Ia.Ftn.Cl.Models.Ui.Service2 service2;
  555:             Ia.Ftn.Cl.Models.Ui.Nokia.AgcfGatewayRecord agcfGatewayRecord;
  556:             Ia.Ftn.Cl.Models.Ui.Nokia.AgcfEndpoint agcfEndpoint;
  557:             Ia.Ftn.Cl.Models.Huawei.Mgw mgw;
  558:             Ia.Ftn.Cl.Models.Huawei.Asbr asbr;
  559:             Ia.Ftn.Cl.Models.Ui.Nokia.SubParty subParty;
  560:             Ia.Ftn.Cl.Models.Ui.Nokia.Subscriber subscriber;
  561:             Ia.Ftn.Cl.Models.OntServiceVoip ontServiceVoip;
  562:             Ia.Ftn.Cl.Models.Huawei.EmsDev emsDev;
  563:             Ia.Ftn.Cl.Models.Huawei.EmsBoard emsBoard;
  564:             Ia.Ftn.Cl.Models.Huawei.EmsPort emsPort;
  565:             Ia.Ftn.Cl.Models.Ui.Huawei.EmsOnt emsOnt;
  566:             Ia.Ftn.Cl.Models.Huawei.EmsOntSipInfo emsOntSipInfo;
  567:             Ia.Ftn.Cl.Models.Huawei.EmsVoipPstnUser emsVoipPstnUser;
  568:             Ia.Ftn.Cl.Models.Huawei.EmsVag emsVag;
  569:             Ia.Ftn.Cl.Models.StaffIdentityUser staffIdentityUser;
  570:             Ia.Ftn.Cl.Models.Contact contact;
  571:             Ia.Ftn.Cl.Models.ServiceExemption serviceExemption;
  572:             Ia.Ftn.Cl.Models.Ui.ReportAccessServiceRequest reportAccessServiceRequest;
  573:             Ia.Ftn.Cl.Models.Business.Service.KuwaitFtnArea kuwaitFtnArea;
  574:             Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor vendor;
  575:             Ia.Ftn.Cl.Models.Ui.Maintenance.AccessFamilyTypeAreaBlock accessFamilyTypeInAreaBlock;
  576:             Ia.Ftn.Cl.Models.Event @event;
  577:             Ia.Ftn.Cl.Models.Business.ServiceNddOntAccessName serviceAccessName;
  578:             Ia.Ftn.Cl.Models.Business.ServiceNddOntAccessNameAddress serviceAccessNameAddress;
  579:             Ia.Ftn.Cl.Models.Business.Huawei.Dev.MsanDev.Lic msanDevLic;
  580:  
  581:             areaId = 0;
  582:             userId = string.Empty;
  583:             itemFullName = item.GetType().FullName;
  584:  
  585:             //if (e.Row.RowType == DataControlRowType.Header || e.Row.RowType == DataControlRowType.Footer || e.Row.RowType == DataControlRowType.DataRow)
  586:             //{
  587:             report = null;
  588:             reportHistory = null;
  589:             serviceRequest = null;
  590:             serviceRequestHistory = null;
  591:             serviceRequestOnt = null;
  592:             serviceRequestOntDetail = null;
  593:             serviceRequestAdministrativeIssue = null;
  594:             sbr = null;
  595:             owsbr = null;
  596:             seruattr = null;
  597:             axeSubscriber = null;
  598:             ewsdSubscriber = null;
  599:             agcfGatewayRecord = null;
  600:             agcfEndpoint = null;
  601:             mgw = null;
  602:             asbr = null;
  603:             subParty = null;
  604:             subscriber = null;
  605:             nddOnt = null;
  606:             ont = null;
  607:             serviceRequestService = null;
  608:             access = null;
  609:             ontOntPots = null;
  610:             ontServiceVoip = null;
  611:             emsDev = null;
  612:             emsBoard = null;
  613:             emsPort = null;
  614:             emsOnt = null;
  615:             emsOntSipInfo = null;
  616:             emsVoipPstnUser = null;
  617:             emsVag = null;
  618:             service2 = null;
  619:             staffIdentityUser = null;
  620:             contact = null;
  621:             serviceExemption = null;
  622:             reportAccessServiceRequest = null;
  623:             kuwaitFtnArea = null;
  624:             vendor = null;
  625:             accessFamilyTypeInAreaBlock = null;
  626:             @event = null;
  627:             serviceAccessName = null;
  628:             serviceAccessNameAddress = null;
  629:             msanDevLic = null;
  630:  
  631:             itemKnown = true;
  632:  
  633:             switch (itemFullName)
  634:             {
  635:                 case "Ia.Ftn.Cl.Models.Report":
  636:                     {
  637:                         report = item as Ia.Ftn.Cl.Models.Report;
  638:                         break;
  639:                     }
  640:                 case "Ia.Ftn.Cl.Models.ReportHistory":
  641:                     {
  642:                         reportHistory = item as Ia.Ftn.Cl.Models.ReportHistory;
  643:                         break;
  644:                     }
  645:                 case "Ia.Ftn.Cl.Models.Ui.ReportAccessServiceRequest":
  646:                     {
  647:                         reportAccessServiceRequest = item as Ia.Ftn.Cl.Models.Ui.ReportAccessServiceRequest;
  648:                         break;
  649:                     }
  650:                 case "Ia.Ftn.Cl.Models.ServiceRequest":
  651:                     {
  652:                         serviceRequest = item as Ia.Ftn.Cl.Models.ServiceRequest;
  653:                         break;
  654:                     }
  655:                 case "Ia.Ftn.Cl.Models.ServiceRequestHistory":
  656:                     {
  657:                         serviceRequestHistory = item as Ia.Ftn.Cl.Models.ServiceRequestHistory;
  658:                         break;
  659:                     }
  660:                 case "Ia.Ftn.Cl.Models.ServiceRequestOnt":
  661:                     {
  662:                         serviceRequestOnt = item as Ia.Ftn.Cl.Models.ServiceRequestOnt;
  663:                         break;
  664:                     }
  665:                 case "Ia.Ftn.Cl.Models.ServiceRequestOntDetail":
  666:                     {
  667:                         serviceRequestOntDetail = item as Ia.Ftn.Cl.Models.ServiceRequestOntDetail;
  668:                         break;
  669:                     }
  670:                 case "Ia.Ftn.Cl.Models.ServiceRequestAdministrativeIssue":
  671:                     {
  672:                         serviceRequestAdministrativeIssue = item as Ia.Ftn.Cl.Models.ServiceRequestAdministrativeIssue;
  673:                         break;
  674:                     }
  675:                 case "Ia.Ftn.Cl.Models.Ui.Huawei.Sbr":
  676:                     {
  677:                         sbr = item as Ia.Ftn.Cl.Models.Ui.Huawei.Sbr;
  678:                         break;
  679:                     }
  680:                 case "Ia.Ftn.Cl.Models.Huawei.Owsbr":
  681:                     {
  682:                         owsbr = item as Ia.Ftn.Cl.Models.Huawei.Owsbr;
  683:                         break;
  684:                     }
  685:                 case "Ia.Ftn.Cl.Models.Huawei.Seruattr":
  686:                     {
  687:                         seruattr = item as Ia.Ftn.Cl.Models.Huawei.Seruattr;
  688:                         break;
  689:                     }
  690:                 case "Ia.Ftn.Cl.Models.Ericsson.AxeSubscriber":
  691:                     {
  692:                         axeSubscriber = item as Ia.Ftn.Cl.Models.Ericsson.AxeSubscriber;
  693:                         break;
  694:                     }
  695:                 case "Ia.Ftn.Cl.Models.Siemens.EwsdSubscriber":
  696:                     {
  697:                         ewsdSubscriber = item as Ia.Ftn.Cl.Models.Siemens.EwsdSubscriber;
  698:                         break;
  699:                     }
  700:                 case "Ia.Ftn.Cl.Models.Ui.Nokia.AgcfGatewayRecord":
  701:                     {
  702:                         agcfGatewayRecord = item as Ia.Ftn.Cl.Models.Ui.Nokia.AgcfGatewayRecord;
  703:                         break;
  704:                     }
  705:                 case "Ia.Ftn.Cl.Models.Ui.Nokia.AgcfEndpoint":
  706:                     {
  707:                         agcfEndpoint = item as Ia.Ftn.Cl.Models.Ui.Nokia.AgcfEndpoint;
  708:                         break;
  709:                     }
  710:                 case "Ia.Ftn.Cl.Models.Huawei.Mgw":
  711:                     {
  712:                         mgw = item as Ia.Ftn.Cl.Models.Huawei.Mgw;
  713:                         break;
  714:                     }
  715:                 case "Ia.Ftn.Cl.Models.Huawei.Asbr":
  716:                     {
  717:                         asbr = item as Ia.Ftn.Cl.Models.Huawei.Asbr;
  718:                         break;
  719:                     }
  720:                 case "Ia.Ftn.Cl.Models.Ui.Nokia.SubParty":
  721:                     {
  722:                         subParty = item as Ia.Ftn.Cl.Models.Ui.Nokia.SubParty;
  723:                         break;
  724:                     }
  725:                 case "Ia.Ftn.Cl.Models.Ui.Nokia.Subscriber":
  726:                     {
  727:                         subscriber = item as Ia.Ftn.Cl.Models.Ui.Nokia.Subscriber;
  728:                         break;
  729:                     }
  730:                 case "Ia.Ftn.Cl.Models.Business.NetworkDesignDocument+Ont": // "...+Ont"
  731:                     {
  732:                         nddOnt = item as Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Ont;
  733:                         break;
  734:                     }
  735:                 case "Ia.Ftn.Cl.Models.Ont":
  736:                     {
  737:                         ont = item as Ia.Ftn.Cl.Models.Ont;
  738:                         break;
  739:                     }
  740:                 case "Ia.Ftn.Cl.Models.OntOntPots":
  741:                     {
  742:                         ontOntPots = item as Ia.Ftn.Cl.Models.OntOntPots;
  743:                         break;
  744:                     }
  745:                 case "Ia.Ftn.Cl.Models.Ui.ServiceRequestService":
  746:                     {
  747:                         serviceRequestService = item as Ia.Ftn.Cl.Models.Ui.ServiceRequestService;
  748:                         break;
  749:                     }
  750:                 case "Ia.Ftn.Cl.Models.Access":
  751:                     {
  752:                         access = item as Ia.Ftn.Cl.Models.Access;
  753:                         break;
  754:                     }
  755:                 case "Ia.Ftn.Cl.Models.Ui.Service2":
  756:                     {
  757:                         service2 = item as Ia.Ftn.Cl.Models.Ui.Service2;
  758:                         break;
  759:                     }
  760:                 case "Ia.Ftn.Cl.Models.OntServiceVoip":
  761:                     {
  762:                         ontServiceVoip = item as Ia.Ftn.Cl.Models.OntServiceVoip;
  763:                         break;
  764:                     }
  765:                 case "Ia.Ftn.Cl.Models.Huawei.EmsDev":
  766:                     {
  767:                         emsDev = item as Ia.Ftn.Cl.Models.Huawei.EmsDev;
  768:                         break;
  769:                     }
  770:                 case "Ia.Ftn.Cl.Models.Huawei.EmsBoard":
  771:                     {
  772:                         emsBoard = item as Ia.Ftn.Cl.Models.Huawei.EmsBoard;
  773:                         break;
  774:                     }
  775:                 case "Ia.Ftn.Cl.Models.Huawei.EmsPort":
  776:                     {
  777:                         emsPort = item as Ia.Ftn.Cl.Models.Huawei.EmsPort;
  778:                         break;
  779:                     }
  780:                 case "Ia.Ftn.Cl.Models.Ui.Huawei.EmsOnt":
  781:                     {
  782:                         emsOnt = item as Ia.Ftn.Cl.Models.Ui.Huawei.EmsOnt;
  783:                         break;
  784:                     }
  785:                 case "Ia.Ftn.Cl.Models.Huawei.EmsOntSipInfo":
  786:                     {
  787:                         emsOntSipInfo = item as Ia.Ftn.Cl.Models.Huawei.EmsOntSipInfo;
  788:                         break;
  789:                     }
  790:                 case "Ia.Ftn.Cl.Models.Huawei.EmsVoipPstnUser":
  791:                     {
  792:                         emsVoipPstnUser = item as Ia.Ftn.Cl.Models.Huawei.EmsVoipPstnUser;
  793:                         break;
  794:                     }
  795:                 case "Ia.Ftn.Cl.Models.Huawei.EmsVag":
  796:                     {
  797:                         emsVag = item as Ia.Ftn.Cl.Models.Huawei.EmsVag;
  798:                         break;
  799:                     }
  800:                 case "Ia.Ftn.Cl.Models.StaffIdentityUser":
  801:                     {
  802:                         staffIdentityUser = item as Ia.Ftn.Cl.Models.StaffIdentityUser;
  803:                         break;
  804:                     }
  805:                 case "Ia.Ftn.Cl.Models.Contact":
  806:                     {
  807:                         contact = item as Ia.Ftn.Cl.Models.Contact;
  808:                         break;
  809:                     }
  810:                 case "Ia.Ftn.Cl.Models.Ui.Maintenance.AccessFamilyTypeAreaBlock":
  811:                     {
  812:                         accessFamilyTypeInAreaBlock = item as Ia.Ftn.Cl.Models.Ui.Maintenance.AccessFamilyTypeAreaBlock;
  813:                         break;
  814:                     }
  815:                 case "Ia.Ftn.Cl.Models.Event":
  816:                     {
  817:                         @event = item as Ia.Ftn.Cl.Models.Event;
  818:                         break;
  819:                     }
  820:                 case "Ia.Ftn.Cl.Models.Business.Service.KuwaitFtnArea":
  821:                     {
  822:                         kuwaitFtnArea = item as Ia.Ftn.Cl.Models.Business.Service.KuwaitFtnArea;
  823:                         break;
  824:                     }
  825:                 case "Ia.Ftn.Cl.Models.ServiceExemption":
  826:                     {
  827:                         serviceExemption = item as Ia.Ftn.Cl.Models.ServiceExemption;
  828:                         break;
  829:                     }
  830:                 case "Ia.Ftn.Cl.Models.Business.ServiceNddOntAccessName":
  831:                     {
  832:                         serviceAccessName = item as Ia.Ftn.Cl.Models.Business.ServiceNddOntAccessName;
  833:                         break;
  834:                     }
  835:                 case "Ia.Ftn.Cl.Models.Business.ServiceNddOntAccessNameAddress":
  836:                     {
  837:                         serviceAccessNameAddress = item as Ia.Ftn.Cl.Models.Business.ServiceNddOntAccessNameAddress;
  838:                         break;
  839:                     }
  840:                 case "Ia.Ftn.Cl.Models.Business.Huawei.Dev.MsanDev.Lic":
  841:                     {
  842:                         msanDevLic = item as Ia.Ftn.Cl.Models.Business.Huawei.Dev.MsanDev.Lic;
  843:                         break;
  844:                     }
  845:                 default:
  846:                     {
  847:                         itemKnown = false;
  848:                         break;
  849:                     }
  850:             }
  851:  
  852:  
  853:             if (itemKnown)
  854:             {
  855:  
  856:                 /*
  857: if (report != null)
  858: {
  859:     if (staffIdentityUser != null)
  860:     {
  861:         if (Ia.Ftn.Cl.Models.Data.Report.ReportResponsibilityByStaffGuidDictionary.ContainsKey(staffIdentityUser.StaffIdentityUser.Id))
  862:         {
  863:             if (Ia.Ftn.Cl.Models.Data.Report.ReportResponsibilityByStaffGuidDictionary[staffIdentityUser.StaffIdentityUser.Id].Any(u => u == report.Id))
  864:             {
  865:                 //e.Row.CssClass = "selected-row-style";
  866:             }
  867:             else { }
  868:         }
  869:         else { }
  870:     }
  871:     else { }
  872: }
  873: else { }
  874: */
  875:  
  876:                 try
  877:                 {
  878:                     if (!string.IsNullOrEmpty(propertyName))
  879:                     {
  880:                         switch (propertyName) //l.ID)
  881:                         {
  882:                             case "reportServiceLabel":
  883:                                 {
  884:                                     s = Ia.Ftn.Cl.Models.Business.Service.ServiceName(report.Service, report.ServiceType);
  885:                                     labelText = s;
  886:                                     break;
  887:                                 }
  888:                             case "reportStatusLabel": labelText = Ia.Ftn.Cl.Models.Data.Report.StatusColoredDictionary[report.Status].ToString(); break;
  889:                             case "reportSeverityLabel": labelText = Ia.Ftn.Cl.Models.Data.Report.SeverityColoredDictionary[report.Severity].ToString(); break;
  890:                             case "reportCategoryLabel": labelText = Ia.Ftn.Cl.Models.Data.Report.CategoryDictionary[report.Category].ToString(); break;
  891:                             case "reportAreaLabel": labelText = Ia.Ftn.Cl.Models.Data.Report.CategoryAreaColoredDictionary[report.Area].ToString(); break;
  892:                             case "reportPriorityLabel": labelText = Ia.Ftn.Cl.Models.Data.Report.PriorityColoredDictionary[report.Priority].ToString(); break;
  893:                             case "reportDetailLabel":
  894:                                 {
  895:                                     labelText = Ia.Cl.Models.Html.Decode(report.Detail);
  896:  
  897:                                     SetTableCellHtmlTextWriteStyleDirectionAccordingToPresenceOfArabicLetters(); //ref e, ref l);
  898:  
  899:                                     break;
  900:                                 }
  901:                             case "reportLastHistoricResolutionLabel":
  902:                                 {
  903:                                     labelText = (report.LastReportHistory != null) ? Ia.Ftn.Cl.Models.Data.Report.ResolutionIdToEnglishArabicColoredNameDictionary[report.LastReportHistory.Resolution].ToString() : string.Empty;
  904:  
  905:                                     break;
  906:                                 }
  907:                             case "reportLastHistoricEstimateLabel": labelText = (report.LastReportHistory != null) ? labelText = Ia.Ftn.Cl.Models.Data.Report.EstimateEnglishAndArabicColoredDictionary[report.LastReportHistory.Estimate].ToString() : string.Empty; break;
  908:                             case "reportLastHistoricStaffLabel":
  909:                                 {
  910:                                     //labelText = (report.LastReportHistory != null) ? labelText = (from _s in Ia.Ftn.Cl.Models.Data.StaffIdentityUser.List() where _s.Id == report.LastReportHistory.StaffIdentityUser.Id select _s.FirstAndMiddleName).SingleOrDefault() : string.Empty;
  911:  
  912:                                     SetTableCellHtmlTextWriteStyleDirectionAccordingToPresenceOfArabicLetters(); //ref e, ref l);
  913:  
  914:                                     break;
  915:                                 }
  916:                             case "reportLastHistoricUpdatedLabel":
  917:                                 {
  918:                                     var dateTime = (report.LastReportHistory != null) ? report.LastReportHistory.Updated : report.Updated;
  919:  
  920:                                     labelText = dateTime.ToString("yyyy-MM-dd hh:mm");
  921:  
  922:                                     break;
  923:                                 }
  924:                             case "reportLastReportAndHistoricStaffFrameworkLabel":
  925:                                 {
  926:                                     if (report.LastReportHistory != null)
  927:                                     {
  928:                                         if (!string.IsNullOrEmpty(report.LastReportHistory.FrameworkId))
  929:                                         {
  930:                                             arabicNameBracketParentArabicNameBracket = (from f in Ia.Ftn.Cl.Models.Data.Administration.FrameworkList
  931:                                                                                         where f.Id == report.LastReportHistory.FrameworkId
  932:                                                                                         select f.ArabicNameBracketParentArabicNameBracket).SingleOrDefault();
  933:  
  934:                                             labelText = arabicNameBracketParentArabicNameBracket;
  935:                                         }
  936:                                         else if (report.LastReportHistory.StaffIdentityUser != null)
  937:                                         {
  938:                                             firstAndMiddleNameBracketFrameworkArabicNameAndFrameworkParentArabicNameBracket = (from _s in Ia.Ftn.Cl.Models.Data.StaffIdentityUser.List()
  939:                                                                                                                                where _s.Id == report.LastReportHistory.StaffIdentityUser.Id
  940:                                                                                                                                select _s.FirstAndMiddleNameBracketFrameworkArabicNameAndFrameworkParentArabicNameBracket).SingleOrDefault();
  941:  
  942:                                             labelText = firstAndMiddleNameBracketFrameworkArabicNameAndFrameworkParentArabicNameBracket;
  943:                                         }
  944:                                     }
  945:                                     else
  946:                                     {
  947:                                         if (!string.IsNullOrEmpty(report.FrameworkId))
  948:                                         {
  949:                                             arabicNameBracketParentArabicNameBracket = (from f in Ia.Ftn.Cl.Models.Data.Administration.FrameworkList
  950:                                                                                         where f.Id == report.FrameworkId
  951:                                                                                         select f.ArabicNameBracketParentArabicNameBracket).SingleOrDefault();
  952:  
  953:                                             labelText = arabicNameBracketParentArabicNameBracket;
  954:                                         }
  955:                                         else
  956:                                         {
  957:                                             firstAndMiddleNameBracketFrameworkArabicNameAndFrameworkParentArabicNameBracket = (from _s in Ia.Ftn.Cl.Models.Data.StaffIdentityUser.List()
  958:                                                                                                                                where _s.Id == report.StaffIdentityUser.Id
  959:                                                                                                                                select _s.FirstAndMiddleNameBracketFrameworkArabicNameAndFrameworkParentArabicNameBracket).SingleOrDefault();
  960:  
  961:                                             labelText = firstAndMiddleNameBracketFrameworkArabicNameAndFrameworkParentArabicNameBracket;
  962:                                         }
  963:                                     }
  964:  
  965:                                     SetTableCellHtmlTextWriteStyleDirectionAccordingToPresenceOfArabicLetters(); //ref e, ref l);
  966:  
  967:                                     break;
  968:                                 }
  969:                             case "reportContactLabel":
  970:                                 {
  971:                                     labelText = Ia.Cl.Models.Html.Decode(report.Contact);
  972:  
  973:                                     SetTableCellHtmlTextWriteStyleDirectionAccordingToPresenceOfArabicLetters(); //ref e, ref l);
  974:  
  975:                                     break;
  976:                                 }
  977:                             case "reportNoteLabel":
  978:                                 {
  979:                                     labelText = Ia.Cl.Models.Html.Decode(report.Note);
  980:  
  981:                                     SetTableCellHtmlTextWriteStyleDirectionAccordingToPresenceOfArabicLetters(); //ref e, ref l);
  982:  
  983:                                     break;
  984:                                 }
  985:  
  986:  
  987:                             case "reportHistoryLastDetailOrReportDetailLabel":
  988:                                 {
  989:                                     labelText = report.LastReportHistory != null ? Ia.Cl.Models.Html.Decode(report.LastReportHistory.Detail) : Ia.Cl.Models.Html.Decode(report.Detail);
  990:  
  991:                                     SetTableCellHtmlTextWriteStyleDirectionAccordingToPresenceOfArabicLetters(); //ref e, ref l);
  992:  
  993:                                     break;
  994:                                 }
  995:  
  996:                             case "reportStatusLastHistoricResolutionLabel":
  997:                                 {
  998:                                     s = Ia.Ftn.Cl.Models.Data.Report.StatusColoredDictionary[report.Status].ToString();
  999:  
 1000:                                     if (report.LastReportHistory != null) s += "/" + Ia.Ftn.Cl.Models.Data.Report.ResolutionIdToEnglishArabicColoredNameDictionary[report.LastReportHistory.Resolution].ToString();
 1001:  
 1002:                                     labelText = s;
 1003:  
 1004:                                     break;
 1005:                                 }
 1006:  
 1007:                             case "reportHistoryLastHistoricalIndicationActionResolutionLabel":
 1008:                                 {
 1009:                                     if (report.LastReportHistory != null)
 1010:                                     {
 1011:                                         s = Ia.Ftn.Cl.Models.Data.Report.IndicationColoredDictionary[report.LastReportHistory.Indication].ToString()
 1012:                                             + "/" + Ia.Ftn.Cl.Models.Data.Report.ActionColoredDictionary[report.LastReportHistory.Action].ToString()
 1013:                                             + "/" + Ia.Ftn.Cl.Models.Data.Report.ResolutionIdToColoredNameDictionary[report.LastReportHistory.Resolution].ToString();
 1014:                                     }
 1015:                                     else s = string.Empty;
 1016:  
 1017:                                     labelText = s;
 1018:  
 1019:                                     break;
 1020:                                 }
 1021:  
 1022:                             case "reportAccessServiceRequestLastHistoricResolutionLabel": labelText = (reportAccessServiceRequest.Report.LastReportHistory != null) ? Ia.Ftn.Cl.Models.Data.Report.ResolutionIdToEnglishArabicColoredNameDictionary[reportAccessServiceRequest.Report.LastReportHistory.Resolution].ToString() : string.Empty; break;
 1023:                             case "reportAccessServiceRequestServiceFlatTermIdLabel": labelText = "?"; break;
 1024:                             case "reportAccessServiceRequestLastHistoricActionLabel": labelText = (reportAccessServiceRequest.Report.LastReportHistory != null) ? Ia.Ftn.Cl.Models.Data.Report.ActionColoredDictionary[reportAccessServiceRequest.Report.LastReportHistory.Action].ToString() : string.Empty; break;
 1025:                             case "reportAccessServiceRequestServiceTypeLabel": labelText = reportAccessServiceRequest.Report.ServiceType.ToString(); break;
 1026:                             case "reportAccessServiceRequestContactLabel": labelText = Ia.Cl.Models.Html.Decode(reportAccessServiceRequest.Report.Contact); break;
 1027:  
 1028:                             case "reportAccessServiceRequestAddressLabel":
 1029:                                 {
 1030:                                     if (reportAccessServiceRequest.Access != null)
 1031:                                     {
 1032:                                         labelText = Ia.Cl.Models.Html.Decode(reportAccessServiceRequest.Access.Address);
 1033:                                     }
 1034:  
 1035:                                     break;
 1036:                                 }
 1037:  
 1038:                             case "reportAccessServiceRequestDetailLabel": labelText = (reportAccessServiceRequest.Report.LastReportHistory != null) ? Ia.Cl.Models.Html.Decode(reportAccessServiceRequest.Report.LastReportHistory.Detail) : string.Empty; break;
 1039:                             case "reportAccessServiceRequestNoteLabel": labelText = (reportAccessServiceRequest.Report.LastReportHistory != null) ? Ia.Cl.Models.Html.Decode(reportAccessServiceRequest.Report.LastReportHistory.Note) : string.Empty; break;
 1040:                             case "reportAccessServiceRequestStaffFrameworkLabel":
 1041:                                 {
 1042:                                     if (reportAccessServiceRequest.Report.LastReportHistory != null)
 1043:                                     {
 1044:                                         if (Ia.Ftn.Cl.Models.Business.Administration.IsFrameworkId(reportAccessServiceRequest.Report.LastReportHistory.StaffIdentityUser.Id))
 1045:                                         {
 1046:                                             labelText = (from f in Ia.Ftn.Cl.Models.Data.Administration.FrameworkList where f.Id == reportAccessServiceRequest.Report.LastReportHistory.StaffIdentityUser.Id select f.ArabicName).SingleOrDefault();
 1047:                                         }
 1048:                                         //else labelText = (from _s in Ia.Ftn.Cl.Models.Data.StaffIdentityUser.List() where _s.Id == reportAccessServiceRequest.Report.LastReportHistory.StaffIdentityUser.Id select _s.FirstAndMiddleName).SingleOrDefault();
 1049:  
 1050:                                         if (!string.IsNullOrEmpty(reportAccessServiceRequest.Report.LastReportHistory.FrameworkId))
 1051:                                         {
 1052:                                             labelText = (from f in Ia.Ftn.Cl.Models.Data.Administration.FrameworkList
 1053:                                                          where f.Id == reportAccessServiceRequest.Report.LastReportHistory.FrameworkId
 1054:                                                          select f.ArabicName).SingleOrDefault();
 1055:                                         }
 1056:                                         else if (reportAccessServiceRequest.Report.LastReportHistory != null)
 1057:                                         {
 1058:                                             labelText = (from _s in Ia.Ftn.Cl.Models.Data.StaffIdentityUser.List()
 1059:                                                          where _s.Id == reportAccessServiceRequest.Report.LastReportHistory.StaffIdentityUser.Id
 1060:                                                          select _s.FirstAndMiddleName).SingleOrDefault();
 1061:                                         }
 1062:                                     }
 1063:                                     else
 1064:                                     {
 1065:                                         labelText = string.Empty;
 1066:                                     }
 1067:  
 1068:                                     break;
 1069:                                 }
 1070:  
 1071:                             case "reportHistoryLastNoteOrReportNoteLabel":
 1072:                                 {
 1073:                                     labelText = report.LastReportHistory != null ? Ia.Cl.Models.Html.Decode(report.LastReportHistory.Note) : Ia.Cl.Models.Html.Decode(report.Note);
 1074:  
 1075:                                     SetTableCellHtmlTextWriteStyleDirectionAccordingToPresenceOfArabicLetters(); //ref e, ref l);
 1076:  
 1077:                                     break;
 1078:                                 }
 1079:                             case "reportHistoryIndicationLabel":
 1080:                                 {
 1081:                                     labelText = Ia.Ftn.Cl.Models.Data.Report.IndicationColoredDictionary.ContainsKey(reportHistory.Indication) ? Ia.Ftn.Cl.Models.Data.Report.IndicationColoredDictionary[reportHistory.Indication].ToString() : string.Empty;
 1082:  
 1083:                                     break;
 1084:                                 }
 1085:                             case "reportHistoryAreaLabel":
 1086:                                 {
 1087:                                     if (Ia.Ftn.Cl.Models.Data.Report.CategoryAreaColoredDictionary.ContainsKey(reportHistory.Area))
 1088:                                     {
 1089:                                         labelText = Ia.Ftn.Cl.Models.Data.Report.CategoryAreaColoredDictionary[reportHistory.Area].ToString();
 1090:                                     }
 1091:                                     else labelText = "Error: Area '" + reportHistory.Area + "' not found. ";
 1092:  
 1093:                                     break;
 1094:                                 };
 1095:                             case "reportHistoryActionLabel":
 1096:                                 {
 1097:                                     labelText = Ia.Ftn.Cl.Models.Data.Report.ActionColoredDictionary.ContainsKey(reportHistory.Action) ? Ia.Ftn.Cl.Models.Data.Report.ActionColoredDictionary[reportHistory.Action].ToString() : string.Empty;
 1098:  
 1099:                                     break;
 1100:                                 }
 1101:                             case "reportHistoryResolutionLabel":
 1102:                                 {
 1103:                                     labelText = Ia.Ftn.Cl.Models.Data.Report.ResolutionIdToEnglishArabicColoredNameDictionary.ContainsKey(reportHistory.Resolution) ? Ia.Ftn.Cl.Models.Data.Report.ResolutionIdToEnglishArabicColoredNameDictionary[reportHistory.Resolution].ToString() : string.Empty;
 1104:  
 1105:                                     break;
 1106:                                 }
 1107:                             case "reportHistoryEstimateLabel": labelText = Ia.Ftn.Cl.Models.Data.Report.EstimateEnglishAndArabicColoredDictionary[reportHistory.Estimate].ToString(); break;
 1108:                             case "reportHistoryDetailLabel":
 1109:                                 {
 1110:                                     labelText = Ia.Cl.Models.Html.Decode(reportHistory.Detail);
 1111:  
 1112:                                     SetTableCellHtmlTextWriteStyleDirectionAccordingToPresenceOfArabicLetters(); //ref e, ref l);
 1113:  
 1114:                                     break;
 1115:                                 }
 1116:                             case "reportHistoryNoteLabel":
 1117:                                 {
 1118:                                     labelText = Ia.Cl.Models.Html.Decode(reportHistory.Note);
 1119:  
 1120:                                     SetTableCellHtmlTextWriteStyleDirectionAccordingToPresenceOfArabicLetters(); //ref e, ref l);
 1121:  
 1122:                                     break;
 1123:                                 }
 1124:                             case "reportHistoryStaffFrameworkLabel":
 1125:                                 {
 1126:                                     if (!string.IsNullOrEmpty(reportHistory.FrameworkId))
 1127:                                     {
 1128:                                         arabicNameBracketParentArabicNameBracket = (from f in Ia.Ftn.Cl.Models.Data.Administration.FrameworkList
 1129:                                                                                     where f.Id == reportHistory.FrameworkId
 1130:                                                                                     select f.ArabicNameBracketParentArabicNameBracket).SingleOrDefault();
 1131:  
 1132:                                         labelText = arabicNameBracketParentArabicNameBracket;
 1133:                                     }
 1134:                                     else if (reportHistory.StaffIdentityUser != null)
 1135:                                     {
 1136:                                         firstAndMiddleNameBracketFrameworkArabicNameAndFrameworkParentArabicNameBracket = (from _s in Ia.Ftn.Cl.Models.Data.StaffIdentityUser.List()
 1137:                                                                                                                            where _s.Id == reportHistory.StaffIdentityUser.Id
 1138:                                                                                                                            select _s.FirstAndMiddleNameBracketFrameworkArabicNameAndFrameworkParentArabicNameBracket).SingleOrDefault();
 1139:  
 1140:                                         labelText = firstAndMiddleNameBracketFrameworkArabicNameAndFrameworkParentArabicNameBracket;
 1141:                                     }
 1142:  
 1143:                                     SetTableCellHtmlTextWriteStyleDirectionAccordingToPresenceOfArabicLetters(); //ref e, ref l);
 1144:  
 1145:                                     break;
 1146:                                 }
 1147:                             case "seruattrRouteNameLabel": labelText = Ia.Ftn.Cl.Models.Business.Huawei.Seruattr.RnidxRouteName[seruattr.RNIDX2]; break;
 1148:                             case "axeSubscriberRouteNameLabel": labelText = Ia.Ftn.Cl.Models.Business.Ericsson.Subscriber.RouteName(axeSubscriber.SCL); break;
 1149:                             case "serviceRequestStatusLabel": labelText = Ia.Ftn.Cl.Models.Data.ServiceRequest.StatusSortedList[serviceRequest.Status].ToString(); break;
 1150:                             case "serviceRequestCustomerCategoryIdLabel": labelText = Ia.Ftn.Cl.Models.Data.ServiceRequest.CustomerCategorySortedList[serviceRequest.CustomerCategoryId].ToString(); break;
 1151:                             case "serviceRequestServiceIdLabel":
 1152:                                 {
 1153:                                     if (Ia.Ftn.Cl.Models.Data.ServiceRequest.ServiceSortedList.ContainsKey(serviceRequest.ServiceId))
 1154:                                     {
 1155:                                         labelText = Ia.Ftn.Cl.Models.Data.ServiceRequest.ServiceSortedList[serviceRequest.ServiceId].ToString();
 1156:                                     }
 1157:                                     else labelText = "Error: Service '" + serviceRequest.ServiceId + "' not found. ";
 1158:  
 1159:                                     break;
 1160:                                 };
 1161:  
 1162:                             case "serviceRequestHistoryStatusLabel": labelText = Ia.Ftn.Cl.Models.Data.ServiceRequest.SystemCode[serviceRequestHistory.Status].ToString(); break;
 1163:                             case "serviceRequestHistoryEndDateTimeLabel":
 1164:                                 {
 1165:                                     if (serviceRequestHistory.EndDateTime == Ia.Ftn.Cl.Models.Business.Administration.SqlFriendlyJanuary1st1753NullDateTime)
 1166:                                     {
 1167:                                         labelText = string.Empty;
 1168:                                     }
 1169:                                     else labelText = serviceRequestHistory.EndDateTime.ToString("yyyy-MM-dd");
 1170:  
 1171:                                     break;
 1172:                                 };
 1173:                             case "serviceRequestHistoryServiceIdLabel":
 1174:                                 {
 1175:                                     if (Ia.Ftn.Cl.Models.Data.ServiceRequest.ServiceSortedList.ContainsKey(serviceRequestHistory.ServiceId))
 1176:                                     {
 1177:                                         labelText = Ia.Ftn.Cl.Models.Data.ServiceRequest.ServiceSortedList[serviceRequestHistory.ServiceId].ToString();
 1178:                                     }
 1179:                                     else labelText = "Error: Service '" + serviceRequestHistory.ServiceId + "' not found. ";
 1180:  
 1181:                                     break;
 1182:                                 };
 1183:                             case "serviceRequestHistoryServiceCategoryIdLabel": labelText = Ia.Ftn.Cl.Models.Data.ServiceRequest.ServiceCategorySortedList[serviceRequestHistory.ServiceCategoryId].ToString(); break;
 1184:  
 1185:                             case "serviceRequestServiceCategoryIdLabel": labelText = Ia.Ftn.Cl.Models.Data.ServiceRequest.ServiceCategorySortedList[serviceRequest.ServiceCategoryId].ToString(); break;
 1186:                             case "serviceRequestCustomerNameLabel": labelText = serviceRequest.CustomerName; break;
 1187:  
 1188:                             case "serviceRequestServiceServiceTypeLabel": labelText = Ia.Ftn.Cl.Models.Data.Service.ServiceType(serviceRequestService.ServiceType).ColoredNameArabicName; break;
 1189:  
 1190:                             case "serviceRequestServiceTypeLabel": labelText = "??"; break;
 1191:                             case "serviceRequestServiceProvisionedLabel": labelText = Ia.Cl.Models.Default.YesNo(serviceRequestService.Provisioned); break;
 1192:                             case "serviceRequestServiceProvisionedArabicLabel": labelText = Ia.Cl.Models.Default.YesNoInArabic(serviceRequestService.Provisioned); break;
 1193:                             case "serviceRequestServiceCallWaitingLabel": labelText = Ia.Cl.Models.Default.YesNo(serviceRequestService.CallWaiting); break;
 1194:                             case "serviceRequestServiceCallForwardingLabel": labelText = Ia.Cl.Models.Default.YesNo(serviceRequestService.CallForwarding); break;
 1195:                             case "serviceRequestServiceAlarmCallLabel": labelText = Ia.Cl.Models.Default.YesNo(serviceRequestService.AlarmCall); break;
 1196:                             case "serviceRequestServiceInternationalCallingUserControlledLabel": labelText = Ia.Cl.Models.Default.YesNo(serviceRequestService.InternationalCallingUserControlled); break;
 1197:                             case "serviceRequestServiceInternationalCallingLabel": labelText = Ia.Cl.Models.Default.YesNo(serviceRequestService.InternationalCalling); break;
 1198:                             case "serviceRequestServiceCallerIdLabel": labelText = Ia.Cl.Models.Default.YesNo(serviceRequestService.CallerId); break;
 1199:                             case "serviceRequestServiceConferenceCallLabel": labelText = Ia.Cl.Models.Default.YesNo(serviceRequestService.ConferenceCall); break;
 1200:                             case "serviceRequestServiceAbbriviatedCallingLabel": labelText = Ia.Cl.Models.Default.YesNo(serviceRequestService.AbbriviatedCalling); break;
 1201:                             case "serviceRequestServiceCallBarringLabel": labelText = Ia.Cl.Models.Default.YesNo(serviceRequestService.CallBarring); break;
 1202:  
 1203:                             case "accessAreaLabel": labelText = (from kna in Ia.Ftn.Cl.Models.Data.Service.KuwaitFtnAreaList where kna.Id == access.AreaId select kna.ArabicName).SingleOrDefault(); break;
 1204:                             case "accessOltLabel": labelText = (from o in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OltList where o.Id == access.Olt select o.AmsName).SingleOrDefault(); break;
 1205:                             case "accessBlockLabel": labelText = access.Block.ToString(); break;
 1206:                             case "accessStreetLabel": labelText = access.Street; break;
 1207:                             case "accessPremisesOldLabel": labelText = access.PremisesOld; break;
 1208:                             case "accessPremisesNewLabel": labelText = access.PremisesNew; break;
 1209:                             case "accessNoteLabel": labelText = access.Note; break;
 1210:                             //case "accessStaffNameLabel": labelText = (from _s in Ia.Ftn.Cl.Models.Data.StaffIdentityUser.List() where _s.Id == access.StaffIdentityUser.Id select _s.FirstAndMiddleName).SingleOrDefault(); break;
 1211:                             case "accessOntFamilyTypeCapacityLabel":
 1212:                                 {
 1213:                                     // temp: later quickly find vendor from accessId
 1214:                                     if (access.Onts != null && access.Onts.Count > 0)
 1215:                                     {
 1216:                                         labelText = Ia.Ftn.Cl.Models.Data.Nokia.Ont.FamilyTypeStringFromId(access.Onts.FirstOrDefault().FamilyTypeId);
 1217:  
 1218:                                         labelText += " (" + Ia.Ftn.Cl.Models.Business.Nokia.Ont.PossibleNumberOfTdForOntFamilyType(access.Onts.FirstOrDefault().FamilyTypeId) + ")";
 1219:                                     }
 1220:                                     else if (access.EmsOnts != null && access.EmsOnts.Count > 0)
 1221:                                     {
 1222:                                         labelText = access.EmsOnts.FirstOrDefault().FamilyType.ToString().ToUpper();
 1223:  
 1224:                                         labelText += " (" + access.EmsOnts.FirstOrDefault().EquipmentType.TelPorts + ")";
 1225:                                     }
 1226:                                     else labelText = string.Empty;
 1227:  
 1228:                                     break;
 1229:                                 }
 1230:  
 1231:                             case "accessFamilyTypeInAreaBlockLabel": labelText = (from kna in Ia.Ftn.Cl.Models.Data.Service.KuwaitFtnAreaList where kna.Id == accessFamilyTypeInAreaBlock.AreaId select kna.NameArabicName).SingleOrDefault(); break;
 1232:  
 1233:                             case "service2ServiceTypeLabel": labelText = Ia.Ftn.Cl.Models.Data.Service.ServiceType(service2.ServiceType).ColoredNameArabicName; break;
 1234:                             case "service2PortLabel":
 1235:                                 {
 1236:                                     if (service2.Port != Ia.Ftn.Cl.Models.Business.Default.PortUndefinedOrInvalidOrUnknown)
 1237:                                     {
 1238:                                         labelText = service2.Port.ToString();
 1239:                                     }
 1240:  
 1241:                                     break;
 1242:                                 }
 1243:                             case "service2CallWaitingLabel": labelText = Ia.Cl.Models.Default.YesNo(service2.CallWaiting); break;
 1244:                             case "service2CallForwardingLabel": labelText = Ia.Cl.Models.Default.YesNo(service2.CallForwarding); break;
 1245:                             case "service2AlarmCallLabel": labelText = Ia.Cl.Models.Default.YesNo(service2.AlarmCall); break;
 1246:                             case "service2InternationalCallingUserControlledLabel": labelText = Ia.Cl.Models.Default.YesNo(service2.InternationalCallingUserControlled); break;
 1247:                             case "service2InternationalCallingLabel": labelText = Ia.Cl.Models.Default.YesNo(service2.InternationalCalling); break;
 1248:                             case "service2CallerIdLabel": labelText = Ia.Cl.Models.Default.YesNo(service2.CallerId); break;
 1249:                             case "service2ConferenceCallLabel": labelText = Ia.Cl.Models.Default.YesNo(service2.ConferenceCall); break;
 1250:                             case "service2AbbriviatedCallingLabel": labelText = Ia.Cl.Models.Default.YesNo(service2.AbbriviatedCalling); break;
 1251:                             case "service2CallBarringLabel": labelText = Ia.Cl.Models.Default.YesNo(service2.CallBarring); break;
 1252:                             case "service2ServiceSuspensionLabel": labelText = Ia.Cl.Models.Default.YesNo(service2.ServiceSuspension); break;
 1253:  
 1254:                             case "serviceRequestAdministrativeIssueTypeNameArabicNameLabel": labelText = Ia.Ftn.Cl.Models.Business.ServiceRequestAdministrativeIssue.ColoredTypeCode(serviceRequestAdministrativeIssue.Type); break;
 1255:  
 1256:                             case "isPrimaryAgcfGatewayRecordLabel": labelText = Ia.Cl.Models.Default.YesNo(agcfGatewayRecord.IsPrimary); break;
 1257:  
 1258:                             case "ontFamilyTypeLabel": labelText = Ia.Ftn.Cl.Models.Data.Nokia.Ont.FamilyTypeStringFromId(ont.FamilyTypeId); break;
 1259:                             case "ontStateIdLabel": labelText = Ia.Ftn.Cl.Models.Data.Nokia.Ams.ColoredBellcoreStateFromId(ont.StateId); break;
 1260:                             case "ontServiceVoipStateIdLabel": labelText = Ia.Ftn.Cl.Models.Data.Nokia.Ams.ColoredBellcoreStateFromId(ontServiceVoip.StateId); break;
 1261:                             case "ontServiceVoipMgcIpLabel": labelText = ontServiceVoip.MgcIp; break;
 1262:                             case "ontOntPotsStateIdLabel": labelText = Ia.Ftn.Cl.Models.Data.Nokia.Ams.ColoredBellcoreStateFromId(ontOntPots.StateId); break;
 1263:                             case "ontVendorLabel": labelText = Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.Vendor.VendorNameFromId(ont.VendorId); break;
 1264:  
 1265:                             case "emsDevStateIdLabel": labelText = Ia.Ftn.Cl.Models.Data.Huawei.Ems.ColoredBellcoreStateFromId(emsDev.StateId); break;
 1266:                             case "emsOntStateIdLabel": labelText = Ia.Ftn.Cl.Models.Data.Huawei.Ems.ColoredBellcoreStateFromId(emsOnt.StateId); break;
 1267:                             case "emsOntSipInfoStateIdLabel": labelText = Ia.Ftn.Cl.Models.Data.Huawei.Ems.ColoredBellcoreStateFromId(emsOntSipInfo.StateId); break;
 1268:                             case "emsOntSipInfoEmsOntAliasLabel": labelText = emsOntSipInfo.EmsOnt.ALIAS.ToString(); break;
 1269:  
 1270:                             //case "emsVoipPstnUserStateIdLabel": text = Ia.Ftn.Cl.Models.Data.Huawei.Ems.ColoredBellcoreStateFromId(emsVoipPstnUser.StateId); break;
 1271:                             //case "emsVagStateIdLabel": text = Ia.Ftn.Cl.Models.Data.Huawei.Ems.ColoredBellcoreStateFromId(emsVag.StateId); break;
 1272:  
 1273:                             case "emsDevTypeLabel": labelText = emsDev.Type.ToString().ToUpper(); break;
 1274:                             case "emsDevResultCodeLabel": labelText = Ia.Ftn.Cl.Models.Client.Huawei.Ems.ColoredResultCodeString(emsDev.ResultCode); break;
 1275:                             case "emsOntResultCodeLabel": labelText = Ia.Ftn.Cl.Models.Client.Huawei.Ems.ColoredResultCodeString(emsOnt.ResultCode); break;
 1276:                             case "emsOntSipInfoResultCodeLabel": labelText = Ia.Ftn.Cl.Models.Client.Huawei.Ems.ColoredResultCodeString(emsOntSipInfo.ResultCode); break;
 1277:  
 1278:                             case "emsVoipPstnUserEmsDevDevLabel": labelText = Ia.Ftn.Cl.Models.Data.Huawei.Dev.EmsDevDevByEmsDevDid(emsVoipPstnUser.DID); break;
 1279:                             //case "emsVoipPstnUserResultCodeLabel": text = Ia.Ftn.Cl.Models.Client.Huawei.Ems.ColoredResultCodeString(emsVoipPstnUser.ResultCode); break;
 1280:                             //case "emsVagResultCodeLabel": text = Ia.Ftn.Cl.Models.Client.Huawei.Ems.ColoredResultCodeString(emsVag.ResultCode); break;
 1281:                             //case "emsVoipPstnUserEmsOntAliasLabel": text = emsVoipPstnUser.EmsOnt.ALIAS; break;
 1282:  
 1283:                             case "impuOwsbrUsCodeLabel": labelText = Ia.Ftn.Cl.Models.Business.Huawei.Owsbr.UsCodeColoredString(owsbr.US); break;
 1284:  
 1285:                             case "userNameLabel": labelText = staffIdentityUser.UserName; break;
 1286:                             case "userEmailLabel": labelText = staffIdentityUser.Email; break;
 1287:                             //case "userIsApprovedLabel": labelText = Ia.Cl.Models.Default.YesNo(staffIdentityUser.IsApproved); break;
 1288:                             //case "userIsOnlineLabel": labelText = Ia.Cl.Models.Default.YesNo(staffIdentityUser.IsOnline); break;
 1289:                             //case "userIsLockedOutLabel": labelText = Ia.Cl.Models.Default.YesNo(staffIdentityUser.IsLockedOut); break;
 1290:  
 1291:                             case "staffIsHeadLabel": labelText = Ia.Cl.Models.Default.YesNoInArabic(staffIdentityUser.IsHead); break;
 1292:                             case "staffFirstNameLabel": labelText = staffIdentityUser.FirstName; break;
 1293:                             case "staffMiddleNameLabel": labelText = staffIdentityUser.MiddleName; break;
 1294:                             case "staffLastNameLabel": labelText = staffIdentityUser.LastName; break;
 1295:                             //case "staffIpPbxExtensionLabel": labelText = staff.IpPbxExtension; break;
 1296:                             //case "staffEmploymentIdLabel": labelText = staff.EmploymentId.ToString(); break;
 1297:                             case "staffFrameworkIdLabel": labelText = (from f in Ia.Ftn.Cl.Models.Data.Administration.FrameworkList where f.Id == staffIdentityUser.FrameworkId select f.FullyQualifiedArabicName).SingleOrDefault(); break;
 1298:                             //case "staffIdentityUserIdLabel": labelText = Ia.Ftn.Cl.Models.Identity.UserNameDictionary[staff.Id]; break;
 1299:                             case "staffUserEmailLabel":
 1300:                                 {
 1301:                                     //userList = Ia.Ftn.Cl.Models.Identity.StaffIdentityUserList();
 1302:  
 1303:                                     //labelText = (from u in userList where u.Id == staff.Id select u.Email).SingleOrDefault();
 1304:                                     break;
 1305:                                 }
 1306:  
 1307:                             case "contactFirstNameLabel": labelText = contact.FirstName; break;
 1308:                             case "contactMiddleNameLabel": labelText = contact.MiddleName; break;
 1309:                             case "contactLastNameLabel": labelText = contact.LastName; break;
 1310:                             case "contactCompanyLabel": labelText = contact.Company; break;
 1311:                             case "contactEmailLabel": labelText = contact.Email; break;
 1312:                             case "contactPhoneLabel": labelText = contact.Phone; break;
 1313:                             case "contactAddressLabel": labelText = contact.Address; break;
 1314:                             case "contactApprovedLabel": labelText = Ia.Cl.Models.Default.YesNoInArabic(contact.IsApproved); break;
 1315:                             case "contactUrlLabel": labelText = contact.Url; break;
 1316:                             case "contactNoteLabel": labelText = contact.Note; break;
 1317:                             case "contactUserIdLabel": labelText = contact.StaffIdentityUser.Id.ToString(); break;
 1318:  
 1319:                             case "reportUserNameLabel": labelText = "?"; break;
 1320:                             case "reportStaffFrameworkLabel":
 1321:                                 {
 1322:                                     if (!string.IsNullOrEmpty(report.FrameworkId))
 1323:                                     {
 1324:                                         arabicNameBracketParentArabicNameBracket = (from f in Ia.Ftn.Cl.Models.Data.Administration.FrameworkList
 1325:                                                                                     where f.Id == report.FrameworkId
 1326:                                                                                     select f.ArabicNameBracketParentArabicNameBracket).SingleOrDefault();
 1327:  
 1328:                                         labelText = arabicNameBracketParentArabicNameBracket;
 1329:                                     }
 1330:                                     else if (report.StaffIdentityUser != null)
 1331:                                     {
 1332:                                         firstAndMiddleNameBracketFrameworkArabicNameAndFrameworkParentArabicNameBracket = (from _s in Ia.Ftn.Cl.Models.Data.StaffIdentityUser.List()
 1333:                                                                                                                            where _s.Id == report.StaffIdentityUser.Id
 1334:                                                                                                                            select _s.FirstAndMiddleNameBracketFrameworkArabicNameAndFrameworkParentArabicNameBracket).SingleOrDefault();
 1335:  
 1336:                                         labelText = firstAndMiddleNameBracketFrameworkArabicNameAndFrameworkParentArabicNameBracket;
 1337:                                     }
 1338:  
 1339:                                     SetTableCellHtmlTextWriteStyleDirectionAccordingToPresenceOfArabicLetters(); //ref e, ref l);
 1340:  
 1341:                                     /*
 1342:                                     if (report.LastReportHistory.StaffIdentityUser.Id == staffIdentityUser.StaffIdentityUser.Id)
 1343:                                     {
 1344:                                         //e.Row.BackColor = System.Drawing.Color.SlateGray;
 1345:                                     }
 1346:                                     */
 1347:  
 1348:                                     break;
 1349:                                 }
 1350:                             case "accessAreaStatisticLabel": labelText = (from kna in Ia.Ftn.Cl.Models.Data.Service.KuwaitFtnAreaList where kna.Id == areaId select kna.ArabicName).SingleOrDefault(); break;
 1351:                             case "subscriberCallWaitingLabel": labelText = Ia.Cl.Models.Default.YesNo(subscriber.CallWaiting); break;
 1352:                             case "subPartyIsSipLabel": labelText = Ia.Cl.Models.Default.YesNo(Ia.Ftn.Cl.Models.Business.Nokia.SubParty.IsSip(subParty.PrimaryPUIDCPEProfileNumber)); break;
 1353:                             case "subPartyServiceSuspensionLabel": labelText = Ia.Cl.Models.Default.YesNo(subParty.ServiceSuspension); break;
 1354:                             case "subscriberCallForwardingLabel": labelText = Ia.Cl.Models.Default.YesNo(subscriber.CallForwarding); break;
 1355:                             case "subscriberAlarmCallLabel": labelText = Ia.Cl.Models.Default.YesNo(subscriber.AlarmCall); break;
 1356:                             case "subscriberInternationalCallingUserControlledLabel": labelText = Ia.Cl.Models.Default.YesNo(subscriber.InternationalCallingUserControlled); break;
 1357:                             case "subscriberInternationalCallingLabel": labelText = Ia.Cl.Models.Default.YesNo(subscriber.InternationalCalling); break;
 1358:                             case "subscriberCallerIdLabel": labelText = Ia.Cl.Models.Default.YesNo(subscriber.CallerId); break;
 1359:                             case "subscriberConferenceCallLabel": labelText = Ia.Cl.Models.Default.YesNo(subscriber.ConferenceCall); break;
 1360:                             case "subscriberAbbriviatedCallingLabel": labelText = Ia.Cl.Models.Default.YesNo(subscriber.AbbriviatedCalling); break;
 1361:                             case "subscriberCallBarringLabel": labelText = "?"; break;
 1362:  
 1363:                             case "nddOntPonPositionLabel": labelText = nddOnt.Pon.Position; break;
 1364:                             case "nddOntPonOltOdfSiteNameLabel": labelText = nddOnt.Pon.PonGroup.Olt.Odf.Router.Site.Name; break;
 1365:                             case "nddOntPonOltOdfSiteNameArabicNameLabel": labelText = nddOnt.Pon.PonGroup.Olt.Odf.Router.Site.Name + " (" + nddOnt.Pon.PonGroup.Olt.Odf.Router.Site.ArabicName + ")"; break;
 1366:                             case "nddOntPonOltAmsNameLabel": labelText = nddOnt.Pon.PonGroup.Olt.AmsName; break;
 1367:                             case "nddOntPonOltAreaLabel": labelText = nddOnt.Pon.PonGroup.Olt.Symbol; break;
 1368:                             case "nddOntPrimarySwitchLabel": labelText = nddOnt.PrimarySwitch; break;
 1369:                             case "nddOntPonOltFieldTypeLabel": labelText = Ia.Ftn.Cl.Models.Business.NetworkDesignDocument.FieldTypeColoredString(nddOnt.Pon.PonGroup.Olt.FieldType); break;
 1370:                             case "nddOntPonOltIsSipLabel": labelText = Ia.Cl.Models.Default.YesNo(nddOnt.Pon.PonGroup.Olt.IsSip); break;
 1371:  
 1372:                             case "nddOntMgcIpLabel": labelText = nddOnt.MgcIp; break;
 1373:                             case "nddOntMgcSecondaryIpLabel": labelText = nddOnt.MgcSecondaryIp; break;
 1374:                             case "nddOntPonOltVlanLabel": labelText = "?"; break; // nddOnt.Pon.PonGroup.Olt.Vlan.ToString(); break;
 1375:                             case "nddOntPonOltNetworkNumberLabel": labelText = nddOnt.Pon.PonGroup.NetworkNumber; break;
 1376:                             case "nddOntPonOltGatewayIpLabel": labelText = nddOnt.Pon.PonGroup.GatewayIp; break;
 1377:                             case "nddOntImsServiceLabel": labelText = nddOnt.ImsService.ToString(); break;
 1378:                             case "nddOntImsFsdbLabel": labelText = nddOnt.ImsFsdb; break;
 1379:  
 1380:                             case "nddOntProposedNameLabel":
 1381:                                 {
 1382:                                     /*
 1383:                                     if (nddOnt.Pon.PonGroup.HasNewProposedPonList)
 1384:                                     {
 1385:                                         text = nddOnt.Access.ProposedName;
 1386:                                     }
 1387:                                     else
 1388:                                     {
 1389:                                         ((GridView)e.Row.Parent.Parent).Columns[5].Visible = false;
 1390:                                         // 5 is position (0 based) of HeaderText="Proposed Name"
 1391:                                     }
 1392:                                     */
 1393:  
 1394:                                     break;
 1395:                                 }
 1396:  
 1397:                             case "nddOntPonOltOdfAccessVendorNameLabel": labelText = nddOnt.Pon.PonGroup.Olt.Odf.Vendor.Name; break;
 1398:                             case "nddOntPonOltOdfRouterSwitchVendorNameLabel": labelText = nddOnt.Pon.PonGroup.Olt.Odf.Router.Vendor.Name; break;
 1399:  
 1400:                             case "serviceExemptionNoteLabel": labelText = serviceExemption.Note; break;
 1401:                             /*
 1402:                         case "serviceExemptionStaffNameLabel":
 1403:                             {
 1404:                                 labelText = (from _s in Ia.Ftn.Cl.Models.Data.StaffIdentityUser.List() 
 1405:                                              where _s.Id == serviceExemption.StaffIdentityUser.Id 
 1406:                                              select _s.FirstAndMiddleName).SingleOrDefault(); 
 1407: 
 1408:                                 break;
 1409:                             }
 1410:                             */
 1411:  
 1412:                             case "serviceRequestAreaLabel": labelText = (from kna in Ia.Ftn.Cl.Models.Data.Service.KuwaitFtnAreaList where kna.Id == serviceRequest.AreaId select kna.ArabicName).SingleOrDefault(); break;
 1413:                             case "serviceRequestOntAreaLabel": labelText = (from kna in Ia.Ftn.Cl.Models.Data.Service.KuwaitFtnAreaList where kna.Symbol == serviceRequestOnt.AreaSymbol select kna.ArabicName).SingleOrDefault(); break;
 1414:  
 1415:                             case "serviceRequestOntDetailServiceTypeLabel": labelText = Ia.Ftn.Cl.Models.Data.ServiceRequest.ServiceSortedList[serviceRequestOntDetail.ServiceType].ToString(); break;
 1416:  
 1417:                             default: break;
 1418:                         }
 1419:  
 1420:  
 1421:                         switch (propertyName) //hl.ID)
 1422:                         {
 1423:                             case "reportServiceHyperLink":
 1424:                                 {
 1425:                                     s = Ia.Ftn.Cl.Models.Business.Service.ServiceName(report.Service, report.ServiceType);
 1426:                                     hyperLinkText = s;
 1427:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(s);
 1428:                                     break;
 1429:                                 }
 1430:                             case "reportAccessServiceRequestServiceHyperLink":
 1431:                                 {
 1432:                                     s = Ia.Ftn.Cl.Models.Business.Service.ServiceName(reportAccessServiceRequest.Report.Service, reportAccessServiceRequest.Report.ServiceType);
 1433:                                     hyperLinkText = s;
 1434:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(s);
 1435:                                     break;
 1436:                                 }
 1437:                             case "serviceRequestNumberSerialHyperLink":
 1438:                                 {
 1439:                                     hyperLinkText = serviceRequest.Number + "/" + serviceRequest.Serial;
 1440:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(serviceRequest.Number.ToString());
 1441:                                     break;
 1442:                                 }
 1443:                             case "serviceRequestCustomerNameHyperLink":
 1444:                                 {
 1445:                                     hyperLinkText = serviceRequest.CustomerName;
 1446:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(serviceRequest.CustomerName);
 1447:                                     break;
 1448:                                 }
 1449:                             case "impuSbrHyperLink":
 1450:                                 {
 1451:                                     hyperLinkText = sbr.IMPU;
 1452:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(sbr.IMPU);
 1453:                                     break;
 1454:                                 }
 1455:                             case "impuOwsbrHyperLink":
 1456:                                 {
 1457:                                     hyperLinkText = owsbr.IMPU;
 1458:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(owsbr.IMPU);
 1459:                                     break;
 1460:                                 }
 1461:                             case "seruattrUsrnumHyperLink":
 1462:                                 {
 1463:                                     hyperLinkText = seruattr.USRNUM;
 1464:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(seruattr.USRNUM);
 1465:                                     break;
 1466:                                 }
 1467:                             case "axeSubscriberSnbHyperLink":
 1468:                                 {
 1469:                                     hyperLinkText = axeSubscriber.SNB.ToString();
 1470:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(axeSubscriber.SNB.ToString());
 1471:                                     break;
 1472:                                 }
 1473:                             case "ewsdSubscriberDnHyperLink":
 1474:                                 {
 1475:                                     hyperLinkText = ewsdSubscriber.DN.ToString();
 1476:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(ewsdSubscriber.DN.ToString());
 1477:                                     break;
 1478:                                 }
 1479:                             case "accessPositionHyperLink":
 1480:                                 {
 1481:                                     hyperLinkText = access.Position;
 1482:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(access.Position);
 1483:  
 1484:                                     break;
 1485:                                 }
 1486:                             case "accessPaciHyperLink":
 1487:                                 {
 1488:                                     hyperLinkText = access.Paci;
 1489:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(access.Paci) + "&inputType=" + Ia.Ftn.Cl.Models.Business.Maintenance.Find.PaciInputTypeString;
 1490:  
 1491:                                     break;
 1492:                                 }
 1493:                             case "ontSerialHyperLink":
 1494:                                 {
 1495:                                     hyperLinkText = ont.Serial;
 1496:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(ont.Serial);
 1497:                                     break;
 1498:                                 }
 1499:                             case "ontResetHyperLink":
 1500:                                 {
 1501:                                     hyperLinkText = "Reset&nbsp;(ريسيت)";
 1502:                                     hyperLinkNavigateUrl = "/maintenance/access?accessName=" + Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.AccessNameByOntId(ont.Id);
 1503:                                     hyperLinkTargetBlank = @"target=""_blank""";
 1504:                                     break;
 1505:                                 }
 1506:                             case "ontAmsEventsHyperLink":
 1507:                                 {
 1508:                                     hyperLinkText = "Events&nbsp;(أحداث)";
 1509:                                     hyperLinkNavigateUrl = "/maintenance/event/ams?accessName=" + Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.AccessNameByOntId(ont.Id);
 1510:                                     hyperLinkTargetBlank = @"target=""_blank""";
 1511:                                     break;
 1512:                                 }
 1513:                             case "emsOntResetHyperLink":
 1514:                                 {
 1515:                                     hyperLinkText = "Reset&nbsp;(ريسيت)";
 1516:                                     hyperLinkNavigateUrl = "/maintenance/access?accessName=" + Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.AccessNameByOntId(emsOnt.Id);
 1517:                                     hyperLinkTargetBlank = @"target=""_blank""";
 1518:                                     break;
 1519:                                 }
 1520:                             case "reportAccessServiceRequestAccessNameHyperLink":
 1521:                                 {
 1522:                                     if (reportAccessServiceRequest.Access != null)
 1523:                                     {
 1524:                                         hyperLinkText = reportAccessServiceRequest.Access.Name;
 1525:                                         hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(reportAccessServiceRequest.Access.Name);
 1526:                                     }
 1527:  
 1528:                                     break;
 1529:                                 }
 1530:                             case "nddOntNameHyperLink":
 1531:                                 {
 1532:                                     hyperLinkText = nddOnt.Access.Name;
 1533:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(nddOnt.Access.Name);
 1534:                                     break;
 1535:                                 }
 1536:                             case "nddOntPonNameHyperLink":
 1537:                                 {
 1538:                                     hyperLinkText = nddOnt.Pon.Name;
 1539:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(nddOnt.Pon.Name);
 1540:                                     break;
 1541:                                 }
 1542:                             case "nddOntPositionHyperLink":
 1543:                                 {
 1544:                                     hyperLinkText = nddOnt.Position;
 1545:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(nddOnt.Position);
 1546:                                     break;
 1547:                                 }
 1548:                             case "nddOntIpHyperLink":
 1549:                                 {
 1550:                                     hyperLinkText = nddOnt.Ip;
 1551:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(nddOnt.Ip);
 1552:                                     break;
 1553:                                 }
 1554:                             case "serviceRequestServiceServiceHyperLink":
 1555:                                 {
 1556:                                     s = Ia.Ftn.Cl.Models.Business.Service.ServiceName(serviceRequestService.Service, serviceRequestService.ServiceType);
 1557:  
 1558:                                     hyperLinkText = s;
 1559:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(s);
 1560:                                     break;
 1561:                                 }
 1562:                             case "serviceRequestServiceAccessNameHyperLink":
 1563:                                 {
 1564:                                     if (serviceRequestService.Access != null)
 1565:                                     {
 1566:                                         hyperLinkText = serviceRequestService.Access.Name;
 1567:                                         hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(serviceRequestService.Access.Name);
 1568:                                     }
 1569:                                     break;
 1570:                                 }
 1571:                             case "serviceRequestServiceReferenceHyperLink":
 1572:                                 {
 1573:                                     var accessName = serviceRequestService.Access != null ? serviceRequestService.Access.Name : string.Empty;
 1574:  
 1575:                                     hyperLinkText = "Reference&nbsp;(ربط)";
 1576:                                     hyperLinkNavigateUrl = "/provision/service-request-service-access?service=" + serviceRequestService.Service + "&accessName=" + accessName;
 1577:                                     hyperLinkTargetBlank = @"target=""_blank""";
 1578:  
 1579:                                     break;
 1580:                                 }
 1581:                             case "serviceRequestNumberHyperLink":
 1582:                                 {
 1583:                                     hyperLinkText = serviceRequest.Number.ToString();
 1584:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(serviceRequest.Number.ToString());
 1585:                                     break;
 1586:                                 }
 1587:                             case "serviceRequestCustomerIdHyperLink":
 1588:                                 {
 1589:                                     hyperLinkText = serviceRequest.CustomerId.ToString();
 1590:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(serviceRequest.CustomerId.ToString()) + "&inputType=" + Ia.Ftn.Cl.Models.Business.Maintenance.Find.ServiceRequestCustomerIdInputTypeString;
 1591:                                     break;
 1592:                                 }
 1593:                             case "serviceRequestHistoryNumberHyperLink":
 1594:                                 {
 1595:                                     hyperLinkText = serviceRequestHistory.Number.ToString();
 1596:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(serviceRequestHistory.Number.ToString());
 1597:                                     break;
 1598:                                 }
 1599:                             case "accessOdfHyperLink":
 1600:                                 {
 1601:                                     hyperLinkText = access.Odf;
 1602:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(access.Odf);
 1603:                                     break;
 1604:                                 }
 1605:                             case "accessNameHyperLink":
 1606:                                 {
 1607:                                     hyperLinkText = access.Name;
 1608:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(access.Name);
 1609:                                     break;
 1610:                                 }
 1611:                             case "accessBlockHyperLink":
 1612:                                 {
 1613:                                     string areaSymbol;
 1614:  
 1615:                                     //if (int.TryParse(access.Block, out int i))
 1616:                                     //{
 1617:                                     hyperLinkText = access.Block;
 1618:                                     areaSymbol = (from kna in Ia.Ftn.Cl.Models.Data.Service.KuwaitFtnAreaList where kna.Id == access.AreaId select kna.Symbol).SingleOrDefault();
 1619:  
 1620:                                     if (!string.IsNullOrEmpty(areaSymbol))
 1621:                                     {
 1622:                                         hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(areaSymbol + "," + access.Block);
 1623:                                     }
 1624:                                     else
 1625:                                     {
 1626:  
 1627:                                     }
 1628:                                     //}
 1629:                                     //else
 1630:                                     //{
 1631:  
 1632:                                     //}
 1633:  
 1634:                                     break;
 1635:                                 }
 1636:  
 1637:                             case "service2ServiceHyperLink":
 1638:                                 {
 1639:                                     s = Ia.Ftn.Cl.Models.Business.Service.ServiceName(service2.Service, service2.ServiceType);
 1640:  
 1641:                                     hyperLinkText = s;
 1642:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(s);
 1643:                                     break;
 1644:                                 }
 1645:                             case "service2AccessNameHyperLink":
 1646:                                 {
 1647:                                     if (service2.AccessName != null && service2.Port != Ia.Ftn.Cl.Models.Business.Default.PortUndefinedOrInvalidOrUnknown)
 1648:                                     {
 1649:                                         hyperLinkText = service2.AccessName;
 1650:                                         hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(service2.AccessName);
 1651:                                     }
 1652:                                     break;
 1653:                                 }
 1654:                             case "service2ServiceProvisionHyperLink":
 1655:                                 {
 1656:                                     var accessName = service2.AccessName != null ? service2.AccessName : string.Empty;
 1657:  
 1658:                                     hyperLinkText = "Provision&nbsp;(تشغيل)";
 1659:                                     hyperLinkNavigateUrl = "/provision/service?service=" + service2.Service + "&accessName=" + accessName;
 1660:                                     hyperLinkTargetBlank = @"target=""_blank""";
 1661:  
 1662:                                     break;
 1663:                                 }
 1664:                             case "emsOntSipInfoServiceProvisionHyperLink":
 1665:                                 {
 1666:                                     var service = Ia.Ftn.Cl.Models.Business.NumberFormatConverter.Service(emsOntSipInfo.SIPUSERNAME);
 1667:  
 1668:                                     var accessName = (emsOntSipInfo.EmsOnt != null
 1669:                                         && emsOntSipInfo.EmsOnt.Access != null
 1670:                                         && emsOntSipInfo.EmsOnt.Access.Name != null) ? emsOntSipInfo.EmsOnt.Access.Name : string.Empty;
 1671:  
 1672:                                     var port = emsOntSipInfo.TEL;
 1673:  
 1674:                                     hyperLinkText = "Provision&nbsp;(تشغيل)";
 1675:                                     hyperLinkNavigateUrl = "/provision/access/service?service=" + service + "&accessName=" + accessName + "&port=" + port;
 1676:                                     hyperLinkTargetBlank = @"target=""_blank""";
 1677:  
 1678:                                     break;
 1679:                                 }
 1680:                             case "emsVoipPstnUserLicNameHyperLink":
 1681:                                 {
 1682:                                     if (emsVoipPstnUser.IsMsan)
 1683:                                     {
 1684:                                         var lic = Ia.Ftn.Cl.Models.Data.Huawei.Default.MsanDevLicByEmsVoipPstnUserId(emsVoipPstnUser.Id);
 1685:  
 1686:                                         if (lic != null)
 1687:                                         {
 1688:                                             hyperLinkText = lic.Name;
 1689:                                             hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(lic.Name);
 1690:                                         }
 1691:                                     }
 1692:                                     else HideColumnName(/*e,*/ "Name");
 1693:  
 1694:                                     break;
 1695:                                 }
 1696:                             case "emsVoipPstnUserServiceOrMsanLicProvisionHyperLink":
 1697:                                 {
 1698:                                     int did, port, cabinet, frame, fn, sn, pn;
 1699:                                     string accessName, msanDevId;
 1700:                                     var service = Ia.Ftn.Cl.Models.Business.NumberFormatConverter.Service(emsVoipPstnUser.DN);
 1701:  
 1702:                                     did = emsVoipPstnUser.DID;
 1703:  
 1704:                                     if (emsVoipPstnUser.IsMsan)
 1705:                                     {
 1706:                                         var lic = Ia.Ftn.Cl.Models.Data.Huawei.Default.MsanDevLicByEmsVoipPstnUserId(emsVoipPstnUser.Id);
 1707:  
 1708:                                         if (lic != null)
 1709:                                         {
 1710:                                             msanDevId = lic.MsanDevId;
 1711:                                             cabinet = lic.Cabinet;
 1712:                                             frame = lic.Frame;
 1713:                                             fn = lic.Fn;
 1714:                                             sn = lic.Sn;
 1715:                                             pn = lic.Pn;
 1716:                                         }
 1717:                                         else
 1718:                                         {
 1719:                                             msanDevId = string.Empty;
 1720:                                             cabinet = frame = fn = sn = pn = -1;
 1721:                                         }
 1722:  
 1723:                                         hyperLinkNavigateUrl = "/provision/lic?msanDevId=" + msanDevId
 1724:                                             + "&cabinet=" + cabinet
 1725:                                             + "&frame=" + frame
 1726:                                             + "&fn=" + fn
 1727:                                             + "&sn=" + sn
 1728:                                             + "&pn=" + pn
 1729:                                             + "&service=" + service;
 1730:                                     }
 1731:                                     else
 1732:                                     {
 1733:                                         var didToMduDevDictionary = Ia.Ftn.Cl.Models.Data.Huawei.Default.DidToMduDevDictionary;
 1734:  
 1735:                                         var mduDev = Ia.Ftn.Cl.Models.Data.Huawei.Default.MduDevByDid(did);
 1736:  
 1737:                                         if (mduDev != null)
 1738:                                         {
 1739:                                             accessName = mduDev.AccessName;
 1740:  
 1741:                                             var fnSnPnPort = mduDev.PossibleFnSnPnPortList.Where(f => f.Fn == emsVoipPstnUser.FN && f.Sn == emsVoipPstnUser.SN && f.Pn == emsVoipPstnUser.PN).SingleOrDefault();
 1742:  
 1743:                                             if (fnSnPnPort != null) port = fnSnPnPort.Port;
 1744:                                             else port = Ia.Ftn.Cl.Models.Business.Default.PortUndefinedOrInvalidOrUnknown;
 1745:                                         }
 1746:                                         else
 1747:                                         {
 1748:                                             accessName = string.Empty;
 1749:                                             port = Ia.Ftn.Cl.Models.Business.Default.PortUndefinedOrInvalidOrUnknown;
 1750:                                         }
 1751:  
 1752:                                         hyperLinkText = "Provision&nbsp;(تشغيل)";
 1753:                                         hyperLinkNavigateUrl = "/provision/access/service?service=" + service + "&accessName=" + accessName + "&port=" + port;
 1754:                                         hyperLinkTargetBlank = @"target=""_blank""";
 1755:                                     }
 1756:  
 1757:                                     break;
 1758:                                 }
 1759:                             case "serviceExemptionServiceHyperLink":
 1760:                                 {
 1761:                                     s = Ia.Ftn.Cl.Models.Business.Service.ServiceName(serviceExemption.Service, serviceExemption.ServiceType);
 1762:  
 1763:                                     hyperLinkText = s;
 1764:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(s);
 1765:                                     break;
 1766:                                 }
 1767:                             case "reportHistoryServiceHyperLink":
 1768:                                 {
 1769:                                     s = Ia.Ftn.Cl.Models.Business.Service.ServiceName(reportHistory.Report.Service, reportHistory.Report.ServiceType);
 1770:  
 1771:                                     hyperLinkText = s;
 1772:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(s);
 1773:                                     break;
 1774:                                 }
 1775:                             case "serviceRequestOntDetailServiceHyperLink":
 1776:                                 {
 1777:                                     s = Ia.Ftn.Cl.Models.Business.Service.ServiceName(serviceRequestOntDetail.Service, serviceRequestOntDetail.ServiceType);
 1778:  
 1779:                                     hyperLinkText = s;
 1780:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(s);
 1781:                                     break;
 1782:                                 }
 1783:                             case "serviceRequestOntNameHyperLink":
 1784:                                 {
 1785:                                     hyperLinkText = serviceRequestOnt.Name;
 1786:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(serviceRequestOnt.Name);
 1787:                                     break;
 1788:                                 }
 1789:                             case "serviceRequestOntBlockHyperLink":
 1790:                                 {
 1791:                                     hyperLinkText = serviceRequestOnt.Block;
 1792:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(serviceRequestOnt.AreaSymbol + "," + serviceRequestOnt.Block);
 1793:  
 1794:                                     break;
 1795:                                 }
 1796:                             case "serviceRequestOntPaciHyperLink":
 1797:                                 {
 1798:                                     hyperLinkText = serviceRequestOnt.Paci;
 1799:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(serviceRequestOnt.Paci) + "&inputType=" + Ia.Ftn.Cl.Models.Business.Maintenance.Find.PaciInputTypeString;
 1800:  
 1801:                                     break;
 1802:                                 }
 1803:                             case "serviceRequestAdministrativeIssueServiceHyperLink":
 1804:                                 {
 1805:                                     hyperLinkText = serviceRequestAdministrativeIssue.Service;
 1806:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(serviceRequestAdministrativeIssue.Service);
 1807:                                     break;
 1808:                                 }
 1809:                             case "eventAccessNameHyperLink":
 1810:                                 {
 1811:                                     if (@event.Ont != null)
 1812:                                     {
 1813:                                         var ontId = @event.Ont.Id;
 1814:  
 1815:                                         var accessName = Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.AccessNameByOntId(ontId);
 1816:  
 1817:                                         hyperLinkText = accessName;
 1818:                                         hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(accessName);
 1819:                                     }
 1820:  
 1821:                                     break;
 1822:                                 }
 1823:                             case "gwIdAgcfGatewayRecordHyperLink":
 1824:                                 {
 1825:                                     hyperLinkText = agcfGatewayRecord.GwId.ToString();
 1826:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(agcfGatewayRecord.GwId.ToString());
 1827:                                     break;
 1828:                                 }
 1829:                             case "ip1AgcfGatewayRecordHyperLink":
 1830:                                 {
 1831:                                     hyperLinkText = agcfGatewayRecord.IP1;
 1832:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(agcfGatewayRecord.IP1);
 1833:                                     break;
 1834:                                 }
 1835:                             case "ip2AgcfGatewayRecordHyperLink":
 1836:                                 {
 1837:                                     hyperLinkText = agcfGatewayRecord.IP2;
 1838:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(agcfGatewayRecord.IP2);
 1839:                                     break;
 1840:                                 }
 1841:                             case "gwIdAgcfEndpointHyperLink":
 1842:                                 {
 1843:                                     hyperLinkText = agcfEndpoint.GwId.ToString();
 1844:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(agcfEndpoint.GwId.ToString());
 1845:                                     break;
 1846:                                 }
 1847:  
 1848:                             case "eidMgwHyperLink":
 1849:                                 {
 1850:                                     hyperLinkText = mgw.EID;
 1851:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(mgw.EID);
 1852:                                     break;
 1853:                                 }
 1854:                             case "puiAsbrHyperLink":
 1855:                                 {
 1856:                                     hyperLinkText = asbr.PUI;
 1857:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(asbr.PUI);
 1858:                                     break;
 1859:                                 }
 1860:                             case "eidAsbrHyperLink":
 1861:                                 {
 1862:                                     hyperLinkText = asbr.EID;
 1863:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(asbr.EID);
 1864:                                     break;
 1865:                                 }
 1866:  
 1867:                             case "subPartyDisplayNameHyperLink":
 1868:                                 {
 1869:                                     hyperLinkText = subParty.DisplayName;
 1870:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(subParty.DisplayName);
 1871:                                     break;
 1872:                                 }
 1873:                             case "ontServiceVoipIpHyperLink":
 1874:                                 {
 1875:                                     hyperLinkText = ontServiceVoip.Ip.ToString();
 1876:                                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(ontServiceVoip.Ip);
 1877:                                     break;
 1878:                                 }
 1879:                             case "reportHistoryHyperLink":
 1880:                                 {
 1881:                                     hyperLinkText = @"<img src=""/image/legend/clock.svg"" class=""icon"" alt=""History""/>";
 1882:                                     hyperLinkNavigateUrl = "/maintenance/report/history?reportId=" + report.Id;
 1883:                                     break;
 1884:                                 }
 1885:                             case "serviceServiceAccessNameHyperLink":
 1886:                                 {
 1887:                                     if (serviceAccessName.Service != null)
 1888:                                     {
 1889:                                         hyperLinkText = serviceAccessName.Service;
 1890:                                         hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(serviceAccessName.Service);
 1891:                                     }
 1892:                                     break;
 1893:                                 }
 1894:                             case "accessNameServiceAccessNameHyperLink":
 1895:                                 {
 1896:                                     if (serviceAccessName.AccessName != null)
 1897:                                     {
 1898:                                         hyperLinkText = serviceAccessName.AccessName;
 1899:                                         hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(serviceAccessName.AccessName);
 1900:                                     }
 1901:                                     break;
 1902:                                 }
 1903:                             case "serviceServiceAccessNameAddressHyperLink":
 1904:                                 {
 1905:                                     if (serviceAccessNameAddress.Service != null)
 1906:                                     {
 1907:                                         hyperLinkText = serviceAccessNameAddress.Service;
 1908:                                         hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(serviceAccessNameAddress.Service);
 1909:                                     }
 1910:                                     break;
 1911:                                 }
 1912:                             case "accessNameServiceAccessNameAddressHyperLink":
 1913:                                 {
 1914:                                     if (serviceAccessNameAddress.AccessName != null)
 1915:                                     {
 1916:                                         hyperLinkText = serviceAccessNameAddress.AccessName;
 1917:                                         hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(serviceAccessNameAddress.AccessName);
 1918:                                     }
 1919:                                     break;
 1920:                                 }
 1921:                             case "msanDevLicNameHyperLink":
 1922:                                 {
 1923:                                     if (msanDevLic.Name != null)
 1924:                                     {
 1925:                                         hyperLinkText = msanDevLic.Name;
 1926:                                         hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(msanDevLic.Name);
 1927:                                     }
 1928:                                     break;
 1929:                                 }
 1930:                             case "msanDevLicServiceHyperLink":
 1931:                                 {
 1932:                                     if (msanDevLic.Service != null)
 1933:                                     {
 1934:                                         hyperLinkText = msanDevLic.Service;
 1935:                                         hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(msanDevLic.Service);
 1936:                                     }
 1937:                                     break;
 1938:                                 }
 1939:                             default: break;
 1940:                         }
 1941:  
 1942:  
 1943:                         switch (propertyName) //tb.ID)
 1944:                         {
 1945:                             //case "staffEmploymentIdTextBox": textBoxText = staff.EmploymentId.ToString(); break;
 1946:                             case "staffFirstNameTextBox": textBoxText = staffIdentityUser.FirstName; break;
 1947:                             case "staffMiddleNameTextBox": textBoxText = staffIdentityUser.MiddleName; break;
 1948:                             case "staffLastNameTextBox": textBoxText = staffIdentityUser.LastName; break;
 1949:                             //case "staffIpPbxExtensionTextBox": textBoxText = staff.IpPbxExtension; break;
 1950:  
 1951:                             case "contactFirstNameTextBox": textBoxText = contact.FirstName; break;
 1952:                             case "contactMiddleNameTextBox": textBoxText = contact.MiddleName; break;
 1953:                             case "contactLastNameTextBox": textBoxText = contact.LastName; break;
 1954:                             case "contactCompanyTextBox": textBoxText = contact.Company; break;
 1955:                             case "contactEmailTextBox": textBoxText = contact.Email; break;
 1956:                             case "contactPhoneTextBox": textBoxText = contact.Phone; break;
 1957:                             case "contactAddressTextBox": textBoxText = contact.Address; break;
 1958:                             case "contactUrlTextBox": textBoxText = contact.Url; break;
 1959:                             case "contactNoteTextBox": textBoxText = contact.Note; break;
 1960:  
 1961:                             case "userNameTextBox": textBoxText = staffIdentityUser.UserName; break;
 1962:                             case "userEmailTextBox": textBoxText = staffIdentityUser.Email; break;
 1963:                             case "accessBlockTextBox": textBoxText = access.Block.ToString(); break;
 1964:                             case "accessStreetTextBox": textBoxText = access.Street; break;
 1965:                             case "accessPremisesOldTextBox": textBoxText = access.PremisesOld; break;
 1966:                             case "accessPremisesNewTextBox": textBoxText = access.PremisesNew; break;
 1967:                             case "accessPaciTextBox": textBoxText = access.Paci; break;
 1968:                             case "accessNoteTextBox": textBoxText = access.Note; break;
 1969:  
 1970:                             case "serviceExemptionNoteTextBox": textBoxText = serviceExemption.Note; break;
 1971:  
 1972:                             default: break;
 1973:                         }
 1974:  
 1975:  
 1976:                         switch (propertyName) //ddl.ID)
 1977:                         {
 1978:                             /*
 1979:                             case "staffFrameworkIdDropDownList":
 1980:                                 {
 1981:                                     ddl.DataSource = Ia.Ftn.Cl.Models.Data.Administration.FrameworkList;
 1982:                                     ddl.DataValueField = "Id";
 1983:                                     ddl.DataTextField = "FullyQualifiedArabicName";
 1984:                                     ddl.DataBind();
 1985: 
 1986:                                     ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByValue(staff.FrameworkId.ToString()));
 1987:                                     break;
 1988:                                 }
 1989: 
 1990:                             case "staffIdentityUserIdDropDownList":
 1991:                                 {
 1992:                                     ddl.Items.Clear();
 1993: 
 1994:                                     userList = Ia.Ftn.Cl.Models.Identity.UserList;
 1995: 
 1996:                                     ddl.DataSource = userList;
 1997:                                     ddl.DataValueField = "ProviderUserKey";
 1998:                                     ddl.DataTextField = "UserName";
 1999:                                     ddl.DataBind();
 2000: 
 2001:                                     ddl.Items.Insert(0, new ListItem("Empty Guid", Guid.Empty.ToString()));
 2002:                                     ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByValue(staff.Id.ToString()));
 2003:                                     break;
 2004:                                 }
 2005:                             */
 2006:  
 2007:                             default: break;
 2008:                         }
 2009:                         /*
 2010:                     }
 2011:                     else if (control.Controls[0].GetType().ToString() == "System.Web.UI.WebControls.CheckBox")
 2012:                     {
 2013:                         CheckBox cb = (CheckBox)control.Controls[0];
 2014:                         switch (name) //cb.ID)
 2015:                         {
 2016:                             case "staffIsHeadCheckBox": cb.Checked = staff.IsHead; break;
 2017:                             case "contactApprovedCheckBox": cb.Checked = contact.IsApproved; break;
 2018:                             default: break;
 2019:                         }
 2020:                     }
 2021:                     else if (control.Controls[0].GetType().ToString() == "System.Web.UI.WebControls.Image")
 2022:                     {
 2023:                         Image im = (Image)control.Controls[0];
 2024:                         */
 2025:  
 2026:  
 2027:                         switch (propertyName) //im.ID)
 2028:                         {
 2029:                             case "deleteImage": break;
 2030:                             case "historyImage": break;
 2031:                             case "nddOntPonOltOdfAccessVendorIconImage":
 2032:                                 {
 2033:                                     //vendor = (from o in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OntList where o.Id == nddOnt.Id select o.Pon.PonGroup.Olt.Odf.Vendor).SingleOrDefault();
 2034:                                     vendor = nddOnt?.Pon.PonGroup.Olt.Odf.Vendor;
 2035:  
 2036:                                     if (vendor != null)
 2037:                                     {
 2038:                                         ImageUrl = vendor.ImageUrl;
 2039:                                         ImageToolTip = vendor.Name;
 2040:                                     }
 2041:  
 2042:                                     break;
 2043:                                 }
 2044:                             case "nddOntPonOltOdfRouterSwitchVendorIconImage":
 2045:                                 {
 2046:                                     // vendor = (from o in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OntList where o.Id == nddOnt.Id select o.Pon.PonGroup.Olt.Odf.Router.Vendor).SingleOrDefault();
 2047:                                     vendor = nddOnt?.Pon.PonGroup.Olt.Odf.Router.Vendor;
 2048:  
 2049:                                     if (vendor != null)
 2050:                                     {
 2051:                                         ImageUrl = vendor.ImageUrl;
 2052:                                         ImageToolTip = vendor.Name;
 2053:                                     }
 2054:  
 2055:                                     break;
 2056:                                 }
 2057:                             case "ontAccessOntPonOltOdfVendorIconImage":
 2058:                                 {
 2059:                                     vendor = (from q in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OntList where q.Id == ont.Id select q.Pon.PonGroup.Olt.Odf.Vendor).SingleOrDefault();
 2060:                                     ImageUrl = vendor.ImageUrl;
 2061:                                     ImageToolTip = vendor.Name;
 2062:                                     break;
 2063:                                 }
 2064:                             case "accessOntPonOltOdfVendorIconImage":
 2065:                                 {
 2066:                                     vendor = (from o in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OntList where o.Access.Id == access.Id select o.Pon.PonGroup.Olt.Odf.Vendor).SingleOrDefault();
 2067:  
 2068:                                     if (vendor != null)
 2069:                                     {
 2070:                                         ImageUrl = vendor.ImageUrl;
 2071:                                         ImageToolTip = vendor.Name;
 2072:                                     }
 2073:  
 2074:                                     break;
 2075:                                 }
 2076:                             default: break;
 2077:                         }
 2078:                         /*
 2079:                     }
 2080:                     //else if (e.Row.RowType == DataControlRowType.Footer)
 2081:                     //{
 2082:                     //}
 2083:                     else
 2084:                     {
 2085:                     }
 2086:                     */
 2087:                     }
 2088:                     else
 2089:                     {
 2090:                         /*
 2091:                         if (e.Row.RowType == DataControlRowType.Header)
 2092:                         {
 2093:                         }
 2094:                         else if (e.Row.RowType == DataControlRowType.DataRow)
 2095:                         {
 2096:                             foreach (Control control in e.Row.Controls)
 2097:                             {
 2098:                                 try
 2099:                                 {
 2100:                                     if (control.Controls.Count > 0)
 2101:                                     {
 2102:                                         if (control.Controls[0].GetType().ToString() == "System.Web.UI.WebControls.Label")
 2103:                                         {
 2104:                                             Label l = (Label)control.Controls[0];
 2105: 
 2106:                                             switch (l.ID)
 2107:                                             {
 2108:                                                 case "staffUserActivityIsApprovedLabel":
 2109:                                                     {
 2110:                                                         var b = Convert.ToBoolean(DataBinder.Eval(e.Row.DataItem, "IsApproved"));
 2111:                                                         text = Ia.Cl.Models.Default.YesNo(b);
 2112:                                                         break;
 2113:                                                     }
 2114:                                                 case "staffUserActivityIsOnlineLabel":
 2115:                                                     {
 2116:                                                         var b = Convert.ToBoolean(DataBinder.Eval(e.Row.DataItem, "IsOnline"));
 2117:                                                         text = Ia.Cl.Models.Default.YesNo(b);
 2118:                                                         break;
 2119:                                                     }
 2120:                                                 case "staffUserActivityIsLockedOutLabel":
 2121:                                                     {
 2122:                                                         var b = Convert.ToBoolean(DataBinder.Eval(e.Row.DataItem, "IsLockedOut"));
 2123:                                                         text = Ia.Cl.Models.Default.YesNo(b);
 2124:                                                         break;
 2125:                                                     }
 2126:                                                 default: break;
 2127:                                             }
 2128:                                         }
 2129:                                         else if (control.Controls[0].GetType().ToString() == "System.Web.UI.WebControls.HyperLink")
 2130:                                         {
 2131:                                             HyperLink hl = (HyperLink)control.Controls[0];
 2132: 
 2133:                                             switch (hl.ID)
 2134:                                             {
 2135:                                                 /*
 2136:                                                 case "reportServiceHyperLink":
 2137:                                                     {
 2138:                                                         s = Ia.Ftn.Cl.Models.Business.Service.ServiceName(report.Service, report.ServiceType);
 2139:                                                         hyperLinkText = s;
 2140:                                                         hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(s);
 2141:                                                         break;
 2142:                                                     }
 2143:                                                 * /
 2144:                                                 default: break;
 2145:                                             }
 2146:                                         }
 2147:                                         else if (control.Controls[0].GetType().ToString() == "System.Web.UI.WebControls.TextBox")
 2148:                                         {
 2149:                                             TextBox tb = (TextBox)control.Controls[0];
 2150: 
 2151:                                             switch (tb.ID)
 2152:                                             {
 2153:                                                 //case "staffEmploymentIdTextBox": textBoxText = staff.EmploymentId.ToString(); break;
 2154:                                                 default: break;
 2155:                                             }
 2156:                                         }
 2157:                                         else if (control.Controls[0].GetType().ToString() == "System.Web.UI.WebControls.DropDownList")
 2158:                                         {
 2159:                                             DropDownList ddl = (DropDownList)control.Controls[0];
 2160: 
 2161:                                             switch (ddl.ID)
 2162:                                             {
 2163:                                                 /*
 2164:                                                 case "staffFrameworkIdDropDownList":
 2165:                                                     {
 2166:                                                         ddl.DataSource = Ia.Ftn.Cl.Models.Data.Administration.FrameworkList;
 2167:                                                         ddl.DataValueField = "Id";
 2168:                                                         ddl.DataTextField = "FullyQualifiedArabicName";
 2169:                                                         ddl.DataBind();
 2170: 
 2171:                                                         ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByValue(staff.FrameworkId.ToString()));
 2172:                                                         break;
 2173:                                                     }
 2174:                                                 * /
 2175: 
 2176:                                                 default: break;
 2177:                                             }
 2178:                                         }
 2179:                                         else if (control.Controls[0].GetType().ToString() == "System.Web.UI.WebControls.CheckBox")
 2180:                                         {
 2181:                                             /*
 2182:                                             CheckBox cb = (CheckBox)control.Controls[0];
 2183: 
 2184:                                             switch (cb.ID)
 2185:                                             {
 2186:                                                 //case "staffIsHeadCheckBox": cb.Checked = staff.IsHead; break;
 2187:                                                 default: break;
 2188:                                             }
 2189:                                             * /
 2190:                                         }
 2191:                                         else if (control.Controls[0].GetType().ToString() == "System.Web.UI.WebControls.Image")
 2192:                                         {
 2193:                                             //Image im = (Image)control.Controls[0];
 2194: 
 2195:                                             switch (im.ID)
 2196:                                             {
 2197:                                                 /*
 2198:                                                 case "nddOntPonOltOdfAccessVendorIconImage":
 2199:                                                     {
 2200:                                                         //vendor = (from o in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OntList where o.Id == nddOnt.Id select o.Pon.PonGroup.Olt.Odf.Vendor).SingleOrDefault();
 2201:                                                         vendor = nddOnt?.Pon.PonGroup.Olt.Odf.Vendor;
 2202: 
 2203:                                                         if (vendor != null)
 2204:                                                         {
 2205:                                                             im.ImageUrl = vendor.ImageUrl;
 2206:                                                             im.ToolTip = vendor.Name;
 2207:                                                         }
 2208: 
 2209:                                                         break;
 2210:                                                     }
 2211:                                                 * /
 2212:                                                 default: break;
 2213:                                             }
 2214:                                         }
 2215:                                         else
 2216:                                         {
 2217: 
 2218:                                         }
 2219:                                     }
 2220:                                 }
 2221:                                 catch (Exception)
 2222:                                 {
 2223:                                 }
 2224:                             }
 2225:                         }
 2226:                         //else if (e.Row.RowType == DataControlRowType.Footer)
 2227:                         //{
 2228:                         //}
 2229:                         else
 2230:                         {
 2231:                         }
 2232:                         */
 2233:                     }
 2234:                     //}
 2235:                     //else
 2236:                     //{
 2237:                     //}
 2238:                 }
 2239:                 catch (Exception e)
 2240:                 {
 2241:                     labelText = string.Empty;
 2242:                     hyperLinkText = string.Empty;
 2243:                     hyperLinkNavigateUrl = string.Empty;
 2244:                     hyperLinkTargetBlank = string.Empty;
 2245:                     textBoxText = string.Empty;
 2246:                     ImageUrl = string.Empty;
 2247:                     ImageToolTip = string.Empty;
 2248:                 }
 2249:             }
 2250:             else
 2251:             {
 2252:             }
 2253:  
 2254:             if (!string.IsNullOrEmpty(labelText)) text = labelText;
 2255:             else if (!string.IsNullOrEmpty(hyperLinkText) && !string.IsNullOrEmpty(hyperLinkNavigateUrl))
 2256:             {
 2257:                 text = @"<a href=""" + hyperLinkNavigateUrl + @""" " + hyperLinkTargetBlank + ">" + hyperLinkText + @"</a>";
 2258:             }
 2259:             else if (!string.IsNullOrEmpty(textBoxText)) text = textBoxText;
 2260:             else if (!string.IsNullOrEmpty(ImageUrl) && !string.IsNullOrEmpty(ImageToolTip))
 2261:             {
 2262:                 text = @"<img src=""" + ImageUrl + @""" alt=""" + ImageToolTip + @"""/>";
 2263:             }
 2264:             else text = string.Empty;
 2265:  
 2266:             return text;
 2267:         }
 2268:  
 2269:         ////////////////////////////////////////////////////////////////////////////
 2270:  
 2271:         /// <summary>
 2272:         ///
 2273:         /// </summary>
 2274:         public static void SetTableCellHtmlTextWriteStyleDirectionAccordingToPresenceOfArabicLetters(/*ref GridViewRowEventArgs gridViewRowEventArgs, ref Label l*/)
 2275:         {
 2276:             //TableCell tableCell;
 2277:  
 2278:             /*
 2279:             // table cell direction depending on if text has Arabic
 2280:             if (!string.IsNullOrEmpty(text))
 2281:             {
 2282:                 if (Ia.Cl.Models.Language.HasArabicLetter(text))
 2283:                 {
 2284:                     //tableCell = gridViewRowEventArgs.Row.FindControl(l.ID).Parent as TableCell;
 2285:                     //tableCell.HorizontalAlign = HorizontalAlign.Right;
 2286:                     //tableCell.Style[HtmlTextWriterStyle.Direction] = "rtl";
 2287:                 }
 2288:             }
 2289:             */
 2290:         }
 2291:  
 2292:         ////////////////////////////////////////////////////////////////////////////
 2293:  
 2294:         /// <summary>
 2295:         ///
 2296:         /// </summary>
 2297:         private static void HideColumnName(/*GridViewRowEventArgs e,*/ string name)
 2298:         {
 2299:             // https://stackoverflow.com/questions/3819247/gridview-hide-column-by-code
 2300:  
 2301:             //GridView gridView = (GridView)e.Row.Parent.Parent;
 2302:  
 2303:             var index = GetColumnIndexByName(/*gridView,*/ name);
 2304:  
 2305:             if (index >= 0)
 2306:             {
 2307:                 //gridView.Columns[index].Visible = false;
 2308:                 //gridView.HeaderRow.Cells[index].Visible = false;
 2309:             }
 2310:         }
 2311:  
 2312:         ////////////////////////////////////////////////////////////////////////////
 2313:  
 2314:         /// <summary>
 2315:         ///
 2316:         /// </summary>
 2317:         private static int GetColumnIndexByName(/*GridView gridView,*/ string name)
 2318:         {
 2319:             // https://stackoverflow.com/questions/3925183/method-to-find-gridview-column-index-by-name
 2320:  
 2321:             /*
 2322:             foreach (DataControlField col in gridView.Columns)
 2323:             {
 2324:                 if (col.HeaderText.ToLower().Trim() == name.ToLower().Trim())
 2325:                 {
 2326:                     return gridView.Columns.IndexOf(col);
 2327:                 }
 2328:             }
 2329:             */
 2330:  
 2331:             return -1;
 2332:         }
 2333:  
 2334:         ////////////////////////////////////////////////////////////////////////////
 2335:         ////////////////////////////////////////////////////////////////////////////
 2336:  
 2337:         /// <summary>
 2338:         ///
 2339:         /// </summary>
 2340:         public static void DropDownList_DataBound(/*System.Web.UI.Page page,*/ object sender, EventArgs e, Ia.Ftn.Cl.Models.StaffIdentityUser staff)
 2341:         {
 2342:             string kuwaitFtnAreaListString;
 2343:             //DropDownList ddl;
 2344:             List<Ia.Ftn.Cl.Models.Business.Service.KuwaitFtnArea> kuwaitFtnAreaList;
 2345:  
 2346:             //ddl = (DropDownList)sender;
 2347:  
 2348:             /*
 2349:             foreach (ListItem listItem in ddl.Items)
 2350:             {
 2351:                 kuwaitFtnAreaList = (from k in Ia.Ftn.Cl.Models.Data.Service.KuwaitFtnAreaList where k.SiteList != null && k.SiteList.Any(u => u.Id == int.Parse(listItem.Value)) select k).ToList();
 2352: 
 2353:                 if (kuwaitFtnAreaList != null && kuwaitFtnAreaList.Count > 0)
 2354:                 {
 2355:                     kuwaitFtnAreaListString = string.Join(", ", kuwaitFtnAreaList.Select(n => n.ArabicName).ToArray());
 2356:                 }
 2357:                 else kuwaitFtnAreaListString = null;
 2358: 
 2359:                 listItem.Text = kuwaitFtnAreaListString;
 2360:             }
 2361:             */
 2362:         }
 2363:  
 2364:         ////////////////////////////////////////////////////////////////////////////
 2365:  
 2366:         /// <summary>
 2367:         ///
 2368:         /// </summary>
 2369:         public static void DropDownList_DataBound(/*System.Web.UI.Page page,*/ object sender, EventArgs e)
 2370:         {
 2371:             DropDownList_DataBound(/*page,*/ sender, e, null);
 2372:         }
 2373:  
 2374:         ////////////////////////////////////////////////////////////////////////////
 2375:         ////////////////////////////////////////////////////////////////////////////
 2376:  
 2377:         /// <summary>
 2378:         ///
 2379:         /// </summary>
 2380:         public static void DataList_ItemDataBound(/*System.Web.UI.Page page, object sender, DataListItemEventArgs e*/)
 2381:         {
 2382:             bool senderKnown;
 2383:             string senderId;
 2384:             //DataList dataList;
 2385:  
 2386:             senderKnown = true;
 2387:             //dataList = (DataList)sender;
 2388:             //senderId = dataList.ID;
 2389:  
 2390:             string accessName;
 2391:  
 2392:             accessName = null;
 2393:  
 2394:             /*
 2395:             switch (senderId)
 2396:             {
 2397:                 case "accessNameDataList":
 2398:                     {
 2399:                         //access = (e.Item.DataItem as Ia.Ftn.Cl.Models.Access);
 2400:                         accessName = (e.Item.DataItem as string);
 2401:                         break;
 2402:                     }
 2403:                 default:
 2404:                     senderKnown = false;
 2405:                     break;
 2406:             }
 2407:             */
 2408:  
 2409:             senderKnown = true;
 2410:  
 2411:             if (senderKnown)
 2412:             {
 2413:                 /*
 2414:                 if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
 2415:                 {
 2416:                     //CheckBox chk = e.Item.FindControl("AApBlue") as CheckBox;
 2417:                     //Label lbl = e.Item.FindControl("Label1") as Label;
 2418: 
 2419:                     //chk.Checked = (lbl.Text == "Y") ? true : false;
 2420: 
 2421:                     HyperLink hl = e.Item.FindControl("accessNameHyperLink") as HyperLink;
 2422: 
 2423:                     hyperLinkText = accessName;
 2424:                     hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(accessName);
 2425:                 }
 2426:                 */
 2427:  
 2428:                 //foreach (DataListItem dataListItem in dataList.Items)
 2429:                 // {
 2430:  
 2431:                 /*
 2432:                 foreach (Control control in dataList.Controls) // dataListItem.Controls)
 2433:                 {
 2434:                     try
 2435:                     {
 2436:                         if (control is Label)
 2437:                         {
 2438:                             // CheckBox cb = (CheckBox)control.Controls[0];
 2439:                             //Label l = (Label)control;
 2440: 
 2441:                             //switch (l.ID)
 2442:                             //{
 2443:                             /*
 2444:                             case "accessAreaLabel": text = (from kna in Ia.Ftn.Cl.Models.Data.Service.KuwaitFtnAreaList where kna.Id == accessName.AreaId select kna.ArabicName).SingleOrDefault(); break;
 2445:                             case "accessOltLabel": text = (from o in Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OltList where o.Id == accessName.Olt select o.AmsName).SingleOrDefault(); break;
 2446:                             case "accessBlockLabel": text = accessName.Block.ToString(); break;
 2447:                             case "accessStreetLabel": text = accessName.Street; break;
 2448:                             case "accessPremisesOldLabel": text = accessName.PremisesOld; break;
 2449:                             case "accessPremisesNewLabel": text = accessName.PremisesNew; break;
 2450:                             case "accessPaciLabel": text = accessName.Paci; break;
 2451:                             case "accessNoteLabel": text = accessName.Note; break;
 2452:                             case "accessStaffNameLabel": text = (from _s in Ia.Ftn.Cl.Models.Data.StaffIdentityUser.List() where _s.Id == accessName.StaffIdentityUser.Id select _s.FirstName).SingleOrDefault(); break;
 2453:                             */    /*
 2454:                             case "accessOntFamilyTypeCapacityLabel":
 2455:                                 {
 2456:                                     // temp: later quickly find vendor from accessId
 2457:                                     try
 2458:                                     {
 2459:                                         if (access.Onts != null && access.Onts.Count > 0)
 2460:                                         {
 2461:                                             text = Ia.Ftn.Cl.Models.Data.Nokia.Ont.FamilyTypeFromId(access.Onts.FirstOrDefault().FamilyTypeId);
 2462: 
 2463:                                             text += " (" + Ia.Ftn.Cl.Models.Business.Nokia.Ams.PossibleNumberOfTdForOntFamilyType(access.Onts.FirstOrDefault().FamilyTypeId) + ")";
 2464:                                         }
 2465:                                         else text = string.Empty;
 2466:                                     }
 2467:                                     catch (Exception)// ex)
 2468:                                     {
 2469:                                         text = string.Empty;
 2470:                                     }
 2471: 
 2472:                                     break;
 2473:                                 }
 2474: 
 2475:                             case "accessFamilyTypeInAreaBlockLabel": text = (from kna in Ia.Ftn.Cl.Models.Data.Service.KuwaitFtnAreaList where kna.Id == accessFamilyTypeInAreaBlock.AreaId select kna.NameArabicName).SingleOrDefault(); break;
 2476:                             * /
 2477:                             //}
 2478:                         }
 2479:                         else if (control is HyperLink) // .GetType().ToString() == "System.Web.UI.WebControls.HyperLink")
 2480:                         {
 2481:                             HyperLink hl = (HyperLink)control;
 2482: 
 2483:                             switch (hl.ID)
 2484:                             {
 2485:                                 case "accessNameHyperLink":
 2486:                                     {
 2487:                                         hyperLinkText = accessName; //.Name;
 2488:                                         hyperLinkNavigateUrl = Ia.Ftn.Cl.Models.Business.Maintenance.Find.Url(accessName); //.Name;
 2489:                                         break;
 2490:                                     }
 2491:                                 default:
 2492:                                     {
 2493:                                         break;
 2494:                                     }
 2495:                             }
 2496:                         }
 2497:                         else
 2498:                         {
 2499: 
 2500:                         }
 2501:                     }
 2502:                     catch (Exception)
 2503:                     {
 2504: 
 2505:                     }
 2506:                 }
 2507:                 */
 2508:                 //}
 2509:             }
 2510:             else
 2511:             {
 2512:  
 2513:             }
 2514:         }
 2515:  
 2516:         ////////////////////////////////////////////////////////////////////////////
 2517:         ////////////////////////////////////////////////////////////////////////////
 2518:  
 2519:         /// <summary>
 2520:         ///
 2521:         /// </summary>
 2522:         public static void FormView_DataBound(/*System.Web.UI.Page page,*/ object sender, EventArgs e)
 2523:         {
 2524:         }
 2525:  
 2526:         ////////////////////////////////////////////////////////////////////////////
 2527:         ////////////////////////////////////////////////////////////////////////////
 2528:  
 2529:         /// <summary>
 2530:         ///
 2531:         /// </summary>
 2532:         public static void TreeView_TreeNodeDataBound(/*System.Web.UI.Page page, object sender, System.Web.UI.WebControls.TreeNodeEventArgs e*/)
 2533:         {
 2534:             string s;
 2535:  
 2536:             //s = e.Node.Text.Trim();
 2537:  
 2538:             //s = s.Replace("\r\n", "<br/>");
 2539:             //s = Regex.Replace(s, @"\s+", " ");
 2540:  
 2541:             //e.Node.Text = s;
 2542:         }
 2543:  
 2544:         /*
 2545:         ////////////////////////////////////////////////////////////////////////////
 2546:         ////////////////////////////////////////////////////////////////////////////
 2547: 
 2548:         /// <summary>
 2549:         /// https://stackoverflow.com/questions/9715983/how-to-get-the-cell-value-by-column-name-not-by-index-in-gridview-in-asp-net
 2550:         /// </summary>
 2551:         private static int GetColumnIndexByName(GridViewRow row, string columnName)
 2552:         {
 2553:             int columnIndex = 0;
 2554: 
 2555:             foreach (DataControlFieldCell cell in row.Cells)
 2556:             {
 2557:                 if (cell.ContainingField is BoundField)
 2558:                     if (((BoundField)cell.ContainingField).DataField.Equals(columnName))
 2559:                         break;
 2560:                 columnIndex++; // keep adding 1 while we don't have the correct name
 2561:             }
 2562: 
 2563:             return columnIndex;
 2564:         }
 2565:         */
 2566:  
 2567:         ////////////////////////////////////////////////////////////////////////////
 2568:         ////////////////////////////////////////////////////////////////////////////
 2569:     }
 2570:  
 2571:     ////////////////////////////////////////////////////////////////////////////
 2572:     ////////////////////////////////////////////////////////////////////////////
 2573: }