1: using System;
2: using System.Collections.Generic;
3: using System.Data;
4: using System.IO;
5: using System.Linq;
6: using System.Reflection;
7: using System.Web;
8: using System.Xml.Linq;
9: using System.Text.RegularExpressions;
10: using Microsoft.EntityFrameworkCore;
11:
12: namespace Ia.Ngn.Cl.Model.Data
13: {
14: ////////////////////////////////////////////////////////////////////////////
15:
16: /// <summary publish="true">
17: /// Service support class for Optical Fiber Network (OFN) data model.
18: /// </summary>
19: ///
20: /// <remarks>
21: /// Copyright © 2006-2022 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
22: ///
23: /// 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
24: /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
25: ///
26: /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
27: /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
28: ///
29: /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
30: ///
31: /// Copyright notice: This notice may not be removed or altered from any source distribution.
32: /// </remarks>
33: public class Service
34: {
35: private static XDocument xDocument;
36: private static List<int> nokiaSwitchNokiaAccessDomainList, huaweiSwitchNokiaAccessDomainList, huaweiAccessDomainList;
37: private static List<Ia.Ngn.Cl.Model.Business.Service.KuwaitOfnArea> kuwaitOfnAreaList;
38: private static List<int> domainList, pstnDomainList, axePstnDomainList, ewsdPstnDomainList, migrationDomainList, nokiaSwitchDomainList, huaweiSwitchDomainList, msanDomainList, softxDomainList, spsDomainList;
39: private static List<int> legacyPstnDomainList, legacyAxePstnDomainList, legacyEwsdPstnDomainList, legacyMrdPstnDomainList;
40: private static List<Ia.Ngn.Cl.Model.Business.Service.ServiceType> serviceTypeList;
41: private static Dictionary<string, int> serviceIdToServiceRequestServicePositionDictionary;
42: private static List<int> serviceList = new List<int>();
43:
44: private static readonly object objectLock = new object();
45:
46: ////////////////////////////////////////////////////////////////////////////
47:
48: /// <summary>
49: ///
50: /// </summary>
51: public class ServiceAccessFnSnPnPort
52: {
53: public ServiceAccessFnSnPnPort()
54: {
55: this.Service = string.Empty;
56: this.ServiceId = string.Empty;
57: this.AccessId = string.Empty;
58: this.Fn = -1;
59: this.Sn = -1;
60: this.Pn = -1;
61: this.Port = Ia.Ngn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown;
62: }
63:
64: /// <summary/>
65: public string Service { get; set; }
66:
67: /// <summary/>
68: public string ServiceId { get; set; }
69:
70: /// <summary/>
71: public string AccessId { get; set; }
72:
73: /// <summary/>
74: public int Fn { get; set; }
75:
76: /// <summary/>
77: public int Sn { get; set; }
78:
79: /// <summary/>
80: public int Pn { get; set; }
81:
82: /// <summary/>
83: public int Port { get; set; }
84: }
85:
86: ////////////////////////////////////////////////////////////////////////////
87:
88: /// <summary>
89: ///
90: /// </summary>
91: public Service() { }
92:
93: ////////////////////////////////////////////////////////////////////////////
94:
95: /// <summary>
96: ///
97: /// </summary>
98: public static Dictionary<string, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor> ImsServiceToOntRouterVendorInAllowedToBeMigratedOltDictionary
99: {
100: get
101: {
102: string service, accessId;
103: Dictionary<string, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor> dictionary;
104:
105: var imsServiceToAccessIdInAllowedToBeMigratedOltDictionary = Ia.Ngn.Cl.Model.Data.Service2.ImsServiceToAccessIdInAllowedToBeMigratedOltDictionary;
106:
107: var allowedToBeMigratedAccessIdToOntDictionary = Ia.Ngn.Cl.Model.Data.Service.AllowedToBeMigratedAccessIdToOntDictionary;
108:
109: dictionary = new Dictionary<string, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor>();
110:
111: foreach (KeyValuePair<string, string> kvp in imsServiceToAccessIdInAllowedToBeMigratedOltDictionary)
112: {
113: service = kvp.Key;
114: accessId = kvp.Value;
115:
116: if (allowedToBeMigratedAccessIdToOntDictionary.ContainsKey(accessId)) // I had to add this after adding 2467,2480 MSAN domains. I do not know why.
117: {
118: dictionary[service] = allowedToBeMigratedAccessIdToOntDictionary[accessId].Pon.PonGroup.Olt.Odf.Router.Vendor;
119: }
120: }
121:
122: return dictionary;
123: }
124: }
125:
126: ////////////////////////////////////////////////////////////////////////////
127:
128: /// <summary>
129: ///
130: /// </summary>
131: public static Dictionary<string, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor> ImsServiceToOntAndMsanRouterVendorInAllowedToBeMigratedOltAndDomainDictionary
132: {
133: get
134: {
135: string service, accessId;
136: Dictionary<string, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor> dictionary;
137:
138: var imsServiceToAccessIdInAllowedToBeMigratedOltDictionary = Ia.Ngn.Cl.Model.Data.Service2.ImsServiceToAccessIdInAllowedToBeMigratedOltDictionary;
139:
140: var allowedToBeMigratedAccessIdToOntDictionary = Ia.Ngn.Cl.Model.Data.Service.AllowedToBeMigratedAccessIdToOntDictionary;
141:
142: dictionary = new Dictionary<string, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor>();
143:
144: foreach (KeyValuePair<string, string> kvp in imsServiceToAccessIdInAllowedToBeMigratedOltDictionary)
145: {
146: service = kvp.Key;
147: accessId = kvp.Value;
148:
149: if (allowedToBeMigratedAccessIdToOntDictionary.ContainsKey(accessId)) // I had to add this after adding 2467,2480 MSAN domains. I do not know why.
150: {
151: dictionary[service] = allowedToBeMigratedAccessIdToOntDictionary[accessId].Pon.PonGroup.Olt.Odf.Router.Vendor;
152: }
153: }
154:
155:
156: var msanServiceList = Ia.Ngn.Cl.Model.Data.Service2.MsanServiceInAllowedToBeMigratedDomainList;
157:
158: foreach (var s in msanServiceList)
159: {
160: if (!dictionary.ContainsKey(s)) dictionary[s] = Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei; // all MSAN services are within Huawei routers
161: }
162:
163: return dictionary;
164: }
165: }
166:
167: ////////////////////////////////////////////////////////////////////////////
168:
169: /// <summary>
170: ///
171: /// </summary>
172: public static Dictionary<string, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Site> ImsServiceToOntAndMsanSiteInAllowedToBeMigratedOltAndDomainDictionary
173: {
174: get
175: {
176: string service, accessId;
177: Dictionary<string, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Site> dictionary;
178:
179: var imsServiceToAccessIdInAllowedToBeMigratedOltDictionary = Ia.Ngn.Cl.Model.Data.Service2.ImsServiceToAccessIdInAllowedToBeMigratedOltDictionary;
180:
181: var allowedToBeMigratedAccessIdToOntDictionary = Ia.Ngn.Cl.Model.Data.Service.AllowedToBeMigratedAccessIdToOntDictionary;
182:
183: dictionary = new Dictionary<string, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Site>();
184:
185: foreach (KeyValuePair<string, string> kvp in imsServiceToAccessIdInAllowedToBeMigratedOltDictionary)
186: {
187: service = kvp.Key;
188: accessId = kvp.Value;
189:
190: if (allowedToBeMigratedAccessIdToOntDictionary.ContainsKey(accessId)) // I had to add this after adding 2467,2480 MSAN domains. I do not know why.
191: {
192: dictionary[service] = allowedToBeMigratedAccessIdToOntDictionary[accessId].Pon.PonGroup.Olt.Odf.Router.Site;
193: }
194: }
195:
196:
197: var msanServiceToSiteInAllowedToBeMigratedDomainListDictionary = Ia.Ngn.Cl.Model.Data.Service2.MsanServiceToSiteInAllowedToBeMigratedDomainListDictionary;
198:
199: foreach (var kvp in msanServiceToSiteInAllowedToBeMigratedDomainListDictionary)
200: {
201: service = kvp.Key;
202:
203: if (!dictionary.ContainsKey(service))
204: {
205: dictionary[service] = msanServiceToSiteInAllowedToBeMigratedDomainListDictionary[service];
206: }
207: }
208:
209: return dictionary;
210: }
211: }
212:
213: ////////////////////////////////////////////////////////////////////////////
214:
215: /// <summary>
216: ///
217: /// </summary>
218: public static Dictionary<string, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Site> ImsServiceToOntSiteInAllowedToBeMigratedOltDictionary
219: {
220: get
221: {
222: string service, accessId;
223: Dictionary<string, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Site> dictionary;
224:
225: var imsServiceToAccessIdInAllowedToBeMigratedOltDictionary = Ia.Ngn.Cl.Model.Data.Service2.ImsServiceToAccessIdInAllowedToBeMigratedOltDictionary;
226:
227: var allowedToBeMigratedAccessIdToOntDictionary = Ia.Ngn.Cl.Model.Data.Service.AllowedToBeMigratedAccessIdToOntDictionary;
228:
229: dictionary = new Dictionary<string, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Site>();
230:
231: foreach (KeyValuePair<string, string> kvp in imsServiceToAccessIdInAllowedToBeMigratedOltDictionary)
232: {
233: service = kvp.Key;
234: accessId = kvp.Value;
235:
236: if (allowedToBeMigratedAccessIdToOntDictionary.ContainsKey(accessId)) // I had to add this after adding 2467,2480 MSAN domains. I do not know why.
237: {
238: dictionary[service] = allowedToBeMigratedAccessIdToOntDictionary[accessId].Pon.PonGroup.Olt.Odf.Router.Site;
239: }
240: }
241:
242: return dictionary;
243: }
244: }
245:
246: ////////////////////////////////////////////////////////////////////////////
247:
248: /// <summary>
249: ///
250: /// </summary>
251: public static List<string> ServiceThatDoNotExistInServiceRequestServiceServiceIdList()
252: {
253: List<string> list;
254:
255: using (var db = new Ia.Ngn.Cl.Model.Ngn())
256: {
257: list = (from s in db.Service2
258: join srs in db.ServiceRequestServices on s.Id equals srs.Id into gj
259: from subsrs in gj.DefaultIfEmpty()
260: where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.ImsService && subsrs.Id == null
261: select s.Id).ToList();
262: }
263:
264: return list;
265: }
266:
267: ////////////////////////////////////////////////////////////////////////////
268:
269: /// <summary>
270: ///
271: /// </summary>
272: public static void DifferenceBetweenServiceAndServiceRequestOntDetailsOfTheCustomerDepartmentDatabase(out List<Ia.Ngn.Cl.Model.Business.ServiceServiceRequestOnt> toInsertIntoCustomerDepartment, out List<Ia.Ngn.Cl.Model.Business.ServiceServiceRequestOnt> toRemoveFromCustomerDepartment)
273: {
274: List<Ia.Ngn.Cl.Model.Business.ServiceServiceRequestOnt> toRemoveBecauseServicePositionIsUndefinedList, toRemoveFromCustomerDepartmentBecauseDoesNotExistInService, toOverwriteByRemovingFirstInCustomerDepartment;
275: Dictionary<string, int> serviceIdToPositionDictionary;
276:
277: toRemoveBecauseServicePositionIsUndefinedList = new List<Ia.Ngn.Cl.Model.Business.ServiceServiceRequestOnt>();
278:
279: serviceIdToPositionDictionary = Ia.Ngn.Cl.Model.Data.Service.ServiceIdToServiceRequestServicePositionDictionaryReloaded;
280:
281: using (var db = new Ia.Ngn.Cl.Model.Ngn())
282: {
283: // insert into db:
284: /*
285: select s.Id, s.Service, s.ServiceType, sro.Id from Service2 s
286: inner join ServiceRequestOnts sro on s.Access_Id = sro.Access_Id
287: left outer join ServiceRequestOntDetails srod on s.Service = srod.Service
288: where s.ServiceType = 1 and srod.Id is null
289: order by s.Service
290: */
291: var toInsertIntoCustomerDepartment0 = (from s in db.Service2
292: join sro in db.ServiceRequestOnts on s.Access.Id equals sro.Access.Id
293: join srod in db.ServiceRequestOntDetails on s.Service equals srod.Service
294: into gj
295: from srodgj in gj.DefaultIfEmpty()
296: where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.ImsService && srodgj.Id == null //&& s.Access != null //&& sro.Access != null
297: select new Ia.Ngn.Cl.Model.Business.ServiceServiceRequestOnt()
298: {
299: ServiceId = s.Id,
300: Service = s.Service,
301: ServiceType = s.ServiceType,
302: ServiceRequestOnt = sro
303: }).Distinct().AsNoTracking().ToList();
304:
305: foreach (var v in toInsertIntoCustomerDepartment0)
306: {
307: if (serviceIdToPositionDictionary.ContainsKey(v.ServiceId))
308: {
309: v.ServicePosition = serviceIdToPositionDictionary[v.ServiceId];
310: }
311: else toRemoveBecauseServicePositionIsUndefinedList.Add(v);
312: }
313:
314: // I will remove the following from list because the service position is not defined
315: foreach (var v in toRemoveBecauseServicePositionIsUndefinedList) toInsertIntoCustomerDepartment0.Remove(v);
316:
317: toInsertIntoCustomerDepartment0 = toInsertIntoCustomerDepartment0.OrderBy(u => u.Service).ToList();
318:
319:
320: // remove from db:
321:
322: toOverwriteByRemovingFirstInCustomerDepartment = (from s in db.Service2
323: join sro in db.ServiceRequestOnts on s.Access.Id equals sro.Access.Id
324: join srod in db.ServiceRequestOntDetails on s.Service equals srod.Service
325: where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.ImsService
326: && srod.ServiceRequestOnt != null
327: && (srod.ServiceRequestOnt.Id != sro.Access.Id || srod.ServiceRequestOnt.Id == sro.Access.Id && (srod.Service != s.Service || srod.ServicePosition != s.Port))
328: select new Ia.Ngn.Cl.Model.Business.ServiceServiceRequestOnt()
329: {
330: ServiceId = s.Id,
331: Service = s.Service,
332: ServiceType = s.ServiceType,
333: ServiceRequestOnt = srod.ServiceRequestOnt
334: }).Distinct().AsNoTracking().ToList();
335:
336: toRemoveFromCustomerDepartmentBecauseDoesNotExistInService = (from srod in db.ServiceRequestOntDetails
337: join sro in db.ServiceRequestOnts on srod.ServiceRequestOnt.Id equals sro.Id
338: join s in db.Service2 on srod.Service equals s.Service
339: into gj
340: from subs in gj.DefaultIfEmpty()
341: where /*subs.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.ImsService &&*/ subs.Id == null && sro.Access != null //&& srod.Service == "25488888"
342: select new Ia.Ngn.Cl.Model.Business.ServiceServiceRequestOnt()
343: {
344: Service = srod.Service,
345: ServiceRequestOnt = sro
346: }).Distinct().AsNoTracking().ToList();
347:
348: var toRemoveFromCustomerDepartment0 = toRemoveFromCustomerDepartmentBecauseDoesNotExistInService.Union(toOverwriteByRemovingFirstInCustomerDepartment).Distinct().ToList();
349:
350:
351: toInsertIntoCustomerDepartment = new List<Ia.Ngn.Cl.Model.Business.ServiceServiceRequestOnt>();
352: toRemoveFromCustomerDepartment = new List<Ia.Ngn.Cl.Model.Business.ServiceServiceRequestOnt>();
353:
354: foreach (var v in toInsertIntoCustomerDepartment0)
355: {
356: if (Ia.Ngn.Cl.Model.Business.Service.ServiceHasEightDigitsAndIsWithinAllowedDomainList(v.Service))
357: {
358: toInsertIntoCustomerDepartment.Add(v);
359: }
360: }
361:
362: foreach (var v in toRemoveFromCustomerDepartment0)
363: {
364: if (Ia.Ngn.Cl.Model.Business.Service.ServiceHasEightDigitsAndIsWithinAllowedDomainList(v.Service))
365: {
366: toRemoveFromCustomerDepartment.Add(v);
367: }
368: }
369: }
370: }
371:
372: ////////////////////////////////////////////////////////////////////////////
373:
374: /// <summary>
375: ///
376: /// </summary>
377: public static List<Ia.Ngn.Cl.Model.Business.ServiceServiceRequestOnt> ServiceServiceRequestOntDetailWithMismatchedInformationInServiceRequestOntDetailList()
378: {
379: List<Ia.Ngn.Cl.Model.Business.ServiceServiceRequestOnt> list;
380: Dictionary<string, int> serviceIdToPositionDictionary;
381:
382: serviceIdToPositionDictionary = Ia.Ngn.Cl.Model.Data.Service.ServiceIdToServiceRequestServicePositionDictionary;
383:
384: using (var db = new Ia.Ngn.Cl.Model.Ngn())
385: {
386: list = (from s in db.Service2
387: join sro in db.ServiceRequestOnts on s.Access.Id equals sro.Access.Id
388: join srod in db.ServiceRequestOntDetails on sro.Id equals srod.ServiceRequestOnt.Id /*into gj
389: from subsrod in gj.DefaultIfEmpty()*/
390: where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.ImsService && /*subsrod.Id == null &&*/ s.Access != null && sro.Access != null
391: select new Ia.Ngn.Cl.Model.Business.ServiceServiceRequestOnt()
392: {
393: ServiceId = s.Id,
394: Service = s.Service,
395: ServiceType = s.ServiceType,
396: ServiceRequestOnt = sro
397: }).ToList();
398:
399: foreach (var v in list)
400: {
401: if (serviceIdToPositionDictionary.ContainsKey(v.ServiceId))
402: {
403: v.ServicePosition = serviceIdToPositionDictionary[v.ServiceId];
404: }
405: }
406: }
407:
408: return list.OrderBy(u => u.Service).ToList();
409: }
410:
411: ////////////////////////////////////////////////////////////////////////////
412:
413: /// <summary>
414: ///
415: /// </summary>
416: public static Dictionary<string, int> ServiceIdToServiceRequestServicePositionDictionary
417: {
418: get
419: {
420: if (serviceIdToServiceRequestServicePositionDictionary == null || serviceIdToServiceRequestServicePositionDictionary.Count == 0)
421: {
422: lock (objectLock)
423: {
424: serviceIdToServiceRequestServicePositionDictionary = Ia.Ngn.Cl.Model.Data.Service._ServiceIdToServiceRequestServicePositionDictionary;
425: }
426: }
427:
428: return serviceIdToServiceRequestServicePositionDictionary;
429: }
430: }
431:
432: ////////////////////////////////////////////////////////////////////////////
433:
434: /// <summary>
435: ///
436: /// </summary>
437: public static Dictionary<string, int> ServiceIdToServiceRequestServicePositionDictionaryReloaded
438: {
439: get
440: {
441: if (serviceIdToServiceRequestServicePositionDictionary != null) serviceIdToServiceRequestServicePositionDictionary.Clear();
442:
443: return ServiceIdToServiceRequestServicePositionDictionary;
444: }
445: }
446:
447: ////////////////////////////////////////////////////////////////////////////
448:
449: /// <summary>
450: ///
451: /// </summary>
452: private static Dictionary<string, int> _ServiceIdToServiceRequestServicePositionDictionary
453: {
454: get
455: {
456: var list = new HashSet<ServiceAccessFnSnPnPort>();
457:
458: var serviceType = Ia.Ngn.Cl.Model.Business.Service.ServiceType.ImsService;
459:
460: using (var db = new Ia.Ngn.Cl.Model.Ngn())
461: {
462: // No-No non-SIP SFU/MDU
463: var list1 = (from a in db.Accesses
464: join o in db.Onts on a.Id equals o.Access.Id
465: join osv in db.OntServiceVoips on o.Id equals osv.Ont.Id
466: join gr in db.AgcfGatewayRecords on osv.Ip equals gr.IP1
467: join ep in db.AgcfEndpoints on gr.Id equals ep.AgcfGatewayRecord.Id
468: select new ServiceAccessFnSnPnPort
469: {
470: Service = ep.PrividUser,
471: AccessId = a.Id,
472: Port = ep.FlatTermID
473: }).AsNoTracking().ToHashSet<ServiceAccessFnSnPnPort>();
474:
475: // No-Hu or Hu-Hu SIP SFU
476: var list2 = (from a in db.Accesses
477: join eo in db.EmsOnts on a.Id equals eo.Access.Id
478: join eosi in db.EmsOntSipInfoes on eo.Id equals eosi.EmsOnt.Id
479: select new ServiceAccessFnSnPnPort
480: {
481: Service = eosi.SIPUSERNAME,
482: AccessId = a.Id,
483: Port = eosi.TEL
484: }).AsNoTracking().ToHashSet<ServiceAccessFnSnPnPort>();
485:
486: // No-Hu or Hu-Hu SIP MDU
487: var list3 = (from a in db.Accesses
488: join eo in db.EmsOnts on a.Id equals eo.Access.Id
489: join evpu in db.EmsVoipPstnUsers on eo.Id equals evpu.EmsOnt.Id
490: select new ServiceAccessFnSnPnPort
491: {
492: Service = evpu.DN,
493: AccessId = a.Id,
494: Fn = evpu.FN,
495: Sn = evpu.SN,
496: Pn = evpu.PN,
497: Port = Ia.Ngn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown,
498: }).AsNoTracking().ToHashSet<ServiceAccessFnSnPnPort>();
499:
500: // Hu-No non-SIP SFU/MDU
501: var list4 = (from a in db.Accesses
502: join o in db.Onts on a.Id equals o.Access.Id
503: join osv in db.OntServiceVoips on o.Id equals osv.Ont.Id
504: join m in db.Mgws on osv.Ip equals m.RA1
505: join asb in db.Asbrs on m.Id equals asb.Mgw.Id
506: select new ServiceAccessFnSnPnPort
507: {
508: Service = asb.PUI,
509: AccessId = a.Id,
510: Port = int.Parse(asb.TID)
511: }).AsNoTracking().ToHashSet<ServiceAccessFnSnPnPort>();
512:
513: var list0 = list1.Union(list2).Union(list3).Union(list4).ToHashSet();
514:
515: string id;
516: var hashSet = new HashSet<string>();
517:
518: foreach (var l in list0)
519: {
520: // debug
521: //if (l.Service.Contains("25413662"))
522: //{
523: //}
524:
525: l.Service = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(l.Service);
526:
527: l.ServiceId = Ia.Ngn.Cl.Model.Business.Service.ServiceToServiceId(l.Service, Ia.Ngn.Cl.Model.Business.Service.ServiceType.ImsService);
528:
529: if (l.Port == Ia.Ngn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown)
530: {
531: l.Port = Ia.Ngn.Cl.Model.Data.Huawei.Default.MduDevPortByAccessIdFnSnPn(l.AccessId, l.Fn, l.Sn, l.Pn);
532: }
533:
534: id = l.AccessId + ":" + l.Service + ":" + l.ServiceId + ":" + l.Fn + ":" + l.Sn + ":" + l.Pn + ":" + l.Port;
535:
536: if (hashSet.Contains(id))
537: {
538:
539: }
540: else
541: {
542: list.Add(l);
543:
544: hashSet.Add(id);
545: }
546: }
547:
548: /*
549: var d = new Dictionary<string, ServiceAccessFnSnPnPort>();
550:
551: var uuu = (from i in list1 where i.Service == "24901414" select i).ToList();
552:
553: var y = list1.Distinct().ToList();
554:
555: foreach (var l in list1)
556: {
557: if (d.ContainsKey(l.Service))
558: {
559:
560: }
561: else d[l.Service] = l;
562: }
563:
564: var l0 = list1.OrderBy(u => u.Service).ToHashSet();
565: var l01 = list1.Distinct().ToHashSet();
566: var l1 = list1.Select(u => u.Service).Intersect(list1.Select(u => u.Service)).ToHashSet();
567: var l2 = list1.Select(u => u.Service).Intersect(list2.Select(u => u.Service)).ToHashSet();
568: var l3 = list1.Select(u => u.Service).Intersect(list3.Select(u => u.Service)).ToHashSet();
569: var l4 = list1.Select(u => u.Service).Intersect(list4.Select(u => u.Service)).ToHashSet();
570:
571: var l5 = list2.Select(u => u.Service).Intersect(list2.Select(u => u.Service)).ToHashSet();
572: var l6 = list2.Select(u => u.Service).Intersect(list3.Select(u => u.Service)).ToHashSet();
573: var l7 = list2.Select(u => u.Service).Intersect(list4.Select(u => u.Service)).ToHashSet();
574:
575: var l8 = list3.Select(u => u.Service).Intersect(list3.Select(u => u.Service)).ToHashSet();
576: var l9 = list3.Select(u => u.Service).Intersect(list4.Select(u => u.Service)).ToHashSet();
577:
578: var l10 = list4.Select(u => u.Service).Intersect(list4.Select(u => u.Service)).ToHashSet();
579: */
580:
581:
582: }
583:
584: var dictionary = new Dictionary<string, int>(list.Count);
585:
586: foreach (var l in list)
587: {
588: if (dictionary.ContainsKey(l.ServiceId))
589: {
590: // debug
591: }
592:
593: if (l.Port != Ia.Ngn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown && l.Port != 0)
594: {
595: dictionary[l.ServiceId] = l.Port;
596: }
597: }
598:
599: return dictionary;
600: }
601: }
602:
603: /*
604: ////////////////////////////////////////////////////////////////////////////
605:
606: /// <summary>
607: ///
608: /// </summary>
609: private static Dictionary<string, int> _ServiceIdToServiceRequestServicePositionDictionaryOld
610: {
611: get
612: {
613: string key;
614: Dictionary<string, int> dictionary;
615:
616: var nokiaToNokiaDictionary = new Dictionary<string, int>();
617: var nokiaToHuaweiEmsOntSipInfoesDictionary = new Dictionary<string, int>();
618: var nokiaToHuaweiEmsVoipPstnUsersDictionary = new Dictionary<string, int>();
619: var huaweiToHuaweiEmsOntSipInfoesDictionary = new Dictionary<string, int>();
620: var huaweiToHuaweiEmsVoipPstnUsersDictionary = new Dictionary<string, int>();
621: var huaweiToNokiaAsbrsDictionary = new Dictionary<string, int>();
622:
623: #if DEBUG
624: var dummyVarToDrawRefractorToBelow = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service("0000000");
625: #endif
626:
627: using (var db = new Ia.Ngn.Cl.Model.Ngn())
628: {
629: // No-No
630: nokiaToNokiaDictionary = (from s in db.Subscribers
631: join sp in db.SubParties on s.SubParty.Id equals sp.Id
632: join ep in db.AgcfEndpoints on sp.AgcfEndpoint.Id equals ep.Id
633: select new { s.Id, ep.FlatTermID }).Distinct().AsNoTracking().ToDictionary(u => u.Id, u => u.FlatTermID);
634:
635:
636: // No-Hu ONT with EmsOntSipInfo
637: // select * from Subscribers as s inner join EmsOntSipInfoes as eosi on s.PartyId = eosi.SIPUSERNAME
638: var list = (from s in db.Subscribers
639: join eosi in db.EmsOntSipInfoes on s.PartyId equals eosi.SIPUSERNAME
640: select new { s.Id, eosi.TEL }).AsNoTracking().ToList();
641:
642: foreach (var l in list)
643: {
644: if (!nokiaToHuaweiEmsOntSipInfoesDictionary.ContainsKey(l.Id))
645: {
646: nokiaToHuaweiEmsOntSipInfoesDictionary[l.Id] = l.TEL;
647: }
648: }
649:
650:
651:
652: // No-Hu MDU with EmsVoipPstnUser
653: // select s.Id, evpu.PN from Subscribers as s inner join EmsVoipPstnUsers as evpu on s.PartyId = '+' + evpu.DN
654: var list2 = (from s in db.Subscribers
655: join evpu in db.EmsVoipPstnUsers on s.PartyId equals "+" + evpu.DN // see: Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ServiceWithCountryCode()
656: where evpu.EmsOnt != null && evpu.EmsOnt.Access != null
657: select new { s.Id, AccessId = evpu.EmsOnt.Access.Id, evpu.FN, evpu.SN, evpu.PN }).AsNoTracking().ToList();
658:
659: foreach (var l in list2)
660: {
661: if (!nokiaToHuaweiEmsVoipPstnUsersDictionary.ContainsKey(l.Id))
662: {
663: nokiaToHuaweiEmsVoipPstnUsersDictionary[l.Id] = l.PN;
664: }
665: }
666:
667:
668:
669: // Hu-Hu ONT with EmsOntSipInfo
670: // I will use SIPUSERNAME because looks similar for Nokia and Huawei switches, but SIPNAME sometimes like +96525422460@ims.moc.kw and like priv_96524602282
671: // select s.IMPU, eosi.SIPUSERNAME, eosi.TEL from HuSbrs as s inner join EmsOntSipInfoes as eosi on s.IMPU = 'sip:' + eosi.SIPNAME
672: var list3 = (from s in db.HuSbrs
673: join eosi in db.EmsOntSipInfoes on s.IMPU equals "sip:" + eosi.SIPNAME // see: Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ImpuSipDomain()
674: select new { s.IMPU, eosi.TEL }).AsNoTracking().ToList();
675:
676: foreach (var l in list3)
677: {
678: if (!huaweiToHuaweiEmsOntSipInfoesDictionary.ContainsKey(l.IMPU))
679: {
680: huaweiToHuaweiEmsOntSipInfoesDictionary[l.IMPU] = l.TEL;
681: }
682: }
683:
684:
685: // Hu-Hu MDU with EmsVoipPstnUser
686: // select * from HuSbrs s inner join EmsVoipPstnUsers evpu on s.IMPU = 'sip:+' + evpu.DN + '@ims.moc.kw'
687: huaweiToHuaweiEmsVoipPstnUsersDictionary = (from s in db.HuSbrs
688: join evpu in db.EmsVoipPstnUsers on s.IMPU equals "sip:+" + evpu.DN + "@ims.moc.kw" // see: Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ServiceWithCountryCode()
689: where evpu.EmsOnt != null && evpu.EmsOnt.Access != null
690: select new { s.IMPU, AccessId = evpu.EmsOnt.Access.Id, evpu.FN, evpu.SN, evpu.PN }).Distinct().AsNoTracking().ToDictionary(u => u.IMPU, u => u.PN);
691:
692:
693: // Hu-No non-SIP SFU/MDU
694: var list5 = (from s in db.HuSbrs
695: join a in db.Asbrs on s.IMPU equals a.PUI
696: select new { s.IMPU, TID = int.Parse(a.TID) }).AsNoTracking().ToList();
697:
698: foreach (var l in list5)
699: {
700: if (!huaweiToNokiaAsbrsDictionary.ContainsKey(l.IMPU))
701: {
702: huaweiToNokiaAsbrsDictionary[l.IMPU] = l.TID;
703: }
704: }
705:
706: dictionary = new Dictionary<string, int>(nokiaToNokiaDictionary.Count + nokiaToHuaweiEmsOntSipInfoesDictionary.Count + huaweiToHuaweiEmsOntSipInfoesDictionary.Count + huaweiToHuaweiEmsVoipPstnUsersDictionary.Count);
707:
708:
709: foreach (KeyValuePair<string, int> kvp in nokiaToNokiaDictionary)
710: {
711: key = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(kvp.Key);
712: key = Ia.Ngn.Cl.Model.Business.Service.ServiceToServiceId(key, Ia.Ngn.Cl.Model.Business.Service.ServiceType.ImsService);
713: dictionary[key] = kvp.Value;
714: }
715:
716: foreach (KeyValuePair<string, int> kvp in nokiaToHuaweiEmsOntSipInfoesDictionary)
717: {
718: key = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(kvp.Key);
719: key = Ia.Ngn.Cl.Model.Business.Service.ServiceToServiceId(key, Ia.Ngn.Cl.Model.Business.Service.ServiceType.ImsService);
720: dictionary[key] = kvp.Value;
721: }
722:
723: foreach (KeyValuePair<string, int> kvp in nokiaToHuaweiEmsVoipPstnUsersDictionary)
724: {
725: key = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(kvp.Key);
726: key = Ia.Ngn.Cl.Model.Business.Service.ServiceToServiceId(key, Ia.Ngn.Cl.Model.Business.Service.ServiceType.ImsService);
727: dictionary[key] = Ia.Ngn.Cl.Model.Business.Service.ConvertEmsVoipPstnUsersPnToServiceRequestServicePosition(kvp.Value);
728: }
729:
730: foreach (KeyValuePair<string, int> kvp in huaweiToHuaweiEmsOntSipInfoesDictionary)
731: {
732: key = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(kvp.Key);
733: key = Ia.Ngn.Cl.Model.Business.Service.ServiceToServiceId(key, Ia.Ngn.Cl.Model.Business.Service.ServiceType.ImsService);
734: dictionary[key] = kvp.Value;
735: }
736:
737: foreach (KeyValuePair<string, int> kvp in huaweiToHuaweiEmsVoipPstnUsersDictionary)
738: {
739: key = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(kvp.Key);
740: key = Ia.Ngn.Cl.Model.Business.Service.ServiceToServiceId(key, Ia.Ngn.Cl.Model.Business.Service.ServiceType.ImsService);
741: dictionary[key] = Ia.Ngn.Cl.Model.Business.Service.ConvertEmsVoipPstnUsersPnToServiceRequestServicePosition(kvp.Value);
742: }
743:
744: foreach (KeyValuePair<string, int> kvp in huaweiToNokiaAsbrsDictionary)
745: {
746: key = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Service(kvp.Key);
747: key = Ia.Ngn.Cl.Model.Business.Service.ServiceToServiceId(key, Ia.Ngn.Cl.Model.Business.Service.ServiceType.ImsService);
748: dictionary[key] = kvp.Value;
749: }
750: }
751:
752: return dictionary;
753: }
754: }
755: */
756:
757: ////////////////////////////////////////////////////////////////////////////
758:
759: /// <summary>
760: ///
761: /// </summary>
762: public static void AccessIdAndPortByService(string service, out string accessId, out int port)
763: {
764: // see Ia.Ngn.Cl.Model.Data.Service._ServiceIdToPositionDictionary;
765:
766: var serviceAccessFnSnPnPort = new ServiceAccessFnSnPnPort();
767:
768: if (!string.IsNullOrEmpty(service))
769: {
770: var serviceType = Ia.Ngn.Cl.Model.Business.Service.ServiceType.ImsService;
771: var serviceId = Ia.Ngn.Cl.Model.Business.Service.ServiceToServiceId(service, serviceType);
772:
773: var router = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.RouterFromService(service);
774:
775: if (router != null)
776: {
777: if (router.Vendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia || router.Vendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
778: {
779: using (var db = new Ia.Ngn.Cl.Model.Ngn())
780: {
781: if (router.Vendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia)
782: {
783: var prividUser = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.PrividUser(service);
784:
785: // attempt to find access of No-No non-SIP SFU/MDU
786: serviceAccessFnSnPnPort = (from a in db.Accesses
787: join o in db.Onts on a.Id equals o.Access.Id
788: join osv in db.OntServiceVoips on o.Id equals osv.Ont.Id
789: join gr in db.AgcfGatewayRecords on osv.Ip equals gr.IP1
790: join ep in db.AgcfEndpoints on gr.Id equals ep.AgcfGatewayRecord.Id
791: where ep.PrividUser == prividUser
792: select new ServiceAccessFnSnPnPort { AccessId = a.Id, Port = ep.FlatTermID }).AsNoTracking().FirstOrDefault(); //.SingleOrDefault();
793:
794: if (serviceAccessFnSnPnPort == null)
795: {
796: var impi = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Impi(service);
797: var impuAid = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ImpuAid(service);
798:
799: // attempt to find access of No-Hu or Hu-Hu SIP SFU
800: serviceAccessFnSnPnPort = (from a in db.Accesses
801: join eo in db.EmsOnts on a.Id equals eo.Access.Id
802: join eosi in db.EmsOntSipInfoes on eo.Id equals eosi.EmsOnt.Id
803: where eosi.SIPNAME == impi || eosi.SIPUSERNAME == impuAid
804: orderby eo.ResultCode == (long)Ia.Ngn.Cl.Model.Client.Huawei.Ems.ResultCode.Succeeded descending, eosi.Created descending
805: select new ServiceAccessFnSnPnPort
806: {
807: AccessId = a.Id,
808: Port = eosi.TEL
809: }).AsNoTracking().FirstOrDefault(); //.SingleOrDefault();
810:
811: if (serviceAccessFnSnPnPort == null)
812: {
813: var dn = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ServiceWithCountryCode(service);
814:
815: // attempt to find access of No-Hu or Hu-Hu SIP MDU
816: serviceAccessFnSnPnPort = (from a in db.Accesses
817: join eo in db.EmsOnts on a.Id equals eo.Access.Id
818: join evpu in db.EmsVoipPstnUsers on eo.Id equals evpu.EmsOnt.Id
819: join ed in db.EmsDevs on evpu.DID equals ed.DID
820: where evpu.EmsOnt != null && evpu.DN == dn
821: orderby ed.ResultCode == (long)Ia.Ngn.Cl.Model.Client.Huawei.Ems.ResultCode.Succeeded descending, evpu.Created descending
822: select new ServiceAccessFnSnPnPort
823: {
824: AccessId = a.Id,
825: Fn = evpu.FN,
826: Sn = evpu.SN,
827: Pn = evpu.PN,
828: }).AsNoTracking().FirstOrDefault(); //.SingleOrDefault();
829:
830: if (serviceAccessFnSnPnPort == null)
831: {
832:
833: }
834: else serviceAccessFnSnPnPort.Port = Ia.Ngn.Cl.Model.Data.Huawei.Default.MduDevPortByAccessIdFnSnPn(serviceAccessFnSnPnPort.AccessId, serviceAccessFnSnPnPort.Fn, serviceAccessFnSnPnPort.Sn, serviceAccessFnSnPnPort.Pn);
835: }
836: else
837: {
838:
839: }
840: }
841: else
842: {
843:
844: }
845: }
846: else //if(router.Vendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei)
847: {
848: var impi = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Impi(service);
849: var impuAid = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ImpuAid(service);
850:
851: // attempt to find access of No-Hu or Hu-Hu SIP SFU
852: serviceAccessFnSnPnPort = (from a in db.Accesses
853: join eo in db.EmsOnts on a.Id equals eo.Access.Id
854: join eosi in db.EmsOntSipInfoes on eo.Id equals eosi.EmsOnt.Id
855: where eosi.SIPNAME == impi || eosi.SIPUSERNAME == impuAid
856: orderby eo.ResultCode == (long)Ia.Ngn.Cl.Model.Client.Huawei.Ems.ResultCode.Succeeded descending, eosi.Created descending
857: select new ServiceAccessFnSnPnPort
858: {
859: AccessId = a.Id,
860: Port = eosi.TEL
861: }).AsNoTracking().FirstOrDefault(); //.SingleOrDefault();
862:
863: if (serviceAccessFnSnPnPort == null)
864: {
865: var dn = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ServiceWithCountryCode(service);
866:
867: // attempt to find access of No-Hu or Hu-Hu SIP MDU
868: serviceAccessFnSnPnPort = (from a in db.Accesses
869: join eo in db.EmsOnts on a.Id equals eo.Access.Id
870: join evpu in db.EmsVoipPstnUsers on eo.Id equals evpu.EmsOnt.Id
871: join ed in db.EmsDevs on evpu.DID equals ed.DID
872: where evpu.EmsOnt != null && evpu.DN == dn
873: orderby ed.ResultCode == (long)Ia.Ngn.Cl.Model.Client.Huawei.Ems.ResultCode.Succeeded descending, evpu.Created descending
874: select new ServiceAccessFnSnPnPort
875: {
876: AccessId = a.Id,
877: Fn = evpu.FN,
878: Sn = evpu.SN,
879: Pn = evpu.PN,
880: }).AsNoTracking().FirstOrDefault(); //.SingleOrDefault();
881:
882: if (serviceAccessFnSnPnPort == null)
883: {
884: var pui = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ImpuSipDomain(service);
885:
886: // attempt to find access of Hu-No non-SIP SFU/MDU
887: serviceAccessFnSnPnPort = (from a in db.Accesses
888: join o in db.Onts on a.Id equals o.Access.Id
889: join osv in db.OntServiceVoips on o.Id equals osv.Ont.Id
890: join m in db.Mgws on osv.Ip equals m.RA1
891: join asb in db.Asbrs on m.Id equals asb.Mgw.Id
892: where asb.PUI == pui
893: select new ServiceAccessFnSnPnPort
894: {
895: AccessId = a.Id,
896: Port = int.Parse(asb.TID)
897: }).AsNoTracking().FirstOrDefault(); //.SingleOrDefault();
898: }
899: else serviceAccessFnSnPnPort.Port = Ia.Ngn.Cl.Model.Data.Huawei.Default.MduDevPortByAccessIdFnSnPn(serviceAccessFnSnPnPort.AccessId, serviceAccessFnSnPnPort.Fn, serviceAccessFnSnPnPort.Sn, serviceAccessFnSnPnPort.Pn);
900: }
901: else
902: {
903:
904: }
905: }
906: }
907: }
908: else
909: {
910:
911: }
912: }
913: else
914: {
915:
916: }
917: }
918: else
919: {
920:
921: }
922:
923: if (serviceAccessFnSnPnPort != null)
924: {
925: accessId = serviceAccessFnSnPnPort.AccessId;
926: port = serviceAccessFnSnPnPort.Port;
927: }
928: else
929: {
930: accessId = string.Empty;
931: port = Ia.Ngn.Cl.Model.Business.Default.PortUndefinedOrInvalidOrUnknown;
932: }
933: }
934:
935: ////////////////////////////////////////////////////////////////////////////
936: ////////////////////////////////////////////////////////////////////////////
937:
938: /// <summary>
939: ///
940: /// </summary>
941: public static List<Ia.Ngn.Cl.Model.Business.Service.KuwaitOfnArea> KuwaitOfnAreaList
942: {
943: get
944: {
945: if (kuwaitOfnAreaList == null || kuwaitOfnAreaList.Count == 0)
946: {
947: lock (objectLock)
948: {
949: kuwaitOfnAreaList = Ia.Ngn.Cl.Model.Data.Service._KuwaitOfnAreaList;
950: }
951: }
952:
953: return kuwaitOfnAreaList;
954: }
955: }
956:
957: ////////////////////////////////////////////////////////////////////////////
958:
959: /// <summary>
960: ///
961: /// </summary>
962: private static List<Ia.Ngn.Cl.Model.Business.Service.KuwaitOfnArea> _KuwaitOfnAreaList
963: {
964: get
965: {
966: int id;
967: string symbol;
968: Ia.Ngn.Cl.Model.Business.Service.KuwaitOfnArea kuwaitOfnArea;
969:
970: kuwaitOfnAreaList = new List<Ia.Ngn.Cl.Model.Business.Service.KuwaitOfnArea>();
971:
972: foreach (XElement xe in XDocument.Element("service").Elements("areaList").Elements("area"))
973: {
974: kuwaitOfnArea = new Ia.Ngn.Cl.Model.Business.Service.KuwaitOfnArea();
975:
976: id = int.Parse(xe.Attribute("id").Value);
977: kuwaitOfnArea.Id = id;
978:
979: symbol = xe.Attribute("symbol").Value;
980: kuwaitOfnArea.Symbol = symbol;
981:
982: kuwaitOfnArea.ServiceRequestAddressProvinceAreaName = xe.Attribute("serviceRequestAddressProvinceAreaName").Value;
983:
984: kuwaitOfnArea.Name = (from ka in Ia.Cl.Model.Kuwait.KuwaitAreaList where ka.Id == id select ka.Name).SingleOrDefault();
985: kuwaitOfnArea.ArabicName = (from ka in Ia.Cl.Model.Kuwait.KuwaitAreaList where ka.Id == id select ka.ArabicName).SingleOrDefault();
986:
987: kuwaitOfnArea.SiteList = (from s in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.SiteList where s.AreaSymbolList.Contains(symbol) select s).ToList();
988:
989: if (kuwaitOfnArea.SiteList != null) kuwaitOfnAreaList.Add(kuwaitOfnArea);
990: }
991:
992: return kuwaitOfnAreaList;
993: }
994: }
995:
996: ////////////////////////////////////////////////////////////////////////////
997:
998: /// <summary>
999: ///
/// </summary>
public static Ia.Ngn.Cl.Model.Business.Service.KuwaitOfnArea KuwaitOfnAreaById(int id)
{
Ia.Ngn.Cl.Model.Business.Service.KuwaitOfnArea kuwaitOfnArea;
if (id > 0)
{
kuwaitOfnArea = (from kna in Ia.Ngn.Cl.Model.Data.Service.KuwaitOfnAreaList
where kna.Id == id
select kna).SingleOrDefault();
}
else kuwaitOfnArea = null;
return kuwaitOfnArea;
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static Ia.Ngn.Cl.Model.Business.Service.KuwaitOfnArea KuwaitOfnAreaBySymbol(string symbol)
{
Ia.Ngn.Cl.Model.Business.Service.KuwaitOfnArea kuwaitOfnArea;
if (!string.IsNullOrEmpty(symbol))
{
kuwaitOfnArea = (from kna in Ia.Ngn.Cl.Model.Data.Service.KuwaitOfnAreaList
where kna.Symbol == symbol
select kna).SingleOrDefault();
}
else kuwaitOfnArea = null;
return kuwaitOfnArea;
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static Dictionary<int, string> AreaIdToSymbolDictionary
{
get
{
Dictionary<int, string> dictionary;
dictionary = (from kna in Ia.Ngn.Cl.Model.Data.Service.KuwaitOfnAreaList
select new { kna.Id, kna.Symbol }).ToDictionary(u => u.Id, u => u.Symbol);
return dictionary;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static Dictionary<int, string> AreaIdToNameArabicNameDictionary
{
get
{
Dictionary<int, string> dictionary;
dictionary = (from kna in Ia.Ngn.Cl.Model.Data.Service.KuwaitOfnAreaList
select new { kna.Id, kna.NameArabicName }).ToDictionary(u => u.Id, u => u.NameArabicName);
return dictionary;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static Dictionary<int, int> AreaIdToSiteIdDictionary
{
get
{
Dictionary<int, int> dictionary;
dictionary = (from kna in Ia.Ngn.Cl.Model.Data.Service.KuwaitOfnAreaList
where kna.SiteList.Count > 0
select new { kna.Id, SiteId = kna.SiteList.FirstOrDefault().Id }).ToDictionary(u => u.Id, u => u.SiteId);
return dictionary;
}
}
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> DomainList
{
get
{
if (domainList == null || domainList.Count == 0)
{
lock (objectLock)
{
domainList = Ia.Ngn.Cl.Model.Data.Service._DomainList;
}
}
return domainList;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
private static List<int> _DomainList
{
get
{
var routerList = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.RouterList;
var list = (from r in routerList select r).SelectMany(r => r.DomainList).ToList();
if (list.Distinct().Count() != list.Count())
{
throw new Exception("domainList has duplicate entries");
}
list.Sort();
return list;
}
}
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> PstnDomainList
{
get
{
if (pstnDomainList == null || pstnDomainList.Count == 0)
{
lock (objectLock)
{
pstnDomainList = Ia.Ngn.Cl.Model.Data.Service._PstnDomainList;
}
}
return pstnDomainList;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
private static List<int> _PstnDomainList
{
get
{
pstnDomainList = (from p in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.PstnList
select p).SelectMany(r => r.DomainList).ToList();
if (pstnDomainList.Distinct().Count() != pstnDomainList.Count())
{
throw new Exception("pstnDomainList has duplicate entries");
}
pstnDomainList.Sort();
return pstnDomainList;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> PstnThatUsesNpServerDomainList
{
get
{
var list = (from p in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.PstnList
where p.UsesNpServer == true
select p).SelectMany(r => r.DomainList).Distinct().ToList();
list.Sort();
return list;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> PstnAndMsanDomainList
{
get
{
var list = Ia.Ngn.Cl.Model.Data.Service.PstnDomainList.Intersect(Ia.Ngn.Cl.Model.Data.Service.MsanDomainList).ToList();
list.Sort();
return list;
}
}
/////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static bool ServiceIsWithinPstnThatUsesNpServerDomainList(string service)
{
return PstnThatUsesNpServerDomainList.Any(u => service.StartsWith(u.ToString()));
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static bool ServiceListHasANumberThatIsWithinPstnThatUsesNpServerDomainList(List<string> serviceList)
{
var b = false;
foreach (var service in serviceList)
{
b = Ia.Ngn.Cl.Model.Data.Service.ServiceIsWithinPstnThatUsesNpServerDomainList(service);
if (b) break;
}
return b;
}
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> LegacyPstnDomainList
{
get
{
if (legacyPstnDomainList == null || legacyPstnDomainList.Count == 0)
{
lock (objectLock)
{
legacyPstnDomainList = Ia.Ngn.Cl.Model.Data.Service._LegacyPstnDomainList;
}
}
return legacyPstnDomainList;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
private static List<int> _LegacyPstnDomainList
{
get
{
legacyPstnDomainList = (from p in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.LegacyPstnList select p).SelectMany(r => r.DomainList).Distinct().ToList();
legacyPstnDomainList.Sort();
return legacyPstnDomainList;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> OfnAndLegacyDomainList
{
get
{
var domainList = Ia.Ngn.Cl.Model.Data.Service.DomainList;
var legacyPstnDomainList = Ia.Ngn.Cl.Model.Data.Service.LegacyPstnDomainList;
var list = domainList.Union(legacyPstnDomainList).ToList();
list.Sort();
return list;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<Ia.Ngn.Cl.Model.Business.Service.HundredsSubdomain> HundredsSubdomainListWithinOfnAndLegacyList
{
get
{
var list = new List<Ia.Ngn.Cl.Model.Business.Service.HundredsSubdomain>();
var routerList = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.RouterList;
foreach (var router in routerList)
{
var subdomainList = HundredsSubdomainListWithinOfnRouter(router);
foreach (var subdomain in subdomainList)
{
list.Add(new Ia.Ngn.Cl.Model.Business.Service.HundredsSubdomain(router, subdomain));
}
}
var legacyPstnList = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.LegacyPstnList;
foreach (var legacyPstn in legacyPstnList)
{
var subdomainList = HundredsSubdomainListWithinLegacyPstn(legacyPstn);
foreach (var subdomain in subdomainList)
{
list.Add(new Ia.Ngn.Cl.Model.Business.Service.HundredsSubdomain(legacyPstn, subdomain));
}
}
return list.Distinct().ToList();
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<Ia.Ngn.Cl.Model.Business.Service.HundredsSubdomain> HundredsSubdomainListWithinOfnList
{
get
{
var list = new List<Ia.Ngn.Cl.Model.Business.Service.HundredsSubdomain>();
var routerList = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.RouterList;
foreach (var router in routerList)
{
var subdomainList = HundredsSubdomainListWithinOfnRouter(router);
foreach (var subdomain in subdomainList)
{
list.Add(new Ia.Ngn.Cl.Model.Business.Service.HundredsSubdomain(router, subdomain));
}
}
return list.Distinct().ToList();
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> HundredsSubdomainListWithinLegacyPstn(string pstnName)
{
int n, length;
string s;
var domainList = (from p in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.LegacyPstnList
where p.Name == pstnName
select p).SelectMany(r => r.DomainList).ToList();
var list = new List<int>(100 * domainList.Count);
foreach (int domain in domainList)
{
s = domain.ToString();
length = s.Length;
if (length == 4)
{
for (int i = 0; i < 100; i++)
{
n = domain * 100 + i;
list.Add(n);
}
}
else if (length == 5)
{
for (int p = 0; p < 10; p++)
{
n = domain * 10 + p;
list.Add(n);
}
}
else
{
throw new Exception("length " + length + " is unknown");
}
}
list.Sort();
return list.OrderBy(u => u).ToList(); // (u => u >= 25410000 && u <= 25440000).ToList();
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> HundredsSubdomainListWithinLegacyPstn(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Pstn pstn)
{
int n, length;
string s;
var domainList = (from p in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.LegacyPstnList
where p == pstn
select p).SelectMany(r => r.DomainList).ToList();
domainList = domainList.Distinct().ToList();
var list = new List<int>(100 * domainList.Count);
foreach (int domain in domainList)
{
s = domain.ToString();
length = s.Length;
if (length == 4)
{
for (int i = 0; i < 100; i++)
{
n = domain * 100 + i;
list.Add(n);
}
}
else if (length == 5)
{
for (int p = 0; p < 10; p++)
{
n = domain * 10 + p;
list.Add(n);
}
}
else
{
throw new Exception("length " + length + " is unknown");
}
}
list.Sort();
return list.OrderBy(u => u).ToList();
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> HundredsSubdomainListWithinOfnRouter(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Router router)
{
int n, length;
string s;
var domainList = (from r in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.RouterList
where r == router
select r).SelectMany(r => r.DomainList).ToList();
domainList = domainList.Distinct().ToList();
var list = new List<int>(100 * domainList.Count);
foreach (int domain in domainList)
{
s = domain.ToString();
length = s.Length;
if (length == 4)
{
for (int i = 0; i < 100; i++)
{
n = domain * 100 + i;
list.Add(n);
}
}
else if (length == 5)
{
for (int p = 0; p < 10; p++)
{
n = domain * 10 + p;
list.Add(n);
}
}
else
{
throw new Exception("length " + length + " is unknown");
}
}
list.Sort();
return list.OrderBy(u => u).ToList();
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> HundredsSubdomainList
{
get
{
int n, length;
string s;
var domainList = Ia.Ngn.Cl.Model.Data.Service.OfnAndLegacyDomainList;
domainList = domainList.Distinct().ToList();
var list = new List<int>(100 * domainList.Count);
foreach (int domain in domainList)
{
s = domain.ToString();
length = s.Length;
if (length == 4)
{
for (int i = 0; i < 100; i++)
{
n = domain * 100 + i;
list.Add(n);
}
}
else if (length == 5)
{
for (int p = 0; p < 10; p++)
{
n = domain * 10 + p;
list.Add(n);
}
}
else
{
throw new Exception("length " + length + " is unknown");
}
}
list.Sort();
return list.OrderBy(u => u).ToList();
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> HundredsSubdomainListWithinOfn
{
get
{
int n, length;
string s;
var domainList = Ia.Ngn.Cl.Model.Data.Service.DomainList;
domainList = domainList.Distinct().ToList();
var list = new List<int>(100 * domainList.Count);
foreach (int domain in domainList)
{
s = domain.ToString();
length = s.Length;
if (length == 4)
{
for (int i = 0; i < 100; i++)
{
n = domain * 100 + i;
list.Add(n);
}
}
else if (length == 5)
{
for (int p = 0; p < 10; p++)
{
n = domain * 10 + p;
list.Add(n);
}
}
else
{
throw new Exception("length " + length + " is unknown");
}
}
list.Sort();
return list.OrderBy(u => u).ToList();
}
}
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> AxePstnDomainList
{
get
{
if (axePstnDomainList == null || axePstnDomainList.Count == 0)
{
lock (objectLock)
{
axePstnDomainList = Ia.Ngn.Cl.Model.Data.Service._AxePstnDomainList;
}
}
return axePstnDomainList;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
private static List<int> _AxePstnDomainList
{
get
{
axePstnDomainList = (from p in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.PstnList
where p.PstnExchangeType == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.PstnExchangeType.EricssonAxe
select p).SelectMany(r => r.DomainList).Distinct().ToList();
axePstnDomainList.Sort();
return axePstnDomainList;
}
}
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> LegacyAxePstnDomainList
{
get
{
if (legacyAxePstnDomainList == null || legacyAxePstnDomainList.Count == 0)
{
lock (objectLock)
{
legacyAxePstnDomainList = Ia.Ngn.Cl.Model.Data.Service._LegacyAxePstnDomainList;
}
}
return legacyAxePstnDomainList;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
private static List<int> _LegacyAxePstnDomainList
{
get
{
legacyAxePstnDomainList = (from p in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.LegacyPstnList
where p.PstnExchangeType == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.PstnExchangeType.EricssonAxe
select p).SelectMany(r => r.DomainList).Distinct().ToList();
legacyAxePstnDomainList.Sort();
return legacyAxePstnDomainList;
}
}
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> EwsdPstnDomainList
{
get
{
if (ewsdPstnDomainList == null || ewsdPstnDomainList.Count == 0)
{
lock (objectLock)
{
ewsdPstnDomainList = Ia.Ngn.Cl.Model.Data.Service._EwsdPstnDomainList;
}
}
return ewsdPstnDomainList;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
private static List<int> _EwsdPstnDomainList
{
get
{
ewsdPstnDomainList = (from p in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.PstnList
where p.PstnExchangeType == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.PstnExchangeType.SiemensEwsd
select p).SelectMany(r => r.DomainList).Distinct().ToList();
ewsdPstnDomainList.Sort();
return ewsdPstnDomainList;
}
}
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> LegacyEwsdPstnDomainList
{
get
{
if (legacyEwsdPstnDomainList == null || legacyEwsdPstnDomainList.Count == 0)
{
lock (objectLock)
{
legacyEwsdPstnDomainList = Ia.Ngn.Cl.Model.Data.Service._LegacyEwsdPstnDomainList;
}
}
return legacyEwsdPstnDomainList;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
private static List<int> _LegacyEwsdPstnDomainList
{
get
{
legacyEwsdPstnDomainList = (from p in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.LegacyPstnList
where p.PstnExchangeType == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.PstnExchangeType.SiemensEwsd
select p).SelectMany(r => r.DomainList).Distinct().ToList();
legacyEwsdPstnDomainList.Sort();
return legacyEwsdPstnDomainList;
}
}
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> LegacyMrdPstnDomainList
{
get
{
if (legacyMrdPstnDomainList == null || legacyMrdPstnDomainList.Count == 0)
{
lock (objectLock)
{
legacyMrdPstnDomainList = Ia.Ngn.Cl.Model.Data.Service._LegacyMrdPstnDomainList;
}
}
return legacyMrdPstnDomainList;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
private static List<int> _LegacyMrdPstnDomainList
{
get
{
legacyMrdPstnDomainList = (from p in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.LegacyPstnList
where p.PstnExchangeType == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.PstnExchangeType.NortelMeridian
select p).SelectMany(r => r.DomainList).Distinct().ToList();
legacyMrdPstnDomainList.Sort();
return legacyMrdPstnDomainList;
}
}
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> MigrationDomainList
{
get
{
if (migrationDomainList == null || migrationDomainList.Count == 0)
{
lock (objectLock)
{
migrationDomainList = Ia.Ngn.Cl.Model.Data.Service._MigrationDomainList;
}
}
return migrationDomainList;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
private static List<int> _MigrationDomainList
{
get
{
var allowedToBeMigratedOltIdList = Ia.Ngn.Cl.Model.Data.Service.AllowedToBeMigratedOltIdList;
var list = (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OltList
where allowedToBeMigratedOltIdList.Contains(o.Id)
select o.Odf.Router).SelectMany(r => r.DomainList).Distinct().ToList();
list.Sort();
return list;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> NokiaSwitchDomainList
{
get
{
if (nokiaSwitchDomainList == null || nokiaSwitchDomainList.Count == 0)
{
lock (objectLock)
{
nokiaSwitchDomainList = Ia.Ngn.Cl.Model.Data.Service._NokiaSwitchDomainList;
}
}
return nokiaSwitchDomainList;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
private static List<int> _NokiaSwitchDomainList
{
get
{
return DomainListWithinSwitchVendor(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia);
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> HuaweiSwitchDomainList
{
get
{
if (huaweiSwitchDomainList == null || huaweiSwitchDomainList.Count == 0)
{
lock (objectLock)
{
huaweiSwitchDomainList = Ia.Ngn.Cl.Model.Data.Service._HuaweiSwitchDomainList;
}
}
return huaweiSwitchDomainList;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
private static List<int> _HuaweiSwitchDomainList
{
get
{
return Ia.Ngn.Cl.Model.Data.Service.DomainListWithinSwitchVendor(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei);
}
}
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> MsanDomainList
{
get
{
if (msanDomainList == null || msanDomainList.Count == 0)
{
lock (objectLock)
{
msanDomainList = Ia.Ngn.Cl.Model.Data.Service._MsanDomainList;
}
}
return msanDomainList;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
private static List<int> _MsanDomainList
{
get
{
msanDomainList = (from m in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.MsanList
where m.DomainList != null
select m).SelectMany(u => u.DomainList).ToList();
if (msanDomainList.Distinct().Count() != msanDomainList.Count())
{
throw new Exception("msanDomainList has duplicate entries");
}
msanDomainList.Sort();
return msanDomainList;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
private static List<int> MsanDomainListBySiteId(int siteId)
{
msanDomainList = (from m in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.MsanList
where m.Site.Id == siteId && m.DomainList != null
select m).SelectMany(u => u.DomainList).Distinct().ToList();
msanDomainList.Sort();
return msanDomainList;
}
////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static bool ServiceIsWithinNokiaSwitchDomainList(string service)
{
bool b;
if (!string.IsNullOrEmpty(service))
{
b = Ia.Ngn.Cl.Model.Data.Service.NokiaSwitchDomainList.Any(u => service.StartsWith(u.ToString()));
}
else b = false;
return b;
}
/////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static bool ServiceIsWithinHuaweiSwitchDomainList(string service)
{
bool b;
if (!string.IsNullOrEmpty(service))
{
b = Ia.Ngn.Cl.Model.Data.Service.HuaweiSwitchDomainList.Any(u => service.StartsWith(u.ToString()));
}
else b = false;
return b;
}
/////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static bool ServiceIsWithinAxePstnDomainList(string service)
{
bool b;
if (!string.IsNullOrEmpty(service))
{
b = Ia.Ngn.Cl.Model.Data.Service.AxePstnDomainList.Any(u => service.StartsWith(u.ToString()));
}
else b = false;
return b;
}
/////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static bool ServiceIsWithinLegacyAxePstnDomainList(string service)
{
bool b;
if (!string.IsNullOrEmpty(service))
{
b = Ia.Ngn.Cl.Model.Data.Service.LegacyAxePstnDomainList.Any(u => service.StartsWith(u.ToString()));
}
else b = false;
return b;
}
/////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static bool ServiceIsWithinEwsdPstnDomainList(string service)
{
bool b;
if (!string.IsNullOrEmpty(service))
{
b = Ia.Ngn.Cl.Model.Data.Service.EwsdPstnDomainList.Any(u => service.StartsWith(u.ToString()));
}
else b = false;
return b;
}
/////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static bool ServiceIsWithinLegacyEwsdPstnDomainList(string service)
{
bool b;
if (!string.IsNullOrEmpty(service))
{
b = Ia.Ngn.Cl.Model.Data.Service.LegacyEwsdPstnDomainList.Any(u => service.StartsWith(u.ToString()));
}
else b = false;
return b;
}
/////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static bool ServiceIsWithinLegacyMrdPstnDomainList(string service)
{
bool b;
if (!string.IsNullOrEmpty(service))
{
b = Ia.Ngn.Cl.Model.Data.Service.LegacyMrdPstnDomainList.Any(u => service.StartsWith(u.ToString()));
}
else b = false;
return b;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static bool ServiceIsWithinSoftXDomainList(string service)
{
bool b;
if (!string.IsNullOrEmpty(service))
{
b = Ia.Ngn.Cl.Model.Data.Service.SoftXDomainList.Any(u => service.StartsWith(u.ToString()));
}
else b = false;
return b;
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static bool ServiceListHasANumberThatIsWithinSoftXServer(List<string> serviceList)
{
var b = false;
foreach (var service in serviceList)
{
b = Ia.Ngn.Cl.Model.Data.Service.ServiceIsWithinSoftXDomainList(service);
if (b) break;
}
return b;
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> SoftXDomainList
{
get
{
if (softxDomainList == null || softxDomainList.Count == 0)
{
lock (objectLock)
{
softxDomainList = Ia.Ngn.Cl.Model.Data.Service._SoftXDomainList;
}
}
return softxDomainList;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
private static List<int> _SoftXDomainList
{
get
{
softxDomainList = (from s in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.SoftXList
where s.DomainList != null
select s).SelectMany(u => u.DomainList).ToList();
if (softxDomainList.Distinct().Count() != softxDomainList.Count())
{
throw new Exception("softxDomainList has duplicate entries");
}
softxDomainList.Sort();
return softxDomainList;
}
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static bool ServiceIsWithinSpsDomainList(string service)
{
bool b;
if (!string.IsNullOrEmpty(service))
{
b = Ia.Ngn.Cl.Model.Data.Service.SpsDomainList.Any(u => service.StartsWith(u.ToString()));
}
else b = false;
return b;
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static bool ServiceListHasANumberThatIsWithinSpsServer(List<string> serviceList)
{
var b = false;
foreach (var service in serviceList)
{
b = Ia.Ngn.Cl.Model.Data.Service.ServiceIsWithinSpsDomainList(service);
if (b) break;
}
return b;
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> SpsDomainList
{
get
{
if (spsDomainList == null || spsDomainList.Count == 0)
{
lock (objectLock)
{
spsDomainList = Ia.Ngn.Cl.Model.Data.Service._SpsDomainList;
}
}
return spsDomainList;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
private static List<int> _SpsDomainList
{
get
{
spsDomainList = (from s in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.PstnList
where s.UsesNpServer == true && s.DomainList != null
select s).SelectMany(u => u.DomainList).ToList();
if (spsDomainList.Distinct().Count() != spsDomainList.Count())
{
throw new Exception("spsDomainList has duplicate entries");
}
spsDomainList.Sort();
return spsDomainList;
}
}
/////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> NokiaSwitchNokiaAccessDomainList
{
get
{
if (nokiaSwitchNokiaAccessDomainList == null || nokiaSwitchNokiaAccessDomainList.Count == 0)
{
lock (objectLock)
{
var oltIdList = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.NokiaSwitchNokiaAccessOltIdList;
nokiaSwitchNokiaAccessDomainList = (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OltList
where oltIdList.Contains(o.Id)
select o.Odf.Router).SelectMany(r => r.DomainList).Distinct().ToList();
nokiaSwitchNokiaAccessDomainList.Sort();
}
}
return nokiaSwitchNokiaAccessDomainList;
}
}
/////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static bool ServiceIsWithinNokiaSwitchNokiaAccessDomainList(string service)
{
bool b;
if (!string.IsNullOrEmpty(service))
{
b = NokiaSwitchNokiaAccessDomainList.Any(u => service.StartsWith(u.ToString()));
}
else b = false;
return b;
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> HuaweiSwitchNokiaAccessDomainList
{
get
{
if (huaweiSwitchNokiaAccessDomainList == null || huaweiSwitchNokiaAccessDomainList.Count == 0)
{
lock (objectLock)
{
var oltIdList = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.HuaweiSwitchNokiaAccessOltIdList;
huaweiSwitchNokiaAccessDomainList = (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OltList
where oltIdList.Contains(o.Id)
select o.Odf.Router).SelectMany(r => r.DomainList).Distinct().ToList();
huaweiSwitchNokiaAccessDomainList.Sort();
}
}
return huaweiSwitchNokiaAccessDomainList;
}
}
/////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static bool ServiceIsWithinHuaweiSwitchNokiaAccessDomainList(string service)
{
bool b;
if (!string.IsNullOrEmpty(service))
{
b = HuaweiSwitchNokiaAccessDomainList.Any(u => service.StartsWith(u.ToString()));
}
else b = false;
return b;
}
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> HuaweiAccessDomainList
{
get
{
if (huaweiAccessDomainList == null || huaweiAccessDomainList.Count == 0)
{
lock (objectLock)
{
var oltIdList = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.HuaweiOltIdList();
huaweiAccessDomainList = (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OltList
where oltIdList.Contains(o.Id)
select o.Odf.Router).SelectMany(r => r.DomainList).Distinct().ToList();
huaweiAccessDomainList.Sort();
}
}
return huaweiAccessDomainList;
}
}
/////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static bool ServiceIsWithinHuaweiAccessDomainList(string service)
{
bool b;
if (!string.IsNullOrEmpty(service))
{
b = HuaweiAccessDomainList.Any(u => service.StartsWith(u.ToString()));
}
else b = false;
return b;
}
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static bool ServiceListHasANumberThatIsWithinHuaweiSwitchNokiaAccessDomainList(List<string> serviceList)
{
var b = false;
foreach (var service in serviceList)
{
b = Ia.Ngn.Cl.Model.Data.Service.ServiceIsWithinHuaweiSwitchNokiaAccessDomainList(service);
if (b) break;
}
return b;
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
private static List<int> DomainListWithinSwitchVendor(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor vendor)
{
List<int> list;
list = (from d in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.RouterList
where d.Vendor == vendor
select d).SelectMany(r => r.DomainList).Distinct().ToList();
list.Sort();
return list;
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
///
/// </summary>
private static List<int> DomainListWithinAccessVendor(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor vendor)
{
List<int> list;
list = (from d in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OdfList
where d.Vendor == vendor
select d.Router).SelectMany(r => r.DomainList).ToList();
list.Sort();
return list;
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> AllPossibleServiceNumberList
{
get
{
int n, length;
string s;
List<int> list;
list = new List<int>(10000 * Ia.Ngn.Cl.Model.Data.Service.DomainList.Count);
foreach (int d in Ia.Ngn.Cl.Model.Data.Service.DomainList)
{
s = d.ToString();
length = s.Length;
if (length == 4)
{
for (int i = 0; i < 10000; i++)
{
n = d * 10000 + i;
list.Add(n);
}
}
else if (length == 5)
{
for (int p = 0; p < 1000; p++)
{
n = d * 1000 + p;
list.Add(n);
}
}
else
{
throw new Exception("length " + length + " is unknown");
}
}
return list;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> AllPossiblePstnServiceNumberList
{
get
{
int n, length;
string s;
List<int> list;
list = new List<int>(10000 * Ia.Ngn.Cl.Model.Data.Service.PstnDomainList.Count);
foreach (int d in Ia.Ngn.Cl.Model.Data.Service.PstnDomainList)
{
s = d.ToString();
length = s.Length;
if (length == 4)
{
for (int i = 0; i < 10000; i++)
{
n = d * 10000 + i;
list.Add(n);
}
}
else if (length == 5)
{
for (int p = 0; p < 1000; p++)
{
n = d * 1000 + p;
list.Add(n);
}
}
else
{
throw new Exception("length " + length + " is unknown");
}
}
return list;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> AllPossibleMsanServiceNumberList
{
get
{
int n, length;
string s;
List<int> list;
list = new List<int>(10000 * Ia.Ngn.Cl.Model.Data.Service.MsanDomainList.Count);
foreach (int d in Ia.Ngn.Cl.Model.Data.Service.MsanDomainList)
{
s = d.ToString();
length = s.Length;
if (length == 4)
{
for (int i = 0; i < 10000; i++)
{
n = d * 10000 + i;
list.Add(n);
}
}
else if (length == 5)
{
for (int p = 0; p < 1000; p++)
{
n = d * 1000 + p;
list.Add(n);
}
}
else
{
throw new Exception("length " + length + " is unknown");
}
}
return list;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> AllPossibleLegacyPstnServiceNumberList
{
get
{
int n, length;
string s;
List<int> list;
list = new List<int>(10000 * Ia.Ngn.Cl.Model.Data.Service.LegacyPstnDomainList.Count);
foreach (int d in Ia.Ngn.Cl.Model.Data.Service.LegacyPstnDomainList)
{
s = d.ToString();
length = s.Length;
if (length == 4)
{
for (int i = 0; i < 10000; i++)
{
n = d * 10000 + i;
list.Add(n);
}
}
else if (length == 5)
{
for (int p = 0; p < 1000; p++)
{
n = d * 1000 + p;
list.Add(n);
}
}
else
{
throw new Exception("length " + length + " is unknown");
}
}
return list;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> AllPossibleServiceNumberListWithinDomain(int domain)
{
int n, length;
string s;
List<int> list;
s = domain.ToString();
length = s.Length;
list = new List<int>(10000);
if (length == 4)
{
for (int i = 0; i < 10000; i++)
{
n = domain * 10000 + i;
list.Add(n);
}
}
else if (length == 5)
{
for (int p = 0; p < 1000; p++)
{
n = domain * 1000 + p;
list.Add(n);
}
}
else
{
throw new Exception("length " + length + " is unknown");
}
return list;
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static void FirstAndLastServiceNumbersWithinDomain(int domain, out int firstServiceNumber, out int lastServiceNumber)
{
var s = domain.ToString();
var length = s.Length;
if (length == 4)
{
firstServiceNumber = domain * 10000;
lastServiceNumber = domain * 10000 + 9999;
}
else if (length == 5)
{
firstServiceNumber = domain * 1000;
lastServiceNumber = domain * 1000 + 999;
}
else if (length == 6)
{
firstServiceNumber = domain * 100;
lastServiceNumber = domain * 100 + 99;
}
else
{
firstServiceNumber = 0;
lastServiceNumber = 0;
//throw new Exception("length " + length + " is undefined.");
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> AllPossibleServiceNumberListWithinHundredsSubdomain(int hundredsSubdomain)
{
int n, length;
string s;
List<int> list;
s = hundredsSubdomain.ToString();
length = s.Length;
list = new List<int>(10000);
if (length == 6) // 6 digits in 8 digit number divided by 100
{
for (int i = 0; i < 100; i++)
{
n = hundredsSubdomain * 100 + i;
list.Add(n);
}
}
else
{
throw new Exception("length " + length + " is unknown");
}
return list;
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static int NumberOfPossibleServicesWithinDomainList(List<int> list)
{
int n, length;
n = 0;
foreach (int domain in list)
{
length = domain.ToString().Length;
if (length == 4) n += 10000;
else if (length == 5) n += 1000;
else
{
throw new Exception("length " + length + " is unknown");
}
}
return n;
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> AllPossibleServiceNumberListWithinNokiaSwitch
{
get
{
List<int> list;
list = AllPossibleServiceNumberListWithinSwitchVendor(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia);
return list;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> AllPossibleServiceNumberListWithinHuaweiSwitch
{
get
{
List<int> list;
list = AllPossibleServiceNumberListWithinSwitchVendor(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei);
return list;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
private static List<int> AllPossibleServiceNumberListWithinSwitchVendor(Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor vendor)
{
int n, length;
string s;
List<int> list;
List<int> domainListWithinSwitchVendor;
domainListWithinSwitchVendor = Ia.Ngn.Cl.Model.Data.Service.DomainListWithinSwitchVendor(vendor);
list = new List<int>(10000 * domainListWithinSwitchVendor.Count);
foreach (int domain in domainListWithinSwitchVendor)
{
s = domain.ToString();
length = s.Length;
if (length == 4)
{
for (int i = 0; i < 10000; i++)
{
n = domain * 10000 + i;
list.Add(n);
}
}
else if (length == 5)
{
for (int p = 0; p < 1000; p++)
{
n = domain * 1000 + p;
list.Add(n);
}
}
else
{
throw new Exception("length " + length + " is unknown");
}
}
return list;
}
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> AllPossibleServiceNumberWithinAHuaweiSwitchRouterThatHasANokiaAccessOlt()
{
int n, length;
string s;
var domainList = HuaweiSwitchNokiaAccessDomainList;
var list = new List<int>(10000 * domainList.Count);
foreach (int domain in domainList)
{
s = domain.ToString();
length = s.Length;
if (length == 4)
{
for (int i = 0; i < 10000; i++)
{
n = domain * 10000 + i;
list.Add(n);
}
}
else if (length == 5)
{
for (int p = 0; p < 1000; p++)
{
n = domain * 1000 + p;
list.Add(n);
}
}
else
{
throw new Exception("length " + length + " is unknown");
}
}
list.Sort();
return list.OrderBy(u => u).ToList(); // (u => u >= 25410000 && u <= 25440000).ToList();
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> AllPossibleServiceNumberWithinSoftX()
{
int n, length;
string s;
var domainList = SoftXDomainList;
var list = new List<int>(10000 * domainList.Count);
foreach (int domain in domainList)
{
s = domain.ToString();
length = s.Length;
if (length == 4)
{
for (int i = 0; i < 10000; i++)
{
n = domain * 10000 + i;
list.Add(n);
}
}
else if (length == 5)
{
for (int p = 0; p < 1000; p++)
{
n = domain * 1000 + p;
list.Add(n);
}
}
else
{
throw new Exception("length " + length + " is unknown");
}
}
list.Sort();
return list.OrderBy(u => u).ToList(); // (u => u >= 25410000 && u <= 25440000).ToList();
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> AllPossibleServiceNumbersWithinSite(string siteName)
{
int n, length;
string s;
var domainList = (from r in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.RouterList
where r.Site.Name == siteName
select r).SelectMany(r => r.DomainList).ToList();
var list = new List<int>(10000 * domainList.Count);
foreach (int domain in domainList)
{
s = domain.ToString();
length = s.Length;
if (length == 4)
{
for (int i = 0; i < 10000; i++)
{
n = domain * 10000 + i;
list.Add(n);
}
}
else if (length == 5)
{
for (int p = 0; p < 1000; p++)
{
n = domain * 1000 + p;
list.Add(n);
}
}
else
{
throw new Exception("length " + length + " is unknown");
}
}
list.Sort();
return list.OrderBy(u => u).ToList(); // (u => u >= 25410000 && u <= 25440000).ToList();
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> AllPossibleServiceNumbersWithinPstn(string pstnName)
{
int n, length;
string s;
var domainList = (from p in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.PstnList
where p.Name == pstnName
select p).SelectMany(r => r.DomainList).ToList();
var list = new List<int>(10000 * domainList.Count);
foreach (int domain in domainList)
{
s = domain.ToString();
length = s.Length;
if (length == 4)
{
for (int i = 0; i < 10000; i++)
{
n = domain * 10000 + i;
list.Add(n);
}
}
else if (length == 5)
{
for (int p = 0; p < 1000; p++)
{
n = domain * 1000 + p;
list.Add(n);
}
}
else
{
throw new Exception("length " + length + " is unknown");
}
}
list.Sort();
return list.OrderBy(u => u).ToList(); // (u => u >= 25410000 && u <= 25440000).ToList();
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> AllPossibleServiceNumbersWithinLegacyPstn(string pstnName)
{
int n, length;
string s;
var domainList = (from p in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.LegacyPstnList
where p.Name == pstnName
select p).SelectMany(r => r.DomainList).ToList();
var list = new List<int>(10000 * domainList.Count);
foreach (int domain in domainList)
{
s = domain.ToString();
length = s.Length;
if (length == 4)
{
for (int i = 0; i < 10000; i++)
{
n = domain * 10000 + i;
list.Add(n);
}
}
else if (length == 5)
{
for (int p = 0; p < 1000; p++)
{
n = domain * 1000 + p;
list.Add(n);
}
}
else
{
throw new Exception("length " + length + " is unknown");
}
}
list.Sort();
return list.OrderBy(u => u).ToList(); // (u => u >= 25410000 && u <= 25440000).ToList();
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<string> SiteDomainList(string siteName)
{
List<int> list;
List<string> sList;
list = (from r in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.RouterList
where r.Site.Name == siteName
select r).SelectMany(r => r.DomainList).ToList();
list.Sort();
sList = (from n in list select n.ToString()).ToList<string>();
return sList;
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<string> SitePstnDomainList(string siteName)
{
List<int> list;
List<string> sList;
list = (from r in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.PstnList
where r.Site.Name == siteName
select r).SelectMany(r => r.DomainList).ToList();
list.Sort();
sList = (from n in list select n.ToString()).ToList<string>();
return sList;
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static bool ServiceListIsWithinSitePstnDomainList(string siteName, List<string> serviceList)
{
bool b;
if (serviceList.Count > 0)
{
b = Ia.Ngn.Cl.Model.Data.Service.SitePstnDomainList(siteName).Any(u => serviceList.Any(v => v.StartsWith(u)));
}
else b = false;
return b;
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static bool ServiceIsWithinPstnDomainList(string service)
{
bool b;
if (!string.IsNullOrEmpty(service))
{
b = Ia.Ngn.Cl.Model.Data.Service.PstnDomainList.Any(u => service.StartsWith(u.ToString()));
}
else b = false;
return b;
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static bool ServiceIsWithinLegacyPstnDomainList(string service)
{
bool b;
if (!string.IsNullOrEmpty(service))
{
b = Ia.Ngn.Cl.Model.Data.Service.LegacyPstnDomainList.Any(u => service.StartsWith(u.ToString()));
}
else b = false;
return b;
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static bool ServiceIsWithinMsanDomainList(string service)
{
bool b;
if (!string.IsNullOrEmpty(service))
{
b = Ia.Ngn.Cl.Model.Data.Service.MsanDomainList.Any(u => service.StartsWith(u.ToString()));
}
else b = false;
return b;
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static bool ServiceListHasANumberThatIsWithinMsanDomainList(List<string> serviceList)
{
var b = false;
foreach (var service in serviceList)
{
if (!string.IsNullOrEmpty(service))
{
b = Ia.Ngn.Cl.Model.Data.Service.MsanDomainList.Any(u => service.StartsWith(u.ToString()));
if (b) break;
}
}
return b;
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static bool ServiceListHasANumberThatIsWithinPstnDomainList(List<string> serviceList)
{
bool b;
if (serviceList.Count > 0)
{
b = Ia.Ngn.Cl.Model.Data.Service.PstnDomainList.Any(u => serviceList.Any(v => v.StartsWith(u.ToString())));
}
else b = false;
return b;
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static bool ServiceListHasANumberThatIsWithinAxePstnDomainList(List<string> serviceList)
{
bool b;
if (serviceList.Count > 0)
{
b = Ia.Ngn.Cl.Model.Data.Service.AxePstnDomainList.Any(u => serviceList.Any(v => v.StartsWith(u.ToString())));
}
else b = false;
return b;
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static bool ServiceListHasANumberThatIsWithinEwsdPstnDomainList(List<string> serviceList)
{
bool b;
if (serviceList.Count > 0)
{
b = Ia.Ngn.Cl.Model.Data.Service.EwsdPstnDomainList.Any(u => serviceList.Any(v => v.StartsWith(u.ToString())));
}
else b = false;
return b;
}
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<string> ActiveServiceRequestServiceNumbersWithinDomainList(string domain)
{
List<string> list;
using (var db = new Ia.Ngn.Cl.Model.Ngn())
{
list = (from srs in db.ServiceRequestServices
where /*srs.ServiceType == 1 &&*/ srs.Service.StartsWith(domain) && srs.Provisioned == true
select srs.Service).AsNoTracking().ToList();
}
return list;
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<string> ActiveServiceNumbersWithinDomainList(string domain)
{
List<string> list;
using (var db = new Ia.Ngn.Cl.Model.Ngn())
{
list = (from s in db.Service2
//where /*s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.ImsService &&*/ s.Service.StartsWith(domain)
select s.Service).AsNoTracking().ToList();
}
return list;
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<string> InactiveServiceRequestServiceNumbersWithinDomainList(string domain)
{
List<int> possibleServiceList;
List<string> serviceList, inactiveServiceList;
serviceList = ActiveServiceRequestServiceNumbersWithinDomainList(domain);
possibleServiceList = Ia.Ngn.Cl.Model.Data.Service.AllPossibleServiceNumberListWithinDomain(int.Parse(domain));
inactiveServiceList = new List<string>(possibleServiceList.Count - serviceList.Count);
// below: extract numbers within possible but not in serviceList
foreach (int i in possibleServiceList)
{
if (!serviceList.Contains(i.ToString())) inactiveServiceList.Add(i.ToString());
}
return inactiveServiceList;
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<string> InactiveServiceNumbersWithinDomainList(string domain)
{
List<int> possibleServiceList;
List<string> serviceList, inactiveServiceList;
serviceList = ActiveServiceNumbersWithinDomainList(domain);
possibleServiceList = Ia.Ngn.Cl.Model.Data.Service.AllPossibleServiceNumberListWithinDomain(int.Parse(domain));
inactiveServiceList = new List<string>(possibleServiceList.Count - serviceList.Count);
// below: extract numbers within possible but not in serviceList
foreach (int i in possibleServiceList)
{
if (!serviceList.Contains(i.ToString())) inactiveServiceList.Add(i.ToString());
}
return inactiveServiceList;
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<string> ServicePbxList
{
get
{
List<string> list, nokiaPbxList, huaweiPbxList;
nokiaPbxList = Ia.Ngn.Cl.Model.Data.Nokia.SubParty.ServicePbxList();
huaweiPbxList = Ia.Ngn.Cl.Model.Data.Huawei.HuSbr.ServicePbxList();
list = nokiaPbxList.Concat(huaweiPbxList).ToList();
return list;
}
}
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Olt> AllowedToBeProvisionedOltList
{
get
{
return Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.GreenFieldOltList.Union(AllowedToBeMigratedOltList).ToList();
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> AllowedToBeProvisionedOltIdList
{
get
{
return Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.GreenFieldOltIdList.Union(AllowedToBeMigratedOltIdList).ToList();
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Olt> AllowedToBeProvisionedSipOltList
{
get
{
return Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.GreenFieldSipOltList.Union(AllowedToBeMigratedSipOltList).ToList();
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> AllowedToBeProvisionedSipOltIdList
{
get
{
return Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.GreenFieldSipOltIdList.Union(AllowedToBeMigratedSipOltIdList).ToList();
}
}
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Olt> AllowedToBeMigratedOltList
{
get
{
return (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OltList
where Ia.Ngn.Cl.Model.Business.Service.AllowedToBeMigratedOltSymbolList.Any(u => u == o.Symbol) || Ia.Ngn.Cl.Model.Business.Service.AllowedToBeMigratedOltSymbolList.Any(u => o.PonGroupList.Any(pg => pg.Symbol == u))
select o).ToList();
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> AllowedToBeMigratedOltIdList
{
get
{
return (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OltList
where Ia.Ngn.Cl.Model.Business.Service.AllowedToBeMigratedOltSymbolList.Any(u => u == o.Symbol) || Ia.Ngn.Cl.Model.Business.Service.AllowedToBeMigratedOltSymbolList.Any(u => o.PonGroupList.Any(pg => pg.Symbol == u))
select o.Id).ToList();
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Olt> AllowedToBeMigratedSipOltList
{
get
{
return (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OltList
where o.IsSip == true && (Ia.Ngn.Cl.Model.Business.Service.AllowedToBeMigratedOltSymbolList.Any(u => u == o.Symbol) || Ia.Ngn.Cl.Model.Business.Service.AllowedToBeMigratedOltSymbolList.Any(u => o.PonGroupList.Any(pg => pg.Symbol == u)))
select o).ToList();
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<int> AllowedToBeMigratedSipOltIdList
{
get
{
return (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OltList
where o.IsSip == true && (Ia.Ngn.Cl.Model.Business.Service.AllowedToBeMigratedOltSymbolList.Any(u => u == o.Symbol) || Ia.Ngn.Cl.Model.Business.Service.AllowedToBeMigratedOltSymbolList.Any(u => o.PonGroupList.Any(pg => pg.Symbol == u)))
select o.Id).ToList();
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static Dictionary<string, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> AllowedToBeMigratedAccessIdToOntDictionary
{
get
{
Dictionary<string, Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> dictionary;
var list = (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList
where Ia.Ngn.Cl.Model.Business.Service.AllowedToBeMigratedOltSymbolList.Any(u => u == o.Pon.PonGroup.Olt.Symbol) || Ia.Ngn.Cl.Model.Business.Service.AllowedToBeMigratedOltSymbolList.Any(u => u == o.Pon.PonGroup.Symbol)
select o).ToList();
dictionary = list.ToDictionary(u => u.Access.Id, u => u);
return dictionary;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Pstn> AllowedToBeMigratedAxePstnList
{
get
{
var list = (from p in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.PstnList
join o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OltList on p.Site equals o.Odf.Router.Site
where Ia.Ngn.Cl.Model.Business.Service.AllowedToBeMigratedOltSymbolList.Any(u => u == o.Symbol) && p.PstnExchangeType == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.PstnExchangeType.EricssonAxe
select p).Distinct().ToList();
return list;
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Pstn> AllowedToBeMigratedEwsdPstnList
{
get
{
var list = (from p in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.PstnList
join o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OltList on p.Site equals o.Odf.Router.Site
where Ia.Ngn.Cl.Model.Business.Service.AllowedToBeMigratedOltSymbolList.Any(u => u == o.Symbol) && p.PstnExchangeType == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.PstnExchangeType.SiemensEwsd
select p).Distinct().ToList();
return list;
}
}
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<string> ServiceNotInServiceRequestServiceList()
{
string s;
List<string> list;
var allPossibleServiceNumberList = Ia.Ngn.Cl.Model.Data.Service.AllPossibleServiceNumberList;
var serviceRequestServiceServiceDictionary = Ia.Ngn.Cl.Model.Data.ServiceRequestService.ServiceDictionary();
list = new List<string>(allPossibleServiceNumberList.Count);
foreach (var i in allPossibleServiceNumberList)
{
s = i.ToString();
if (!serviceRequestServiceServiceDictionary.ContainsKey(s))
{
/*if (i > Ia.Ngn.Cl.Model.Business.Service.TemporaryProcedureToIndicateWhereTheLastReadNumberFromOracleDatabaseBecauseListIsTooLongToRepeatHahaha)*/
list.Add(s);
}
}
return list.OrderBy(u => u).ToList();
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static string SequentialAllPossibleServiceNumberList(ref int referenceIndex, out int itemIndex, out int listCount)
{
int service;
if (serviceList.JustStartedOrRolledOver())
{
serviceList = Ia.Ngn.Cl.Model.Data.Service.AllPossibleServiceNumberList;
// below: temp to quickly go through specific domains
/*
serviceList = (from s in serviceList
where s.ToString().StartsWith("2361") || s.ToString().StartsWith("2362") || s.ToString().StartsWith("2391") || s.ToString().StartsWith("2392")
select s).ToList();
*/
}
service = serviceList.Next(ref referenceIndex, out itemIndex, out listCount);
return service.ToString();
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<string> NumbersWithinEmsOntSipInfoAndEmsVoipPstnUserThatDoNotBelongToListOfAllPossibleNetworkNumbers()
{
var allPossibleServiceNumberList = Ia.Ngn.Cl.Model.Data.Service.AllPossibleServiceNumberList;
//var s2 = Ia.Ngn.Cl.Model.Data.Service.AllPossiblePstnServiceNumberList;
//var s3 = Ia.Ngn.Cl.Model.Data.Service.AllPossibleMsanServiceNumberList;
//var v = allPossibleServiceNumberList;//.Union(s2).Union(s3).ToList();
var allPossibleServiceList = allPossibleServiceNumberList.ConvertAll(delegate (int i) { return i.ToString(); });
var ontSipInfoServiceList = Ia.Ngn.Cl.Model.Data.Huawei.OntSipInfo.ServiceList();
var voipPstnUserServiceList = Ia.Ngn.Cl.Model.Data.Huawei.VoipPstnUser.ServiceList();
var ontSipInfoAndVoipPstnUserServiceList = ontSipInfoServiceList.Union(voipPstnUserServiceList).ToList();
var list = ontSipInfoAndVoipPstnUserServiceList.Except(allPossibleServiceList).ToList();
return list;
}
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static Ia.Ngn.Cl.Model.Business.Service.ServiceType ServiceType(int typeId)
{
return (from s in Ia.Ngn.Cl.Model.Data.Service.ServiceTypeList where s.Id == typeId select s).SingleOrDefault();
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static string ServiceTypeNameFromId(int id)
{
return (from s in Ia.Ngn.Cl.Model.Data.Service.ServiceTypeList where s.Id == id select s.Name).SingleOrDefault();
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
public static List<Ia.Ngn.Cl.Model.Business.Service.ServiceType> ServiceTypeList
{
get
{
if (serviceTypeList == null || serviceTypeList.Count == 0)
{
serviceTypeList = new List<Ia.Ngn.Cl.Model.Business.Service.ServiceType>();
serviceTypeList = new List<Ia.Ngn.Cl.Model.Business.Service.ServiceType>
{
// DO NOT CHANGE "Ims" and "Pstn" values, they will effect class ServiceType values
new Ia.Ngn.Cl.Model.Business.Service.ServiceType(0, "Undefined", "Undefined (غير معرف)", "red"),
new Ia.Ngn.Cl.Model.Business.Service.ServiceType(1, "Ims", "Digital (رقمي)", "fiber-blue"),
new Ia.Ngn.Cl.Model.Business.Service.ServiceType(2, "Pstn", "Copper (نحاس)", "copper-brown"),
};
/*
/// 0:IMSSIPUE(IMSSIPUSER): The subscriber is an IMS SIP-UE subscriber.
/// 1:POTS(POTSUSER): The subscriber is a SIP subscriber connected to the SIPIAD of the AGCF.
/// 4:G/U(GUUSER): The subscriber is a G/U subscriber.
/// 5:CDMA(CDMAUSER): The subscriber is a CDMA subscriber.
/// 6:PSTN(PSTNUSER): The subscriber is a PSTN subscriber.
<type id="0" name="?"/>
<type id="1" name="DN" Idlike="25212254:1:965"/>
<type id="2" name="HSI" Idlike="SLA.82.13.1.2:2:965 SLA.PON.ONT.CARD.PORT"/>
<type id="3" name="CDMA"/>
<type id="4" name="G/U"/>
<type id="5" name="POTS"/>
<type id="6" name="PSTN"/>
*/
}
return serviceTypeList.ToList();
}
}
////////////////////////////////////////////////////////////////////////////
/// <summary>
///
/// How to embed and access resources by using Visual C# http://support.microsoft.com/kb/319292/en-us
///
/// 1. Change the "Build Action" property of your XML file from "Content" to "Embedded Resource".
/// 2. Add "using System.Reflection".
/// 3. Manifest resource stream will start with the project namespace, the location of XML file.
///
/// </summary>
private static XDocument XDocument
{
get
{
if (xDocument == null)
{
lock (objectLock)
{
Assembly _assembly;
StreamReader streamReader;
_assembly = Assembly.GetExecutingAssembly();
streamReader = new StreamReader(_assembly.GetManifestResourceStream("Ia.Ngn.Cl.model.data.service.xml"));
try
{
if (streamReader.Peek() != -1)
{
xDocument = System.Xml.Linq.XDocument.Load(streamReader);
}
}
catch (Exception)
{
}
finally
{
}
}
}
return xDocument;
}
}
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
}
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
}