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