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: /// Service Request 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 class ServiceRequestOnt //: ITriggerable
28: {
29: /// <summary/>
30: public ServiceRequestOnt()
31: {
32: //this.Triggers().Inserting += entry => { TriggeredInstanceQueue.Enqueue(entry.Entity); };
33: //this.Triggers().Updating += entry => { TriggeredInstanceQueue.Enqueue(entry.Entity); };
34: //this.Triggers().Deleting += entry => { TriggeredInstanceQueue.Enqueue(entry.Entity); };
35: }
36:
37: /// <summary/>
38: [Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
39: public string Id { get; set; }
40:
41: /// <summary/>
42: public int Pon { get; set; }
43:
44: /// <summary/>
45: public int Ont { get; set; }
46:
47: /// <summary/>
48: public string AreaSymbol { get; set; }
49:
50: /// <summary/>
51: public string Block { get; set; }
52:
53: /// <summary/>
54: public string Street { get; set; }
55:
56: /// <summary/>
57: public string PremisesOld { get; set; }
58:
59: /// <summary/>
60: public string PremisesNew { get; set; }
61:
62: /// <summary/>
63: public string Paci { get; set; }
64:
65: /// <summary/>
66: public int PossibleNumberOfTd { get; set; }
67:
68: /// <summary/>
69: public int PossibleNumberOfEthernet { get; set; }
70:
71: /// <summary/>
72: public DateTime Created { get; set; }
73:
74: /// <summary/>
75: public DateTime Updated { get; set; }
76:
77: /// <summary/>
78: [ForeignKey("Access_Id")]
79: public virtual Access Access { get; set; }
80:
81: /// <summary/>
82: [NotMapped]
83: public static Queue<ServiceRequestOnt> TriggeredInstanceQueue = new Queue<ServiceRequestOnt>();
84:
85: /// <summary/>
86: [NotMapped]
87: public string Name
88: {
89: get
90: {
91: string s;
92:
93: s = this.AreaSymbol + "." + this.Pon + "." + this.Ont;
94:
95: return s;
96: }
97: }
98:
99: ////////////////////////////////////////////////////////////////////////////
100:
101: /// <summary>
102: ///
103: /// </summary>
104: public void Copy(ServiceRequestOnt serviceRequestOnt)
105: {
106: this.Access = serviceRequestOnt.Access;
107: this.Id = serviceRequestOnt.Id;
108: this.Created = serviceRequestOnt.Created;
109: this.Updated = serviceRequestOnt.Updated;
110:
111: this.Pon = serviceRequestOnt.Pon;
112: this.Ont = serviceRequestOnt.Ont;
113: this.AreaSymbol = serviceRequestOnt.AreaSymbol;
114: this.Block = serviceRequestOnt.Block;
115: this.Street = serviceRequestOnt.Street;
116: this.PremisesOld = serviceRequestOnt.PremisesOld;
117: this.PremisesNew = serviceRequestOnt.PremisesNew;
118: this.Paci = serviceRequestOnt.Paci;
119: this.PossibleNumberOfTd = serviceRequestOnt.PossibleNumberOfTd;
120: this.PossibleNumberOfEthernet = serviceRequestOnt.PossibleNumberOfEthernet;
121: }
122:
123: ////////////////////////////////////////////////////////////////////////////
124:
125: /// <summary>
126: ///
127: /// </summary>
128: public bool Update(ServiceRequestOnt updatedServiceRequestOnt)
129: {
130: // below: this will not update Id, Created
131: bool updated;
132:
133: updated = false;
134:
135: if (this.Access != updatedServiceRequestOnt.Access) { this.Access = updatedServiceRequestOnt.Access; updated = true; }
136:
137: if (this.Pon != updatedServiceRequestOnt.Pon) { this.Pon = updatedServiceRequestOnt.Pon; updated = true; }
138: if (this.Ont != updatedServiceRequestOnt.Ont) { this.Ont = updatedServiceRequestOnt.Ont; updated = true; }
139: if (this.AreaSymbol != updatedServiceRequestOnt.AreaSymbol) { this.AreaSymbol = updatedServiceRequestOnt.AreaSymbol; updated = true; }
140: if (this.Block != updatedServiceRequestOnt.Block) { this.Block = updatedServiceRequestOnt.Block; updated = true; }
141: if (this.Street != updatedServiceRequestOnt.Street) { this.Street = updatedServiceRequestOnt.Street; updated = true; }
142: if (this.PremisesOld != updatedServiceRequestOnt.PremisesOld) { this.PremisesOld = updatedServiceRequestOnt.PremisesOld; updated = true; }
143: if (this.PremisesNew != updatedServiceRequestOnt.PremisesNew) { this.PremisesNew = updatedServiceRequestOnt.PremisesNew; updated = true; }
144: if (this.Paci != updatedServiceRequestOnt.Paci) { this.Paci = updatedServiceRequestOnt.Paci; updated = true; }
145: if (this.PossibleNumberOfTd != updatedServiceRequestOnt.PossibleNumberOfTd) { this.PossibleNumberOfTd = updatedServiceRequestOnt.PossibleNumberOfTd; updated = true; }
146: if (this.PossibleNumberOfEthernet != updatedServiceRequestOnt.PossibleNumberOfEthernet) { this.PossibleNumberOfEthernet = updatedServiceRequestOnt.PossibleNumberOfEthernet; updated = true; }
147:
148: if (updated) this.Updated = DateTime.UtcNow.AddHours(3);
149:
150: return updated;
151: }
152:
153: ////////////////////////////////////////////////////////////////////////////
154: ////////////////////////////////////////////////////////////////////////////
155: }
156:
157: ////////////////////////////////////////////////////////////////////////////
158: ////////////////////////////////////////////////////////////////////////////
159: }