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

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.Ui.Huawei.HuSbr huSbr;
 480:              Ia.Ngn.Cl.Model.Huawei.Owsbr owsbr;
 481:              Ia.Ngn.Cl.Model.Huawei.Seruattr seruattr;
 482:              Ia.Ngn.Cl.Model.Ericsson.AxeSubscriber axeSubscriber;
 483:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont nddOnt;
 484:              Ia.Ngn.Cl.Model.Ont ont;
 485:              Ia.Ngn.Cl.Model.OntOntPots ontOntPots;
 486:              Ia.Ngn.Cl.Model.Ui.ServiceRequestService serviceRequestService;
 487:              Ia.Ngn.Cl.Model.Access access;
 488:              Ia.Ngn.Cl.Model.Ui.Service2 service2;
 489:              Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord agcfGatewayRecord;
 490:              Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint agcfEndpoint;
 491:              Ia.Ngn.Cl.Model.Ui.Nokia.SubParty subParty;
 492:              Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber subscriber;
 493:              Ia.Ngn.Cl.Model.OntServiceVoip ontServiceVoip;
 494:              Ia.Ngn.Cl.Model.Huawei.EmsDev emsDev;
 495:              Ia.Ngn.Cl.Model.Huawei.EmsBoard emsBoard;
 496:              Ia.Ngn.Cl.Model.Huawei.EmsPort emsPort;
 497:              Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt emsOnt;
 498:              Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo emsOntSipInfo;
 499:              Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser emsVoipPstnUser;
 500:              Ia.Ngn.Cl.Model.Staff staff;
 501:              Ia.Ngn.Cl.Model.Contact contact;
 502:              Ia.Ngn.Cl.Model.ServiceExemption serviceExemption;
 503:              Ia.Ngn.Cl.Model.Ui.ReportAccessServiceRequest reportAccessServiceRequest;
 504:              Ia.Ngn.Cl.Model.Business.Service.KuwaitNgnArea kuwaitNgnArea;
 505:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor vendor;
 506:              Ia.Ngn.Cl.Model.Ui.Maintenance.AccessFamilyTypeAreaBlock accessFamilyTypeInAreaBlock;
 507:              Ia.Ngn.Cl.Model.Ui.Event newOntEvent;
 508:              Ia.Ngn.Cl.Model.Business.ServiceNddOntAccessName serviceAccessName;
 509:              MembershipUser membershipUser;
 510:   
 511:              areaId = 0;
 512:              userId = Guid.Empty;
 513:              senderId = e.Row.Parent.Parent.ID;
 514:   
 515:              if (e.Row.RowType == DataControlRowType.Header || e.Row.RowType == DataControlRowType.Footer || e.Row.RowType == DataControlRowType.DataRow)
 516:              {
 517:                  report = null;
 518:                  reportHistory = null;
 519:                  serviceRequest = null;
 520:                  serviceRequestHistory = null;
 521:                  serviceRequestOnt = null;
 522:                  serviceRequestOntDetail = null;
 523:                  huSbr = null;
 524:                  owsbr = null;
 525:                  seruattr = null;
 526:                  axeSubscriber = null;
 527:                  agcfGatewayRecord = null;
 528:                  agcfEndpoint = null;
 529:                  subParty = null;
 530:                  subscriber = null;
 531:                  nddOnt = null;
 532:                  ont = null;
 533:                  serviceRequestService = null;
 534:                  access = null;
 535:                  ontOntPots = null;
 536:                  ontServiceVoip = null;
 537:                  emsDev = null;
 538:                  emsBoard = null;
 539:                  emsPort = null;
 540:                  emsOnt = null;
 541:                  emsOntSipInfo = null;
 542:                  service2 = null;
 543:                  staff = null;
 544:                  contact = null;
 545:                  serviceExemption = null;
 546:                  membershipUser = null;
 547:                  reportAccessServiceRequest = null;
 548:                  kuwaitNgnArea = null;
 549:                  vendor = null;
 550:                  accessFamilyTypeInAreaBlock = null;
 551:                  newOntEvent = null;
 552:                  serviceAccessName = null;
 553:   
 554:                  senderKnown = true;
 555:   
 556:                  switch (senderId)
 557:                  {
 558:                      case "reportGridView":
 559:                          {
 560:                              report = (e.Row.DataItem as Ia.Ngn.Cl.Model.Report);
 561:                              buttonColumnType = GridViewButtonColumnType.DeleteAndDeleteOffAndDeleteChildOffAndHistoryButtons;
 562:                              break;
 563:                          }
 564:                      case "fieldTnmdSupplierReportGridView":
 565:                          {
 566:                              reportAccessServiceRequest = (e.Row.DataItem as Ia.Ngn.Cl.Model.Ui.ReportAccessServiceRequest);
 567:                              break;
 568:                          }
 569:                      case "insertedRecordGridView":
 570:                          {
 571:                              report = (e.Row.DataItem as Ia.Ngn.Cl.Model.Report);
 572:                              break;
 573:                          }
 574:                      case "reportListHistoryColumnOnlyGridView":
 575:                          {
 576:                              report = (e.Row.DataItem as Ia.Ngn.Cl.Model.Report);
 577:                              buttonColumnType = GridViewButtonColumnType.HistoryButton;
 578:                              break;
 579:                          }
 580:                      case "reportHistoryGridView":
 581:                          {
 582:                              reportHistory = (e.Row.DataItem as Ia.Ngn.Cl.Model.ReportHistory);
 583:                              buttonColumnType = GridViewButtonColumnType.DeleteAndDeleteOffButton;
 584:                              break;
 585:                          }
 586:                      case "serviceRequestGridView":
 587:                          {
 588:                              serviceRequest = (e.Row.DataItem as Ia.Ngn.Cl.Model.ServiceRequest);
 589:                              break;
 590:                          }
 591:                      case "serviceRequestHistoryGridView":
 592:                          {
 593:                              serviceRequestHistory = (e.Row.DataItem as Ia.Ngn.Cl.Model.ServiceRequestHistory);
 594:                              break;
 595:                          }
 596:                      case "serviceRequestOntGridView":
 597:                          {
 598:                              serviceRequestOnt = (e.Row.DataItem as Ia.Ngn.Cl.Model.ServiceRequestOnt);
 599:                              break;
 600:                          }
 601:                      case "serviceRequestOntDetailGridView":
 602:                          {
 603:                              serviceRequestOntDetail = (e.Row.DataItem as Ia.Ngn.Cl.Model.ServiceRequestOntDetail);
 604:                              break;
 605:                          }
 606:                      case "huSbrGridView":
 607:                          {
 608:                              huSbr = (e.Row.DataItem as Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr);
 609:                              break;
 610:                          }
 611:                      case "owsbrGridView":
 612:                          {
 613:                              owsbr = (e.Row.DataItem as Ia.Ngn.Cl.Model.Huawei.Owsbr);
 614:                              break;
 615:                          }
 616:                      case "seruattrGridView":
 617:                          {
 618:                              seruattr = (e.Row.DataItem as Ia.Ngn.Cl.Model.Huawei.Seruattr);
 619:                              break;
 620:                          }
 621:                      case "axeSubscriberGridView":
 622:                          {
 623:                              axeSubscriber = (e.Row.DataItem as Ia.Ngn.Cl.Model.Ericsson.AxeSubscriber);
 624:                              break;
 625:                          }
 626:                      case "agcfGatewayRecordGridView":
 627:                          {
 628:                              agcfGatewayRecord = (e.Row.DataItem as Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord);
 629:                              break;
 630:                          }
 631:                      case "agcfEndpointGridView":
 632:                          {
 633:                              agcfEndpoint = (e.Row.DataItem as Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint);
 634:                              break;
 635:                          }
 636:                      case "subPartyGridView":
 637:                          {
 638:                              subParty = (e.Row.DataItem as Ia.Ngn.Cl.Model.Ui.Nokia.SubParty);
 639:                              break;
 640:                          }
 641:                      case "subscriberGridView":
 642:                          {
 643:                              subscriber = (e.Row.DataItem as Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber);
 644:                              break;
 645:                          }
 646:                      case "nddOntGridView":
 647:                          {
 648:                              nddOnt = (e.Row.DataItem as Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont);
 649:                              break;
 650:                          }
 651:                      case "ontGridView":
 652:                          {
 653:                              ont = (e.Row.DataItem as Ia.Ngn.Cl.Model.Ont);
 654:                              break;
 655:                          }
 656:                      case "ontOntPotsGridView":
 657:                          {
 658:                              ontOntPots = (e.Row.DataItem as Ia.Ngn.Cl.Model.OntOntPots);
 659:                              break;
 660:                          }
 661:                      case "serviceRequestServiceGridView":
 662:                          {
 663:                              serviceRequestService = (e.Row.DataItem as Ia.Ngn.Cl.Model.Ui.ServiceRequestService);
 664:                              break;
 665:                          }
 666:                      case "accessGridView":
 667:                          {
 668:                              access = (e.Row.DataItem as Ia.Ngn.Cl.Model.Access);
 669:                              break;
 670:                          }
 671:                      case "serviceGridView":
 672:                          {
 673:                              service2 = (e.Row.DataItem as Ia.Ngn.Cl.Model.Ui.Service2);
 674:                              break;
 675:                          }
 676:                      case "ontServiceVoipGridView":
 677:                          {
 678:                              ontServiceVoip = (e.Row.DataItem as Ia.Ngn.Cl.Model.OntServiceVoip);
 679:                              break;
 680:                          }
 681:                      case "emsDevGridView":
 682:                          {
 683:                              emsDev = (e.Row.DataItem as Ia.Ngn.Cl.Model.Huawei.EmsDev);
 684:                              break;
 685:                          }
 686:                      case "emsBoardGridView":
 687:                          {
 688:                              emsBoard = (e.Row.DataItem as Ia.Ngn.Cl.Model.Huawei.EmsBoard);
 689:                              break;
 690:                          }
 691:                      case "emsPortGridView":
 692:                          {
 693:                              emsPort = (e.Row.DataItem as Ia.Ngn.Cl.Model.Huawei.EmsPort);
 694:                              break;
 695:                          }
 696:                      case "emsOntGridView":
 697:                          {
 698:                              emsOnt = (e.Row.DataItem as Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt);
 699:                              break;
 700:                          }
 701:                      case "emsOntSipInfoGridView":
 702:                          {
 703:                              emsOntSipInfo = (e.Row.DataItem as Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo);
 704:                              break;
 705:                          }
 706:                      case "emsVoipPstnUserGridView":
 707:                          {
 708:                              emsVoipPstnUser = (e.Row.DataItem as Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser);
 709:                              break;
 710:                          }
 711:                      case "staffGridView":
 712:                          {
 713:                              staff = (e.Row.DataItem as Ia.Ngn.Cl.Model.Staff);
 714:                              break;
 715:                          }
 716:                      case "contactGridView":
 717:                          {
 718:                              contact = (e.Row.DataItem as Ia.Ngn.Cl.Model.Contact);
 719:                              break;
 720:                          }
 721:                      case "userGridView":
 722:                          {
 723:                              membershipUser = (e.Row.DataItem as MembershipUser);
 724:                              break;
 725:                          }
 726:                      case "accessFamilyTypeInAreaBlockGridView":
 727:                          {
 728:                              accessFamilyTypeInAreaBlock = (e.Row.DataItem as Ia.Ngn.Cl.Model.Ui.Maintenance.AccessFamilyTypeAreaBlock);
 729:                              break;
 730:                          }
 731:                      case "newOntEventGridView":
 732:                          {
 733:                              newOntEvent = (e.Row.DataItem as Ia.Ngn.Cl.Model.Ui.Event);
 734:                              break;
 735:                          }
 736:                      case "staffFrameworkPerformanceGridView":
 737:                          {
 738:                              if (e.Row.DataItem != null) userId = Guid.TryParse((e.Row.DataItem as Ia.Ngn.Cl.Model.Ui.Performance).UserId.ToString(), out _userId) ? _userId : Guid.Empty;
 739:                              break;
 740:                          }
 741:                      case "kuwaitNgnAreaGridView":
 742:                          {
 743:                              if (e.Row.DataItem != null) kuwaitNgnArea = (Ia.Ngn.Cl.Model.Business.Service.KuwaitNgnArea)e.Row.DataItem;
 744:                              break;
 745:                          }
 746:                      case "serviceExemptionGridView":
 747:                          {
 748:                              serviceExemption = (e.Row.DataItem as Ia.Ngn.Cl.Model.ServiceExemption);
 749:                              break;
 750:                          }
 751:                      case "serviceAccessNameGridView":
 752:                          {
 753:                              serviceAccessName = (e.Row.DataItem as Ia.Ngn.Cl.Model.Business.ServiceNddOntAccessName);
 754:                              break;
 755:                          }
 756:                      default:
 757:                          {
 758:                              senderKnown = false;
 759:                              break;
 760:                          }
 761:                  }
 762:   
 763:                  if (senderKnown)
 764:                  {
 765:                      if (e.Row.RowType == DataControlRowType.Header)
 766:                      {
 767:                          if (buttonColumnType == GridViewButtonColumnType.NoButtons)
 768:                          {
 769:                          }
 770:                          else if (buttonColumnType == GridViewButtonColumnType.HistoryButton)
 771:                          {
 772:                              // below: for the header just keep the first column visible
 773:                              e.Row.Cells[0].Visible = true;
 774:                          }
 775:                          else if (buttonColumnType == GridViewButtonColumnType.DeleteAndDeleteOffButton)
 776:                          {
 777:                              // below: for the header just keep one (first) column visible
 778:                              e.Row.Cells[0].Visible = true;
 779:                              e.Row.Cells[1].Visible = false;
 780:                          }
 781:                          else if (buttonColumnType == GridViewButtonColumnType.DeleteAndDeleteOffAndDeleteChildOffAndHistoryButtons)
 782:                          {
 783:                              // below: for the header just keep one (first) column visible
 784:                              e.Row.Cells[0].Visible = true; // first visible
 785:                              e.Row.Cells[1].Visible = false; // second hidden
 786:                              e.Row.Cells[2].Visible = false; // third hidden
 787:                          }
 788:                          else if (buttonColumnType == GridViewButtonColumnType.DeleteAndEditAndCancelAndUpdateButtons)
 789:                          {
 790:                          }
 791:                      }
 792:                      else if (e.Row.RowType == DataControlRowType.DataRow)
 793:                      {
 794:                          if (buttonColumnType == GridViewButtonColumnType.NoButtons)
 795:                          {
 796:                          }
 797:                          else if (buttonColumnType == GridViewButtonColumnType.HistoryButton)
 798:                          {
 799:                          }
 800:                          else if (buttonColumnType == GridViewButtonColumnType.DeleteAndDeleteOffButton)
 801:                          {
 802:                              // below: manage the delete button according to the role of user
 803:                              if (Ia.Ngn.Cl.Model.Business.Authority.StaffCanCreateReadUpdateDeleteReportHistory(Ia.Ngn.Cl.Model.Business.Authority.PersistentStorageFunction.Delete, report, reportHistory, staffMembershipUser))
 804:                              {
 805:                                  if (reportHistory.Report.StatusIsOpen)
 806:                                  {
 807:                                      // below: report status open
 808:                                      e.Row.Cells[0].Visible = true; // delete is visible
 809:                                      e.Row.Cells[1].Visible = false; // delete-off is hidden
 810:                                  }
 811:                                  else
 812:                                  {
 813:                                      // below: report closed, hence can not delete histories
 814:                                      e.Row.Cells[0].Visible = false; // delete is hidden
 815:                                      e.Row.Cells[1].Visible = true; // delete-off is visible
 816:                                  }
 817:                              }
 818:                              else
 819:                              {
 820:                                  e.Row.Cells[0].Visible = false; // delete is hidden
 821:                                  e.Row.Cells[1].Visible = true; // delete-off is visible
 822:                              }
 823:                          }
 824:                          else if (buttonColumnType == GridViewButtonColumnType.DeleteAndDeleteOffAndDeleteChildOffAndHistoryButtons)
 825:                          {
 826:                              // below: manage the delete button according to the role of user
 827:                              if (Ia.Ngn.Cl.Model.Business.Authority.StaffCanCreateReadUpdateDeleteReport(Ia.Ngn.Cl.Model.Business.Authority.PersistentStorageFunction.Delete, report, staffMembershipUser))
 828:                              {
 829:                                  if (report.StatusIsOpen)
 830:                                  {
 831:                                      if (report.ReportHistories != null && report.ReportHistories.Count > 0)
 832:                                      {
 833:                                          // below: has children
 834:                                          e.Row.Cells[0].Visible = false; // delete is hidden
 835:                                          e.Row.Cells[1].Visible = false; // delete-off is hidden
 836:                                          e.Row.Cells[2].Visible = true;  // delete-child-off is visible
 837:                                      }
 838:                                      else
 839:                                      {
 840:                                          // below: no children
 841:                                          e.Row.Cells[0].Visible = true; // delete is visible
 842:                                          e.Row.Cells[1].Visible = false; // delete-off is hidden
 843:                                          e.Row.Cells[2].Visible = false; // delete-child-off is hidden
 844:                                      }
 845:                                  }
 846:                                  else
 847:                                  {
 848:                                      // below: report is closed, hence can not delete histories
 849:                                      e.Row.Cells[0].Visible = false; // delete is hidden
 850:                                      e.Row.Cells[1].Visible = true; // delete-off is visible
 851:                                      e.Row.Cells[2].Visible = false;  // delete-child-off is hidden
 852:                                  }
 853:                              }
 854:                              else
 855:                              {
 856:                                  e.Row.Cells[0].Visible = false; // delete is hidden
 857:                                  e.Row.Cells[1].Visible = true; // delete-off is visible
 858:                                  e.Row.Cells[2].Visible = false; // delete-child-off is hidden
 859:                              }
 860:                          }
 861:                          else if (buttonColumnType == GridViewButtonColumnType.DeleteAndEditAndCancelAndUpdateButtons)
 862:                          {
 863:                          }
 864:   
 865:   
 866:                          if (report != null)
 867:                          {
 868:                              if (staffMembershipUser != null)
 869:                              {
 870:                                  if (Ia.Ngn.Cl.Model.Data.Report.ReportResponsibilityByStaffGuidDictionary.ContainsKey(staffMembershipUser.UserId))
 871:                                  {
 872:                                      if (Ia.Ngn.Cl.Model.Data.Report.ReportResponsibilityByStaffGuidDictionary[staffMembershipUser.UserId].Any(u => u == report.Id))
 873:                                      {
 874:                                          e.Row.CssClass = "selected-row-style";
 875:                                      }
 876:                                      else { }
 877:                                  }
 878:                                  else { }
 879:                              }
 880:                              else { }
 881:                          }
 882:                          else { }
 883:   
 884:   
 885:                          foreach (Control control in e.Row.Controls)
 886:                          {
 887:                              try
 888:                              {
 889:                                  if (control.Controls.Count > 0)
 890:                                  {
 891:                                      if (control.Controls[0].GetType().ToString() == "System.Web.UI.WebControls.Label")
 892:                                      {
 893:                                          Label l = (Label)control.Controls[0];
 894:   
 895:                                          switch (l.ID)
 896:                                          {
 897:                                              case "reportServiceLabel":
 898:                                                  {
 899:                                                      s = Ia.Ngn.Cl.Model.Business.Service.ServiceName(report.Service, report.ServiceType);
 900:                                                      l.Text = s;
 901:                                                      break;
 902:                                                  }
 903:                                              case "reportStatusLabel": l.Text = Ia.Ngn.Cl.Model.Data.Report.StatusColoredDictionary[report.Status].ToString(); break;
 904:                                              case "reportSeverityLabel": l.Text = Ia.Ngn.Cl.Model.Data.Report.SeverityColoredDictionary[report.Severity].ToString(); break;
 905:                                              case "reportCategoryLabel": l.Text = Ia.Ngn.Cl.Model.Data.Report.CategoryDictionary[report.Category].ToString(); break;
 906:                                              case "reportAreaLabel": l.Text = Ia.Ngn.Cl.Model.Data.Report.CategoryAreaColoredDictionary[report.Area].ToString(); break;
 907:                                              case "reportPriorityLabel": l.Text = Ia.Ngn.Cl.Model.Data.Report.PriorityColoredDictionary[report.Priority].ToString(); break;
 908:                                              case "reportDetailLabel":
 909:                                                  {
 910:                                                      l.Text = Ia.Cl.Model.Html.Decode(report.Detail);
 911:   
 912:                                                      SetTableCellHtmlTextWriteStyleDirectionAccordingToPresenceOfArabicLetters(ref e, ref l);
 913:   
 914:                                                      break;
 915:                                                  }
 916:                                              case "reportHistoryLastDetailOrReportDetailLabel":
 917:                                                  {
 918:                                                      l.Text = report.LastReportHistory != null ? Ia.Cl.Model.Html.Decode(report.LastReportHistory.Detail) : Ia.Cl.Model.Html.Decode(report.Detail);
 919:   
 920:                                                      SetTableCellHtmlTextWriteStyleDirectionAccordingToPresenceOfArabicLetters(ref e, ref l);
 921:   
 922:                                                      break;
 923:                                                  }
 924:                                              case "reportLastHistoricResolutionLabel":
 925:                                                  {
 926:                                                      l.Text = (report.LastReportHistory != null) ? Ia.Ngn.Cl.Model.Data.Report.ResolutionEnglishAndArabicColoredDictionary[report.LastReportHistory.Resolution].ToString() : string.Empty;
 927:   
 928:                                                      break;
 929:                                                  }
 930:   
 931:                                              case "reportStatusLastHistoricResolutionLabel":
 932:                                                  {
 933:                                                      s = Ia.Ngn.Cl.Model.Data.Report.StatusColoredDictionary[report.Status].ToString();
 934:   
 935:                                                      if (report.LastReportHistory != null) s += "/" + Ia.Ngn.Cl.Model.Data.Report.ResolutionEnglishAndArabicColoredDictionary[report.LastReportHistory.Resolution].ToString();
 936:   
 937:                                                      l.Text = s;
 938:   
 939:                                                      break;
 940:                                                  }
 941:   
 942:                                              case "reportHistoryLastHistoricalIndicationActionResolutionLabel":
 943:                                                  {
 944:                                                      if (report.LastReportHistory != null)
 945:                                                      {
 946:                                                          s = Ia.Ngn.Cl.Model.Data.Report.IndicationColoredDictionary[report.LastReportHistory.Indication].ToString()
 947:                                                              + "/" + Ia.Ngn.Cl.Model.Data.Report.ActionColoredDictionary[report.LastReportHistory.Action].ToString()
 948:                                                              + "/" + Ia.Ngn.Cl.Model.Data.Report.ResolutionColoredDictionary[report.LastReportHistory.Resolution].ToString();
 949:                                                      }
 950:                                                      else s = string.Empty;
 951:   
 952:                                                      l.Text = s;
 953:   
 954:                                                      break;
 955:                                                  }
 956:   
 957:                                              case "reportAccessServiceRequestLastHistoricResolutionLabel": l.Text = (reportAccessServiceRequest.Report.LastReportHistory != null) ? Ia.Ngn.Cl.Model.Data.Report.ResolutionEnglishAndArabicColoredDictionary[reportAccessServiceRequest.Report.LastReportHistory.Resolution].ToString() : string.Empty; break;
 958:                                              case "reportAccessServiceRequestServiceFlatTermIdLabel": l.Text = "?"; break;
 959:                                              case "reportAccessServiceRequestLastHistoricActionLabel": l.Text = (reportAccessServiceRequest.Report.LastReportHistory != null) ? Ia.Ngn.Cl.Model.Data.Report.ActionColoredDictionary[reportAccessServiceRequest.Report.LastReportHistory.Action].ToString() : string.Empty; break;
 960:                                              case "reportAccessServiceRequestServiceTypeLabel": l.Text = reportAccessServiceRequest.Report.ServiceType.ToString(); break;
 961:                                              case "reportAccessServiceRequestContactLabel": l.Text = Ia.Cl.Model.Html.Decode(reportAccessServiceRequest.Report.Contact); break;
 962:                                              case "reportAccessServiceRequestAddressLabel": l.Text = Ia.Cl.Model.Html.Decode(reportAccessServiceRequest.Access.Address); break;
 963:                                              case "reportAccessServiceRequestDetailLabel": l.Text = (reportAccessServiceRequest.Report.LastReportHistory != null) ? Ia.Cl.Model.Html.Decode(reportAccessServiceRequest.Report.LastReportHistory.Detail) : string.Empty; break;
 964:                                              case "reportAccessServiceRequestNoteLabel": l.Text = (reportAccessServiceRequest.Report.LastReportHistory != null) ? Ia.Cl.Model.Html.Decode(reportAccessServiceRequest.Report.LastReportHistory.Note) : string.Empty; break;
 965:                                              case "reportAccessServiceRequestStaffFrameworkLabel":
 966:                                                  {
 967:                                                      if (reportAccessServiceRequest.Report.LastReportHistory != null)
 968:                                                      {
 969:                                                          if (Ia.Ngn.Cl.Model.Business.Administration.IsFrameworkGuid(reportAccessServiceRequest.Report.LastReportHistory.UserId))
 970:                                                          {
 971:                                                              l.Text = (from f in Ia.Ngn.Cl.Model.Data.Administration.FrameworkList where f.Guid == reportAccessServiceRequest.Report.LastReportHistory.UserId select f.ArabicName).SingleOrDefault();
 972:                                                          }
 973:                                                          else l.Text = (from _s in Ia.Ngn.Cl.Model.Data.Staff.List where _s.UserId == reportAccessServiceRequest.Report.LastReportHistory.UserId select _s.FirstAndMiddleName).SingleOrDefault();
 974:                                                      }
 975:                                                      else
 976:                                                      {
 977:                                                          l.Text = string.Empty;
 978:                                                      }
 979:   
 980:                                                      break;
 981:                                                  }
 982:   
 983:                                              case "reportLastHistoricEstimateLabel": l.Text = (report.LastReportHistory != null) ? l.Text = Ia.Ngn.Cl.Model.Data.Report.EstimateEnglishAndArabicColoredDictionary[report.LastReportHistory.Estimate].ToString() : string.Empty; break;
 984:                                              case "reportLastHistoricStaffLabel":
 985:                                                  {
 986:                                                      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;
 987:   
 988:                                                      SetTableCellHtmlTextWriteStyleDirectionAccordingToPresenceOfArabicLetters(ref e, ref l);
 989:   
 990:                                                      break;
 991:                                                  }
 992:                                              case "reportLastReportAndHistoricStaffFrameworkLabel":
 993:                                                  {
 994:                                                      if (report.LastReportHistory != null)
 995:                                                      {
 996:                                                          if (Ia.Ngn.Cl.Model.Business.Administration.IsFrameworkGuid(report.LastReportHistory.UserId))
 997:                                                          {
 998:                                                              arabicNameBracketParentArabicNameBracket = (from f in Ia.Ngn.Cl.Model.Data.Administration.FrameworkList where f.Guid == report.LastReportHistory.UserId select f.ArabicNameBracketParentArabicNameBracket).SingleOrDefault();
 999:   
1000:                                                              l.Text = arabicNameBracketParentArabicNameBracket;
1001:                                                          }
1002:                                                          else
1003:                                                          {
1004:                                                              firstAndMiddleNameBracketFrameworkArabicNameAndFrameworkParentArabicNameBracket = (from _s in Ia.Ngn.Cl.Model.Data.Staff.List where _s.UserId == report.LastReportHistory.UserId select _s.FirstAndMiddleNameBracketFrameworkArabicNameAndFrameworkParentArabicNameBracket).SingleOrDefault();
1005:   
1006:                                                              l.Text = firstAndMiddleNameBracketFrameworkArabicNameAndFrameworkParentArabicNameBracket;
1007:                                                          }
1008:                                                      }
1009:                                                      else
1010:                                                      {
1011:                                                          if (Ia.Ngn.Cl.Model.Business.Administration.IsFrameworkGuid(report.UserId))
1012:                                                          {
1013:                                                              arabicNameBracketParentArabicNameBracket = (from f in Ia.Ngn.Cl.Model.Data.Administration.FrameworkList where f.Guid == report.UserId select f.ArabicNameBracketParentArabicNameBracket).SingleOrDefault();
1014:   
1015:                                                              l.Text = arabicNameBracketParentArabicNameBracket;
1016:                                                          }
1017:                                                          else
1018:                                                          {
1019:                                                              firstAndMiddleNameBracketFrameworkArabicNameAndFrameworkParentArabicNameBracket = (from _s in Ia.Ngn.Cl.Model.Data.Staff.List where _s.UserId == report.UserId select _s.FirstAndMiddleNameBracketFrameworkArabicNameAndFrameworkParentArabicNameBracket).SingleOrDefault();
1020:   
1021:                                                              l.Text = firstAndMiddleNameBracketFrameworkArabicNameAndFrameworkParentArabicNameBracket;
1022:                                                          }
1023:                                                      }
1024:   
1025:                                                      SetTableCellHtmlTextWriteStyleDirectionAccordingToPresenceOfArabicLetters(ref e, ref l);
1026:   
1027:                                                      break;
1028:                                                  }
1029:                                              case "reportContactLabel":
1030:                                                  {
1031:                                                      l.Text = Ia.Cl.Model.Html.Decode(report.Contact);
1032:   
1033:                                                      SetTableCellHtmlTextWriteStyleDirectionAccordingToPresenceOfArabicLetters(ref e, ref l);
1034:   
1035:                                                      break;
1036:                                                  }
1037:                                              case "reportNoteLabel":
1038:                                                  {
1039:                                                      l.Text = Ia.Cl.Model.Html.Decode(report.Note);
1040:   
1041:                                                      SetTableCellHtmlTextWriteStyleDirectionAccordingToPresenceOfArabicLetters(ref e, ref l);
1042:   
1043:                                                      break;
1044:                                                  }
1045:   
1046:                                              case "reportHistoryLastNoteOrReportNoteLabel":
1047:                                                  {
1048:                                                      l.Text = report.LastReportHistory != null ? Ia.Cl.Model.Html.Decode(report.LastReportHistory.Note) : Ia.Cl.Model.Html.Decode(report.Note);
1049:   
1050:                                                      SetTableCellHtmlTextWriteStyleDirectionAccordingToPresenceOfArabicLetters(ref e, ref l);
1051:   
1052:                                                      break;
1053:                                                  }
1054:                                              case "reportHistoryIndicationLabel": l.Text = Ia.Ngn.Cl.Model.Data.Report.IndicationColoredDictionary[reportHistory.Indication].ToString(); break;
1055:                                              case "reportHistoryAreaLabel":
1056:                                                  {
1057:                                                      if (Ia.Ngn.Cl.Model.Data.Report.CategoryAreaColoredDictionary.ContainsKey(reportHistory.Area))
1058:                                                      {
1059:                                                          l.Text = Ia.Ngn.Cl.Model.Data.Report.CategoryAreaColoredDictionary[reportHistory.Area].ToString();
1060:                                                      }
1061:                                                      else l.Text = "Error: Area '" + reportHistory.Area + "' not found. ";
1062:   
1063:                                                      break;
1064:                                                  };
1065:                                              case "reportHistoryActionLabel": l.Text = Ia.Ngn.Cl.Model.Data.Report.ActionColoredDictionary[reportHistory.Action].ToString(); break;
1066:                                              case "reportHistoryResolutionLabel": l.Text = Ia.Ngn.Cl.Model.Data.Report.ResolutionEnglishAndArabicColoredDictionary[reportHistory.Resolution].ToString(); break;
1067:                                              case "reportHistoryEstimateLabel": l.Text = Ia.Ngn.Cl.Model.Data.Report.EstimateEnglishAndArabicColoredDictionary[reportHistory.Estimate].ToString(); break;
1068:                                              case "reportHistoryDetailLabel":
1069:                                                  {
1070:                                                      l.Text = Ia.Cl.Model.Html.Decode(reportHistory.Detail);
1071:   
1072:                                                      SetTableCellHtmlTextWriteStyleDirectionAccordingToPresenceOfArabicLetters(ref e, ref l);
1073:   
1074:                                                      break;
1075:                                                  }
1076:                                              case "reportHistoryNoteLabel":
1077:                                                  {
1078:                                                      l.Text = Ia.Cl.Model.Html.Decode(reportHistory.Note);
1079:   
1080:                                                      SetTableCellHtmlTextWriteStyleDirectionAccordingToPresenceOfArabicLetters(ref e, ref l);
1081:   
1082:                                                      break;
1083:                                                  }
1084:                                              case "reportHistoryStaffFrameworkLabel":
1085:                                                  {
1086:                                                      if (Ia.Ngn.Cl.Model.Business.Administration.IsFrameworkGuid(reportHistory.UserId))
1087:                                                      {
1088:                                                          arabicNameBracketParentArabicNameBracket = (from f in Ia.Ngn.Cl.Model.Data.Administration.FrameworkList where f.Guid == reportHistory.UserId select f.ArabicNameBracketParentArabicNameBracket).SingleOrDefault();
1089:   
1090:                                                          l.Text = arabicNameBracketParentArabicNameBracket;
1091:                                                      }
1092:                                                      else
1093:                                                      {
1094:                                                          firstAndMiddleNameBracketFrameworkArabicNameAndFrameworkParentArabicNameBracket = (from _s in Ia.Ngn.Cl.Model.Data.Staff.List where _s.UserId == reportHistory.UserId select _s.FirstAndMiddleNameBracketFrameworkArabicNameAndFrameworkParentArabicNameBracket).SingleOrDefault();
1095:   
1096:                                                          l.Text = firstAndMiddleNameBracketFrameworkArabicNameAndFrameworkParentArabicNameBracket;
1097:                                                      }
1098:   
1099:                                                      SetTableCellHtmlTextWriteStyleDirectionAccordingToPresenceOfArabicLetters(ref e, ref l);
1100:   
1101:                                                      break;
1102:                                                  }
1103:                                              case "seruattrRouteNameLabel": l.Text = Ia.Ngn.Cl.Model.Business.Huawei.Seruattr.RnidxRouteName[seruattr.RNIDX2]; break;
1104:                                              case "axeSubscriberRouteNameLabel": l.Text = Ia.Ngn.Cl.Model.Business.Ericsson.Subscriber.RouteName(axeSubscriber.SCL); break;
1105:                                              case "serviceRequestStatusLabel": l.Text = Ia.Ngn.Cl.Model.Data.ServiceRequest.StatusSortedList[serviceRequest.Status].ToString(); break;
1106:                                              case "serviceRequestCustomerCategoryIdLabel": l.Text = Ia.Ngn.Cl.Model.Data.ServiceRequest.CustomerCategorySortedList[serviceRequest.CustomerCategoryId].ToString(); break;
1107:                                              case "serviceRequestServiceIdLabel":
1108:                                                  {
1109:                                                      if (Ia.Ngn.Cl.Model.Data.ServiceRequest.ServiceSortedList.ContainsKey(serviceRequest.ServiceId))
1110:                                                      {
1111:                                                          l.Text = Ia.Ngn.Cl.Model.Data.ServiceRequest.ServiceSortedList[serviceRequest.ServiceId].ToString();
1112:                                                      }
1113:                                                      else l.Text = "Error: Service '" + serviceRequest.ServiceId + "' not found. ";
1114:   
1115:                                                      break;
1116:                                                  };
1117:   
1118:                                              case "staffFrameworkPerformanceStaffLabel": l.Text = (userId != Guid.Empty) ? l.Text = (from _s in Ia.Ngn.Cl.Model.Data.Staff.List where _s.UserId == userId select _s.FirstAndMiddleName).SingleOrDefault() : string.Empty; break;
1119:   
1120:                                              case "serviceRequestHistoryStatusLabel": l.Text = Ia.Ngn.Cl.Model.Data.ServiceRequest.SystemCode[serviceRequestHistory.Status].ToString(); break;
1121:                                              case "serviceRequestHistoryEndDateTimeLabel":
1122:                                                  {
1123:                                                      if (serviceRequestHistory.EndDateTime == Ia.Ngn.Cl.Model.Business.Administration.SqlFriendlyJanuary1st1753NullDateTime)
1124:                                                      {
1125:                                                          l.Text = string.Empty;
1126:                                                      }
1127:                                                      else l.Text = serviceRequestHistory.EndDateTime.ToString("yyyy-MM-dd");
1128:   
1129:                                                      break;
1130:                                                  };
1131:                                              case "serviceRequestHistoryServiceIdLabel":
1132:                                                  {
1133:                                                      if (Ia.Ngn.Cl.Model.Data.ServiceRequest.ServiceSortedList.ContainsKey(serviceRequestHistory.ServiceId))
1134:                                                      {
1135:                                                          l.Text = Ia.Ngn.Cl.Model.Data.ServiceRequest.ServiceSortedList[serviceRequestHistory.ServiceId].ToString();
1136:                                                      }
1137:                                                      else l.Text = "Error: Service '" + serviceRequestHistory.ServiceId + "' not found. ";
1138:   
1139:                                                      break;
1140:                                                  };
1141:                                              case "serviceRequestHistoryServiceCategoryIdLabel": l.Text = Ia.Ngn.Cl.Model.Data.ServiceRequest.ServiceCategorySortedList[serviceRequestHistory.ServiceCategoryId].ToString(); break;
1142:   
1143:                                              case "serviceRequestServiceCategoryIdLabel": l.Text = Ia.Ngn.Cl.Model.Data.ServiceRequest.ServiceCategorySortedList[serviceRequest.ServiceCategoryId].ToString(); break;
1144:                                              case "serviceRequestCustomerNameLabel": l.Text = serviceRequest.CustomerName; break;
1145:                                              case "serviceRequestServiceServiceTypeLabel": l.Text = Ia.Ngn.Cl.Model.Data.ServiceRequest.ServiceSortedList[serviceRequestService.ServiceType].ToString(); break;
1146:                                              case "serviceRequestServiceTypeLabel": l.Text = "??"; break;
1147:                                              case "serviceRequestServiceProvisionedLabel": l.Text = Ia.Cl.Model.Default.YesNo(serviceRequestService.Provisioned); break;
1148:                                              case "serviceRequestServiceProvisionedArabicLabel": l.Text = Ia.Cl.Model.Default.YesNoInArabic(serviceRequestService.Provisioned); break;
1149:                                              case "serviceRequestServiceCallWaitingLabel": l.Text = Ia.Cl.Model.Default.YesNo(serviceRequestService.CallWaiting); break;
1150:                                              case "serviceRequestServiceCallForwardingLabel": l.Text = Ia.Cl.Model.Default.YesNo(serviceRequestService.CallForwarding); break;
1151:                                              case "serviceRequestServiceAlarmCallLabel": l.Text = Ia.Cl.Model.Default.YesNo(serviceRequestService.AlarmCall); break;
1152:                                              case "serviceRequestServiceInternationalCallingUserControlledLabel": l.Text = Ia.Cl.Model.Default.YesNo(serviceRequestService.InternationalCallingUserControlled); break;
1153:                                              case "serviceRequestServiceInternationalCallingLabel": l.Text = Ia.Cl.Model.Default.YesNo(serviceRequestService.InternationalCalling); break;
1154:                                              case "serviceRequestServiceCallerIdLabel": l.Text = Ia.Cl.Model.Default.YesNo(serviceRequestService.CallerId); break;
1155:                                              case "serviceRequestServiceConferenceCallLabel": l.Text = Ia.Cl.Model.Default.YesNo(serviceRequestService.ConferenceCall); break;
1156:                                              case "serviceRequestServiceAbbriviatedCallingLabel": l.Text = Ia.Cl.Model.Default.YesNo(serviceRequestService.AbbriviatedCalling); break;
1157:                                              case "serviceRequestServiceCallBarringLabel": l.Text = Ia.Cl.Model.Default.YesNo(serviceRequestService.CallBarring); break;
1158:                                              case "serviceRequestServiceServiceSuspensionLabel": l.Text = Ia.Cl.Model.Default.YesNo(serviceRequestService.ServiceSuspension); break;
1159:   
1160:                                              case "accessAreaLabel": l.Text = (from kna in Ia.Ngn.Cl.Model.Data.Service.KuwaitNgnAreaList where kna.Id == access.AreaId select kna.ArabicName).SingleOrDefault(); break;
1161:                                              case "accessOltLabel": l.Text = (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OltList where o.Id == access.Olt select o.AmsName).SingleOrDefault(); break;
1162:                                              case "accessBlockLabel": l.Text = access.Block.ToString(); break;
1163:                                              case "accessStreetLabel": l.Text = access.Street; break;
1164:                                              case "accessPremisesOldLabel": l.Text = access.PremisesOld; break;
1165:                                              case "accessPremisesNewLabel": l.Text = access.PremisesNew; break;
1166:                                              case "accessPaciLabel": l.Text = access.Paci; break;
1167:                                              case "accessNoteLabel": l.Text = access.Note; break;
1168:                                              case "accessStaffNameLabel": l.Text = (from _s in Ia.Ngn.Cl.Model.Data.Staff.List where _s.UserId == access.UserId select _s.FirstName).SingleOrDefault(); break;
1169:                                              case "accessOntFamilyTypeCapacityLabel":
1170:                                                  {
1171:                                                      // temp: later quickly find vendor from accessId
1172:                                                      if (access.Onts != null && access.Onts.Count > 0)
1173:                                                      {
1174:                                                          l.Text = Ia.Ngn.Cl.Model.Data.Nokia.Ont.FamilyTypeFromId(access.Onts.FirstOrDefault().FamilyTypeId);
1175:   
1176:                                                          l.Text += " (" + Ia.Ngn.Cl.Model.Business.Nokia.Ams.PossibleNumberOfTdForOntFamilyType(access.Onts.FirstOrDefault().FamilyTypeId) + ")";
1177:                                                      }
1178:                                                      else if (access.EmsOnts != null && access.EmsOnts.Count > 0)
1179:                                                      {
1180:                                                          l.Text = access.EmsOnts.FirstOrDefault().FamilyType.ToString().ToUpper();
1181:   
1182:                                                          l.Text += " (" + access.EmsOnts.FirstOrDefault().EquipmentType.TelPorts + ")";
1183:                                                      }
1184:                                                      else l.Text = string.Empty;
1185:   
1186:                                                      break;
1187:                                                  }
1188:   
1189:                                              case "accessFamilyTypeInAreaBlockLabel": l.Text = (from kna in Ia.Ngn.Cl.Model.Data.Service.KuwaitNgnAreaList where kna.Id == accessFamilyTypeInAreaBlock.AreaId select kna.NameArabicName).SingleOrDefault(); break;
1190:   
1191:                                              case "service2ServiceTypeLabel": l.Text = Ia.Ngn.Cl.Model.Data.Service.ServiceType(service2.ServiceType).ColoredNameArabicName; break;
1192:                                              case "service2CallWaitingLabel": l.Text = Ia.Cl.Model.Default.YesNo(service2.CallWaiting); break;
1193:                                              case "service2CallForwardingLabel": l.Text = Ia.Cl.Model.Default.YesNo(service2.CallForwarding); break;
1194:                                              case "service2AlarmCallLabel": l.Text = Ia.Cl.Model.Default.YesNo(service2.AlarmCall); break;
1195:                                              case "service2InternationalCallingUserControlledLabel": l.Text = Ia.Cl.Model.Default.YesNo(service2.InternationalCallingUserControlled); break;
1196:                                              case "service2InternationalCallingLabel": l.Text = Ia.Cl.Model.Default.YesNo(service2.InternationalCalling); break;
1197:                                              case "service2CallerIdLabel": l.Text = Ia.Cl.Model.Default.YesNo(service2.CallerId); break;
1198:                                              case "service2ConferenceCallLabel": l.Text = Ia.Cl.Model.Default.YesNo(service2.ConferenceCall); break;
1199:                                              case "service2AbbriviatedCallingLabel": l.Text = Ia.Cl.Model.Default.YesNo(service2.AbbriviatedCalling); break;
1200:                                              case "service2CallBarringLabel": l.Text = Ia.Cl.Model.Default.YesNo(service2.CallBarring); break;
1201:                                              case "service2ServiceSuspensionLabel": l.Text = Ia.Cl.Model.Default.YesNo(service2.ServiceSuspension); break;
1202:   
1203:                                              case "isPrimaryAgcfGatewayRecordLabel": l.Text = Ia.Cl.Model.Default.YesNo(agcfGatewayRecord.IsPrimary); break;
1204:   
1205:                                              case "ontFamilyTypeLabel": l.Text = Ia.Ngn.Cl.Model.Data.Nokia.Ont.FamilyTypeFromId(ont.FamilyTypeId); break;
1206:                                              case "ontStateIdLabel": l.Text = Ia.Ngn.Cl.Model.Data.Nokia.Ams.BellcoreStateFromId(ont.StateId); break;
1207:                                              case "ontServiceVoipStateIdLabel": l.Text = Ia.Ngn.Cl.Model.Data.Nokia.Ams.BellcoreStateFromId(ontServiceVoip.StateId); break;
1208:                                              case "ontServiceVoipMgcIpLabel": l.Text = ontServiceVoip.MgcIp; break;
1209:                                              case "ontOntPotsStateIdLabel": l.Text = Ia.Ngn.Cl.Model.Data.Nokia.Ams.BellcoreStateFromId(ontOntPots.StateId); break;
1210:                                              case "ontVendorLabel": l.Text = Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.VendorNameFromId(ont.VendorId); break;
1211:   
1212:                                              case "userNameLabel": l.Text = membershipUser.UserName; break;
1213:                                              case "userEmailLabel": l.Text = membershipUser.Email; break;
1214:   
1215:                                              case "staffIsHeadLabel": l.Text = Ia.Cl.Model.Default.YesNoInArabic(staff.IsHead); break;
1216:                                              case "staffFirstNameLabel": l.Text = staff.FirstName; break;
1217:                                              case "staffMiddleNameLabel": l.Text = staff.MiddleName; break;
1218:                                              case "staffLastNameLabel": l.Text = staff.LastName; break;
1219:                                              case "staffIpPbxExtensionLabel": l.Text = staff.IpPbxExtension; break;
1220:                                              case "staffEmploymentIdLabel": l.Text = staff.EmploymentId.ToString(); break;
1221:                                              case "staffAdministrativeFrameworkIdLabel": l.Text = (from f in Ia.Ngn.Cl.Model.Data.Administration.FrameworkList where f.Id == staff.AdministrativeFrameworkId select f.ArabicName).SingleOrDefault(); break;
1222:                                              case "staffIdentityUserIdLabel": l.Text = Ia.Cl.Model.Identity.UserNameDictionary[staff.UserId]; break;
1223:                                              case "staffUserEmailLabel":
1224:                                                  {
1225:                                                      userList = Ia.Cl.Model.Identity.UserList;
1226:   
1227:                                                      l.Text = (from u in userList where u.ProviderUserKey == staff.UserId select u.Email).SingleOrDefault();
1228:                                                      break;
1229:                                                  }
1230:   
1231:                                              case "contactFirstNameLabel": l.Text = contact.FirstName; break;
1232:                                              case "contactMiddleNameLabel": l.Text = contact.MiddleName; break;
1233:                                              case "contactLastNameLabel": l.Text = contact.LastName; break;
1234:                                              case "contactCompanyLabel": l.Text = contact.Company; break;
1235:                                              case "contactEmailLabel": l.Text = contact.Email; break;
1236:                                              case "contactPhoneLabel": l.Text = contact.Phone; break;
1237:                                              case "contactAddressLabel": l.Text = contact.Address; break;
1238:                                              case "contactApprovedLabel": l.Text = Ia.Cl.Model.Default.YesNoInArabic(contact.IsApproved); break;
1239:                                              case "contactUrlLabel": l.Text = contact.Url; break;
1240:                                              case "contactNoteLabel": l.Text = contact.Note; break;
1241:                                              case "contactUserIdLabel": l.Text = contact.UserId.ToString(); break;
1242:   
1243:                                              case "reportUserNameLabel": l.Text = "?"; break;
1244:                                              case "reportStaffFrameworkLabel":
1245:                                                  {
1246:                                                      if (Ia.Ngn.Cl.Model.Business.Administration.IsFrameworkGuid(report.UserId))
1247:                                                      {
1248:                                                          arabicNameBracketParentArabicNameBracket = (from f in Ia.Ngn.Cl.Model.Data.Administration.FrameworkList where f.Guid == report.UserId select f.ArabicNameBracketParentArabicNameBracket).SingleOrDefault();
1249:   
1250:                                                          l.Text = arabicNameBracketParentArabicNameBracket;
1251:                                                      }
1252:                                                      else
1253:                                                      {
1254:                                                          firstAndMiddleNameBracketFrameworkArabicNameAndFrameworkParentArabicNameBracket = (from _s in Ia.Ngn.Cl.Model.Data.Staff.List where _s.UserId == report.UserId select _s.FirstAndMiddleNameBracketFrameworkArabicNameAndFrameworkParentArabicNameBracket).SingleOrDefault();
1255:   
1256:                                                          l.Text = firstAndMiddleNameBracketFrameworkArabicNameAndFrameworkParentArabicNameBracket;
1257:                                                      }
1258:   
1259:                                                      SetTableCellHtmlTextWriteStyleDirectionAccordingToPresenceOfArabicLetters(ref e, ref l);
1260:   
1261:                                                      /*
1262:                                                      if (report.LastReportHistory.UserId == staffMembershipUser.UserId)
1263:                                                      {
1264:                                                          //e.Row.BackColor = System.Drawing.Color.SlateGray;
1265:                                                      }
1266:                                                      */
1267:   
1268:                                                      break;
1269:                                                  }
1270:                                              case "accessAreaStatisticLabel": l.Text = (from kna in Ia.Ngn.Cl.Model.Data.Service.KuwaitNgnAreaList where kna.Id == areaId select kna.ArabicName).SingleOrDefault(); break;
1271:   
1272:   
1273:                                              case "subscriberCallWaitingLabel":
1274:                                                  {
1275:                                                      l.Text = Ia.Cl.Model.Default.YesNo(subscriber.CallWaiting);
1276:   
1277:                                                      break;
1278:                                                  }
1279:                                              case "subPartyIsSipLabel":
1280:                                                  {
1281:                                                      l.Text = Ia.Cl.Model.Default.YesNo(Ia.Ngn.Cl.Model.Business.Nokia.SubParty.IsSip(subParty.PrimaryPUIDCPEProfileNumber));
1282:   
1283:                                                      break;
1284:                                                  }
1285:                                              case "subscriberCallForwardingLabel":
1286:                                                  {
1287:                                                      l.Text = Ia.Cl.Model.Default.YesNo(subscriber.CallForwarding);
1288:   
1289:                                                      break;
1290:                                                  }
1291:                                              case "subscriberAlarmCallLabel":
1292:                                                  {
1293:                                                      l.Text = Ia.Cl.Model.Default.YesNo(subscriber.AlarmCall);
1294:   
1295:                                                      break;
1296:                                                  }
1297:                                              case "subscriberInternationalCallingUserControlledLabel":
1298:                                                  {
1299:                                                      l.Text = Ia.Cl.Model.Default.YesNo(subscriber.InternationalCallingUserControlled);
1300:   
1301:                                                      break;
1302:                                                  }
1303:                                              case "subscriberInternationalCallingLabel":
1304:                                                  {
1305:                                                      l.Text = Ia.Cl.Model.Default.YesNo(subscriber.InternationalCalling);
1306:   
1307:                                                      break;
1308:                                                  }
1309:                                              case "subscriberCallerIdLabel":
1310:                                                  {
1311:                                                      l.Text = Ia.Cl.Model.Default.YesNo(subscriber.CallerId);
1312:   
1313:                                                      break;
1314:                                                  }
1315:                                              case "subscriberConferenceCallLabel":
1316:                                                  {
1317:                                                      l.Text = Ia.Cl.Model.Default.YesNo(subscriber.ConferenceCall);
1318:   
1319:                                                      break;
1320:                                                  }
1321:                                              case "subscriberAbbriviatedCallingLabel":
1322:                                                  {
1323:                                                      l.Text = Ia.Cl.Model.Default.YesNo(subscriber.AbbriviatedCalling);
1324:   
1325:                                                      break;
1326:                                                  }
1327:                                              case "subscriberCallBarringLabel":
1328:                                                  {
1329:                                                      l.Text = "?"; // Ia.Cl.Model.Default.YesNo(subscriber.??);
1330:   
1331:                                                      break;
1332:                                                  }
1333:                                              case "subscriberServiceSuspensionLabel":
1334:                                                  {
1335:                                                      l.Text = "?"; // Ia.Cl.Model.Default.YesNo(subscriber.ServiceSuspension);
1336:   
1337:                                                      break;
1338:                                                  }
1339:   
1340:   
1341:                                              case "nddOntPonPositionLabel": l.Text = nddOnt.Pon.Position; break;
1342:                                              case "nddOntPonOltOdfSiteNameLabel": l.Text = nddOnt.Pon.PonGroup.Olt.Odf.Router.Site.Name; break;
1343:                                              case "nddOntPonOltOdfSiteNameArabicNameLabel": l.Text = nddOnt.Pon.PonGroup.Olt.Odf.Router.Site.Name + " (" + nddOnt.Pon.PonGroup.Olt.Odf.Router.Site.ArabicName + ")"; break;
1344:                                              case "nddOntPonOltAmsNameLabel": l.Text = nddOnt.Pon.PonGroup.Olt.AmsName; break;
1345:                                              case "nddOntPonOltAreaLabel": l.Text = nddOnt.Pon.PonGroup.Olt.Symbol; break;
1346:                                              case "nddOntPrimarySwitchLabel": l.Text = nddOnt.PrimarySwitch; break;
1347:                                              case "nddOntPonOltFieldTypeLabel": l.Text = Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.FieldTypeColoredString(nddOnt.Pon.PonGroup.Olt.FieldType); break;
1348:                                              case "nddOntPonOltIsSipLabel": l.Text = Ia.Cl.Model.Default.YesNo(nddOnt.Pon.PonGroup.Olt.IsSip); break;
1349:   
1350:                                              case "nddOntMgcIpLabel": l.Text = nddOnt.MgcIp; break;
1351:                                              case "nddOntMgcSecondaryIpLabel": l.Text = nddOnt.MgcSecondaryIp; break;
1352:                                              case "nddOntPonOltVlanLabel": l.Text = "?"; break; // nddOnt.Pon.PonGroup.Olt.Vlan.ToString(); break;
1353:                                              case "nddOntPonOltNetworkNumberLabel": l.Text = nddOnt.Pon.PonGroup.NetworkNumber; break;
1354:                                              case "nddOntPonOltGatewayIpLabel": l.Text = nddOnt.Pon.PonGroup.GatewayIp; break;
1355:                                              case "nddOntImsServiceLabel": l.Text = nddOnt.ImsService.ToString(); break;
1356:                                              case "nddOntImsFsdbLabel": l.Text = nddOnt.ImsFsdb; break;
1357:   
1358:                                              case "nddOntProposedNameLabel":
1359:                                                  {
1360:                                                      if (nddOnt.Pon.PonGroup.HasNewProposedPonList)
1361:                                                      {
1362:                                                          l.Text = nddOnt.Access.ProposedName;
1363:                                                      }
1364:                                                      else
1365:                                                      {
1366:                                                          ((GridView)e.Row.Parent.Parent).Columns[5].Visible = false;
1367:                                                          // 5 is position (0 based) of HeaderText="Proposed Name"
1368:                                                      }
1369:   
1370:                                                      break;
1371:                                                  }
1372:   
1373:                                              case "nddOntPonOltOdfAccessVendorNameLabel": l.Text = nddOnt.Pon.PonGroup.Olt.Odf.Vendor.Name; break;
1374:                                              case "nddOntPonOltOdfRouterSwitchVendorNameLabel": l.Text = nddOnt.Pon.PonGroup.Olt.Odf.Router.Vendor.Name; break;
1375:   
1376:                                              case "serviceExemptionNoteLabel": l.Text = serviceExemption.Note; break;
1377:                                              case "serviceExemptionStaffNameLabel": l.Text = (from _s in Ia.Ngn.Cl.Model.Data.Staff.List where _s.UserId == serviceExemption.UserId select _s.FirstName).SingleOrDefault(); break;
1378:   
1379:                                              case "serviceRequestAreaLabel": l.Text = (from kna in Ia.Ngn.Cl.Model.Data.Service.KuwaitNgnAreaList where kna.Id == serviceRequest.AreaId select kna.ArabicName).SingleOrDefault(); break;
1380:                                              case "serviceRequestOntAreaLabel": l.Text = (from kna in Ia.Ngn.Cl.Model.Data.Service.KuwaitNgnAreaList where kna.Symbol == serviceRequestOnt.AreaSymbol select kna.ArabicName).SingleOrDefault(); break;
1381:   
1382:                                              case "serviceRequestOntDetailServiceTypeLabel": l.Text = Ia.Ngn.Cl.Model.Data.ServiceRequest.ServiceSortedList[serviceRequestOntDetail.ServiceType].ToString(); break;
1383:   
1384:                                              default: break;
1385:   
1386:   
1387:                                          }
1388:                                      }
1389:                                      else if (control.Controls[0].GetType().ToString() == "System.Web.UI.WebControls.HyperLink")
1390:                                      {
1391:                                          HyperLink hl = (HyperLink)control.Controls[0];
1392:   
1393:                                          switch (hl.ID)
1394:                                          {
1395:                                              case "reportServiceHyperLink":
1396:                                                  {
1397:                                                      s = Ia.Ngn.Cl.Model.Business.Service.ServiceName(report.Service, report.ServiceType);
1398:                                                      hl.Text = s;
1399:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + s;
1400:                                                      break;
1401:                                                  }
1402:                                              case "reportAccessServiceRequestServiceHyperLink":
1403:                                                  {
1404:                                                      s = Ia.Ngn.Cl.Model.Business.Service.ServiceName(reportAccessServiceRequest.Report.Service, reportAccessServiceRequest.Report.ServiceType);
1405:                                                      hl.Text = s;
1406:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + s;
1407:                                                      break;
1408:                                                  }
1409:                                              case "serviceRequestNumberSerialHyperLink":
1410:                                                  {
1411:                                                      hl.Text = serviceRequest.Number + "/" + serviceRequest.Serial;
1412:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + serviceRequest.Number;
1413:                                                      break;
1414:                                                  }
1415:                                              case "serviceRequestCustomerNameHyperLink":
1416:                                                  {
1417:                                                      hl.Text = serviceRequest.CustomerName;
1418:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + HttpUtility.UrlEncode(serviceRequest.CustomerName);
1419:                                                      break;
1420:                                                  }
1421:                                              case "impuHuSbrHyperLink":
1422:                                                  {
1423:                                                      hl.Text = huSbr.IMPU;
1424:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + HttpUtility.UrlEncode(huSbr.IMPU);
1425:                                                      break;
1426:                                                  }
1427:                                              case "impuOwsbrHyperLink":
1428:                                                  {
1429:                                                      hl.Text = owsbr.IMPU;
1430:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + HttpUtility.UrlEncode(owsbr.IMPU);
1431:                                                      break;
1432:                                                  }
1433:                                              case "seruattrUsrnumHyperLink":
1434:                                                  {
1435:                                                      hl.Text = seruattr.USRNUM;
1436:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + HttpUtility.UrlEncode(seruattr.USRNUM);
1437:                                                      break;
1438:                                                  }
1439:                                              case "axeSubscriberSnbHyperLink":
1440:                                                  {
1441:                                                      hl.Text = axeSubscriber.SNB.ToString();
1442:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + HttpUtility.UrlEncode(axeSubscriber.SNB.ToString());
1443:                                                      break;
1444:                                                  }
1445:                                              case "accessPositionHyperLink":
1446:                                                  {
1447:                                                      hl.Text = access.Position;
1448:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + access.Position;
1449:   
1450:                                                      break;
1451:                                                  }
1452:                                              case "ontSerialHyperLink":
1453:                                                  {
1454:                                                      hl.Text = ont.Serial;
1455:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + ont.Serial;
1456:                                                      break;
1457:                                                  }
1458:                                              case "reportAccessServiceRequestAccessNameHyperLink":
1459:                                                  {
1460:                                                      hl.Text = reportAccessServiceRequest.Access.Name;
1461:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + reportAccessServiceRequest.Access.Name;
1462:                                                      break;
1463:                                                  }
1464:                                              case "nddOntNameHyperLink":
1465:                                                  {
1466:                                                      hl.Text = nddOnt.Access.Name;
1467:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + nddOnt.Access.Name;
1468:                                                      break;
1469:                                                  }
1470:                                              case "nddOntPonNameHyperLink":
1471:                                                  {
1472:                                                      hl.Text = nddOnt.Pon.Name;
1473:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + nddOnt.Pon.Name;
1474:                                                      break;
1475:                                                  }
1476:                                              case "nddOntPositionHyperLink":
1477:                                                  {
1478:                                                      hl.Text = nddOnt.Position;
1479:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + nddOnt.Position;
1480:                                                      break;
1481:                                                  }
1482:                                              case "nddOntIpHyperLink":
1483:                                                  {
1484:                                                      hl.Text = nddOnt.Ip;
1485:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + nddOnt.Ip;
1486:                                                      break;
1487:                                                  }
1488:                                              case "serviceRequestServiceServiceHyperLink":
1489:                                                  {
1490:                                                      s = Ia.Ngn.Cl.Model.Business.Service.ServiceName(serviceRequestService.Service, serviceRequestService.ServiceType);
1491:   
1492:                                                      hl.Text = s;
1493:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + s;
1494:                                                      break;
1495:                                                  }
1496:                                              case "serviceRequestServiceAccessNameHyperLink":
1497:                                                  {
1498:                                                      if (serviceRequestService.Access != null)
1499:                                                      {
1500:                                                          hl.Text = serviceRequestService.Access.Name;
1501:                                                          hl.NavigateUrl = "~/maintenance/find.aspx?input=" + serviceRequestService.Access.Name;
1502:                                                      }
1503:                                                      break;
1504:                                                  }
1505:                                              case "serviceRequestNumberHyperLink":
1506:                                                  {
1507:                                                      hl.Text = serviceRequest.Number.ToString();
1508:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + serviceRequest.Number.ToString();
1509:                                                      break;
1510:                                                  }
1511:                                              case "serviceRequestCustomerIdHyperLink":
1512:                                                  {
1513:                                                      hl.Text = serviceRequest.CustomerId.ToString();
1514:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + serviceRequest.CustomerId.ToString() + "&inputType=" + Ia.Ngn.Cl.Model.Business.ServiceRequest.ServiceRequestCustomerIdInputTypeString;
1515:                                                      break;
1516:                                                  }
1517:                                              case "serviceRequestHistoryNumberHyperLink":
1518:                                                  {
1519:                                                      hl.Text = serviceRequestHistory.Number.ToString();
1520:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + serviceRequestHistory.Number.ToString();
1521:                                                      break;
1522:                                                  }
1523:                                              case "accessOdfHyperLink":
1524:                                                  {
1525:                                                      hl.Text = access.Odf;
1526:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + access.Odf;
1527:                                                      break;
1528:                                                  }
1529:                                              case "accessNameHyperLink":
1530:                                                  {
1531:                                                      hl.Text = access.Name;
1532:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + access.Name;
1533:                                                      break;
1534:                                                  }
1535:                                              case "accessBlockHyperLink":
1536:                                                  {
1537:                                                      int i;
1538:                                                      string areaSymbol;
1539:   
1540:                                                      if (int.TryParse(access.Block, out i))
1541:                                                      {
1542:                                                          hl.Text = access.Block;
1543:                                                          areaSymbol = (from kna in Ia.Ngn.Cl.Model.Data.Service.KuwaitNgnAreaList where kna.Id == access.AreaId select kna.Symbol).SingleOrDefault();
1544:   
1545:                                                          if (!string.IsNullOrEmpty(areaSymbol))
1546:                                                          {
1547:                                                              hl.NavigateUrl = "~/maintenance/find.aspx?input=" + areaSymbol + "," + access.Block;
1548:                                                          }
1549:                                                          else
1550:                                                          {
1551:   
1552:                                                          }
1553:                                                      }
1554:                                                      else
1555:                                                      {
1556:   
1557:                                                      }
1558:   
1559:                                                      break;
1560:                                                  }
1561:   
1562:                                              case "service2ServiceHyperLink":
1563:                                                  {
1564:                                                      s = Ia.Ngn.Cl.Model.Business.Service.ServiceName(service2.Service, service2.ServiceType);
1565:   
1566:                                                      hl.Text = s;
1567:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + s;
1568:                                                      break;
1569:                                                  }
1570:                                              case "service2AccessNameHyperLink":
1571:                                                  {
1572:                                                      if (service2.AccessName != null)
1573:                                                      {
1574:                                                          hl.Text = service2.AccessName;
1575:                                                          hl.NavigateUrl = "~/maintenance/find.aspx?input=" + service2.AccessName;
1576:                                                      }
1577:                                                      break;
1578:                                                  }
1579:   
1580:                                              case "newOntEventAccessNameHyperLink":
1581:                                                  {
1582:                                                      if (newOntEvent.AccessName != null)
1583:                                                      {
1584:                                                          hl.Text = newOntEvent.AccessName;
1585:                                                          hl.NavigateUrl = "~/maintenance/find.aspx?input=" + newOntEvent.AccessName;
1586:                                                      }
1587:                                                      break;
1588:                                                  }
1589:                                              case "serviceExemptionServiceLabel":
1590:                                                  {
1591:                                                      s = Ia.Ngn.Cl.Model.Business.Service.ServiceName(serviceExemption.Service, serviceExemption.ServiceType);
1592:   
1593:                                                      hl.Text = s;
1594:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + s;
1595:                                                      break;
1596:                                                  }
1597:                                              case "gwIdAgcfGatewayRecordHyperLink":
1598:                                                  {
1599:                                                      hl.Text = agcfGatewayRecord.GwId.ToString();
1600:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + agcfGatewayRecord.GwId;
1601:                                                      break;
1602:                                                  }
1603:                                              case "ip1AgcfGatewayRecordHyperLink":
1604:                                                  {
1605:                                                      hl.Text = agcfGatewayRecord.IP1;
1606:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + agcfGatewayRecord.IP1;
1607:                                                      break;
1608:                                                  }
1609:                                              case "ip2AgcfGatewayRecordHyperLink":
1610:                                                  {
1611:                                                      hl.Text = agcfGatewayRecord.IP2;
1612:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + agcfGatewayRecord.IP2;
1613:                                                      break;
1614:                                                  }
1615:                                              case "gwIdAgcfEndpointHyperLink":
1616:                                                  {
1617:                                                      hl.Text = agcfEndpoint.GwId.ToString();
1618:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + agcfEndpoint.GwId.ToString();
1619:                                                      break;
1620:                                                  }
1621:                                              case "subPartyDisplayNameHyperLink":
1622:                                                  {
1623:                                                      hl.Text = subParty.DisplayName;
1624:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + subParty.DisplayName;
1625:                                                      break;
1626:                                                  }
1627:                                              case "ontServiceVoipIpHyperLink":
1628:                                                  {
1629:                                                      hl.Text = ontServiceVoip.Ip.ToString();
1630:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + ontServiceVoip.Ip.ToString();
1631:                                                      break;
1632:                                                  }
1633:                                              case "reportHistoryHyperLink":
1634:                                                  {
1635:                                                      //hl.Text = "<img src=" + Ia.Cl.Model.Default.AbsoluteUrl(page) + "/image/legend/history.png class=icon alt=History width=19 height=19 />";
1636:                                                      hl.NavigateUrl = "~/maintenance/report/history.aspx?reportId=" + report.Id;
1637:                                                      break;
1638:                                                  }
1639:                                              case "reportHistoryServiceHyperLink":
1640:                                                  {
1641:                                                      s = Ia.Ngn.Cl.Model.Business.Service.ServiceName(reportHistory.Report.Service, reportHistory.Report.ServiceType);
1642:   
1643:                                                      hl.Text = s;
1644:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + s;
1645:                                                      break;
1646:                                                  }
1647:                                              case "serviceServiceAccessNameHyperLink":
1648:                                                  {
1649:                                                      if (serviceAccessName.Service != null)
1650:                                                      {
1651:                                                          hl.Text = serviceAccessName.Service;
1652:                                                          hl.NavigateUrl = "~/maintenance/find.aspx?input=" + serviceAccessName.Service;
1653:                                                      }
1654:                                                      break;
1655:                                                  }
1656:                                              case "accessNameServiceAccessNameHyperLink":
1657:                                                  {
1658:                                                      if (serviceAccessName.AccessName != null)
1659:                                                      {
1660:                                                          hl.Text = serviceAccessName.AccessName;
1661:                                                          hl.NavigateUrl = "~/maintenance/find.aspx?input=" + serviceAccessName.AccessName;
1662:                                                      }
1663:                                                      break;
1664:                                                  }
1665:                                              case "serviceRequestOntDetailServiceHyperLink":
1666:                                                  {
1667:                                                      s = Ia.Ngn.Cl.Model.Business.Service.ServiceName(serviceRequestOntDetail.Service, serviceRequestOntDetail.ServiceType);
1668:   
1669:                                                      hl.Text = s;
1670:                                                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + s;
1671:                                                      break;
1672:                                                  }
1673:                                              default: break;
1674:                                          }
1675:                                      }
1676:                                      else if (control.Controls[0].GetType().ToString() == "System.Web.UI.WebControls.TextBox")
1677:                                      {
1678:                                          TextBox tb = (TextBox)control.Controls[0];
1679:   
1680:                                          switch (tb.ID)
1681:                                          {
1682:                                              case "staffEmploymentIdTextBox": tb.Text = staff.EmploymentId.ToString(); break;
1683:                                              case "staffFirstNameTextBox": tb.Text = staff.FirstName; break;
1684:                                              case "staffMiddleNameTextBox": tb.Text = staff.MiddleName; break;
1685:                                              case "staffLastNameTextBox": tb.Text = staff.LastName; break;
1686:                                              case "staffIpPbxExtensionTextBox": tb.Text = staff.IpPbxExtension; break;
1687:   
1688:                                              case "contactFirstNameTextBox": tb.Text = contact.FirstName; break;
1689:                                              case "contactMiddleNameTextBox": tb.Text = contact.MiddleName; break;
1690:                                              case "contactLastNameTextBox": tb.Text = contact.LastName; break;
1691:                                              case "contactCompanyTextBox": tb.Text = contact.Company; break;
1692:                                              case "contactEmailTextBox": tb.Text = contact.Email; break;
1693:                                              case "contactPhoneTextBox": tb.Text = contact.Phone; break;
1694:                                              case "contactAddressTextBox": tb.Text = contact.Address; break;
1695:                                              case "contactUrlTextBox": tb.Text = contact.Url; break;
1696:                                              case "contactNoteTextBox": tb.Text = contact.Note; break;
1697:   
1698:                                              case "userNameTextBox": tb.Text = membershipUser.UserName; break;
1699:                                              case "userEmailTextBox": tb.Text = membershipUser.Email; break;
1700:                                              case "accessBlockTextBox": tb.Text = access.Block.ToString(); break;
1701:                                              case "accessStreetTextBox": tb.Text = access.Street; break;
1702:                                              case "accessPremisesOldTextBox": tb.Text = access.PremisesOld; break;
1703:                                              case "accessPremisesNewTextBox": tb.Text = access.PremisesNew; break;
1704:                                              case "accessPaciTextBox": tb.Text = access.Paci; break;
1705:                                              case "accessNoteTextBox": tb.Text = access.Note; break;
1706:   
1707:                                              case "serviceExemptionNoteTextBox": tb.Text = serviceExemption.Note; break;
1708:   
1709:                                              default: break;
1710:                                          }
1711:                                      }
1712:                                      else if (control.Controls[0].GetType().ToString() == "System.Web.UI.WebControls.DropDownList")
1713:                                      {
1714:                                          DropDownList ddl = (DropDownList)control.Controls[0];
1715:   
1716:                                          switch (ddl.ID)
1717:                                          {
1718:                                              case "staffAdministrativeFrameworkIdDropDownList":
1719:                                                  {
1720:                                                      ddl.DataSource = Ia.Ngn.Cl.Model.Data.Administration.FrameworkList;
1721:                                                      ddl.DataValueField = "Id";
1722:                                                      ddl.DataTextField = "FullyQualifiedArabicName";
1723:                                                      ddl.DataBind();
1724:   
1725:                                                      ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByValue(staff.AdministrativeFrameworkId.ToString()));
1726:                                                      break;
1727:                                                  }
1728:   
1729:                                              case "staffIdentityUserIdDropDownList":
1730:                                                  {
1731:                                                      ddl.Items.Clear();
1732:   
1733:                                                      userList = Ia.Cl.Model.Identity.UserList;
1734:   
1735:                                                      ddl.DataSource = userList;
1736:                                                      ddl.DataValueField = "ProviderUserKey";
1737:                                                      ddl.DataTextField = "UserName";
1738:                                                      ddl.DataBind();
1739:   
1740:                                                      ddl.Items.Insert(0, new ListItem("Empty Guid", Guid.Empty.ToString()));
1741:                                                      ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByValue(staff.UserId.ToString()));
1742:                                                      break;
1743:                                                  }
1744:   
1745:                                              default: break;
1746:                                          }
1747:                                      }
1748:                                      else if (control.Controls[0].GetType().ToString() == "System.Web.UI.WebControls.CheckBox")
1749:                                      {
1750:                                          CheckBox cb = (CheckBox)control.Controls[0];
1751:   
1752:                                          switch (cb.ID)
1753:                                          {
1754:                                              case "staffIsHeadCheckBox": cb.Checked = staff.IsHead; break;
1755:                                              case "contactApprovedCheckBox": cb.Checked = contact.IsApproved; break;
1756:                                              default: break;
1757:                                          }
1758:                                      }
1759:                                      else if (control.Controls[0].GetType().ToString() == "System.Web.UI.WebControls.Image")
1760:                                      {
1761:                                          Image im = (Image)control.Controls[0];
1762:   
1763:                                          switch (im.ID)
1764:                                          {
1765:                                              case "deleteImage": break;
1766:                                              case "historyImage": break;
1767:                                              case "nddOntPonOltOdfAccessVendorIconImage":
1768:                                                  {
1769:                                                      vendor = (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList where o.Id == nddOnt.Id select o.Pon.PonGroup.Olt.Odf.Vendor).SingleOrDefault();
1770:                                                      im.ImageUrl = vendor.ImageUrl;
1771:                                                      im.ToolTip = vendor.Name;
1772:                                                      break;
1773:                                                  }
1774:                                              case "nddOntPonOltOdfRouterSwitchVendorIconImage":
1775:                                                  {
1776:                                                      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();
1777:                                                      im.ImageUrl = vendor.ImageUrl;
1778:                                                      im.ToolTip = vendor.Name;
1779:                                                      break;
1780:                                                  }
1781:                                              /*
1782:                                          case "ontAccessOntPonOltOdfVendorIconImage":
1783:                                              {
1784:                                                  vendor = (from q in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList where q.Id == ont.Id select q.Pon.PonGroup.Olt.Odf.Vendor).SingleOrDefault();
1785:                                                  im.ImageUrl = vendor.ImageUrl;
1786:                                                  im.ToolTip = vendor.Name;
1787:                                                  break;
1788:                                              }
1789:                                              */
1790:                                              case "accessOntPonOltOdfVendorIconImage":
1791:                                                  {
1792:                                                      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();
1793:                                                      im.ImageUrl = vendor.ImageUrl;
1794:                                                      im.ToolTip = vendor.Name;
1795:                                                      break;
1796:                                                  }
1797:                                              default: break;
1798:                                          }
1799:                                      }
1800:                                      else
1801:                                      {
1802:   
1803:                                      }
1804:                                  }
1805:                              }
1806:                              catch (Exception)
1807:                              {
1808:                              }
1809:                          }
1810:                      }
1811:                      else if (e.Row.RowType == DataControlRowType.Footer)
1812:                      {
1813:                      }
1814:                      else
1815:                      {
1816:                      }
1817:                  }
1818:                  else
1819:                  {
1820:                  }
1821:              }
1822:              else
1823:              {
1824:              }
1825:          }
1826:   
1827:          ////////////////////////////////////////////////////////////////////////////
1828:   
1829:          /// <summary>
1830:          ///
1831:          /// </summary>
1832:          public static void SetTableCellHtmlTextWriteStyleDirectionAccordingToPresenceOfArabicLetters(ref GridViewRowEventArgs gridViewRowEventArgs, ref Label l)
1833:          {
1834:              TableCell tableCell;
1835:   
1836:              // table cell direction depending on if text has Arabic
1837:              if (!string.IsNullOrEmpty(l.Text))
1838:              {
1839:                  if (Ia.Cl.Model.Language.HasArabicLetter(l.Text))
1840:                  {
1841:                      tableCell = gridViewRowEventArgs.Row.FindControl(l.ID).Parent as TableCell;
1842:                      //tableCell.HorizontalAlign = HorizontalAlign.Right;
1843:                      tableCell.Style[HtmlTextWriterStyle.Direction] = "rtl";
1844:                  }
1845:              }
1846:          }
1847:   
1848:          ////////////////////////////////////////////////////////////////////////////
1849:          ////////////////////////////////////////////////////////////////////////////
1850:   
1851:          /// <summary>
1852:          ///
1853:          /// </summary>
1854:          public static void DropDownList_DataBound(System.Web.UI.Page page, object sender, EventArgs e, Ia.Ngn.Cl.Model.Staff staff)
1855:          {
1856:              string kuwaitNgnAreaListString;
1857:              DropDownList ddl;
1858:              List<Ia.Ngn.Cl.Model.Business.Service.KuwaitNgnArea> kuwaitNgnAreaList;
1859:   
1860:              ddl = (DropDownList)sender;
1861:   
1862:              foreach (ListItem listItem in ddl.Items)
1863:              {
1864:                  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();
1865:   
1866:                  if (kuwaitNgnAreaList != null && kuwaitNgnAreaList.Count > 0)
1867:                  {
1868:                      kuwaitNgnAreaListString = string.Join(", ", kuwaitNgnAreaList.Select(n => n.ArabicName).ToArray());
1869:                  }
1870:                  else kuwaitNgnAreaListString = null;
1871:   
1872:                  listItem.Text = kuwaitNgnAreaListString;
1873:              }
1874:          }
1875:   
1876:          ////////////////////////////////////////////////////////////////////////////
1877:   
1878:          /// <summary>
1879:          ///
1880:          /// </summary>
1881:          public static void DropDownList_DataBound(System.Web.UI.Page page, object sender, EventArgs e)
1882:          {
1883:              DropDownList_DataBound(page, sender, e, null);
1884:          }
1885:   
1886:          ////////////////////////////////////////////////////////////////////////////
1887:          ////////////////////////////////////////////////////////////////////////////
1888:   
1889:          /// <summary>
1890:          ///
1891:          /// </summary>
1892:          public static void DataList_ItemDataBound(System.Web.UI.Page page, object sender, DataListItemEventArgs e)
1893:          {
1894:              bool senderKnown;
1895:              string s, senderId;
1896:              DataList dataList;
1897:   
1898:              senderKnown = true;
1899:              dataList = (DataList)sender;
1900:              senderId = dataList.ID;
1901:   
1902:              string accessName;
1903:   
1904:              accessName = null;
1905:   
1906:              switch (senderId)
1907:              {
1908:                  case "accessNameDataList":
1909:                      {
1910:                          //access = (e.Item.DataItem as Ia.Ngn.Cl.Model.Access);
1911:                          accessName = (e.Item.DataItem as string);
1912:                          break;
1913:                      }
1914:                  default:
1915:                      senderKnown = false;
1916:                      break;
1917:              }
1918:   
1919:              senderKnown = true;
1920:   
1921:              if (senderKnown)
1922:              {
1923:                  if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
1924:                  {
1925:                      //CheckBox chk = e.Item.FindControl("AApBlue") as CheckBox;
1926:                      //Label lbl = e.Item.FindControl("Label1") as Label;
1927:   
1928:                      //chk.Checked = (lbl.Text == "Y") ? true : false;
1929:   
1930:                      HyperLink hl = e.Item.FindControl("accessNameHyperLink") as HyperLink;
1931:   
1932:                      hl.Text = accessName;
1933:                      hl.NavigateUrl = "~/maintenance/find.aspx?input=" + accessName;
1934:                  }
1935:   
1936:                  //foreach (DataListItem dataListItem in dataList.Items)
1937:                  // {
1938:                  foreach (Control control in dataList.Controls) // dataListItem.Controls)
1939:                  {
1940:                      try
1941:                      {
1942:                          if (control is Label)
1943:                          {
1944:                              // CheckBox cb = (CheckBox)control.Controls[0];
1945:                              Label l = (Label)control;
1946:   
1947:                              switch (l.ID)
1948:                              {
1949:                                  /*
1950:                                  case "accessAreaLabel": l.Text = (from kna in Ia.Ngn.Cl.Model.Data.Service.KuwaitNgnAreaList where kna.Id == accessName.AreaId select kna.ArabicName).SingleOrDefault(); break;
1951:                                  case "accessOltLabel": l.Text = (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OltList where o.Id == accessName.Olt select o.AmsName).SingleOrDefault(); break;
1952:                                  case "accessBlockLabel": l.Text = accessName.Block.ToString(); break;
1953:                                  case "accessStreetLabel": l.Text = accessName.Street; break;
1954:                                  case "accessPremisesOldLabel": l.Text = accessName.PremisesOld; break;
1955:                                  case "accessPremisesNewLabel": l.Text = accessName.PremisesNew; break;
1956:                                  case "accessPaciLabel": l.Text = accessName.Paci; break;
1957:                                  case "accessNoteLabel": l.Text = accessName.Note; break;
1958:                                  case "accessStaffNameLabel": l.Text = (from _s in Ia.Ngn.Cl.Model.Data.Staff.List where _s.UserId == accessName.UserId select _s.FirstName).SingleOrDefault(); break;
1959:                                  */    /*
1960:                                  case "accessOntFamilyTypeCapacityLabel":
1961:                                      {
1962:                                          // temp: later quickly find vendor from accessId
1963:                                          try
1964:                                          {
1965:                                              if (access.Onts != null && access.Onts.Count > 0)
1966:                                              {
1967:                                                  l.Text = Ia.Ngn.Cl.Model.Data.Nokia.Ont.FamilyTypeFromId(access.Onts.FirstOrDefault().FamilyTypeId);
1968:  
1969:                                                  l.Text += " (" + Ia.Ngn.Cl.Model.Business.Nokia.Ams.PossibleNumberOfTdForOntFamilyType(access.Onts.FirstOrDefault().FamilyTypeId) + ")";
1970:                                              }
1971:                                              else l.Text = string.Empty;
1972:                                          }
1973:                                          catch (Exception)// ex)
1974:                                          {
1975:                                              l.Text = string.Empty;
1976:                                          }
1977:  
1978:                                          break;
1979:                                      }
1980:  
1981:                                  case "accessFamilyTypeInAreaBlockLabel": l.Text = (from kna in Ia.Ngn.Cl.Model.Data.Service.KuwaitNgnAreaList where kna.Id == accessFamilyTypeInAreaBlock.AreaId select kna.NameArabicName).SingleOrDefault(); break;
1982:                                  */
1983:                              }
1984:                          }
1985:                          else if (control is HyperLink) // .GetType().ToString() == "System.Web.UI.WebControls.HyperLink")
1986:                          {
1987:                              HyperLink hl = (HyperLink)control;
1988:   
1989:                              switch (hl.ID)
1990:                              {
1991:                                  case "accessNameHyperLink":
1992:                                      {
1993:                                          hl.Text = accessName; //.Name;
1994:                                          hl.NavigateUrl = "~/maintenance/find.aspx?input=" + accessName; //.Name;
1995:                                          break;
1996:                                      }
1997:                                  default:
1998:                                      {
1999:                                          break;
2000:                                      }
2001:                              }
2002:                          }
2003:                          else
2004:                          {
2005:   
2006:                          }
2007:                      }
2008:                      catch (Exception)
2009:                      {
2010:   
2011:                      }
2012:                  }
2013:                  //}
2014:              }
2015:              else
2016:              {
2017:   
2018:              }
2019:          }
2020:   
2021:          ////////////////////////////////////////////////////////////////////////////
2022:          ////////////////////////////////////////////////////////////////////////////
2023:   
2024:          /// <summary>
2025:          ///
2026:          /// </summary>
2027:          public static void FormView_DataBound(System.Web.UI.Page page, object sender, EventArgs e)
2028:          {
2029:          }
2030:   
2031:          ////////////////////////////////////////////////////////////////////////////
2032:          ////////////////////////////////////////////////////////////////////////////
2033:   
2034:          /// <summary>
2035:          /// https://stackoverflow.com/questions/9715983/how-to-get-the-cell-value-by-column-name-not-by-index-in-gridview-in-asp-net
2036:          /// </summary>
2037:          private static int GetColumnIndexByName(GridViewRow row, string columnName)
2038:          {
2039:              int columnIndex = 0;
2040:              foreach (DataControlFieldCell cell in row.Cells)
2041:              {
2042:                  if (cell.ContainingField is BoundField)
2043:                      if (((BoundField)cell.ContainingField).DataField.Equals(columnName))
2044:                          break;
2045:                  columnIndex++; // keep adding 1 while we don't have the correct name
2046:              }
2047:              return columnIndex;
2048:          }
2049:   
2050:          ////////////////////////////////////////////////////////////////////////////
2051:          ////////////////////////////////////////////////////////////////////////////
2052:      }
2053:   
2054:      ////////////////////////////////////////////////////////////////////////////
2055:      ////////////////////////////////////////////////////////////////////////////
2056:  }