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

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Default

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

Maintenance Report data 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:  using System.Linq;
   6:   
   7:  namespace Ia.Ngn.Cl.Model.Ui.Maintenance.Report
   8:  {
   9:      ////////////////////////////////////////////////////////////////////////////
  10:   
  11:      /// <summary publish="true">
  12:      /// Maintenance Report data support class for the Next Generation Network ui model
  13:      /// </summary>
  14:      /// 
  15:      /// <remarks> 
  16:      /// Copyright © 2017-2018 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet Applications - Kuwait. All Rights Reserved.
  17:      ///
  18:      /// 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
  19:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  20:      ///
  21:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  22:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  23:      /// 
  24:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  25:      /// 
  26:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  27:      /// </remarks> 
  28:      [DataContract(IsReference = true, Namespace = "kw.com.ia.ngn.api", Name = "apiMaintenanceReport")]
  29:      public partial class Default
  30:      {
  31:          private static List<Ia.Ngn.Cl.Model.Ui.ReportAccessServiceRequest> reportAccessServiceRequestList;
  32:   
  33:          /// <summary/>
  34:          [DataMember(Name = "result")]
  35:          public Ia.Cl.Model.Result Result { get; set; }
  36:   
  37:          /////////////////////////////////////////////////////////////////////////////////
  38:   
  39:          /// <summary>
  40:          ///
  41:          /// </summary>
  42:          public static void TnmdListForMail(Ia.Ngn.Cl.Model.Business.Administration.StaffContact staffContact, string opcode, string operand, out string subject, out string content)
  43:          {
  44:              string inputType, horizontalRule;
  45:              StringBuilder contentStringBuilder;
  46:              DateTime now;
  47:   
  48:              inputType = string.Empty;
  49:              horizontalRule = "===============================================";
  50:   
  51:              now = DateTime.UtcNow.AddHours(3);
  52:   
  53:              // subject can't have \r\n
  54:              subject = "Optical Fiber Network (OFN) Find Result (" + now.ToString("yyyy-MM-dd HH:mm") + ")";
  55:              content = string.Empty;
  56:   
  57:              if (Ia.Ngn.Cl.Model.Business.Authority.StaffContactCanCreateReadUpdateDeleteAccessList(Ia.Ngn.Cl.Model.Business.Authority.PersistentStorageFunction.Create, staffContact))
  58:              {
  59:                  opcode = opcode.ToLower();
  60:   
  61:                  FieldTnmdSupplierListForTelegramBotApiAndMailSimpleText(opcode, operand, inputType, horizontalRule, out contentStringBuilder);
  62:   
  63:                  contentStringBuilder.AppendLine(horizontalRule);
  64:                  contentStringBuilder.AppendLine(@"Help? Send message with ""mail/maintenance/find/help""");
  65:                  contentStringBuilder.AppendLine(horizontalRule);
  66:                  contentStringBuilder.AppendLine();
  67:   
  68:                  content = contentStringBuilder.ToString();
  69:              }
  70:              else
  71:              {
  72:                  content += "\r\n";
  73:                  content += "You are not authorized to modify this value. ";
  74:                  content += "\r\n";
  75:              }
  76:          }
  77:   
  78:          /////////////////////////////////////////////////////////////////////////////////
  79:   
  80:          /// <summary>
  81:          ///
  82:          /// </summary>
  83:          public static void TnmdListForTelegramBotApi(string opcode, out string subject, out string content)
  84:          {
  85:              string inputType, horizontalRule;
  86:              StringBuilder contentStringBuilder;
  87:              DateTime now;
  88:   
  89:              inputType = string.Empty;
  90:              horizontalRule = " ";
  91:   
  92:              now = DateTime.UtcNow.AddHours(3);
  93:   
  94:              // subject can't have \r\n
  95:              subject = string.Empty; // "Optical Fiber Network (OFN) TNMD list: ";
  96:   
  97:              //if (Ia.Ngn.Cl.Model.Business.Authority.StaffContactCanCreateReadUpdateDeleteAccessList(Ia.Ngn.Cl.Model.Business.Authority.PersistentStorageFunction.Create, staffContact))
  98:              //{
  99:              opcode = opcode.ToLower();
 100:   
 101:              FieldTnmdSupplierListForTelegramBotApiAndMailSimpleText(opcode, string.Empty, inputType, horizontalRule, out contentStringBuilder);
 102:   
 103:              contentStringBuilder.AppendLine(horizontalRule);
 104:              contentStringBuilder.AppendLine(@"Help? Send the command /help");
 105:              contentStringBuilder.AppendLine(horizontalRule);
 106:              contentStringBuilder.AppendLine();
 107:   
 108:              content = contentStringBuilder.ToString();
 109:              //}
 110:              //else
 111:              //{
 112:              //    responseContent += "\r\n";
 113:              //    responseContent += "You are not authorized to modify this value. ";
 114:              //    responseContent += "\r\n";
 115:              //}
 116:          }
 117:   
 118:          /////////////////////////////////////////////////////////////////////////////////
 119:   
 120:          /// <summary>
 121:          ///
 122:          /// </summary>
 123:          public static void FieldListForTelegramBotApi(string opcode, string operand, out string subject, out string content)
 124:          {
 125:              string inputType, horizontalRule;
 126:              StringBuilder contentStringBuilder;
 127:              DateTime now;
 128:   
 129:              inputType = string.Empty;
 130:              horizontalRule = " ";
 131:   
 132:              now = DateTime.UtcNow.AddHours(3);
 133:   
 134:              // subject can't have \r\n
 135:              subject = string.Empty; // "Optical Fiber Network (OFN) Field list: ";
 136:   
 137:              //if (Ia.Ngn.Cl.Model.Business.Authority.StaffContactCanCreateReadUpdateDeleteAccessList(Ia.Ngn.Cl.Model.Business.Authority.PersistentStorageFunction.Create, staffContact))
 138:              //{
 139:              opcode = opcode.ToLower();
 140:              operand = operand.ToLower();
 141:   
 142:              FieldTnmdSupplierListForTelegramBotApiAndMailSimpleText(opcode, operand, inputType, horizontalRule, out contentStringBuilder);
 143:   
 144:              contentStringBuilder.AppendLine(horizontalRule);
 145:              contentStringBuilder.AppendLine(@"Help? Send the command /help");
 146:              contentStringBuilder.AppendLine(horizontalRule);
 147:              contentStringBuilder.AppendLine();
 148:   
 149:              content = contentStringBuilder.ToString();
 150:              //}
 151:              //else
 152:              //{
 153:              //    responseContent += "\r\n";
 154:              //    responseContent += "You are not authorized to modify this value. ";
 155:              //    responseContent += "\r\n";
 156:              //}
 157:          }
 158:   
 159:          /////////////////////////////////////////////////////////////////////////////////
 160:   
 161:          /// <summary>
 162:          ///
 163:          /// </summary>
 164:          public static void NokiaListForTelegramBotApi(string opcode, out string subject, out string content)
 165:          {
 166:              string inputType, horizontalRule;
 167:              StringBuilder contentStringBuilder;
 168:              DateTime now;
 169:   
 170:              inputType = string.Empty;
 171:              horizontalRule = " ";
 172:   
 173:              now = DateTime.UtcNow.AddHours(3);
 174:   
 175:              // subject can't have \r\n
 176:              subject = string.Empty; // "Optical Fiber Network (OFN) TNMD list: ";
 177:   
 178:              //if (Ia.Ngn.Cl.Model.Business.Authority.StaffContactCanCreateReadUpdateDeleteAccessList(Ia.Ngn.Cl.Model.Business.Authority.PersistentStorageFunction.Create, staffContact))
 179:              //{
 180:              opcode = opcode.ToLower();
 181:   
 182:              FieldTnmdSupplierListForTelegramBotApiAndMailSimpleText(opcode, string.Empty, inputType, horizontalRule, out contentStringBuilder);
 183:   
 184:              contentStringBuilder.AppendLine(horizontalRule);
 185:              contentStringBuilder.AppendLine(@"Help? Send the command /help");
 186:              contentStringBuilder.AppendLine(horizontalRule);
 187:              contentStringBuilder.AppendLine();
 188:   
 189:              content = contentStringBuilder.ToString();
 190:              //}
 191:              //else
 192:              //{
 193:              //    responseContent += "\r\n";
 194:              //    responseContent += "You are not authorized to modify this value. ";
 195:              //    responseContent += "\r\n";
 196:              //}
 197:          }
 198:   
 199:          /////////////////////////////////////////////////////////////////////////////////
 200:   
 201:          /// <summary>
 202:          ///
 203:          /// </summary>
 204:          public static void HuaweiListForTelegramBotApi(string opcode, out string subject, out string content)
 205:          {
 206:              string inputType, horizontalRule;
 207:              StringBuilder contentStringBuilder;
 208:              DateTime now;
 209:   
 210:              inputType = string.Empty;
 211:              horizontalRule = " ";
 212:   
 213:              now = DateTime.UtcNow.AddHours(3);
 214:   
 215:              // subject can't have \r\n
 216:              subject = string.Empty; // "Optical Fiber Network (OFN) TNMD list: ";
 217:   
 218:              //if (Ia.Ngn.Cl.Model.Business.Authority.StaffContactCanCreateReadUpdateDeleteAccessList(Ia.Ngn.Cl.Model.Business.Authority.PersistentStorageFunction.Create, staffContact))
 219:              //{
 220:              opcode = opcode.ToLower();
 221:   
 222:              FieldTnmdSupplierListForTelegramBotApiAndMailSimpleText(opcode, string.Empty, inputType, horizontalRule, out contentStringBuilder);
 223:   
 224:              contentStringBuilder.AppendLine(horizontalRule);
 225:              contentStringBuilder.AppendLine(@"Help? Send the command /help");
 226:              contentStringBuilder.AppendLine(horizontalRule);
 227:              contentStringBuilder.AppendLine();
 228:   
 229:              content = contentStringBuilder.ToString();
 230:              //}
 231:              //else
 232:              //{
 233:              //    responseContent += "\r\n";
 234:              //    responseContent += "You are not authorized to modify this value. ";
 235:              //    responseContent += "\r\n";
 236:              //}
 237:          }
 238:   
 239:          ////////////////////////////////////////////////////////////////////////////
 240:   
 241:          /// <summary>
 242:          ///
 243:          /// </summary>
 244:          public static void FieldTnmdSupplierListForTelegramBotApiAndMailSimpleText(string opcode, string operand, string inputType, string horizontalRule, out StringBuilder contentStringBuilder)
 245:          {
 246:              int siteId;
 247:              StringBuilder stringBuilder;
 248:              DateTime now;
 249:   
 250:              stringBuilder = new StringBuilder();
 251:              now = DateTime.UtcNow.AddHours(3);
 252:   
 253:              //stringBuilder.AppendLine("Optical Fiber Network (OFN) Find Result: " + now.ToString("yyyy-MM-dd HH:mm"));
 254:   
 255:              //stringBuilder.AppendLine(@"Opcode: """ + opcode + @""".");
 256:              //responseContent += @"Operand: """ + operand + @"""." + "\r\n";
 257:              //stringBuilder.AppendLine();
 258:   
 259:              if (opcode.Contains("tnmd"))
 260:              {
 261:                  reportAccessServiceRequestList = Ia.Ngn.Cl.Model.Ui.Report.ReadSpecificUserIdListAndSiteIdReportWithReportOpenStatusList(Ia.Ngn.Cl.Model.Business.Authority.TnmdFrameworkAndStaffGuidList, 0);
 262:   
 263:                  stringBuilder.AppendLine(horizontalRule);
 264:                  stringBuilder.AppendLine("TNMD List:");
 265:                  stringBuilder.AppendLine();
 266:   
 267:                  if (reportAccessServiceRequestList != null && reportAccessServiceRequestList.Count > 0)
 268:                  {
 269:                      foreach (var rasr in reportAccessServiceRequestList) stringBuilder.AppendLine(rasr.ToSimpleTextString());
 270:                  }
 271:                  else
 272:                  {
 273:                      stringBuilder.AppendLine("No records were found. ");
 274:                  }
 275:   
 276:                  stringBuilder.AppendLine(horizontalRule);
 277:                  stringBuilder.AppendLine();
 278:              }
 279:              else if (opcode.Contains("field"))
 280:              {
 281:                  if (!string.IsNullOrEmpty(operand))
 282:                  {
 283:                      // get the siteId from the site name in operand
 284:                      siteId = (from s in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.SiteList where s.Name.ToLower() == operand select s.Id).SingleOrDefault();
 285:   
 286:                      reportAccessServiceRequestList = Ia.Ngn.Cl.Model.Ui.Report.ReadSpecificUserIdListAndSiteIdReportWithReportOpenStatusList(Ia.Ngn.Cl.Model.Business.Authority.FieldFrameworkAndStaffGuidList, siteId);
 287:   
 288:                      stringBuilder.AppendLine(horizontalRule);
 289:                      stringBuilder.AppendLine("Field List:");
 290:                      stringBuilder.AppendLine();
 291:   
 292:                      if (reportAccessServiceRequestList != null && reportAccessServiceRequestList.Count > 0)
 293:                      {
 294:                          foreach (var rasr in reportAccessServiceRequestList) stringBuilder.AppendLine(rasr.ToSimpleTextString());
 295:                      }
 296:                      else
 297:                      {
 298:                          stringBuilder.AppendLine("No records were found. ");
 299:                      }
 300:   
 301:                      stringBuilder.AppendLine(horizontalRule);
 302:                      stringBuilder.AppendLine();
 303:                  }
 304:                  else
 305:                  {
 306:                      stringBuilder.AppendLine(horizontalRule);
 307:                      stringBuilder.AppendLine("Error: operand is null. ");
 308:                      stringBuilder.AppendLine(horizontalRule);
 309:                      stringBuilder.AppendLine();
 310:                  }
 311:              }
 312:              else if (opcode.Contains("nokia"))
 313:              {
 314:                  reportAccessServiceRequestList = Ia.Ngn.Cl.Model.Ui.Report.ReadSpecificUserIdListAndSiteIdReportWithReportOpenStatusList(Ia.Ngn.Cl.Model.Business.Authority.NokiaFrameworkAndStaffGuidList, 0);
 315:   
 316:                  stringBuilder.AppendLine(horizontalRule);
 317:                  stringBuilder.AppendLine("Nokia List:");
 318:                  stringBuilder.AppendLine();
 319:   
 320:                  if (reportAccessServiceRequestList != null && reportAccessServiceRequestList.Count > 0)
 321:                  {
 322:                      foreach (var rasr in reportAccessServiceRequestList) stringBuilder.AppendLine(rasr.ToSimpleTextString());
 323:                  }
 324:                  else
 325:                  {
 326:                      stringBuilder.AppendLine("No records were found. ");
 327:                  }
 328:   
 329:                  stringBuilder.AppendLine(horizontalRule);
 330:                  stringBuilder.AppendLine();
 331:              }
 332:              else if (opcode.Contains("huawei"))
 333:              {
 334:                  reportAccessServiceRequestList = Ia.Ngn.Cl.Model.Ui.Report.ReadSpecificUserIdListAndSiteIdReportWithReportOpenStatusList(Ia.Ngn.Cl.Model.Business.Authority.HuaweiFrameworkAndStaffGuidList, 0);
 335:   
 336:                  stringBuilder.AppendLine(horizontalRule);
 337:                  stringBuilder.AppendLine("Huawei List:");
 338:                  stringBuilder.AppendLine();
 339:   
 340:                  if (reportAccessServiceRequestList != null && reportAccessServiceRequestList.Count > 0)
 341:                  {
 342:                      foreach (var rasr in reportAccessServiceRequestList) stringBuilder.AppendLine(rasr.ToSimpleTextString());
 343:                  }
 344:                  else
 345:                  {
 346:                      stringBuilder.AppendLine("No records were found. ");
 347:                  }
 348:   
 349:                  stringBuilder.AppendLine(horizontalRule);
 350:                  stringBuilder.AppendLine();
 351:              }
 352:              else
 353:              {
 354:                  stringBuilder.AppendLine(horizontalRule);
 355:                  stringBuilder.AppendLine("Error: opcode: [" + opcode + "] is unrecognized. ");
 356:                  stringBuilder.AppendLine(horizontalRule);
 357:                  stringBuilder.AppendLine();
 358:              }
 359:   
 360:              contentStringBuilder = stringBuilder.Replace(Environment.NewLine + horizontalRule, horizontalRule);
 361:          }
 362:   
 363:          ////////////////////////////////////////////////////////////////////////////
 364:          ////////////////////////////////////////////////////////////////////////////    
 365:      }
 366:   
 367:      ////////////////////////////////////////////////////////////////////////////
 368:      ////////////////////////////////////////////////////////////////////////////   
 369:  }