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

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

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, 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, 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, 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, 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:   
 141:              FieldTnmdSupplierListForTelegramBotApiAndMailSimpleText(opcode, inputType, horizontalRule, out contentStringBuilder);
 142:   
 143:              contentStringBuilder.AppendLine(horizontalRule);
 144:              contentStringBuilder.AppendLine(@"Help? Send the command /help");
 145:              contentStringBuilder.AppendLine(horizontalRule);
 146:              contentStringBuilder.AppendLine();
 147:   
 148:              content = contentStringBuilder.ToString();
 149:              //}
 150:              //else
 151:              //{
 152:              //    responseContent += "\r\n";
 153:              //    responseContent += "You are not authorized to modify this value. ";
 154:              //    responseContent += "\r\n";
 155:              //}
 156:          }
 157:   
 158:          /////////////////////////////////////////////////////////////////////////////////
 159:   
 160:          /// <summary>
 161:          ///
 162:          /// </summary>
 163:          public static void NokiaListForTelegramBotApi(string opcode, out string subject, out string content)
 164:          {
 165:              string inputType, horizontalRule;
 166:              StringBuilder contentStringBuilder;
 167:              DateTime now;
 168:   
 169:              inputType = string.Empty;
 170:              horizontalRule = " ";
 171:   
 172:              now = DateTime.UtcNow.AddHours(3);
 173:   
 174:              // subject can't have \r\n
 175:              subject = string.Empty; // "Optical Fiber Network (OFN) TNMD list: ";
 176:   
 177:              //if (Ia.Ngn.Cl.Model.Business.Authority.StaffContactCanCreateReadUpdateDeleteAccessList(Ia.Ngn.Cl.Model.Business.Authority.PersistentStorageFunction.Create, staffContact))
 178:              //{
 179:              opcode = opcode.ToLower();
 180:   
 181:              FieldTnmdSupplierListForTelegramBotApiAndMailSimpleText(opcode, inputType, horizontalRule, out contentStringBuilder);
 182:   
 183:              contentStringBuilder.AppendLine(horizontalRule);
 184:              contentStringBuilder.AppendLine(@"Help? Send the command /help");
 185:              contentStringBuilder.AppendLine(horizontalRule);
 186:              contentStringBuilder.AppendLine();
 187:   
 188:              content = contentStringBuilder.ToString();
 189:              //}
 190:              //else
 191:              //{
 192:              //    responseContent += "\r\n";
 193:              //    responseContent += "You are not authorized to modify this value. ";
 194:              //    responseContent += "\r\n";
 195:              //}
 196:          }
 197:   
 198:          /////////////////////////////////////////////////////////////////////////////////
 199:   
 200:          /// <summary>
 201:          ///
 202:          /// </summary>
 203:          public static void HuaweiListForTelegramBotApi(string opcode, out string subject, out string content)
 204:          {
 205:              string inputType, horizontalRule;
 206:              StringBuilder contentStringBuilder;
 207:              DateTime now;
 208:   
 209:              inputType = string.Empty;
 210:              horizontalRule = " ";
 211:   
 212:              now = DateTime.UtcNow.AddHours(3);
 213:   
 214:              // subject can't have \r\n
 215:              subject = string.Empty; // "Optical Fiber Network (OFN) TNMD list: ";
 216:   
 217:              //if (Ia.Ngn.Cl.Model.Business.Authority.StaffContactCanCreateReadUpdateDeleteAccessList(Ia.Ngn.Cl.Model.Business.Authority.PersistentStorageFunction.Create, staffContact))
 218:              //{
 219:              opcode = opcode.ToLower();
 220:   
 221:              FieldTnmdSupplierListForTelegramBotApiAndMailSimpleText(opcode, inputType, horizontalRule, out contentStringBuilder);
 222:   
 223:              contentStringBuilder.AppendLine(horizontalRule);
 224:              contentStringBuilder.AppendLine(@"Help? Send the command /help");
 225:              contentStringBuilder.AppendLine(horizontalRule);
 226:              contentStringBuilder.AppendLine();
 227:   
 228:              content = contentStringBuilder.ToString();
 229:              //}
 230:              //else
 231:              //{
 232:              //    responseContent += "\r\n";
 233:              //    responseContent += "You are not authorized to modify this value. ";
 234:              //    responseContent += "\r\n";
 235:              //}
 236:          }
 237:   
 238:          ////////////////////////////////////////////////////////////////////////////
 239:   
 240:          /// <summary>
 241:          ///
 242:          /// </summary>
 243:          public static void FieldTnmdSupplierListForTelegramBotApiAndMailSimpleText(string opcode, string inputType, string horizontalRule, out StringBuilder contentStringBuilder)
 244:          {
 245:              StringBuilder stringBuilder;
 246:              DateTime now;
 247:   
 248:              stringBuilder = new StringBuilder();
 249:              now = DateTime.UtcNow.AddHours(3);
 250:   
 251:              //stringBuilder.AppendLine("Optical Fiber Network (OFN) Find Result: " + now.ToString("yyyy-MM-dd HH:mm"));
 252:   
 253:              //stringBuilder.AppendLine(@"Opcode: """ + opcode + @""".");
 254:              //responseContent += @"Operand: """ + operand + @"""." + "\r\n";
 255:              //stringBuilder.AppendLine();
 256:   
 257:              if (opcode.Contains("tnmd"))
 258:              {
 259:                  reportAccessServiceRequestList = Ia.Ngn.Cl.Model.Ui.Report.ReadSpecificUserIdListAndAreaIdReportWithReportOpenStatusList(Ia.Ngn.Cl.Model.Business.Authority.TnmdFrameworkAndStaffGuidList, 0);
 260:   
 261:                  if (reportAccessServiceRequestList != null && reportAccessServiceRequestList.Count > 0)
 262:                  {
 263:                      stringBuilder.AppendLine(horizontalRule);
 264:                      stringBuilder.AppendLine("TNMD List:");
 265:                      stringBuilder.AppendLine();
 266:                      foreach (var rasr in reportAccessServiceRequestList) stringBuilder.AppendLine(rasr.ToSimpleTextString());
 267:                      stringBuilder.AppendLine(horizontalRule);
 268:                      stringBuilder.AppendLine();
 269:                  }
 270:                  else
 271:                  {
 272:                      stringBuilder.AppendLine(horizontalRule);
 273:                      stringBuilder.AppendLine();
 274:                  }
 275:              }
 276:              else if (opcode.Contains("field"))
 277:              {
 278:                  reportAccessServiceRequestList = Ia.Ngn.Cl.Model.Ui.Report.ReadSpecificUserIdListAndAreaIdReportWithReportOpenStatusList(Ia.Ngn.Cl.Model.Business.Authority.FieldFrameworkAndStaffGuidList, 0);
 279:   
 280:                  if (reportAccessServiceRequestList != null && reportAccessServiceRequestList.Count > 0)
 281:                  {
 282:                      stringBuilder.AppendLine(horizontalRule);
 283:                      stringBuilder.AppendLine("Field List:");
 284:                      stringBuilder.AppendLine();
 285:                      foreach (var rasr in reportAccessServiceRequestList) stringBuilder.AppendLine(rasr.ToSimpleTextString());
 286:                      stringBuilder.AppendLine(horizontalRule);
 287:                      stringBuilder.AppendLine();
 288:                  }
 289:                  else
 290:                  {
 291:                      stringBuilder.AppendLine(horizontalRule);
 292:                      stringBuilder.AppendLine();
 293:                  }
 294:              }
 295:              else if (opcode.Contains("nokia"))
 296:              {
 297:                  reportAccessServiceRequestList = Ia.Ngn.Cl.Model.Ui.Report.ReadSpecificUserIdListAndAreaIdReportWithReportOpenStatusList(Ia.Ngn.Cl.Model.Business.Authority.NokiaFrameworkAndStaffGuidList, 0);
 298:   
 299:                  if (reportAccessServiceRequestList != null && reportAccessServiceRequestList.Count > 0)
 300:                  {
 301:                      stringBuilder.AppendLine(horizontalRule);
 302:                      stringBuilder.AppendLine("Nokia List:");
 303:                      stringBuilder.AppendLine();
 304:                      foreach (var rasr in reportAccessServiceRequestList) stringBuilder.AppendLine(rasr.ToSimpleTextString());
 305:                      stringBuilder.AppendLine(horizontalRule);
 306:                      stringBuilder.AppendLine();
 307:                  }
 308:                  else
 309:                  {
 310:                      stringBuilder.AppendLine(horizontalRule);
 311:                      stringBuilder.AppendLine();
 312:                  }
 313:              }
 314:              else if (opcode.Contains("huawei"))
 315:              {
 316:                  reportAccessServiceRequestList = Ia.Ngn.Cl.Model.Ui.Report.ReadSpecificUserIdListAndAreaIdReportWithReportOpenStatusList(Ia.Ngn.Cl.Model.Business.Authority.HuaweiFrameworkAndStaffGuidList, 0);
 317:   
 318:                  if (reportAccessServiceRequestList != null && reportAccessServiceRequestList.Count > 0)
 319:                  {
 320:                      stringBuilder.AppendLine(horizontalRule);
 321:                      stringBuilder.AppendLine("Huawei List:");
 322:                      stringBuilder.AppendLine();
 323:                      foreach (var rasr in reportAccessServiceRequestList) stringBuilder.AppendLine(rasr.ToSimpleTextString());
 324:                      stringBuilder.AppendLine(horizontalRule);
 325:                      stringBuilder.AppendLine();
 326:                  }
 327:                  else
 328:                  {
 329:                      stringBuilder.AppendLine(horizontalRule);
 330:                      stringBuilder.AppendLine();
 331:                  }
 332:              }
 333:              else
 334:              {
 335:                  stringBuilder.AppendLine(horizontalRule);
 336:                  stringBuilder.AppendLine("Error: opcode: [" + opcode + "] is unrecognized. ");
 337:                  stringBuilder.AppendLine(horizontalRule);
 338:                  stringBuilder.AppendLine();
 339:              }
 340:   
 341:              contentStringBuilder = stringBuilder.Replace(Environment.NewLine + horizontalRule, horizontalRule);
 342:          }
 343:   
 344:          ////////////////////////////////////////////////////////////////////////////
 345:          ////////////////////////////////////////////////////////////////////////////    
 346:      }
 347:   
 348:      ////////////////////////////////////////////////////////////////////////////
 349:      ////////////////////////////////////////////////////////////////////////////   
 350:  }