12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- using System.Collections.Generic;
- using System.ComponentModel.DataAnnotations;
- using System.ComponentModel.DataAnnotations.Schema;
- using UnivateProperties_API.Containers.Timeshare.Detailed;
- using UnivateProperties_API.Model.Banks;
- using UnivateProperties_API.Model.Misc;
- using UnivateProperties_API.Model.Properties;
-
- namespace UnivateProperties_API.Model.Users
- {
- public class Individual : Person
- {
- #region Constructor
- public Individual()
- {
-
- }
-
- #endregion Constructor
-
- #region Properties
- public string IdNumber { get; set; }
- public string CompanyRegNumber { get; set; }
- public string MaritalStatus { get; set; }
- [ForeignKey("Address")]
- public int? AddressId { get; set; }
- public string IncomeTaxNumber { get; set; }
- [ForeignKey("BankAccount")]
- public int? BankAccountId { get; set; }
- public virtual Address Address { get; set; }
- public virtual BankAccount BankAccount { get; set; }
- public virtual ICollection<Property> Properties { get; set; }
- #endregion Properties
-
- #region Methods
- public void UpdateFromDetailedOwner(DetailedOwner owner)
- {
- if (owner.Id == Id)
- {
- Name = owner.Name;
- Surname = owner.Surname;
- IdNumber = owner.IdNumber;
- CompanyRegNumber = owner.CompanyRegNumber;
- MaritalStatus = owner.MaritalStatus;
- Email = owner.EmailAddress;
- CellNumber = owner.CellNumber;
- Telephone = owner.LandlineNumber;
-
- if (owner.Address != null)
- {
- if (Address == null)
- {
- Address = new Address()
- {
- StreetNumber = owner.Address.StreetNumber,
- Street = owner.Address.Street,
- City = owner.Address.City,
- Suburb = owner.Address.Suburb,
- Province = owner.Address.Province,
- PostalCode = owner.Address.PostalCode
- };
- }
- else
- {
- Address.StreetNumber = owner.Address.StreetNumber;
- Address.Street = owner.Address.Street;
- Address.City = owner.Address.City;
- Address.Suburb = owner.Address.Suburb;
- Address.Province = owner.Address.Province;
- Address.PostalCode = owner.Address.PostalCode;
- }
-
- }
-
- if (owner.BankingDetails != null)
- {
- if (BankAccount == null)
- {
- BankAccount = new BankAccount()
- {
- BankId = owner.BankingDetails.BankId,
- AccountNumber = owner.BankingDetails.AccountNumber,
- AccountHolder = owner.BankingDetails.AccountHolder
- };
- }
- else
- {
- BankAccount.BankId = owner.BankingDetails.BankId;
- BankAccount.AccountNumber = owner.BankingDetails.AccountNumber;
- BankAccount.AccountHolder = owner.BankingDetails.AccountHolder;
- }
- }
- }
- }
- #endregion Methods
- }
- }
|