1: using Microsoft.EntityFrameworkCore.Metadata.Internal;
2: using System;
3: using System.Collections.Generic;
4: using System.ComponentModel.DataAnnotations;
5: using System.ComponentModel.DataAnnotations.Schema;
6: using System.Linq;
7: using System.Runtime.Serialization;
8: using System.Threading;
9: using System.Threading.Tasks;
10:
11: namespace Ia.Ngn.Cl.Model
12: {
13: ////////////////////////////////////////////////////////////////////////////
14:
15: /// <summary publish="true">
16: /// Service Request Type Entity Framework class for Optical Fiber Network (OFN) entity model.
17: /// </summary>
18: ///
19: /// <remarks>
20: /// Copyright © 2006-2021 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
21: ///
22: /// 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
23: /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
24: ///
25: /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
26: /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
27: ///
28: /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
29: ///
30: /// Copyright notice: This notice may not be removed or altered from any source distribution.
31: /// </remarks>
32: [DataContract(IsReference = true, Namespace = "kw.com.ia.ofn.api", Name = "ServiceRequestType")]
33: public class ServiceRequestType
34: {
35: /// <summary/>
36: public ServiceRequestType()
37: {
38: }
39:
40: /// <summary/>
41: [DataMember]
42: [Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
43: public int Id { get; set; }
44:
45: /// <summary/>
46: [DataMember]
47: public int TypeId { get; set; }
48:
49: /// <summary/>
50: [DataMember]
51: public string Value { get; set; }
52:
53: /// <summary/>
54: [DataMember]
55: public DateTime Created { get; set; }
56:
57: /// <summary/>
58: [DataMember]
59: public DateTime Updated { get; set; }
60:
61: /// <summary/>
62: [DataMember]
63: public System.Guid UserId { get; set; }
64:
65: /// <summary/>
66: [ForeignKey("ServiceRequest_Id")]
67: public virtual ServiceRequest ServiceRequest { get; set; }
68:
69: ////////////////////////////////////////////////////////////////////////////
70:
71: /// <summary>
72: ///
73: /// </summary>
74: public bool Update(ServiceRequestType updatedServiceRequestType)
75: {
76: // below: this will not update Id, Created
77: bool updated;
78:
79: updated = false;
80:
81: if (this.TypeId != updatedServiceRequestType.TypeId) { this.TypeId = updatedServiceRequestType.TypeId; updated = true; }
82: if (this.Value != updatedServiceRequestType.Value) { this.Value = updatedServiceRequestType.Value; updated = true; }
83: if (this.UserId != updatedServiceRequestType.UserId) { this.UserId = updatedServiceRequestType.UserId; updated = true; }
84:
85: // below: ??
86: //if (this.ServiceRequest == null || this.ServiceRequest != updatedServiceRequestType.ServiceRequest) { this.ServiceRequest = updatedServiceRequestType.ServiceRequest; updated = true; }
87:
88: if (updated) this.Updated = DateTime.UtcNow.AddHours(3);
89:
90: return updated;
91: }
92:
93: ////////////////////////////////////////////////////////////////////////////
94: ////////////////////////////////////////////////////////////////////////////
95: }
96:
97: ////////////////////////////////////////////////////////////////////////////
98: ////////////////////////////////////////////////////////////////////////////
99: }