using BuddyFinance.Integration.Models.Profiles; using BuddyFinance.Common.Encryption; using Microsoft.AspNetCore.Mvc.Rendering; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.ComponentModel.DataAnnotations; namespace BuddyFinance.Admin.Areas.Admin.Models { public class ProfileEditViewModel { public int ProfileId { get; set; } public string ProfileId_ { get; set; } [Required] [Display(Name = "Immediate Activity")] public int ProfileTypeId { get; set; } public bool LendServiceAccount { get; set; } public bool BorrowServiceAccount { get; set; } public string Name { get; set; } public string Surname { get; set; } public string EmailAddress { get; set; } public string ContactNumber { get; set; } public DateTime? DateOfBirth { get; set; } public int? GenderId { get; set; } //public int? CountryOfBirthId { get; set; } //public int? EthnicityId { get; set; } public int? IdentificationTypeId { get; set; } public string IdentificationNumber { get; set; } //public int? SourceOfIncomeId { get; set; } //public string OtherSourceOfIncome { get; set; } public string BankName { get; set; } public string AccountType { get; set; } //public string BranchName { get; set; } //public string BranchCode { get; set; } public string AccountName { get; set; } public string AccountNumber { get; set; } public int? TaxIdentificationTypeId { get; set; } public string TaxNumber { get; set; } public int? TaxCountryId { get; set; } public bool? IsTaxRegistered { get; set; } public int? EmploymentStatusId { get; set; } public string EmployerName { get; set; } = ""; public string EmployerContactNumber { get; set; } = ""; public System.DateTime? EmploymentStartDate { get; set; } = null; public System.DateTime? EmploymentEndDate { get; set; } = null; public double? GrossMonthlyIncome { get; set; } public double? NetMonthlyIncome { get; set; } = null; public string EmployerNumber { get; set; } public int? EmploymentTypeId { get; set; } = null; public int? SalaryDay { get; set; } = null; public int? BillingDay { get; set; } = null; //public DateTime? BillingDate { get; set; } public string NextOfKinName { get; set; } public string RelationshipType { get; set; } public string NextOfKinContactNumber { get; set; } public double? Income { get; set; } public int FicaStatusId { get; set; } public DateTime? VerificationDate { get; set; } public List Addresses { get; set; } = new List(); public List Documents { get; set; } = new List(); public Profile Profile { get; set; } public List ProfileTypeList { get; set; } = new List(); public List GenderList { get; set; } = new List(); public List CountryList { get; set; } = new List(); public List EthnicityList { get; set; } = new List(); public List SourceOfIncomeList { get; set; } = new List(); public List TaxIdentificationTypeList { get; set; } = new List(); public List TaxCountryList { get; set; } = new List(); public List EmploymentStatusList { get; set; } = new List(); public List EmploymentTypeList { get; set; } = new List(); public List SalaryDayList { get; set; } = new List(); public List ProvinceList { get; set; } = new List(); public ProfileEditViewModel() { } public ProfileEditViewModel(Profile profile) { MapFrom(profile); } private void MapFrom(Profile profile) { if (profile == null) return; Profile = profile; ProfileId = profile.ProfileId; ProfileId_ = profile.ProfileId.ToEncryptedString(); LendServiceAccount = profile.LendServiceAccount; BorrowServiceAccount = profile.BorrowServiceAccount; Name = profile.Name; Surname = profile.Surname; EmailAddress = profile.EmailAddress; ContactNumber = profile.ContactNumber; DateOfBirth = profile.DateOfBirth; GenderId = profile.GenderId; //CountryOfBirthId = profile.CountryOfBirthId; //EthnicityId = profile.EthnicityId; IdentificationTypeId = profile.IdentificationTypeId; IdentificationNumber = profile.IdentificationNumber; if (profile.BankingDetails != null) { BankName = profile.BankingDetails.BankName; AccountName = profile.BankingDetails.AccountName; AccountNumber = profile.BankingDetails.AccountNumber; AccountType = profile.BankingDetails.AccountType; } //IsTaxRegistered = profile.TaxRegistered; //if (profile.TaxInformation != null) //{ // TaxNumber = profile.TaxInformation.TaxNumber; // TaxIdentificationTypeId = profile.TaxInformation.TaxIdentificationTypeId; // TaxCountryId = profile.TaxInformation.TaxCountryId; //} if (profile.NextOfKin != null) { NextOfKinName = profile.NextOfKin.NextOfKinName; RelationshipType = profile.NextOfKin.RelationshipType; NextOfKinContactNumber = profile.NextOfKin.NextOfKinContactNumber; } if (profile.FicaCompliance != null) { FicaStatusId = profile.FicaCompliance.FicaStatusId; VerificationDate = profile.FicaCompliance.VerificationDate; } if (profile.EmploymentDetail != null) { NetMonthlyIncome = profile.EmploymentDetail.NetMonthlyIncome; GrossMonthlyIncome = profile.EmploymentDetail.GrossMonthlyIncome; SalaryDay = profile.EmploymentDetail.SalaryDay; EmploymentStartDate = profile.EmploymentDetail.EmploymentStartDate; EmploymentEndDate = profile.EmploymentDetail.EmploymentEndDate; SalaryDay = profile.EmploymentDetail.SalaryDay; BillingDay = profile.EmploymentDetail.BillingDay; EmployerNumber = profile.EmploymentDetail.EmployerNumber; EmployerName = profile.EmploymentDetail.EmployerName; EmploymentTypeId = profile.EmploymentDetail.EmploymentTypeId; EmploymentStatusId = profile.EmploymentDetail.EmploymentStatusId; } Addresses = profile.Addresses.Select(m => new AddressViewModel(m)).ToList(); Documents = profile.Documents.Select(m => new DocumentViewModel(m)).ToList(); } } }