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 Detail 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 ServiceRequestOntDetail
31: {
32: /// <summary/>
33: public ServiceRequestOntDetail()
34: {
35: }
36:
37: /// <summary/>
38: [Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
39: public string Id { get; set; }
40:
41: /// <summary/>
42: public int ServiceType { get; set; }
43:
44: /// <summary/>
45: public int ServicePosition { get; set; }
46:
47: /// <summary/>
48: public string Service { get; set; }
49:
50: /// <summary/>
51: public DateTime Created { get; set; }
52:
53: /// <summary/>
54: public DateTime Updated { get; set; }
55:
56: /// <summary/>
57: [ForeignKey("ServiceRequestOnt_Id")]
58: public virtual ServiceRequestOnt ServiceRequestOnt { get; set; }
59:
60: ////////////////////////////////////////////////////////////////////////////
61:
62: /// <summary>
63: ///
64: /// </summary>
65: public void Copy(ServiceRequestOntDetail serviceRequestOntDetail)
66: {
67: this.ServiceRequestOnt = serviceRequestOntDetail.ServiceRequestOnt;
68: this.Id = serviceRequestOntDetail.Id;
69: this.Created = serviceRequestOntDetail.Created;
70: this.Updated = serviceRequestOntDetail.Updated;
71:
72: this.ServiceType = serviceRequestOntDetail.ServiceType;
73: this.ServicePosition = serviceRequestOntDetail.ServicePosition;
74: this.Service = serviceRequestOntDetail.Service;
75: }
76:
77: ////////////////////////////////////////////////////////////////////////////
78:
79: /// <summary>
80: ///
81: /// </summary>
82: public bool Update(ServiceRequestOntDetail updatedServiceRequestOntDetail)
83: {
84: // below: this will not update Id, Created
85: bool updated;
86:
87: updated = false;
88:
89: if (this.ServiceRequestOnt != updatedServiceRequestOntDetail.ServiceRequestOnt) { this.ServiceRequestOnt = updatedServiceRequestOntDetail.ServiceRequestOnt; updated = true; }
90:
91: if (this.ServiceType != updatedServiceRequestOntDetail.ServiceType) { this.ServiceType = updatedServiceRequestOntDetail.ServiceType; updated = true; }
92: if (this.ServicePosition != updatedServiceRequestOntDetail.ServicePosition) { this.ServicePosition = updatedServiceRequestOntDetail.ServicePosition; updated = true; }
93: if (this.Service != updatedServiceRequestOntDetail.Service) { this.Service = updatedServiceRequestOntDetail.Service; updated = true; }
94:
95: if (updated) this.Updated = DateTime.UtcNow.AddHours(3);
96:
97: return updated;
98: }
99:
100: ////////////////////////////////////////////////////////////////////////////
101: ////////////////////////////////////////////////////////////////////////////
102: }
103:
104: ////////////////////////////////////////////////////////////////////////////
105: ////////////////////////////////////////////////////////////////////////////
106: }