شركة التطبيقات المتكاملة لتصميم النظم البرمجية الخاصة ش.ش.و.

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Default

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

Default support class for Next Generation Network (NGN) ui model.

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