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

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

Sbr Entity Framework class for Next Generation Network (NGN) entity model.

   1:  using System;
   2:  using System.Collections;
   3:  using System.Collections.Generic;
   4:  using System.Linq;
   5:  using System.Web;
   6:  using System.ComponentModel.DataAnnotations;
   7:  using System.ComponentModel.DataAnnotations.Schema;
   8:  using System.Data;
   9:   
  10:  namespace Ia.Ngn.Cl.Model.Huawei
  11:  {
  12:      ////////////////////////////////////////////////////////////////////////////
  13:   
  14:      /// <summary publish="true">
  15:      /// Sbr Entity Framework class for Next Generation Network (NGN) entity model.
  16:      /// </summary>
  17:      /// 
  18:      /// <remarks> 
  19:      /// Copyright © 2014-2015 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet Applications - Kuwait. All Rights Reserved.
  20:      ///
  21:      /// 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
  22:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  23:      ///
  24:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  25:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  26:      /// 
  27:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  28:      /// 
  29:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  30:      /// </remarks> 
  31:      public partial class Sbr
  32:      {
  33:          /// <summary/>
  34:          public Sbr() { }
  35:   
  36:          //ADD SBR: IMPU="tel:+96523900039", UTYPE=POTS, CPC=ORDINARY, NSCFU=1, NSCFB=1, NSCFNR=1, NSCW=1, NS3PTY=1, NSCLIP=1, NSCBA=1, NSWAKE_UP=1, ITT=1, IITT=1, ICIDD=1, COP="4498";
  37:   
  38:          /// <summary/>
  39:          public long Id { get; set; }
  40:   
  41:          /// <summary/>
  42:          [Key]
  43:          public string IMPU { get; set; }
  44:          public string UTYPE { get; set; }
  45:          public string CPC { get; set; }
  46:          public bool NSCFU { get; set; }
  47:          public bool NSCFB { get; set; }
  48:          public bool NSCFNR { get; set; }
  49:          public bool NSCW { get; set; }
  50:          public bool NS3PTY { get; set; }
  51:          public bool NSCLIP { get; set; }
  52:          public bool NSCBA { get; set; }
  53:          public bool NSWAKE_UP { get; set; }
  54:          public bool ITT { get; set; }
  55:          public bool IITT { get; set; }
  56:          public bool ICIDD { get; set; }
  57:          public string COP { get; set; }
  58:   
  59:          public int LMTGRP { get; set; }
  60:          public string STYPE { get; set; }
  61:          public string TREAT { get; set; }
  62:          
  63:          public int NSICO { get; set; }
  64:          public int NSOUTG { get; set; }
  65:   
  66:          /// <summary/>
  67:          public DateTime Created { get; set; }
  68:   
  69:          /// <summary/>
  70:          public DateTime Updated { get; set; }
  71:   
  72:          /// <summary/>
  73:          public DateTime Viewed { get; set; }
  74:   
  75:          ////////////////////////////////////////////////////////////////////////////
  76:   
  77:          /// <summary>
  78:          ///
  79:          /// </summary>
  80:          public bool Equal(Sbr b)
  81:          {
  82:              // below: this will not check the Id, Created, Updated, or Viewed fields
  83:              bool areEqual;
  84:   
  85:              if (this.IMPU != b.IMPU) areEqual = false;
  86:              else if (this.UTYPE != b.UTYPE) areEqual = false;
  87:              else if (this.CPC != b.CPC) areEqual = false;
  88:              else if (this.NSCFU != b.NSCFU) areEqual = false;
  89:              else if (this.NSCFB != b.NSCFB) areEqual = false;
  90:              else if (this.NSCFNR != b.NSCFNR) areEqual = false;
  91:              else if (this.NSCW != b.NSCW) areEqual = false;
  92:              else if (this.NS3PTY != b.NS3PTY) areEqual = false;
  93:              else if (this.NSCLIP != b.NSCLIP) areEqual = false;
  94:              else if (this.NSCBA != b.NSCBA) areEqual = false;
  95:              else if (this.NSWAKE_UP != b.NSWAKE_UP) areEqual = false;
  96:              else if (this.ITT != b.ITT) areEqual = false;
  97:              else if (this.IITT != b.IITT) areEqual = false;
  98:              else if (this.ICIDD != b.ICIDD) areEqual = false;
  99:              else if (this.COP != b.COP) areEqual = false;
 100:              else if (this.LMTGRP != b.LMTGRP) areEqual = false;
 101:              else if (this.STYPE != b.STYPE) areEqual = false;
 102:              else if (this.TREAT != b.TREAT) areEqual = false;
 103:              else if (this.NSICO != b.NSICO) areEqual = false;
 104:              else if (this.NSOUTG != b.NSOUTG) areEqual = false;
 105:              else areEqual = true;
 106:   
 107:              return areEqual;
 108:          }
 109:   
 110:          ////////////////////////////////////////////////////////////////////////////
 111:   
 112:          /// <summary>
 113:          ///
 114:          /// </summary>
 115:          public void Update(Sbr b)
 116:          {
 117:              // below: this will not update Id or Created
 118:   
 119:              if (this.IMPU != b.IMPU) this.IMPU = b.IMPU;
 120:              if (this.UTYPE != b.UTYPE) this.UTYPE = b.UTYPE;
 121:              if (this.CPC != b.CPC) this.CPC = b.CPC;
 122:              if (this.NSCFU != b.NSCFU) this.NSCFU = b.NSCFU;
 123:              if (this.NSCFB != b.NSCFB) this.NSCFB = b.NSCFB;
 124:              if (this.NSCFNR != b.NSCFNR) this.NSCFNR = b.NSCFNR;
 125:              if (this.NSCW != b.NSCW) this.NSCW = b.NSCW;
 126:              if (this.NS3PTY != b.NS3PTY) this.NS3PTY = b.NS3PTY;
 127:              if (this.NSCLIP != b.NSCLIP) this.NSCLIP = b.NSCLIP;
 128:              if (this.NSCBA != b.NSCBA) this.NSCBA = b.NSCBA;
 129:              if (this.NSWAKE_UP != b.NSWAKE_UP) this.NSWAKE_UP = b.NSWAKE_UP;
 130:              if (this.ITT != b.ITT) this.ITT = b.ITT;
 131:              if (this.IITT != b.IITT) this.IITT = b.IITT;
 132:              if (this.ICIDD != b.ICIDD) this.ICIDD = b.ICIDD;
 133:              if (this.COP != b.COP) this.COP = b.COP;
 134:              if (this.LMTGRP != b.LMTGRP) this.LMTGRP = b.LMTGRP;
 135:              if (this.STYPE != b.STYPE) this.STYPE = b.STYPE;
 136:              if (this.TREAT != b.TREAT) this.TREAT = b.TREAT;
 137:              if (this.NSICO != b.NSICO) this.NSICO = b.NSICO;
 138:              if (this.NSOUTG != b.NSOUTG) this.NSOUTG = b.NSOUTG;
 139:   
 140:              if (this.Updated != b.Updated) this.Updated = b.Updated;
 141:              if (this.Viewed != b.Viewed) this.Viewed = b.Viewed;
 142:          }
 143:   
 144:          /*
 145:          ////////////////////////////////////////////////////////////////////////////
 146:  
 147:          /// <summary>
 148:          ///
 149:          /// </summary>
 150:          public static long ServiceId(string lceid, int lan)
 151:          {
 152:              // below: logic below is based on LCEID data in service.xml
 153:              long id;
 154:  
 155:              id = Ia.Cl.Model.Default.HexToDec(lceid);
 156:              id = (id - 48000) / 16 * 100000;
 157:              id += lan;
 158:  
 159:              return id;
 160:          }
 161:  
 162:          ////////////////////////////////////////////////////////////////////////////
 163:  
 164:          /// <summary>
 165:          /// Read all services for a certain LCEID
 166:          /// </summary>
 167:          public static List<Service> ReadList(string lceidName)
 168:          {
 169:              List<Service> serviceList;
 170:  
 171:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 172:              {
 173:                  serviceList = (from q in db.Services where q.LCEIDName == lceidName select q).ToList();
 174:              }
 175:  
 176:              return serviceList;
 177:          }
 178:  
 179:          ////////////////////////////////////////////////////////////////////////////
 180:  
 181:          /// <summary>
 182:          /// Read service of a DN
 183:          /// </summary>
 184:          public static Service Read(long dn)
 185:          {
 186:              Service service;
 187:  
 188:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 189:              {
 190:                  service = (from q in db.Services where q.DN == dn select q).SingleOrDefault();
 191:              }
 192:  
 193:              return service;
 194:          }
 195:  
 196:          ////////////////////////////////////////////////////////////////////////////
 197:  
 198:          /// <summary>
 199:          /// Read all services for a DN list
 200:          /// </summary>
 201:          public static List<Service> ReadList(ArrayList dnList)
 202:          {
 203:              long i;
 204:              long[] sp;
 205:              List<Service> serviceList;
 206:  
 207:              i = 0;
 208:              sp = new long[dnList.Count];
 209:  
 210:              foreach (long l in dnList) sp[i++] = l;
 211:  
 212:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 213:              {
 214:                  //serviceList = (from q in db.Services where dnList.Contains(q.DN) select q).ToList();
 215:  
 216:                  // var pages = context.Pages.Where(x => keys.Any(key => x.Title.Contains(key)));
 217:                  serviceList = db.Services.Where(q => sp.Any(v => q.DN == v)).ToList();
 218:              }
 219:  
 220:              return serviceList;
 221:          }
 222:           */ 
 223:   
 224:          ////////////////////////////////////////////////////////////////////////////
 225:          ////////////////////////////////////////////////////////////////////////////
 226:      }
 227:   
 228:      ////////////////////////////////////////////////////////////////////////////
 229:      ////////////////////////////////////////////////////////////////////////////
 230:  }