Professional Applications Programmers/Consultants برمجة واستشارات تطبيقات الإنترنت
Skip Navigation LinksHome » Code Library » Find

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

Find subscriber and network information support class for the Next Generation Network ui model

   1:  using System;
   2:  using System.Text;
   3:  using System.Collections.Generic;
   4:  using System.Runtime.Serialization;
   5:   
   6:  namespace Ia.Ngn.Cl.Model.Ui.Maintenance
   7:  {
   8:      ////////////////////////////////////////////////////////////////////////////
   9:   
  10:      /// <summary publish="true">
  11:      /// Find subscriber and network information support class for the Next Generation Network ui model
  12:      /// </summary>
  13:      /// 
  14:      /// <remarks> 
  15:      /// Copyright © 2006-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet Applications - Kuwait. All Rights Reserved.
  16:      ///
  17:      /// 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
  18:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  19:      ///
  20:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  21:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  22:      /// 
  23:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  24:      /// 
  25:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  26:      /// </remarks> 
  27:      [DataContract(IsReference = true, Namespace = "kw.com.ia.ngn.api", Name = "apiFind")]
  28:      public partial class Find
  29:      {
  30:          private static List<Ia.Ngn.Cl.Model.Ui.Service2> serviceList;
  31:          private static List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfGatewayRecord> agcfGatewayRecordList;
  32:          private static List<Ia.Ngn.Cl.Model.Ui.Nokia.AgcfEndpoint> agcfEndpointList;
  33:          private static List<Ia.Ngn.Cl.Model.Ui.Nokia.SubParty> subPartyList;
  34:          private static List<Ia.Ngn.Cl.Model.Ui.Nokia.Subscriber> subscriberList;
  35:          private static List<Ia.Ngn.Cl.Model.Ui.Huawei.HuSbr> huSbrList;
  36:          private static List<Ia.Ngn.Cl.Model.Huawei.Owsbr> owsbrList;
  37:          private static List<Ia.Ngn.Cl.Model.Ont> ontList;
  38:          private static List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> nddOntList;
  39:          private static List<Ia.Ngn.Cl.Model.OntServiceVoip> ontServiceVoipList;
  40:          private static List<Ia.Ngn.Cl.Model.OntOntPots> ontOntPotsList;
  41:          private static List<Ia.Ngn.Cl.Model.Ui.Huawei.EmsOnt> emsOntList;
  42:          private static List<Ia.Ngn.Cl.Model.Huawei.EmsOntSipInfo> emsOntSipInfoList;
  43:          private static List<Ia.Ngn.Cl.Model.Huawei.EmsVoipPstnUser> emsVoipPstnUserList;
  44:          private static List<Ia.Ngn.Cl.Model.Event> eventList;
  45:          private static List<Ia.Ngn.Cl.Model.Access> accessList;
  46:          private static List<Ia.Ngn.Cl.Model.Ui.ServiceRequestService> serviceRequestServiceList;
  47:          private static List<Ia.Ngn.Cl.Model.ServiceInitialState> serviceInitialStateList;
  48:          private static List<Ia.Ngn.Cl.Model.ServiceRequest> serviceRequestList;
  49:          private static List<Ia.Ngn.Cl.Model.ServiceRequestType> serviceRequestTypeList;
  50:          private static List<Ia.Ngn.Cl.Model.ServiceRequestOnt> serviceRequestOntList;
  51:          private static List<Ia.Ngn.Cl.Model.ServiceRequestOntDetail> serviceRequestOntDetailList;
  52:          private static List<Ia.Ngn.Cl.Model.Report> reportList;
  53:          private static List<Ia.Ngn.Cl.Model.ReportHistory> reportHistoryList;
  54:   
  55:          /// <summary/>
  56:          [DataMember(Name = "serviceList")]
  57:          public List<Ia.Ngn.Cl.Model.Ui.Service2> ServiceList { get; set; }
  58:   
  59:          /// <summary/>
  60:          [DataMember(Name = "result")]
  61:          public Ia.Cl.Model.Result Result { get; set; }
  62:   
  63:          /////////////////////////////////////////////////////////////////////////////////
  64:   
  65:          /// <summary>
  66:          ///
  67:          /// </summary>
  68:          public static void SearchForApi(Ia.Ngn.Cl.Model.Business.Administration.StaffContact staffContact, string input, out List<Ia.Ngn.Cl.Model.Ui.Service2> serviceList, out Ia.Cl.Model.Result result)
  69:          {
  70:              string inputType;
  71:              result = new Ia.Cl.Model.Result();
  72:   
  73:              inputType = string.Empty;
  74:              serviceList = null;
  75:   
  76:              if (Ia.Ngn.Cl.Model.Business.Authority.StaffContactCanCreateReadUpdateDeleteMaintenanceFind(Ia.Ngn.Cl.Model.Business.Authority.PersistentStorageFunction.Read, staffContact))
  77:              {
  78:                  Ia.Ngn.Cl.Model.Business.Maintenance.Find.Search(input, inputType, out serviceList, out agcfGatewayRecordList, out agcfEndpointList, out subPartyList, out subscriberList, out huSbrList, out owsbrList, out nddOntList, out ontList, out ontServiceVoipList, out ontOntPotsList, out emsOntList, out emsOntSipInfoList, out emsVoipPstnUserList, out eventList, out accessList, out serviceRequestServiceList, out serviceInitialStateList, out serviceRequestList, out serviceRequestTypeList, out serviceRequestOntList, out serviceRequestOntDetailList, out reportList, out reportHistoryList, out result);
  79:   
  80:                  if (!result.HasError)
  81:                  {
  82:   
  83:                  }
  84:                  else
  85:                  {
  86:   
  87:                  }
  88:              }
  89:              else
  90:              {
  91:                  result.AddError("You are not authorized to modify this value (لست مخولاً بتعديل هذه القيمة). ");
  92:              }
  93:          }
  94:   
  95:          /////////////////////////////////////////////////////////////////////////////////
  96:   
  97:          /// <summary>
  98:          ///
  99:          /// </summary>
 100:          public static void SearchForMail(Ia.Ngn.Cl.Model.Business.Administration.StaffContact staffContact, string opcode, string operand, out string subject, out StringBuilder contentStringBuilder)
 101:          {
 102:              string inputType, horizontalRule;
 103:              DateTime now;
 104:   
 105:              inputType = string.Empty;
 106:              horizontalRule = "===============================================";
 107:   
 108:              now = DateTime.UtcNow.AddHours(3);
 109:   
 110:              // subject can't have \r\n
 111:              //responseSubject = "Optical Fiber Network (OFN) Find Result (" + now.ToString("yyyy-MM-dd HH:mm") + ")";
 112:   
 113:              //if (Ia.Ngn.Cl.Model.Business.Authority.StaffContactCanCreateReadUpdateDeleteAccessList(Ia.Ngn.Cl.Model.Business.Authority.PersistentStorageFunction.Create, staffContact))
 114:              //{
 115:              opcode = opcode.ToLower();
 116:   
 117:              SearchForTelegramBotApiAndMailSimpleText(opcode, operand, inputType, horizontalRule, out subject, out contentStringBuilder);
 118:   
 119:              contentStringBuilder.AppendLine(horizontalRule);
 120:              contentStringBuilder.AppendLine(@"Help? Send message with ""mail/maintenance/find/help""");
 121:              contentStringBuilder.AppendLine(horizontalRule);
 122:              contentStringBuilder.AppendLine();
 123:              /*}
 124:               else
 125:               {
 126:                   responseContent += "\r\n";
 127:                   responseContent += "You are not authorized to modify this value. ";
 128:                   responseContent += "\r\n";
 129:               }*/
 130:          }
 131:   
 132:          /////////////////////////////////////////////////////////////////////////////////
 133:   
 134:          /// <summary>
 135:          ///
 136:          /// </summary>
 137:          public static void SearchForTelegramBotApi(string opcode, string operand, out string subject, out string content)
 138:          {
 139:              string inputType, horizontalRule;
 140:              StringBuilder contentStringBuilder;
 141:              DateTime now;
 142:   
 143:              inputType = string.Empty;
 144:              horizontalRule = " ";
 145:   
 146:              now = DateTime.UtcNow.AddHours(3);
 147:   
 148:              //if (Ia.Ngn.Cl.Model.Business.Authority.StaffContactCanCreateReadUpdateDeleteAccessList(Ia.Ngn.Cl.Model.Business.Authority.PersistentStorageFunction.Create, staffContact))
 149:              //{
 150:              opcode = opcode.ToLower();
 151:   
 152:              SearchForTelegramBotApiAndMailSimpleText(opcode, operand, inputType, horizontalRule, out subject, out contentStringBuilder);
 153:   
 154:              contentStringBuilder.AppendLine(@"Help? Send the command /help");
 155:              contentStringBuilder.AppendLine(horizontalRule);
 156:              contentStringBuilder.AppendLine();
 157:   
 158:              content = contentStringBuilder.ToString();
 159:              //}
 160:              //else
 161:              //{
 162:              //    responseContent += "\r\n";
 163:              //    responseContent += "You are not authorized to modify this value. ";
 164:              //    responseContent += "\r\n";
 165:              //}
 166:          }
 167:   
 168:          ////////////////////////////////////////////////////////////////////////////
 169:   
 170:          /// <summary>
 171:          ///
 172:          /// </summary>
 173:          public static void SearchForTelegramBotApiAndMailSimpleText(string opcode, string operand, string inputType, string horizontalRule, out string subject, out StringBuilder contentStringBuilder)
 174:          {
 175:              StringBuilder stringBuilder;
 176:              DateTime now;
 177:              Ia.Cl.Model.Result result;
 178:   
 179:              stringBuilder = new StringBuilder();
 180:   
 181:              subject = string.Empty;
 182:              now = DateTime.UtcNow.AddHours(3);
 183:   
 184:              if (opcode.Contains("help"))
 185:              {
 186:                  // subject can't have \r\n
 187:                  //subject = "Help:";
 188:   
 189:                  stringBuilder.AppendLine(Ia.Ngn.Cl.Model.Data.Help.Text(opcode));
 190:                  stringBuilder.AppendLine();
 191:              }
 192:              else if (opcode.Contains("find"))
 193:              {
 194:                  // subject can't have \r\n
 195:                  subject = "Optical Fiber Network (OFN) Find Result (" + now.ToString("yyyy-MM-dd HH:mm") + ")";
 196:   
 197:                  Ia.Ngn.Cl.Model.Business.Maintenance.Find.Search(operand, inputType, out serviceList, out agcfGatewayRecordList, out agcfEndpointList, out subPartyList, out subscriberList, out huSbrList, out owsbrList, out nddOntList, out ontList, out ontServiceVoipList, out ontOntPotsList, out emsOntList, out emsOntSipInfoList, out emsVoipPstnUserList, out eventList, out accessList, out serviceRequestServiceList, out serviceInitialStateList, out serviceRequestList, out serviceRequestTypeList, out serviceRequestOntList, out serviceRequestOntDetailList, out reportList, out reportHistoryList, out result);
 198:   
 199:                  if (result.IsSuccessful)
 200:                  {
 201:                      if (serviceList != null && serviceList.Count > 0)
 202:                      {
 203:                          stringBuilder.AppendLine(horizontalRule);
 204:                          stringBuilder.AppendLine("Services:"); //("Service2s:");
 205:                          stringBuilder.AppendLine();
 206:                          foreach (var s in serviceList) stringBuilder.AppendLine(s.ToSimpleTextString());
 207:                          stringBuilder.AppendLine(horizontalRule);
 208:                          stringBuilder.AppendLine();
 209:                      }
 210:   
 211:                      if (agcfGatewayRecordList != null && agcfGatewayRecordList.Count > 0)
 212:                      {
 213:                          stringBuilder.AppendLine(horizontalRule);
 214:                          stringBuilder.AppendLine("AGCF Gateway Records:");
 215:                          stringBuilder.AppendLine();
 216:                          foreach (var gr in agcfGatewayRecordList) stringBuilder.AppendLine(gr.ToSimpleTextString());
 217:                          stringBuilder.AppendLine(horizontalRule);
 218:                          stringBuilder.AppendLine();
 219:                      }
 220:   
 221:                      if (agcfEndpointList != null && agcfEndpointList.Count > 0)
 222:                      {
 223:                          stringBuilder.AppendLine(horizontalRule);
 224:                          stringBuilder.AppendLine("AGCF Endpoints:");
 225:                          stringBuilder.AppendLine();
 226:                          foreach (var ep in agcfEndpointList) stringBuilder.AppendLine(ep.ToSimpleTextString());
 227:                          stringBuilder.AppendLine(horizontalRule);
 228:                          stringBuilder.AppendLine();
 229:                      }
 230:   
 231:                      if (subPartyList != null && subPartyList.Count > 0)
 232:                      {
 233:                          stringBuilder.AppendLine(horizontalRule);
 234:                          stringBuilder.AppendLine("SubParties:");
 235:                          stringBuilder.AppendLine();
 236:                          foreach (var sp in subPartyList) stringBuilder.AppendLine(sp.ToSimpleTextString());
 237:                          stringBuilder.AppendLine(horizontalRule);
 238:                          stringBuilder.AppendLine();
 239:                      }
 240:   
 241:                      if (subscriberList != null && subscriberList.Count > 0)
 242:                      {
 243:                          stringBuilder.AppendLine(horizontalRule);
 244:                          stringBuilder.AppendLine("Subscribers:");
 245:                          stringBuilder.AppendLine();
 246:                          foreach (var s in subscriberList) stringBuilder.AppendLine(s.ToSimpleTextString());
 247:                          stringBuilder.AppendLine(horizontalRule);
 248:                          stringBuilder.AppendLine();
 249:                      }
 250:   
 251:   
 252:                      if (huSbrList != null && huSbrList.Count > 0)
 253:                      {
 254:                          stringBuilder.AppendLine(horizontalRule);
 255:                          stringBuilder.AppendLine("Sbrs:");
 256:                          stringBuilder.AppendLine();
 257:                          foreach (var h in huSbrList) stringBuilder.AppendLine(h.ToSimpleTextString());
 258:                          stringBuilder.AppendLine(horizontalRule);
 259:                          stringBuilder.AppendLine();
 260:                      }
 261:   
 262:                      if (owsbrList != null && owsbrList.Count > 0)
 263:                      {
 264:                          stringBuilder.AppendLine(horizontalRule);
 265:                          stringBuilder.AppendLine("Owsbrs:");
 266:                          stringBuilder.AppendLine();
 267:                          foreach (var o in owsbrList) stringBuilder.AppendLine(o.ToSimpleTextString());
 268:                          stringBuilder.AppendLine(horizontalRule);
 269:                          stringBuilder.AppendLine();
 270:                      }
 271:   
 272:                      if (nddOntList != null && nddOntList.Count > 0)
 273:                      {
 274:                          stringBuilder.AppendLine(horizontalRule);
 275:                          stringBuilder.AppendLine("Network Design Document ONTs (Standard):");
 276:                          stringBuilder.AppendLine();
 277:                          foreach (var o in nddOntList) stringBuilder.AppendLine(o.ToSimpleTextString());
 278:                          stringBuilder.AppendLine(horizontalRule);
 279:                          stringBuilder.AppendLine();
 280:                      }
 281:   
 282:                      if (ontList != null && ontList.Count > 0)
 283:                      {
 284:                          stringBuilder.AppendLine(horizontalRule);
 285:                          stringBuilder.AppendLine("ONTs (AMS):");
 286:                          stringBuilder.AppendLine();
 287:                          foreach (var o in ontList) stringBuilder.AppendLine(o.ToSimpleTextString());
 288:                          stringBuilder.AppendLine(horizontalRule);
 289:                          stringBuilder.AppendLine();
 290:                      }
 291:   
 292:                      if (ontServiceVoipList != null && ontServiceVoipList.Count > 0)
 293:                      {
 294:                          stringBuilder.AppendLine(horizontalRule);
 295:                          stringBuilder.AppendLine("ONT (AMS) Service VOIPs:");
 296:                          stringBuilder.AppendLine();
 297:                          foreach (var osv in ontServiceVoipList) stringBuilder.AppendLine(osv.ToSimpleTextString());
 298:                          stringBuilder.AppendLine(horizontalRule);
 299:                          stringBuilder.AppendLine();
 300:                      }
 301:   
 302:                      if (ontOntPotsList != null && ontOntPotsList.Count > 0)
 303:                      {
 304:                          stringBuilder.AppendLine(horizontalRule);
 305:                          stringBuilder.AppendLine("ONT (AMS) POTSs:");
 306:                          stringBuilder.AppendLine();
 307:                          foreach (var oop in ontOntPotsList) stringBuilder.AppendLine(oop.ToSimpleTextString());
 308:                          stringBuilder.AppendLine(horizontalRule);
 309:                          stringBuilder.AppendLine();
 310:                      }
 311:   
 312:                      if (emsOntList != null && emsOntList.Count > 0)
 313:                      {
 314:                          stringBuilder.AppendLine(horizontalRule);
 315:                          stringBuilder.AppendLine("ONTs (EMS):");
 316:                          stringBuilder.AppendLine();
 317:                          foreach (var eo in emsOntList) stringBuilder.AppendLine(eo.ToSimpleTextString());
 318:                          stringBuilder.AppendLine(horizontalRule);
 319:                          stringBuilder.AppendLine();
 320:                      }
 321:   
 322:                      if (emsOntSipInfoList != null && emsOntSipInfoList.Count > 0)
 323:                      {
 324:                          stringBuilder.AppendLine(horizontalRule);
 325:                          stringBuilder.AppendLine("ONTSIPINFOs (EMS):");
 326:                          stringBuilder.AppendLine();
 327:                          foreach (var eosi in emsOntSipInfoList) stringBuilder.AppendLine(eosi.ToSimpleTextString());
 328:                          stringBuilder.AppendLine(horizontalRule);
 329:                          stringBuilder.AppendLine();
 330:                      }
 331:   
 332:                      if (emsVoipPstnUserList != null && emsVoipPstnUserList.Count > 0)
 333:                      {
 334:                          stringBuilder.AppendLine(horizontalRule);
 335:                          stringBuilder.AppendLine("VOIPPSTNUSERs (EMS):");
 336:                          stringBuilder.AppendLine();
 337:                          foreach (var evpu in emsVoipPstnUserList) stringBuilder.AppendLine(evpu.ToSimpleTextString());
 338:                          stringBuilder.AppendLine(horizontalRule);
 339:                          stringBuilder.AppendLine();
 340:                      }
 341:   
 342:                      // , out eventList
 343:   
 344:                      if (accessList != null && accessList.Count > 0)
 345:                      {
 346:                          stringBuilder.AppendLine(horizontalRule);
 347:                          stringBuilder.AppendLine("Accesses:");
 348:                          stringBuilder.AppendLine();
 349:                          foreach (var a in accessList) stringBuilder.AppendLine(a.ToSimpleTextString());
 350:                          stringBuilder.AppendLine(horizontalRule);
 351:                          stringBuilder.AppendLine();
 352:                      }
 353:   
 354:                      if (serviceRequestServiceList != null && serviceRequestServiceList.Count > 0)
 355:                      {
 356:                          stringBuilder.AppendLine(horizontalRule);
 357:                          stringBuilder.AppendLine("Service Request Services:");
 358:                          stringBuilder.AppendLine();
 359:                          foreach (var srs in serviceRequestServiceList) stringBuilder.AppendLine(srs.ToSimpleTextString());
 360:                          stringBuilder.AppendLine(horizontalRule);
 361:                          stringBuilder.AppendLine();
 362:                      }
 363:   
 364:                      // out serviceInitialStateList,
 365:   
 366:                      if (serviceRequestList != null && serviceRequestList.Count > 0)
 367:                      {
 368:                          stringBuilder.AppendLine(horizontalRule);
 369:                          stringBuilder.AppendLine("Service Requests:");
 370:                          stringBuilder.AppendLine();
 371:                          foreach (var sr in serviceRequestList) stringBuilder.AppendLine(sr.ToSimpleTextString());
 372:                          stringBuilder.AppendLine(horizontalRule);
 373:                          stringBuilder.AppendLine();
 374:                      }
 375:   
 376:                      //out serviceRequestTypeList, out serviceRequestOntList, out serviceRequestOntDetailList, out reportList, out reportHistoryList
 377:   
 378:                      if (result.HasWarning)
 379:                      {
 380:                          stringBuilder.AppendLine(horizontalRule);
 381:                          stringBuilder.AppendLine(result.Message);
 382:                          stringBuilder.AppendLine();
 383:                          stringBuilder.AppendLine(horizontalRule);
 384:                          stringBuilder.AppendLine();
 385:                      }
 386:                      else
 387:                      {
 388:                          stringBuilder.AppendLine(horizontalRule);
 389:                          stringBuilder.AppendLine(result.Message);
 390:                          stringBuilder.AppendLine();
 391:                          stringBuilder.AppendLine(horizontalRule);
 392:                          stringBuilder.AppendLine();
 393:                      }
 394:                  }
 395:                  else
 396:                  {
 397:                      stringBuilder.AppendLine(horizontalRule);
 398:                      stringBuilder.AppendLine(result.Message);
 399:                      stringBuilder.AppendLine();
 400:                      stringBuilder.AppendLine(horizontalRule);
 401:                      stringBuilder.AppendLine();
 402:                  }
 403:              }
 404:              else
 405:              {
 406:                  stringBuilder.AppendLine(horizontalRule);
 407:                  stringBuilder.AppendLine("Error: opcode: [" + opcode + "] is unrecognized. ");
 408:                  stringBuilder.AppendLine(horizontalRule);
 409:                  stringBuilder.AppendLine();
 410:              }
 411:   
 412:              contentStringBuilder = stringBuilder.Replace(Environment.NewLine + horizontalRule, horizontalRule);
 413:          }
 414:   
 415:          ////////////////////////////////////////////////////////////////////////////
 416:          ////////////////////////////////////////////////////////////////////////////    
 417:      }
 418:   
 419:      ////////////////////////////////////////////////////////////////////////////
 420:      ////////////////////////////////////////////////////////////////////////////   
 421:  }