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

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