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