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

Integrated Applications Programming Company

Skip Navigation Links

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

Ericsson AXE support class of Next Generation Network'a (NGN's) data model.

   1:  using System;
   2:  using System.Data;
   3:  using System.Linq;
   4:   
   5:  namespace Ia.Ngn.Cl.Model.Data.Ericsson
   6:  {
   7:      ////////////////////////////////////////////////////////////////////////////
   8:   
   9:      /// <summary publish="true">
  10:      /// Ericsson AXE support class of Next Generation Network'a (NGN's) data model.
  11:      /// </summary>
  12:      /// 
  13:      /// <remarks> 
  14:      /// Copyright © 2017-2020 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
  15:      ///
  16:      /// 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
  17:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  18:      ///
  19:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  20:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  21:      /// 
  22:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  23:      /// 
  24:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  25:      /// </remarks> 
  26:      public class Axe
  27:      {
  28:          ////////////////////////////////////////////////////////////////////////////
  29:   
  30:          /// <summary>
  31:          ///
  32:          /// </summary>
  33:          public Axe() { }
  34:   
  35:          ////////////////////////////////////////////////////////////////////////////
  36:   
  37:          /// <summary>
  38:          ///
  39:          /// </summary>
  40:          public static bool UpdateDatabaseWithAxeCommandOutput(string content, ref Ia.Ngn.Cl.Model.Client.Ericsson.Axe axe, out Ia.Cl.Model.Result result)
  41:          {
  42:              bool b;
  43:              Ia.Ngn.Cl.Model.Business.Ericsson.Axe.Response response;
  44:   
  45:              b = false;
  46:              result = new Ia.Cl.Model.Result();
  47:   
  48:              if (content.StartsWith("WO   ")) b = true; // WO      MSF KW64/CN-G2/ACG210   NVT-929   TIME 200103 2115  PAGE    1
  49:              else
  50:              {
  51:                  response = Ia.Ngn.Cl.Model.Data.Ericsson.Axe.ParseResponse(content);
  52:   
  53:                  if (response.ReturnCode == Ia.Ngn.Cl.Model.Client.Ericsson.Axe.ResultCode.Successful)
  54:                  {
  55:                      if (!string.IsNullOrEmpty(response.CommandString))
  56:                      {
  57:                          if (response.CommandString.StartsWith("SUSCP:"))
  58:                          {
  59:                              Ia.Ngn.Cl.Model.Data.Ericsson.Axe.UpdateSubscriberAndServiceFromAxeResponse(response, out result);
  60:   
  61:                              b = result.IsSuccessful;
  62:                          }
  63:                          else if (response.CommandString.StartsWith("SUSCC:"))
  64:                          {
  65:                              result.AddSuccess(response.DateTime.ToString("yyyy-MM-dd hh:mm:ss"));
  66:                          }
  67:                          else if (response.CommandString.StartsWith("SULIE:"))
  68:                          {
  69:                              result.AddSuccess(response.DateTime.ToString("yyyy-MM-dd hh:mm:ss"));
  70:                          }
  71:                          else
  72:                          {
  73:                              result.AddError("No designated opcode to process");
  74:   
  75:                              b = false;
  76:                          }
  77:                      }
  78:                      else
  79:                      {
  80:                          result.AddSuccess(response.ReturnCode.ToString());
  81:                      }
  82:                  }
  83:                  else
  84:                  {
  85:                      result.AddError(response.ReturnCode.ToString());
  86:   
  87:                      b = false;
  88:                  }
  89:              }
  90:   
  91:              return b;
  92:          }
  93:   
  94:          ////////////////////////////////////////////////////////////////////////////
  95:   
  96:          /// <summary>
  97:          ///
  98:          /// </summary>
  99:          private static void UpdateSubscriberAndServiceFromAxeResponse(Ia.Ngn.Cl.Model.Business.Ericsson.Axe.Response response, out Ia.Cl.Model.Result result)
 100:          {
 101:              result = new Ia.Cl.Model.Result();
 102:   
 103:              Ia.Ngn.Cl.Model.Data.Ericsson.Subscriber.Update(response, out Ia.Cl.Model.Result subscriberResult);
 104:   
 105:              Ia.Ngn.Cl.Model.Data.Ericsson.Axe.UpdateService(response, out Ia.Cl.Model.Result serviceResult);
 106:   
 107:              result.AddSuccess("Subscriber: " + subscriberResult.Message + "Service: " + serviceResult.Message);
 108:          }
 109:   
 110:          ////////////////////////////////////////////////////////////////////////////
 111:   
 112:          /// <summary>
 113:          ///
 114:          /// </summary>
 115:          private static bool UpdateService(Ia.Ngn.Cl.Model.Business.Ericsson.Axe.Response response, out Ia.Cl.Model.Result result)
 116:          {
 117:              bool insert, update, delete;
 118:              int serviceType;
 119:              string serviceId, service;
 120:              Ia.Ngn.Cl.Model.Service2 service2, newService;
 121:   
 122:              insert = update = delete = false;
 123:              result = new Ia.Cl.Model.Result();
 124:   
 125:              service = response.Service.ToString();
 126:   
 127:              serviceType = Ia.Ngn.Cl.Model.Business.Service.ServiceType.PstnService;
 128:              serviceId = Ia.Ngn.Cl.Model.Business.Service2.ServiceId(service, serviceType);
 129:   
 130:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 131:              {
 132:                  if (response.IsProvisioned)
 133:                  {
 134:                      newService = new Ia.Ngn.Cl.Model.Service2();
 135:   
 136:                      newService.Id = serviceId;
 137:                      newService.AreaCode = Ia.Ngn.Cl.Model.Business.Service.CountryCode;
 138:                      newService.Service = service;
 139:                      newService.ServiceType = serviceType;
 140:   
 141:                      newService.CallerId = response.ServiceSupplementaryService.SupplementaryServiceList.Contains(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.CallerId);
 142:                      newService.AbbriviatedCalling = response.ServiceSupplementaryService.SupplementaryServiceList.Contains(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.AbbriviatedCalling);
 143:                      newService.CallForwarding = response.ServiceSupplementaryService.SupplementaryServiceList.Contains(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.CallForwarding);
 144:                      newService.CallWaiting = response.ServiceSupplementaryService.SupplementaryServiceList.Contains(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.CallWaiting);
 145:                      newService.ConferenceCall = response.ServiceSupplementaryService.SupplementaryServiceList.Contains(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.ConferenceCall);
 146:                      newService.InternationalCalling = response.ServiceSupplementaryService.SupplementaryServiceList.Contains(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.InternationalCalling);
 147:                      newService.InternationalCallingUserControlled = response.ServiceSupplementaryService.SupplementaryServiceList.Contains(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.InternationalCallingUserControlled);
 148:   
 149:                      newService.AlarmCall = response.ServiceSupplementaryService.SupplementaryServiceList.Contains(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.WakeupCall);
 150:                      newService.WakeupCall = response.ServiceSupplementaryService.SupplementaryServiceList.Contains(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.WakeupCall);
 151:   
 152:                      newService.ServiceSuspension = response.ServiceSupplementaryService.SupplementaryServiceList.Contains(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.ServiceSuspension);
 153:                      //newService.CallBarring = subParty.ServiceSuspension;
 154:   
 155:                      newService.Pin = int.TryParse(response.ServiceSupplementaryService.Pin, out int i) ? i : 0;
 156:   
 157:                      //if (nddOnt != null) newService.Access = (from a in db.Accesses where a.Id == nddOnt.Access.Id select a).SingleOrDefault();
 158:                      //else
 159:                      newService.Access = null;
 160:   
 161:                      service2 = (from s in db.Service2s
 162:                                  where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.PstnService && s.Id == newService.Id
 163:                                  select s).SingleOrDefault();
 164:   
 165:                      if (service2 == null)
 166:                      {
 167:                          newService.Created = newService.Updated = DateTime.UtcNow.AddHours(3);
 168:                          db.Service2s.Add(newService);
 169:   
 170:                          insert = true;
 171:                      }
 172:                      else
 173:                      {
 174:                          if (service2.Update(newService))
 175:                          {
 176:                              db.Service2s.Attach(service2);
 177:                              db.Entry(service2).State = System.Data.Entity.EntityState.Modified;
 178:   
 179:                              update = true;
 180:                          }
 181:                          else update = false;
 182:                      }
 183:                  }
 184:                  else
 185:                  {
 186:                      service2 = (from s in db.Service2s
 187:                                  where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.PstnService && s.Id == serviceId
 188:                                  select s).SingleOrDefault();
 189:   
 190:                      if (service2 != null)
 191:                      {
 192:                          db.Service2s.Remove(service2);
 193:   
 194:                          delete = true;
 195:                      }
 196:                  }
 197:   
 198:                  db.SaveChanges();
 199:              }
 200:   
 201:              result.AddSuccess(service + ": state: " + Ia.Ngn.Cl.Model.Ui.Text.ExpressionOfInsertOrUpdateOrDelete(insert, update, delete));
 202:   
 203:              return insert || update || delete;
 204:          }
 205:   
 206:          ////////////////////////////////////////////////////////////////////////////
 207:   
 208:          /// <summary>
 209:          /// Parse response of Ericsson AXE
 210:          /// </summary>
 211:          private static Ia.Ngn.Cl.Model.Business.Ericsson.Axe.Response ParseResponse(string content)
 212:          {
 213:              Ia.Ngn.Cl.Model.Business.Ericsson.Axe.Response response;
 214:   
 215:              response = new Ia.Ngn.Cl.Model.Business.Ericsson.Axe.Response(content);
 216:   
 217:              return response;
 218:          }
 219:   
 220:          ////////////////////////////////////////////////////////////////////////////
 221:          ////////////////////////////////////////////////////////////////////////////
 222:      }
 223:   
 224:      ////////////////////////////////////////////////////////////////////////////
 225:      ////////////////////////////////////////////////////////////////////////////    
 226:  }
 227: