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

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

Ams support class for Next Generation Network (NGN) ui model.

   1:  using System;
   2:  using System.Collections.Generic;
   3:  using System.Linq;
   4:  using System.Web;
   5:  using System.Web.Security;
   6:  using System.Text;
   7:  using System.Text.RegularExpressions;
   8:  using System.Data.Entity;
   9:  using System.Data;
  10:  using System.IO;
  11:   
  12:  namespace Ia.Ngn.Cl.Model.Ui.Maintenance.Log.Transaction
  13:  {
  14:      ////////////////////////////////////////////////////////////////////
  15:      ////////
  16:   
  17:      /// <summary publish="true">
  18:      /// Ams support class for Next Generation Network (NGN) ui model.
  19:      /// </summary>
  20:      /// 
  21:      /// <remarks> 
  22:      /// Copyright © 2006-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet Applications - Kuwait. All Rights Reserved.
  23:      ///
  24:      /// 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
  25:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  26:      ///
  27:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  28:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  29:      /// 
  30:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  31:      /// 
  32:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  33:      /// </remarks> 
  34:      public partial class Ams
  35:      {
  36:          /// <summary/>
  37:          public Ams() { }
  38:   
  39:          /////////////////////////////////////////////////////////////////////////////////
  40:   
  41:          /// <summary>
  42:          ///
  43:          /// </summary>
  44:          public static void Manage(Ia.Ngn.Cl.Model.Business.Administration.StaffContact staffContact, string opcode, string operand, string attachementContent, out string responseSubject, out string responseContent)
  45:          {
  46:              StringBuilder stringBuilder;
  47:              DateTime now;
  48:              Ia.Cl.Model.Result result;
  49:   
  50:              result = new Ia.Cl.Model.Result();
  51:   
  52:              opcode = opcode.ToLower();
  53:   
  54:              now = DateTime.UtcNow.AddHours(3);
  55:   
  56:              // subject can't have \r\n
  57:              responseSubject = "Optical Fiber Network (OFN) AMS Transaction Log Manager (" + now.ToString("yyyy-MM-dd HH:mm") + ")";
  58:              responseContent = "Optical Fiber Network (OFN) AMS Transaction Log Manager: " + now.ToString("yyyy-MM-dd HH:mm") + "\r\n";
  59:   
  60:              if (opcode.Contains("help"))
  61:              {
  62:                  responseContent += Ia.Ngn.Cl.Model.Data.Help.Text("mail/maintenance/log/transaction/ams");
  63:                  responseContent += "\r\n";
  64:              }
  65:              else
  66:              {
  67:                  if (opcode.StartsWith("mail/maintenance/log/transaction/ams/insert"))
  68:                  {
  69:                      if (Ia.Ngn.Cl.Model.Business.Authority.StaffContactCanInsertAmsTransactionCsvFile(Ia.Ngn.Cl.Model.Business.Authority.PersistentStorageFunction.Create, staffContact))
  70:                      {
  71:                          responseContent += @"Opcode: """ + opcode + @"""." + "\r\n";
  72:                          responseContent += "\r\n";
  73:   
  74:                          stringBuilder = new StringBuilder(10000);
  75:   
  76:                          if (attachementContent.Length > 0)
  77:                          {
  78:                              Ia.Ngn.Cl.Model.Nokia.Data.AmsTransaction.Process(attachementContent, out result);
  79:   
  80:                              stringBuilder.AppendLine(result.Message);
  81:                          }
  82:                          else
  83:                          {
  84:                              stringBuilder.AppendLine("Error: Attachement is empty. ");
  85:                          }
  86:   
  87:                          responseContent += stringBuilder.ToString();
  88:                          responseContent += "\r\n";
  89:                          //content += "\r\nResult: " + result.Message;
  90:   
  91:                          responseContent += "\r\n";
  92:                          responseContent += "\r\n";
  93:                          responseContent += @"Help? Send email with subject ""mail/maintenance/log/transaction/ams/help"". ";
  94:                          responseContent += "\r\n";
  95:                          responseContent += "\r\n";
  96:                      }
  97:                      else
  98:                      {
  99:                          responseContent += "\r\n";
 100:                          responseContent += "You are not authorized to modify this value. ";
 101:                          responseContent += "\r\n";
 102:                      }
 103:                  }
 104:                  else if (opcode.StartsWith("mail/maintenance/log/transaction/ams/read"))
 105:                  {
 106:                      responseContent += "\r\n";
 107:                      responseContent += "This opcode is not defined yet. ";
 108:                      responseContent += "\r\n";
 109:                  }
 110:                  else
 111:                  {
 112:                      responseContent += "\r\n";
 113:                      responseContent += "This opcode is not known. ";
 114:                      responseContent += "\r\n";
 115:                  }
 116:              }
 117:          }
 118:   
 119:          ////////////////////////////////////////////////////////////////////////////
 120:          ////////////////////////////////////////////////////////////////////////////
 121:      }
 122:  }