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

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Ont

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

Huawei's Ont support class of Next Generation Network'a (NGN's) data model.

   1:  using Microsoft.EntityFrameworkCore;
   2:  using System;
   3:  using System.Collections;
   4:  using System.Collections.Generic;
   5:  using System.Data;
   6:  using System.Linq;
   7:  using System.Text;
   8:   
   9:  namespace Ia.Ngn.Cl.Model.Data.Huawei
  10:  {
  11:      ////////////////////////////////////////////////////////////////////////////
  12:   
  13:      /// <summary publish="true">
  14:      /// Huawei's Ont support class of Next Generation Network'a (NGN's) data model.
  15:      /// </summary>
  16:      /// 
  17:      /// <remarks> 
  18:      /// Copyright © 2016-2019 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
  19:      ///
  20:      /// 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
  21:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  22:      ///
  23:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  24:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  25:      /// 
  26:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  27:      /// 
  28:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  29:      /// </remarks> 
  30:      public partial class Ont
  31:      {
  32:          /// <summary/>
  33:          public Ont() { }
  34:   
  35:          ////////////////////////////////////////////////////////////////////////////
  36:   
  37:          /// <summary>
  38:          ///
  39:          /// </summary>
  40:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsOnt> List()
  41:          {
  42:              List<Ia.Ngn.Cl.Model.Huawei.EmsOnt> list;
  43:   
  44:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
  45:              {
  46:                  list = (from o in db.EmsOnts select o).ToList();
  47:              }
  48:   
  49:              return list;
  50:          }
  51:   
  52:          ////////////////////////////////////////////////////////////////////////////
  53:   
  54:          /// <summary>
  55:          ///
  56:          /// </summary>
  57:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsOnt> ListIncludeAccess()
  58:          {
  59:              List<Ia.Ngn.Cl.Model.Huawei.EmsOnt> list;
  60:   
  61:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
  62:              {
  63:                  list = (from o in db.EmsOnts select o).Include(u => u.Access).ToList();
  64:              }
  65:   
  66:              return list;
  67:          }
  68:   
  69:          ////////////////////////////////////////////////////////////////////////////
  70:   
  71:          /// <summary>
  72:          ///
  73:          /// </summary>
  74:          public static List<string> IdList()
  75:          {
  76:              List<string> list;
  77:   
  78:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
  79:              {
  80:                  list = (from o in db.EmsOnts select o.Id).ToList();
  81:              }
  82:   
  83:              return list;
  84:          }
  85:   
  86:          ////////////////////////////////////////////////////////////////////////////
  87:   
  88:          /// <summary>
  89:          ///
  90:          /// </summary>
  91:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsOnt> ListByDidFnSnPn(int did, int fn, int sn, int pn)
  92:          {
  93:              List<Ia.Ngn.Cl.Model.Huawei.EmsOnt> list;
  94:   
  95:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
  96:              {
  97:                  list = (from o in db.EmsOnts where o.DID == did && o.FN == fn && o.SN == sn && o.PN == pn select o).ToList();
  98:              }
  99:   
 100:              return list;
 101:          }
 102:   
 103:          ////////////////////////////////////////////////////////////////////////////
 104:   
 105:          /// <summary>
 106:          ///
 107:          /// </summary>
 108:          public static List<Ia.Ngn.Cl.Model.Huawei.EmsOnt> ListByDid(int did)
 109:          {
 110:              List<Ia.Ngn.Cl.Model.Huawei.EmsOnt> list;
 111:   
 112:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 113:              {
 114:                  list = (from o in db.EmsOnts where o.DID == did select o).Include(u => u.Access).ToList();
 115:              }
 116:   
 117:              return list;
 118:          }
 119:   
 120:          ////////////////////////////////////////////////////////////////////////////
 121:   
 122:          /// <summary>
 123:          ///
 124:          /// </summary>
 125:          public static Ia.Ngn.Cl.Model.Huawei.EmsOnt ReadByDidFnSnPnOntId(int did, int fn, int sn, int pn, int ontId)
 126:          {
 127:              Ia.Ngn.Cl.Model.Huawei.EmsOnt item;
 128:   
 129:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 130:              {
 131:                  item = (from o in db.EmsOnts where o.DID == did && o.FN == fn && o.SN == sn && o.PN == pn && o.ONTID == ontId select o).SingleOrDefault();
 132:              }
 133:   
 134:              return item;
 135:          }
 136:   
 137:          ////////////////////////////////////////////////////////////////////////////
 138:   
 139:          /// <summary>
 140:          ///
 141:          /// </summary>
 142:          public static Ia.Ngn.Cl.Model.Huawei.EmsOnt Read(string id)
 143:          {
 144:              Ia.Ngn.Cl.Model.Huawei.EmsOnt item;
 145:   
 146:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 147:              {
 148:                  item = (from o in db.EmsOnts where o.Id == id select o).SingleOrDefault(); // use Id to connecto MduDev.NddOntId instead.Include(u => u.Access).SingleOrDefault();
 149:              }
 150:   
 151:              return item;
 152:          }
 153:   
 154:          ////////////////////////////////////////////////////////////////////////////
 155:   
 156:          /// <summary>
 157:          ///
 158:          /// </summary>
 159:          public static Ia.Ngn.Cl.Model.Huawei.EmsOnt ReadWithAccess(string id)
 160:          {
 161:              Ia.Ngn.Cl.Model.Huawei.EmsOnt item;
 162:   
 163:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 164:              {
 165:                  item = (from o in db.EmsOnts where o.Id == id select o).Include(u => u.Access).SingleOrDefault();
 166:              }
 167:   
 168:              return item;
 169:          }
 170:   
 171:          /*
 172:          ////////////////////////////////////////////////////////////////////////////
 173:  
 174:          /// <summary>
 175:          ///
 176:          /// </summary>
 177:          public static List<Ia.Ngn.Cl.Model.Huawei.Ont> List(string portId)
 178:          {
 179:              List<Ia.Ngn.Cl.Model.Huawei.Ont> list;
 180:  
 181:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 182:              {
 183:                  list = (from o in db.EmsOnts where o.Port.Id == portId select o).ToList();
 184:              }
 185:  
 186:              return list;
 187:          }
 188:          */
 189:   
 190:          /*
 191:          ////////////////////////////////////////////////////////////////////////////
 192:  
 193:          /// <summary>
 194:          ///
 195:          /// </summary>
 196:          public static List<Ia.Ngn.Cl.Model.Huawei.Ont> ListByBoardId(string boardId)
 197:          {
 198:              List<Ia.Ngn.Cl.Model.Huawei.Ont> list;
 199:  
 200:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 201:              {
 202:                  list = (from o in db.EmsOnts where o.Port.Board.Id == boardId select o).ToList();
 203:              }
 204:  
 205:              return list;
 206:          }
 207:          */
 208:   
 209:          /*
 210:          ////////////////////////////////////////////////////////////////////////////
 211:  
 212:          /// <summary>
 213:          ///
 214:          /// </summary>
 215:          public static List<Ia.Ngn.Cl.Model.Huawei.Ont> ListByDevId(int devId)
 216:          {
 217:              List<Ia.Ngn.Cl.Model.Huawei.Ont> list;
 218:  
 219:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 220:              {
 221:                  list = (from o in db.EmsOnts where o.Port.Board.Dev.Id == devId select o).ToList();
 222:              }
 223:  
 224:              return list;
 225:          }
 226:          */
 227:   
 228:          ////////////////////////////////////////////////////////////////////////////
 229:   
 230:          /// <summary>
 231:          ///
 232:          /// </summary>
 233:          public static Dictionary<string, string> IdToAccessIdDictionary
 234:          {
 235:              get
 236:              {
 237:                  Dictionary<string, string> dictionary, nullDictionary;
 238:   
 239:                  using (var db = new Ia.Ngn.Cl.Model.Ngn())
 240:                  {
 241:                      dictionary = (from s in db.EmsOnts
 242:                                    where s.Access != null
 243:                                    select new
 244:                                    {
 245:                                        s.Id,
 246:                                        s.Access
 247:                                    }).ToDictionary(u => u.Id, u => u.Access.Id);
 248:   
 249:                      nullDictionary = (from s in db.Onts where s.Access == null select s.Id).ToDictionary(u => u, null);
 250:                  }
 251:   
 252:                  return dictionary.Union(nullDictionary).ToDictionary(u => u.Key, u => u.Value);
 253:              }
 254:          }
 255:   
 256:          ////////////////////////////////////////////////////////////////////////////
 257:   
 258:          /// <summary>
 259:          ///
 260:          /// </summary>
 261:          public static Dictionary<string, Ia.Ngn.Cl.Model.Huawei.EmsOnt> IdToOntDictionary
 262:          {
 263:              get
 264:              {
 265:                  Dictionary<string, Ia.Ngn.Cl.Model.Huawei.EmsOnt> dictionary;
 266:   
 267:                  using (var db = new Ia.Ngn.Cl.Model.Ngn())
 268:                  {
 269:                      dictionary = (from s in db.EmsOnts
 270:                                    where s.Access != null
 271:                                    select new { OntId = s.Id, Ont = s }).ToDictionary(u => u.OntId, u => u.Ont);
 272:                  }
 273:   
 274:                  return dictionary;
 275:              }
 276:          }
 277:   
 278:          ////////////////////////////////////////////////////////////////////////////
 279:   
 280:          /// <summary>
 281:          ///
 282:          /// </summary>
 283:          public static Dictionary<string, Ia.Ngn.Cl.Model.Huawei.EmsOnt> AccessIdToOntDictionary
 284:          {
 285:              get
 286:              {
 287:                  Dictionary<string, Ia.Ngn.Cl.Model.Huawei.EmsOnt> dictionary;
 288:   
 289:                  using (var db = new Ia.Ngn.Cl.Model.Ngn())
 290:                  {
 291:                      dictionary = (from s in db.EmsOnts
 292:                                    where s.Access != null
 293:                                    select new { OntAccessId = s.Access.Id, Ont = s }).ToDictionary(u => u.OntAccessId, u => u.Ont);
 294:                  }
 295:   
 296:                  return dictionary;
 297:              }
 298:          }
 299:   
 300:          ////////////////////////////////////////////////////////////////////////////
 301:   
 302:          /// <summary>
 303:          ///
 304:          /// </summary>
 305:          public static Hashtable IdWithNullAccessHashtable
 306:          {
 307:              get
 308:              {
 309:                  List<string> list;
 310:                  Hashtable ht;
 311:   
 312:                  using (var db = new Ia.Ngn.Cl.Model.Ngn())
 313:                  {
 314:                      list = (from eo in db.EmsOnts where eo.Access == null select eo.Id).ToList();
 315:   
 316:                      if (list.Count > 0)
 317:                      {
 318:                          ht = new Hashtable(list.Count);
 319:   
 320:                          foreach (string s in list) ht[s] = null;
 321:                      }
 322:                      else ht = null;
 323:                  }
 324:   
 325:                  return ht;
 326:              }
 327:          }
 328:   
 329:          ////////////////////////////////////////////////////////////////////////////
 330:   
 331:          /// <summary>
 332:          ///
 333:          /// </summary>
 334:          public static Dictionary<string, string> IdToAliasForNonNullAccessDictionary
 335:          {
 336:              get
 337:              {
 338:                  Dictionary<string, string> dictionary;
 339:   
 340:                  using (var db = new Ia.Ngn.Cl.Model.Ngn())
 341:                  {
 342:                      dictionary = (from eo in db.EmsOnts
 343:                                    where eo.Access != null
 344:                                    select new
 345:                                    {
 346:                                        eo.Id,
 347:                                        eo.ALIAS
 348:                                    }).ToDictionary(u => u.Id, u => u.ALIAS);
 349:                  }
 350:   
 351:                  return dictionary;
 352:              }
 353:          }
 354:   
 355:          ////////////////////////////////////////////////////////////////////////////
 356:   
 357:          /// <summary>
 358:          ///
 359:          /// </summary>
 360:          public static Dictionary<string, int> DistributionOfEquipmentIdInEmsOntWhereAccessIsNotNullDictionary
 361:          {
 362:              get
 363:              {
 364:                  Dictionary<string, int> dictionary;
 365:   
 366:                  using (var db = new Ia.Ngn.Cl.Model.Ngn())
 367:                  {
 368:                      var v = (from s in db.EmsOnts where s.Access != null group s by s.EQUIPMENTID into g select new { EquipmentId = g.Key, Count = g.Count() });
 369:                      dictionary = v.ToDictionary(u => u.EquipmentId, u => u.Count);
 370:                  }
 371:   
 372:                  return dictionary;
 373:              }
 374:          }
 375:   
 376:          ////////////////////////////////////////////////////////////////////////////
 377:   
 378:          /// <summary>
 379:          ///
 380:          /// </summary>
 381:          public static bool Update(Ia.Ngn.Cl.Model.Business.Huawei.Ems.Response response, out Ia.Cl.Model.Result result)
 382:          {
 383:              bool isUpdated;
 384:              int did, dictionaryDid, fn, sn, pn, ontId, queryFn, querySn, queryPn, queryOntId, readItemCount, existingItemCount, insertedItemCount, updatedItemCount, deletedItemCount;
 385:              string id, queryCommand, queryDev, accessId;
 386:              DataColumnCollection columns;
 387:              DataRow dataRow;
 388:              Dictionary<string, int> devToDidDictionary;
 389:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Pon pon;
 390:              Ia.Ngn.Cl.Model.Huawei.EmsOnt ont, newOnt;
 391:              Ia.Ngn.Cl.Model.Huawei.EmsPort port;
 392:              //List<string> itemIdList;
 393:              //List<Ia.Ngn.Cl.Model.Huawei.EmsOnt> ontList;
 394:   
 395:              isUpdated = false;
 396:              readItemCount = existingItemCount = insertedItemCount = updatedItemCount = deletedItemCount = 0;
 397:              result = new Ia.Cl.Model.Result();
 398:   
 399:              queryCommand = response.CommandFromCorrelationTagDictionaryByCtag;
 400:   
 401:              // "LST-ONT::DEV=" + ont.Pon.PonGroup.Olt.EmsName + ",FN=0,SN=" + sn + ",PN=" + pn + ",ONTID=" + ontId + ":{ctag}::;";
 402:              queryDev = Ia.Cl.Model.Default.Match(queryCommand, @"DEV=(.+?),");
 403:              queryFn = int.Parse(Ia.Cl.Model.Default.Match(queryCommand, @"FN=(\d+)"));
 404:              querySn = int.Parse(Ia.Cl.Model.Default.Match(queryCommand, @"SN=(\d+)"));
 405:              queryPn = int.Parse(Ia.Cl.Model.Default.Match(queryCommand, @"PN=(\d+)"));
 406:              queryOntId = int.Parse(Ia.Cl.Model.Default.Match(queryCommand, @"ONTID=(\d+)"));
 407:   
 408:              if (response.CompletionCode == "COMPLD")
 409:              {
 410:                  devToDidDictionary = Ia.Ngn.Cl.Model.Data.Huawei.Dev.DevToDidDictionary;
 411:   
 412:                  if (devToDidDictionary.ContainsKey(queryDev))
 413:                  {
 414:                      dictionaryDid = devToDidDictionary[queryDev];
 415:   
 416:                      port = Ia.Ngn.Cl.Model.Data.Huawei.Port.ReadByDidFnSnPn(dictionaryDid, queryFn, querySn, queryPn);
 417:   
 418:                      if (port != null)
 419:                      {
 420:                          //itemIdList = new List<string>(readItemCount + 1);
 421:   
 422:                          pon = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.PonByOltEmsNameAndSnAndPnAndOptionallyOntId(queryDev, querySn, queryPn, queryOntId);
 423:   
 424:                          if (pon != null)
 425:                          {
 426:                              id = Ia.Ngn.Cl.Model.Business.Huawei.Ont.OntId(pon.Id, queryOntId);
 427:   
 428:                              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 429:                              {
 430:                                  //ontList = (from eo in db.EmsOnts where eo.EmsPort.Id == port.Id select eo).ToList();
 431:   
 432:                                  ont = (from eo in db.EmsOnts where eo.Id == id select eo).SingleOrDefault();
 433:   
 434:                                  if (ont != null) existingItemCount = 1;
 435:   
 436:                                  if (response.QueryDataTable != null)
 437:                                  {
 438:                                      columns = response.QueryDataTable.Columns;
 439:                                      readItemCount = response.QueryDataTable.Rows.Count;
 440:   
 441:                                      if (readItemCount == 1)
 442:                                      {
 443:                                          dataRow = response.QueryDataTable.Rows[0];
 444:   
 445:                                          did = int.Parse(dataRow[columns.IndexOf("DID")].ToString());
 446:                                          fn = int.Parse(dataRow[columns.IndexOf("FN")].ToString());
 447:                                          sn = int.Parse(dataRow[columns.IndexOf("SN")].ToString());
 448:                                          pn = int.Parse(dataRow[columns.IndexOf("PN")].ToString());
 449:                                          ontId = int.Parse(dataRow[columns.IndexOf("ONTID")].ToString());
 450:   
 451:                                          if (fn == queryFn && sn == querySn && pn == queryPn && ontId == queryOntId)
 452:                                          {
 453:                                              newOnt = new Ia.Ngn.Cl.Model.Huawei.EmsOnt()
 454:                                              {
 455:                                                  Id = id,
 456:                                                  DID = did,
 457:                                                  ResultCode = (long)response.ResultCode,
 458:                                                  StateId = (int)Ia.Ngn.Cl.Model.Business.Huawei.Ems.BellcoreState.Unknown, // (int)response.ResultCode,
 459:                                                  FN = fn,
 460:                                                  SN = sn,
 461:                                                  PN = pn,
 462:                                                  ONTID = ontId,
 463:                                                  NAME = columns.Contains("NAME") ? dataRow[columns.IndexOf("NAME")].ToString() : string.Empty,
 464:                                                  ALIAS = columns.Contains("ALIAS") ? dataRow[columns.IndexOf("ALIAS")].ToString() : string.Empty,
 465:                                                  CAPABPROF = columns.Contains("CAPABPROF") ? dataRow[columns.IndexOf("CAPABPROF")].ToString() : string.Empty,
 466:                                                  VENDORID = columns.Contains("VENDORID") ? dataRow[columns.IndexOf("VENDORID")].ToString() : string.Empty,
 467:                                                  EQUIPMENTID = columns.Contains("EQUIPMENTID") ? dataRow[columns.IndexOf("EQUIPMENTID")].ToString() : string.Empty,
 468:                                                  MAINSOFTVERSION = columns.Contains("MAINSOFTVERSION") ? dataRow[columns.IndexOf("MAINSOFTVERSION")].ToString() : string.Empty,
 469:                                                  AUTH = columns.Contains("AUTH") ? dataRow[columns.IndexOf("AUTH")].ToString() : string.Empty,
 470:                                                  AUTHTIMEOUT = columns.Contains("AUTHTIMEOUT") ? Ia.Ngn.Cl.Model.Business.Huawei.Ont.SpecialIntegerParameterHandling("AUTHTIMEOUT", dataRow[columns.IndexOf("AUTHTIMEOUT")].ToString()) : 0,
 471:                                                  LINEPROF = columns.Contains("LINEPROF") ? dataRow[columns.IndexOf("LINEPROF")].ToString() : string.Empty,
 472:                                                  SRVPROF = columns.Contains("SRVPROF") ? dataRow[columns.IndexOf("SRVPROF")].ToString() : string.Empty,
 473:                                                  SERIALNUM = columns.Contains("SERIALNUM") ? dataRow[columns.IndexOf("SERIALNUM")].ToString() : string.Empty,
 474:                                                  LOID = columns.Contains("LOID") ? dataRow[columns.IndexOf("LOID")].ToString() : string.Empty,
 475:                                                  CHECKCODE = columns.Contains("CHECKCODE") ? dataRow[columns.IndexOf("CHECKCODE")].ToString() : string.Empty,
 476:                                                  PWD = columns.Contains("PWD") ? dataRow[columns.IndexOf("PWD")].ToString() : string.Empty,
 477:                                                  ALMPROF = columns.Contains("ALMPROF") ? dataRow[columns.IndexOf("ALMPROF")].ToString() : string.Empty,
 478:                                                  DEV = columns.Contains("DEV") ? dataRow[columns.IndexOf("DEV")].ToString() : string.Empty,
 479:                                                  VLAN = columns.Contains("VLAN") ? int.Parse(dataRow[columns.IndexOf("VLAN")].ToString()) : 0,
 480:                                                  PRI = columns.Contains("PRI") ? int.Parse(dataRow[columns.IndexOf("PRI")].ToString()) : 0,
 481:                                                  IP = columns.Contains("IP") ? dataRow[columns.IndexOf("IP")].ToString() : string.Empty,
 482:                                                  MASK = columns.Contains("MASK") ? dataRow[columns.IndexOf("MASK")].ToString() : string.Empty,
 483:                                                  GATE = columns.Contains("GATE") ? dataRow[columns.IndexOf("GATE")].ToString() : string.Empty,
 484:                                                  ROUTEIP = columns.Contains("ROUTEIP") ? dataRow[columns.IndexOf("ROUTEIP")].ToString() : string.Empty,
 485:                                                  ROUTEMASK = columns.Contains("ROUTEMASK") ? dataRow[columns.IndexOf("ROUTEMASK")].ToString() : string.Empty,
 486:                                                  NEXTHOP = columns.Contains("NEXTHOP") ? dataRow[columns.IndexOf("NEXTHOP")].ToString() : string.Empty,
 487:                                                  SNMPPROF = columns.Contains("SNMPPROF") ? dataRow[columns.IndexOf("SNMPPROF")].ToString() : string.Empty,
 488:                                                  OPTALMPROF = columns.Contains("OPTALMPROF") ? dataRow[columns.IndexOf("OPTALMPROF")].ToString() : string.Empty,
 489:                                                  VAPROF = columns.Contains("VAPROF") ? dataRow[columns.IndexOf("VAPROF")].ToString() : string.Empty,
 490:                                                  MACLEARN = columns.Contains("MACLEARN") ? dataRow[columns.IndexOf("MACLEARN")].ToString() : string.Empty,
 491:                                                  SRVLEVELPROF = columns.Contains("SRVLEVELPROF") ? dataRow[columns.IndexOf("SRVLEVELPROF")].ToString() : string.Empty,
 492:                                                  LSTUPTIME = columns.Contains("LSTUPTIME") ? int.Parse(dataRow[columns.IndexOf("LSTUPTIME")].ToString()) : 0,
 493:                                                  LSTDOWNTIME = columns.Contains("LSTDOWNTIME") ? int.Parse(dataRow[columns.IndexOf("LSTDOWNTIME")].ToString()) : 0,
 494:                                                  DEVCURRENTTIME = columns.Contains("DEVCURRENTTIME") ? int.Parse(dataRow[columns.IndexOf("DEVCURRENTTIME")].ToString()) : 0,
 495:                                                  VASPROFILESET = columns.Contains("VASPROFILESET") ? dataRow[columns.IndexOf("VASPROFILESET")].ToString() : string.Empty,
 496:                                                  HARDWAREVERSION = columns.Contains("HARDWAREVERSION") ? dataRow[columns.IndexOf("HARDWAREVERSION")].ToString() : string.Empty,
 497:                                                  OPERSTATE = columns.Contains("OPERSTATE") ? dataRow[columns.IndexOf("OPERSTATE")].ToString() : string.Empty,
 498:                                                  DEVNAME = columns.Contains("DEVNAME") ? dataRow[columns.IndexOf("DEVNAME")].ToString() : string.Empty,
 499:                                                  BINDWIDTHTYPE = columns.Contains("BINDWIDTHTYPE") ? int.Parse(dataRow[columns.IndexOf("BINDWIDTHTYPE")].ToString()) : 0,
 500:                                                  EmsPort = (from ep in db.EmsPorts where ep.Id == port.Id select ep).SingleOrDefault()
 501:                                              };
 502:   
 503:                                              accessId = Ia.Ngn.Cl.Model.Business.Access.AccessId(id);
 504:                                              if (accessId != null) newOnt.Access = (from a in db.Accesses where a.Id == accessId select a).SingleOrDefault();
 505:   
 506:                                              if (ont == null)
 507:                                              {
 508:                                                  newOnt.Created = newOnt.Updated = DateTime.UtcNow.AddHours(3);
 509:   
 510:                                                  db.EmsOnts.Add(newOnt);
 511:   
 512:                                                  insertedItemCount++;
 513:                                              }
 514:                                              else // update
 515:                                              {
 516:                                                  // below: copy values from newOnt to ont
 517:   
 518:                                                  if (ont.Update(newOnt))
 519:                                                  {
 520:                                                      db.EmsOnts.Attach(ont);
 521:                                                      db.Entry(ont).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
 522:   
 523:                                                      updatedItemCount++;
 524:                                                  }
 525:                                              }
 526:                                          }
 527:                                          else
 528:                                          {
 529:                                              result.AddError("did, fn, sn, pn, and/or ontId is/are not equal to queryDid, queryFn, querySn, queryPn, and/or ontId. did: " + did + ", queryDid: " + queryDev + ", fn: " + fn + ", queryFn: " + queryFn + ", sn: " + sn + ", querySn: " + querySn + ", pn: " + pn + ", queryPn: " + queryPn + ", ontId: " + ontId + ", queryOntId: " + queryOntId);
 530:                                          }
 531:                                      }
 532:                                      else //if (readItemCount > 1)
 533:                                      {
 534:                                          result.AddError("dataTable.Rows.Count has more than 1 row");
 535:                                      }
 536:                                  }
 537:                                  else
 538:                                  {
 539:                                      // if DataTable is null or "Resource does not exist"
 540:                                      // delete element if exists
 541:   
 542:                                      if (ont != null)
 543:                                      {
 544:                                          db.EmsOnts.Remove(ont);
 545:   
 546:                                          deletedItemCount++;
 547:                                      }
 548:   
 549:                                      result.AddWarning("LST-ONT: " + response.CompletionCode + ", " + response.ResultCode.ToString());
 550:                                  }
 551:   
 552:                                  db.SaveChanges();
 553:                              }
 554:   
 555:                              if (insertedItemCount != 0 || updatedItemCount != 0 || deletedItemCount != 0) isUpdated = true;
 556:                              else isUpdated = false;
 557:   
 558:                              result.AddSuccess("LST-ONT: " + response.CompletionCode + ", " + response.ResultCode.ToString() + " (" + readItemCount + "/" + existingItemCount + "/" + insertedItemCount + "," + updatedItemCount + "," + deletedItemCount + ")");
 559:                          }
 560:                          else
 561:                          {
 562:                              result.AddWarning("NDD PON is null");
 563:                          }
 564:                      }
 565:                      else
 566:                      {
 567:                          result.AddWarning("port is null");
 568:                      }
 569:                  }
 570:                  else
 571:                  {
 572:                      result.AddError("devToDidDictionary does not contain key: " + queryDev);
 573:                  }
 574:              }
 575:              else
 576:              {
 577:                  result.AddWarning("LST-ONT: (" + response.CompletionCode + ", " + response.ResultCode.ToString() + ")");
 578:              }
 579:   
 580:              return isUpdated;
 581:          }
 582:   
 583:          ////////////////////////////////////////////////////////////////////////////
 584:   
 585:          /// <summary>
 586:          ///
 587:          /// </summary>
 588:          public static bool UpdateListWithDid(Ia.Ngn.Cl.Model.Business.Huawei.Ems.Response response, out Ia.Cl.Model.Result result)
 589:          {
 590:              bool isUpdated;
 591:              int queryDid, did, fn, sn, pn, ontId, readItemCount, existingItemCount, insertedItemCount, updatedItemCount, deletedItemCount;
 592:              string id, queryCommand, accessId;
 593:              DataColumnCollection columns;
 594:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Pon pon;
 595:              Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Olt olt;
 596:              Ia.Ngn.Cl.Model.Huawei.EmsOnt ont, newOnt;
 597:              Ia.Ngn.Cl.Model.Huawei.EmsPort port;
 598:              List<string> itemIdList;
 599:              List<Ia.Ngn.Cl.Model.Huawei.EmsOnt> ontList;
 600:   
 601:              isUpdated = false;
 602:              readItemCount = existingItemCount = insertedItemCount = updatedItemCount = deletedItemCount = 0;
 603:              result = new Ia.Cl.Model.Result();
 604:   
 605:              if (response.CompletionCode == "COMPLD")
 606:              {
 607:                  if (response.QueryDataTable != null)
 608:                  {
 609:                      queryCommand = response.CommandFromCorrelationTagDictionaryByCtag;
 610:   
 611:                      columns = response.QueryDataTable.Columns;
 612:                      readItemCount = response.QueryDataTable.Rows.Count;
 613:   
 614:                      // "LST-ONT::DID=" + olt.Did + ":{ctag}::;";
 615:                      queryDid = int.Parse(Ia.Cl.Model.Default.Match(queryCommand, @"DID=(\d+):"));
 616:   
 617:                      olt = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OltByDid(queryDid);
 618:   
 619:                      if (olt != null)
 620:                      {
 621:                          ontList = Ia.Ngn.Cl.Model.Data.Huawei.Ont.ListByDid(queryDid);
 622:                          existingItemCount = ontList.Count;
 623:   
 624:                          itemIdList = new List<string>(response.QueryDataTable.Rows.Count + 1);
 625:   
 626:                          using (var db = new Ia.Ngn.Cl.Model.Ngn())
 627:                          {
 628:                              foreach (DataRow dataRow in response.QueryDataTable.Rows)
 629:                              {
 630:                                  did = int.Parse(dataRow[columns.IndexOf("DID")].ToString());
 631:                                  fn = int.Parse(dataRow[columns.IndexOf("FN")].ToString());
 632:                                  sn = int.Parse(dataRow[columns.IndexOf("SN")].ToString());
 633:                                  pn = int.Parse(dataRow[columns.IndexOf("PN")].ToString());
 634:                                  ontId = int.Parse(dataRow[columns.IndexOf("ONTID")].ToString());
 635:   
 636:                                  port = Ia.Ngn.Cl.Model.Data.Huawei.Port.ReadByDidFnSnPn(queryDid, fn, sn, pn);
 637:   
 638:                                  if (port != null)
 639:                                  {
 640:                                      ontList = (from eo in db.EmsOnts where eo.EmsPort.Id == port.Id select eo).ToList();
 641:                                      // or ontList = Ia.Ngn.Cl.Model.Data.Huawei.Ont.List(port.Id);
 642:   
 643:                                      if (did == queryDid)
 644:                                      {
 645:                                          pon = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.PonByOltEmsNameAndSnAndPnAndOptionallyOntId(olt.EmsName, sn, pn, ontId);
 646:   
 647:                                          if (pon != null)
 648:                                          {
 649:                                              id = Ia.Ngn.Cl.Model.Business.Huawei.Ont.OntId(pon.Id, ontId);
 650:   
 651:                                              newOnt = new Ia.Ngn.Cl.Model.Huawei.EmsOnt()
 652:                                              {
 653:                                                  Id = id,
 654:                                                  DID = did,
 655:                                                  FN = fn,
 656:                                                  SN = sn,
 657:                                                  PN = pn,
 658:                                                  ONTID = ontId,
 659:                                                  NAME = columns.Contains("NAME") ? dataRow[columns.IndexOf("NAME")].ToString() : string.Empty,
 660:                                                  ALIAS = columns.Contains("ALIAS") ? dataRow[columns.IndexOf("ALIAS")].ToString() : string.Empty,
 661:                                                  CAPABPROF = columns.Contains("CAPABPROF") ? dataRow[columns.IndexOf("CAPABPROF")].ToString() : string.Empty,
 662:                                                  VENDORID = columns.Contains("VENDORID") ? dataRow[columns.IndexOf("VENDORID")].ToString() : string.Empty,
 663:                                                  EQUIPMENTID = columns.Contains("EQUIPMENTID") ? dataRow[columns.IndexOf("EQUIPMENTID")].ToString() : string.Empty,
 664:                                                  MAINSOFTVERSION = columns.Contains("MAINSOFTVERSION") ? dataRow[columns.IndexOf("MAINSOFTVERSION")].ToString() : string.Empty,
 665:                                                  AUTH = columns.Contains("AUTH") ? dataRow[columns.IndexOf("AUTH")].ToString() : string.Empty,
 666:                                                  AUTHTIMEOUT = columns.Contains("AUTHTIMEOUT") ? Ia.Ngn.Cl.Model.Business.Huawei.Ont.SpecialIntegerParameterHandling("AUTHTIMEOUT", dataRow[columns.IndexOf("AUTHTIMEOUT")].ToString()) : 0,
 667:                                                  LINEPROF = columns.Contains("LINEPROF") ? dataRow[columns.IndexOf("LINEPROF")].ToString() : string.Empty,
 668:                                                  SRVPROF = columns.Contains("SRVPROF") ? dataRow[columns.IndexOf("SRVPROF")].ToString() : string.Empty,
 669:                                                  SERIALNUM = columns.Contains("SERIALNUM") ? dataRow[columns.IndexOf("SERIALNUM")].ToString() : string.Empty,
 670:                                                  LOID = columns.Contains("LOID") ? dataRow[columns.IndexOf("LOID")].ToString() : string.Empty,
 671:                                                  CHECKCODE = columns.Contains("CHECKCODE") ? dataRow[columns.IndexOf("CHECKCODE")].ToString() : string.Empty,
 672:                                                  PWD = columns.Contains("PWD") ? dataRow[columns.IndexOf("PWD")].ToString() : string.Empty,
 673:                                                  ALMPROF = columns.Contains("ALMPROF") ? dataRow[columns.IndexOf("ALMPROF")].ToString() : string.Empty,
 674:                                                  DEV = columns.Contains("DEV") ? dataRow[columns.IndexOf("DEV")].ToString() : string.Empty,
 675:                                                  VLAN = columns.Contains("VLAN") ? int.Parse(dataRow[columns.IndexOf("VLAN")].ToString()) : 0,
 676:                                                  PRI = columns.Contains("PRI") ? int.Parse(dataRow[columns.IndexOf("PRI")].ToString()) : 0,
 677:                                                  IP = columns.Contains("IP") ? dataRow[columns.IndexOf("IP")].ToString() : string.Empty,
 678:                                                  MASK = columns.Contains("MASK") ? dataRow[columns.IndexOf("MASK")].ToString() : string.Empty,
 679:                                                  GATE = columns.Contains("GATE") ? dataRow[columns.IndexOf("GATE")].ToString() : string.Empty,
 680:                                                  ROUTEIP = columns.Contains("ROUTEIP") ? dataRow[columns.IndexOf("ROUTEIP")].ToString() : string.Empty,
 681:                                                  ROUTEMASK = columns.Contains("ROUTEMASK") ? dataRow[columns.IndexOf("ROUTEMASK")].ToString() : string.Empty,
 682:                                                  NEXTHOP = columns.Contains("NEXTHOP") ? dataRow[columns.IndexOf("NEXTHOP")].ToString() : string.Empty,
 683:                                                  SNMPPROF = columns.Contains("SNMPPROF") ? dataRow[columns.IndexOf("SNMPPROF")].ToString() : string.Empty,
 684:                                                  OPTALMPROF = columns.Contains("OPTALMPROF") ? dataRow[columns.IndexOf("OPTALMPROF")].ToString() : string.Empty,
 685:                                                  VAPROF = columns.Contains("VAPROF") ? dataRow[columns.IndexOf("VAPROF")].ToString() : string.Empty,
 686:                                                  MACLEARN = columns.Contains("MACLEARN") ? dataRow[columns.IndexOf("MACLEARN")].ToString() : string.Empty,
 687:                                                  SRVLEVELPROF = columns.Contains("SRVLEVELPROF") ? dataRow[columns.IndexOf("SRVLEVELPROF")].ToString() : string.Empty,
 688:                                                  LSTUPTIME = columns.Contains("LSTUPTIME") ? int.Parse(dataRow[columns.IndexOf("LSTUPTIME")].ToString()) : 0,
 689:                                                  LSTDOWNTIME = columns.Contains("LSTDOWNTIME") ? int.Parse(dataRow[columns.IndexOf("LSTDOWNTIME")].ToString()) : 0,
 690:                                                  DEVCURRENTTIME = columns.Contains("DEVCURRENTTIME") ? int.Parse(dataRow[columns.IndexOf("DEVCURRENTTIME")].ToString()) : 0,
 691:                                                  VASPROFILESET = columns.Contains("VASPROFILESET") ? dataRow[columns.IndexOf("VASPROFILESET")].ToString() : string.Empty,
 692:                                                  HARDWAREVERSION = columns.Contains("HARDWAREVERSION") ? dataRow[columns.IndexOf("HARDWAREVERSION")].ToString() : string.Empty,
 693:                                                  OPERSTATE = columns.Contains("OPERSTATE") ? dataRow[columns.IndexOf("OPERSTATE")].ToString() : string.Empty,
 694:                                                  DEVNAME = columns.Contains("DEVNAME") ? dataRow[columns.IndexOf("DEVNAME")].ToString() : string.Empty,
 695:                                                  BINDWIDTHTYPE = columns.Contains("BINDWIDTHTYPE") ? int.Parse(dataRow[columns.IndexOf("BINDWIDTHTYPE")].ToString()) : 0,
 696:                                                  EmsPort = (from ep in db.EmsPorts where ep.Id == port.Id select ep).SingleOrDefault()
 697:                                              };
 698:   
 699:                                              accessId = Ia.Ngn.Cl.Model.Business.Access.AccessId(id);
 700:                                              if (accessId != null) newOnt.Access = (from a in db.Accesses where a.Id == accessId select a).SingleOrDefault();
 701:   
 702:                                              ont = (from eo in /*ontList*/ db.EmsOnts where eo.Id == id select eo).SingleOrDefault();
 703:   
 704:                                              if (ont == null)
 705:                                              {
 706:                                                  newOnt.Created = newOnt.Updated = DateTime.UtcNow.AddHours(3);
 707:   
 708:                                                  db.EmsOnts.Add(newOnt);
 709:   
 710:                                                  insertedItemCount++;
 711:                                              }
 712:                                              else
 713:                                              {
 714:                                                  // below: copy values from newOnt to ont
 715:   
 716:                                                  if (ont.Update(newOnt))
 717:                                                  {
 718:                                                      db.EmsOnts.Attach(ont);
 719:                                                      db.Entry(ont).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
 720:   
 721:                                                      updatedItemCount++;
 722:                                                  }
 723:                                              }
 724:   
 725:                                              itemIdList.Add(id); // keep at the end
 726:                                          }
 727:                                          else
 728:                                          {
 729:                                              result.AddError("PON is null.");
 730:                                          }
 731:                                      }
 732:                                      else
 733:                                      {
 734:                                          result.AddError("did not equal to queryDid. did: " + did);
 735:                                      }
 736:                                  }
 737:                                  else
 738:                                  {
 739:                                      result.AddWarning("port is null");
 740:                                  }
 741:                              }
 742:   
 743:                              // below: this function will remove values that were not present in the reading
 744:                              if (ontList.Count > 0)
 745:                              {
 746:                                  foreach (Ia.Ngn.Cl.Model.Huawei.EmsOnt on in ontList)
 747:                                  {
 748:                                      if (!itemIdList.Contains(on.Id))
 749:                                      {
 750:                                          ont = (from o in db.EmsOnts where o.Id == @on.Id select o).SingleOrDefault();
 751:   
 752:                                          db.EmsOnts.Remove(ont);
 753:   
 754:                                          deletedItemCount++;
 755:                                      }
 756:                                  }
 757:                              }
 758:   
 759:                              db.SaveChanges();
 760:                          }
 761:   
 762:                          if (insertedItemCount != 0 || updatedItemCount != 0 || deletedItemCount != 0) isUpdated = true;
 763:                          else isUpdated = false;
 764:   
 765:                          result.AddSuccess("LST-ONT: (" + readItemCount + "/" + existingItemCount + "/" + insertedItemCount + "," + updatedItemCount + "," + deletedItemCount + ")");
 766:                      }
 767:                      else
 768:                      {
 769:                          result.AddWarning("NDD OLT is null");
 770:                      }
 771:                  }
 772:                  else
 773:                  {
 774:                      result.AddWarning("LST-ONT: QueryDataTable is null, (" + response.CompletionCode + ", " + response.ResultCode.ToString() + ")");
 775:                  }
 776:              }
 777:              else
 778:              {
 779:                  result.AddWarning("LST-ONT: (" + response.CompletionCode + ", " + response.ResultCode.ToString() + ")");
 780:              }
 781:   
 782:              return isUpdated;
 783:          }
 784:   
 785:          ////////////////////////////////////////////////////////////////////////////
 786:   
 787:          /// <summary>
 788:          ///
 789:          /// </summary>
 790:          public static bool UpdateResultCode(Ia.Ngn.Cl.Model.Huawei.EmsOnt emsOnt, Ia.Ngn.Cl.Model.Client.Huawei.Ems.ResultCode resultCode)
 791:          {
 792:              // similar to Ia.Ngn.Cl.Model.Data.Huawei.Dev.UpdateResultCode();
 793:              bool isUpdated;
 794:   
 795:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 796:              {
 797:                  if (emsOnt != null)
 798:                  {
 799:                      var updatedOnt = (from o in db.EmsOnts where o.Id == emsOnt.Id select o).SingleOrDefault();
 800:   
 801:                      if (updatedOnt != null)
 802:                      {
 803:                          if (updatedOnt.ResultCode != (long)resultCode)
 804:                          {
 805:                              updatedOnt.ResultCode = (long)resultCode;
 806:                              updatedOnt.Updated = DateTime.UtcNow.AddHours(3);
 807:   
 808:                              db.EmsOnts.Attach(updatedOnt);
 809:                              db.Entry(updatedOnt).Property(u => u.ResultCode).IsModified = true;
 810:                              db.Entry(updatedOnt).Property(u => u.Updated).IsModified = true;
 811:   
 812:                              db.SaveChanges();
 813:   
 814:                              isUpdated = true;
 815:                              //result.AddSuccess("EmsOnt.ResultCode updated. ");
 816:                          }
 817:                          else
 818:                          {
 819:                              isUpdated = false;
 820:                              // result.AddWarning("Warning: EmsOnt.ResultCode value was not updated because its the same. ");
 821:                          }
 822:                      }
 823:                      else
 824:                      {
 825:                          isUpdated = false;
 826:                          // result.AddError("Error: updatedOnt is null. ");
 827:                      }
 828:                  }
 829:                  else
 830:                  {
 831:                      isUpdated = false;
 832:                  }
 833:              }
 834:   
 835:              return isUpdated;
 836:          }
 837:   
 838:          ////////////////////////////////////////////////////////////////////////////
 839:   
 840:          /// <summary>
 841:          ///
 842:          /// </summary>
 843:          public static bool NullifyAccessIdByAccessId(string accessId, out string result)
 844:          {
 845:              bool b;
 846:              int numberOfRecordsWhereAccessIsNullified;
 847:              Ia.Ngn.Cl.Model.Huawei.EmsOnt ont;
 848:   
 849:              b = false;
 850:              numberOfRecordsWhereAccessIsNullified = 0;
 851:   
 852:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 853:              {
 854:                  // --update EmsOnts set Access_Id = null where Access_Id = '1040101010040004'
 855:                  //var query = (from eo in db.EmsOnts where eo.Access.Id == accessId select eo).ToList();
 856:   
 857:                  //foreach (var v in query)
 858:                  //{
 859:                  ont = (from o in db.EmsOnts where o.Access.Id == accessId select o).Include(u => u.Access).FirstOrDefault(); //.SingleOrDefault();
 860:   
 861:                  if (ont != null)
 862:                  {
 863:                      ont.Access = null;
 864:                      ont.Updated = DateTime.UtcNow.AddHours(3);
 865:   
 866:                      db.EmsOnts.Attach(ont);
 867:                      db.Entry(ont).Property(u => u.Updated).IsModified = true;
 868:   
 869:                      db.SaveChanges();
 870:   
 871:                      numberOfRecordsWhereAccessIsNullified++;
 872:                  }
 873:                  //}
 874:   
 875:                  b = true;
 876:              }
 877:   
 878:              result = "Number of records where access is nullified: " + numberOfRecordsWhereAccessIsNullified;
 879:   
 880:              return b;
 881:          }
 882:   
 883:          ////////////////////////////////////////////////////////////////////////////
 884:   
 885:          /// <summary>
 886:          ///
 887:          /// </summary>
 888:          public static bool Delete(string id, out string result)
 889:          {
 890:              bool b;
 891:   
 892:              b = false;
 893:              result = string.Empty;
 894:   
 895:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 896:              {
 897:                  var v = (from em in db.EmsOnts where em.Id == id select em).FirstOrDefault();
 898:   
 899:                  if (v != null)
 900:                  {
 901:                      db.EmsOnts.Remove(v);
 902:                      db.SaveChanges();
 903:   
 904:                      b = true;
 905:                  }
 906:                  else b = false;
 907:              }
 908:   
 909:              return b;
 910:          }
 911:   
 912:          ////////////////////////////////////////////////////////////////////////////
 913:   
 914:          /// <summary>
 915:          ///
 916:          /// </summary>
 917:          public static bool DeleteByAccessId(string accessId, out string result)
 918:          {
 919:              bool b;
 920:   
 921:              b = false;
 922:              result = string.Empty;
 923:   
 924:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 925:              {
 926:                  var v = (from eo in db.EmsOnts where eo.Access.Id == accessId select eo).Include(u => u.Access).FirstOrDefault();
 927:   
 928:                  if (v != null)
 929:                  {
 930:                      db.EmsOnts.Remove(v);
 931:                      db.SaveChanges();
 932:   
 933:                      b = true;
 934:                  }
 935:                  else b = false;
 936:              }
 937:   
 938:              return b;
 939:          }
 940:   
 941:          ////////////////////////////////////////////////////////////////////////////
 942:          ////////////////////////////////////////////////////////////////////////////
 943:   
 944:          /// <summary>
 945:          ///
 946:          /// </summary>
 947:          public static string ToSimpleTextString(Ia.Ngn.Cl.Model.Huawei.EmsOnt ont)
 948:          {
 949:              StringBuilder sb;
 950:   
 951:              sb = new StringBuilder();
 952:   
 953:              /*
 954:              //sb.AppendLine("Vendor: " + Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia.Name);
 955:              sb.AppendLine("State: " + ont.State);
 956:              sb.AppendLine("FamilyType: " + Ia.Ngn.Cl.Model.Data.Nokia.Ont.FamilyTypeFromId(ont.FamilyTypeId));
 957:              sb.AppendLine("Serial: " + ont.Serial);
 958:              sb.AppendLine("EquipmentId: " + ont.EquipmentId);
 959:              sb.AppendLine("ActiveSoftware: " + ont.ActiveSoftware);
 960:              //sb.AppendLine("PassiveSoftware: " + ont.PassiveSoftware);
 961:              sb.AppendLine("PlannedSoftware: " + ont.PlannedSoftware);
 962:              //sb.AppendLine("BatteryBackupAvailable: " + ont.BatteryBackupAvailable);
 963:              sb.AppendLine("Description1: " + ont.Description1);
 964:              sb.AppendLine("Description2: " + ont.Description2);
 965:              */
 966:   
 967:              return sb.ToString();
 968:          }
 969:   
 970:          ////////////////////////////////////////////////////////////////////////////
 971:          ////////////////////////////////////////////////////////////////////////////
 972:      }
 973:   
 974:      ////////////////////////////////////////////////////////////////////////////
 975:      ////////////////////////////////////////////////////////////////////////////
 976:  }