1: using System;
2: using System.Collections.Generic;
3: using System.ComponentModel.DataAnnotations;
4: using System.ComponentModel.DataAnnotations.Schema;
5: using System.Linq;
6: using System.Threading;
7: using System.Threading.Tasks;
8:
9: namespace Ia.Ngn.Cl.Model
10: {
11: ////////////////////////////////////////////////////////////////////////////
12:
13: /// <summary publish="true">
14: /// Service Request Ont Entity Framework class for Optical Fiber Network (OFN) entity model.
15: /// </summary>
16: ///
17: /// <remarks>
18: /// Copyright © 2006-2021 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
19: ///
20: /// 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
21: /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
22: ///
23: /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
24: /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
25: ///
26: /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
27: ///
28: /// Copyright notice: This notice may not be removed or altered from any source distribution.
29: /// </remarks>
30: public class ServiceRequestOnt
31: {
32: /// <summary/>
33: public ServiceRequestOnt()
34: {
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 string Name
84: {
85: get
86: {
87: string s;
88:
89: s = this.AreaSymbol + "." + this.Pon + "." + this.Ont;
90:
91: return s;
92: }
93: }
94:
95: ////////////////////////////////////////////////////////////////////////////
96:
97: /// <summary>
98: ///
99: /// </summary>
100: public void Copy(ServiceRequestOnt serviceRequestOnt)
101: {
102: this.Access = serviceRequestOnt.Access;
103: this.Id = serviceRequestOnt.Id;
104: this.Created = serviceRequestOnt.Created;
105: this.Updated = serviceRequestOnt.Updated;
106:
107: this.Pon = serviceRequestOnt.Pon;
108: this.Ont = serviceRequestOnt.Ont;
109: this.AreaSymbol = serviceRequestOnt.AreaSymbol;
110: this.Block = serviceRequestOnt.Block;
111: this.Street = serviceRequestOnt.Street;
112: this.PremisesOld = serviceRequestOnt.PremisesOld;
113: this.PremisesNew = serviceRequestOnt.PremisesNew;
114: this.Paci = serviceRequestOnt.Paci;
115: this.PossibleNumberOfTd = serviceRequestOnt.PossibleNumberOfTd;
116: this.PossibleNumberOfEthernet = serviceRequestOnt.PossibleNumberOfEthernet;
117: }
118:
119: ////////////////////////////////////////////////////////////////////////////
120:
121: /// <summary>
122: ///
123: /// </summary>
124: public bool Update(ServiceRequestOnt updatedServiceRequestOnt)
125: {
126: // below: this will not update Id, Created
127: bool updated;
128:
129: updated = false;
130:
131: if (this.Access != updatedServiceRequestOnt.Access) { this.Access = updatedServiceRequestOnt.Access; updated = true; }
132:
133: if (this.Pon != updatedServiceRequestOnt.Pon) { this.Pon = updatedServiceRequestOnt.Pon; updated = true; }
134: if (this.Ont != updatedServiceRequestOnt.Ont) { this.Ont = updatedServiceRequestOnt.Ont; updated = true; }
135: if (this.AreaSymbol != updatedServiceRequestOnt.AreaSymbol) { this.AreaSymbol = updatedServiceRequestOnt.AreaSymbol; updated = true; }
136: if (this.Block != updatedServiceRequestOnt.Block) { this.Block = updatedServiceRequestOnt.Block; updated = true; }
137: if (this.Street != updatedServiceRequestOnt.Street) { this.Street = updatedServiceRequestOnt.Street; updated = true; }
138: if (this.PremisesOld != updatedServiceRequestOnt.PremisesOld) { this.PremisesOld = updatedServiceRequestOnt.PremisesOld; updated = true; }
139: if (this.PremisesNew != updatedServiceRequestOnt.PremisesNew) { this.PremisesNew = updatedServiceRequestOnt.PremisesNew; updated = true; }
140: if (this.Paci != updatedServiceRequestOnt.Paci) { this.Paci = updatedServiceRequestOnt.Paci; updated = true; }
141: if (this.PossibleNumberOfTd != updatedServiceRequestOnt.PossibleNumberOfTd) { this.PossibleNumberOfTd = updatedServiceRequestOnt.PossibleNumberOfTd; updated = true; }
142: if (this.PossibleNumberOfEthernet != updatedServiceRequestOnt.PossibleNumberOfEthernet) { this.PossibleNumberOfEthernet = updatedServiceRequestOnt.PossibleNumberOfEthernet; updated = true; }
143:
144: if (updated) this.Updated = DateTime.UtcNow.AddHours(3);
145:
146: return updated;
147: }
148:
149: ////////////////////////////////////////////////////////////////////////////
150: ////////////////////////////////////////////////////////////////////////////
151: }
152:
153: ////////////////////////////////////////////////////////////////////////////
154: ////////////////////////////////////////////////////////////////////////////
155: }