1: using System;
2: using System.Collections.Generic;
3: using System.ComponentModel.DataAnnotations;
4: using System.ComponentModel.DataAnnotations.Schema;
5:
6: namespace Ia.Ngn.Cl.Model
7: {
8: ////////////////////////////////////////////////////////////////////////////
9:
10: /// <summary publish="true">
11: /// ONT Entity Framework class for Next Generation Network (NGN) entity model.
12: /// </summary>
13: ///
14: /// <remarks>
15: /// Copyright © 2006-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
16: ///
17: /// 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
18: /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
19: ///
20: /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
21: /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
22: ///
23: /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
24: ///
25: /// Copyright notice: This notice may not be removed or altered from any source distribution.
26: /// </remarks>
27: public partial class Ont
28: {
29: /// <summary/>
30: public Ont() { }
31:
32: /// <summary/>
33: [Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
34: public string Id { get; set; }
35:
36: /// <summary/>
37: public int StateId { get; set; }
38:
39: /// <summary/>
40: public int FamilyTypeId { get; set; }
41:
42: /// <summary/>
43: public string Serial { get; set; }
44:
45: /// <summary/>
46: public string EquipmentId { get; set; }
47:
48: /// <summary/>
49: public int VendorId { get; set; }
50:
51: /// <summary/>
52: public string ActiveSoftware { get; set; }
53:
54: /// <summary/>
55: public string PassiveSoftware { get; set; }
56:
57: /// <summary/>
58: public string PlannedSoftware { get; set; }
59:
60: /// <summary/>
61: public bool BatteryBackupAvailable { get; set; }
62:
63: /// <summary/>
64: public string Description1 { get; set; }
65:
66: /// <summary/>
67: public string Description2 { get; set; }
68:
69: /// <summary/>
70: public DateTime Created { get; set; }
71:
72: /// <summary/>
73: public DateTime Updated { get; set; }
74:
75: /// <summary/>
76: public System.Guid UserId { get; set; }
77:
78: /// <summary/>
79: public virtual Access Access { get; set; }
80:
81: /// <summary/>
82: //public virtual ICollection<OntServiceHsi> OntServiceHsis { get; set; }
83:
84: /// <summary/>
85: public virtual ICollection<OntServiceVoip> OntServiceVoips { get; set; }
86:
87: /// <summary/>
88: public virtual ICollection<OntOntPots> OntOntPotses { get; set; }
89:
90: ////////////////////////////////////////////////////////////////////////////
91:
92: /// <summary>
93: ///
94: /// </summary>
95: [NotMapped]
96: public string State
97: {
98: get
99: {
100: return Ia.Ngn.Cl.Model.Data.Nokia.Ams.BellcoreStateFromId(this.StateId);
101: }
102: }
103:
104: ////////////////////////////////////////////////////////////////////////////
105:
106: /// <summary>
107: ///
108: /// </summary>
109: [NotMapped]
110: public Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType FamilyType
111: {
112: get
113: {
114: return (Ia.Ngn.Cl.Model.Business.Nokia.Ont.FamilyType)this.FamilyTypeId;
115:
116: // return Ia.Ngn.Cl.Model.Business.Nokia.Ont.familytypefrom.FamilyTypeFromString(this.EquipmentId);
117: }
118: }
119:
120: ////////////////////////////////////////////////////////////////////////////
121:
122: /// <summary>
123: ///
124: /// </summary>
125: public bool Equal(Ia.Ngn.Cl.Model.Ont b)
126: {
127: // below: this will not check the Id, Created, Updated fields
128: bool areEqual;
129:
130: if (this.BatteryBackupAvailable != b.BatteryBackupAvailable) areEqual = false;
131: else areEqual = true;
132:
133: return areEqual;
134: }
135:
136: ////////////////////////////////////////////////////////////////////////////
137:
138: /// <summary>
139: ///
140: /// </summary>
141: public bool Update(Ia.Ngn.Cl.Model.Ont updatedItem)
142: {
143: // below: this will not update Id, Created
144: bool updated;
145:
146: updated = false;
147:
148: if (this.StateId != updatedItem.StateId) { this.StateId = updatedItem.StateId; updated = true; }
149: if (this.FamilyTypeId != updatedItem.FamilyTypeId) { this.FamilyTypeId = updatedItem.FamilyTypeId; updated = true; }
150: if (this.Serial != updatedItem.Serial) { this.Serial = updatedItem.Serial; updated = true; }
151: if (this.EquipmentId != updatedItem.EquipmentId) { this.EquipmentId = updatedItem.EquipmentId; updated = true; }
152: if (this.VendorId != updatedItem.VendorId) { this.VendorId = updatedItem.VendorId; updated = true; }
153: if (this.ActiveSoftware != updatedItem.ActiveSoftware) { this.ActiveSoftware = updatedItem.ActiveSoftware; updated = true; }
154: if (this.PassiveSoftware != updatedItem.PassiveSoftware) { this.PassiveSoftware = updatedItem.PassiveSoftware; updated = true; }
155:
156: if (this.PlannedSoftware != updatedItem.PlannedSoftware) { this.PlannedSoftware = updatedItem.PlannedSoftware; updated = true; }
157: if (this.BatteryBackupAvailable != updatedItem.BatteryBackupAvailable) { this.BatteryBackupAvailable = updatedItem.BatteryBackupAvailable; updated = true; }
158: if (this.Description1 != updatedItem.Description1) { this.Description1 = updatedItem.Description1; updated = true; }
159: if (this.Description2 != updatedItem.Description2) { this.Description2 = updatedItem.Description2; updated = true; }
160: if (this.UserId != updatedItem.UserId) { this.UserId = updatedItem.UserId; updated = true; }
161: if (this.Access != updatedItem.Access) { this.Access = updatedItem.Access; updated = true; }
162:
163: if (updated) this.Updated = DateTime.UtcNow.AddHours(3);
164:
165: return updated;
166: }
167:
168: ////////////////////////////////////////////////////////////////////////////
169: ////////////////////////////////////////////////////////////////////////////
170:
171: /// <summary>
172: ///
173: /// </summary>
174: public string ToSimpleTextString()
175: {
176: return Ia.Ngn.Cl.Model.Data.Nokia.Ont.ToSimpleTextString(this);
177: }
178:
179: ////////////////////////////////////////////////////////////////////////////
180: ////////////////////////////////////////////////////////////////////////////
181: }
182:
183: ////////////////////////////////////////////////////////////////////////////
184: ////////////////////////////////////////////////////////////////////////////
185: }