using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using Kreta.BusinessLogic.Classes; using Kreta.BusinessLogic.Validation; using Kreta.Core; using Kreta.Enums; using Kreta.Framework.Util; using Kreta.Resources; using Newtonsoft.Json; namespace Kreta.BusinessLogic.HelperClasses.ImportCo { public class NebuloImportCo : BaseImportCo { [JsonIgnore] public List MainImportItemList { get; set; } = new List(); [JsonIgnore] public List NemImportalhatoItemList { get; set; } = new List(); [JsonProperty("T_NEBULO_OSSZES")] public List MainImportJsonItemList { get; set; } [JsonIgnore] public int NebuloImportTipus { get; set; } [JsonIgnore] public List NebuloCoList { get; set; } public Dictionary> Validate() { var validationResultDictionary = new Dictionary>(); foreach (NebuloImportItemCo importItem in MainImportItemList) { var validationResultList = new List(); //NOTE: Az import item-eket egyesével levalidáljuk! var blValidator = new BlValidator(importItem); if (!blValidator.IsValid) { validationResultList.AddRange(blValidator.ErrorList); } var oktatasiAzonositoToCompare = importItem.OktatasiAzonositoSzama?.ToComparableString(); if (!string.IsNullOrWhiteSpace(oktatasiAzonositoToCompare)) { if (NebuloCoList.Any(x => x.OktatasiAzonositoSzama == oktatasiAzonositoToCompare)) { validationResultList.Add(new ValidationResult(string.Format(ImportExportNebuloResource.ErrorNemMegfeleloOktAzon, importItem.OktatasiAzonositoSzama))); } } if (MainImportItemList.Where(x => x.OktatasiAzonositoSzamImportData == oktatasiAzonositoToCompare).ToList().Count > 1) { validationResultList.Add(new ValidationResult(string.Format(ImportExportNebuloResource.ErrorDuplikaltOktAzon, importItem.OktatasiAzonositoSzama))); } if (validationResultList.Count > 0) { validationResultDictionary.Add(importItem.LineNumber, validationResultList); } } Dictionary lineNumberCompareHashDictionary = MainImportItemList.ToDictionary(x => x.LineNumber, x => x.CompareHash); var duplicatedRowConditonTextList = new List { ImportExportNebuloResource.ImportHeaderNameSzuletesiVezeteknev, ImportExportNebuloResource.ImportHeaderNameSzuletesiKeresztnev, ImportExportNebuloResource.ImportHeaderNameAnyjaNeveVezeteknev, ImportExportNebuloResource.ImportHeaderNameAnyjaNeveKeresztnev, ImportExportNebuloResource.ImportHeaderNameSzuletesiIdo, ImportExportNebuloResource.ImportHeaderNameSzuletesiTelepules }; ValidateDuplicatedRows(validationResultDictionary, lineNumberCompareHashDictionary, duplicatedRowConditonTextList); return validationResultDictionary; } } public class NebuloImportItemCo : BaseImportItemCo, IValidatableObject { private readonly int _tanevId; private NebuloImportItemCo() { } public NebuloImportItemCo(int tanevId) { _tanevId = tanevId; } [Required(ErrorMessageResourceName = nameof(ErrorResource.Required), ErrorMessageResourceType = typeof(ErrorResource))] [MaxLength(20, ErrorMessageResourceName = nameof(CommonResource.MaxLengthValidation), ErrorMessageResourceType = typeof(CommonResource))] [KretaRegularExpression(Constants.RegularExpressions.OktatasiAzonosito, ErrorMessageResourceName = nameof(ErrorResource.OktatasiAzonositoFormatumaNemMegfelelo), ErrorMessageResourceType = typeof(ErrorResource))] [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameOktatasiAzonositoSzam), ResourceType = typeof(ImportExportNebuloResource))] public string OktatasiAzonositoSzamImportData { get; set; } [MaxLength(20, ErrorMessageResourceName = nameof(CommonResource.MaxLengthValidation), ErrorMessageResourceType = typeof(CommonResource))] [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameViseltElonev), ResourceType = typeof(ImportExportNebuloResource))] public string ViseltElonevImportData { get; set; } [Required(ErrorMessageResourceName = nameof(ErrorResource.Required), ErrorMessageResourceType = typeof(ErrorResource))] [MaxLength(255, ErrorMessageResourceName = nameof(CommonResource.MaxLengthValidation), ErrorMessageResourceType = typeof(CommonResource))] [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameViseltVezeteknev), ResourceType = typeof(ImportExportNebuloResource))] public string ViseltVezeteknevImportData { get; set; } [Required(ErrorMessageResourceName = nameof(ErrorResource.Required), ErrorMessageResourceType = typeof(ErrorResource))] [MaxLength(255, ErrorMessageResourceName = nameof(CommonResource.MaxLengthValidation), ErrorMessageResourceType = typeof(CommonResource))] [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameViseltKeresztnev), ResourceType = typeof(ImportExportNebuloResource))] public string ViseltKeresztnevImportData { get; set; } [Required(ErrorMessageResourceName = nameof(ErrorResource.Required), ErrorMessageResourceType = typeof(ErrorResource))] [MaxLength(255, ErrorMessageResourceName = nameof(CommonResource.MaxLengthValidation), ErrorMessageResourceType = typeof(CommonResource))] [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameSzuletesiVezeteknev), ResourceType = typeof(ImportExportNebuloResource))] public string SzuletesiVezeteknevImportData { get; set; } [Required(ErrorMessageResourceName = nameof(ErrorResource.Required), ErrorMessageResourceType = typeof(ErrorResource))] [MaxLength(255, ErrorMessageResourceName = nameof(CommonResource.MaxLengthValidation), ErrorMessageResourceType = typeof(CommonResource))] [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameSzuletesiKeresztnev), ResourceType = typeof(ImportExportNebuloResource))] public string SzuletesiKeresztnevImportData { get; set; } [Required(ErrorMessageResourceName = nameof(ErrorResource.Required), ErrorMessageResourceType = typeof(ErrorResource))] [MaxLength(255, ErrorMessageResourceName = nameof(CommonResource.MaxLengthValidation), ErrorMessageResourceType = typeof(CommonResource))] [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameAnyjaNeveVezeteknev), ResourceType = typeof(ImportExportNebuloResource))] public string AnyjaNeveVezeteknevImportData { get; set; } [Required(ErrorMessageResourceName = nameof(ErrorResource.Required), ErrorMessageResourceType = typeof(ErrorResource))] [MaxLength(255, ErrorMessageResourceName = nameof(CommonResource.MaxLengthValidation), ErrorMessageResourceType = typeof(CommonResource))] [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameAnyjaNeveKeresztnev), ResourceType = typeof(ImportExportNebuloResource))] public string AnyjaNeveKeresztnevImportData { get; set; } [Required(ErrorMessageResourceName = nameof(ErrorResource.Required), ErrorMessageResourceType = typeof(ErrorResource))] [MaxLength(20, ErrorMessageResourceName = nameof(CommonResource.MaxLengthValidation), ErrorMessageResourceType = typeof(CommonResource))] [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameSzuletesiIdo), ResourceType = typeof(ImportExportNebuloResource))] public string SzuletesiIdoImportData { get; set; } [Required(ErrorMessageResourceName = nameof(ErrorResource.Required), ErrorMessageResourceType = typeof(ErrorResource))] [MaxLength(50, ErrorMessageResourceName = nameof(CommonResource.MaxLengthValidation), ErrorMessageResourceType = typeof(CommonResource))] [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameSzuletesiTelepules), ResourceType = typeof(ImportExportNebuloResource))] public string SzuletesiTelepulesImportData { get; set; } [MaxLength(250, ErrorMessageResourceName = nameof(CommonResource.MaxLengthValidation), ErrorMessageResourceType = typeof(CommonResource))] [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameTartozkodasiCimOrszag), ResourceType = typeof(ImportExportNebuloResource))] public string TartozkodasiCimOrszagImportData { get; set; } [MaxLength(255, ErrorMessageResourceName = nameof(CommonResource.MaxLengthValidation), ErrorMessageResourceType = typeof(CommonResource))] [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameTartozkodasiCimTelepules), ResourceType = typeof(ImportExportNebuloResource))] public string TartozkodasiCimTelepulesImportData { get; set; } [MaxLength(20, ErrorMessageResourceName = nameof(CommonResource.MaxLengthValidation), ErrorMessageResourceType = typeof(CommonResource))] [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameTartozkodasiCimIranyitoszam), ResourceType = typeof(ImportExportNebuloResource))] public string TartozkodasiCimIranyitoszamImportData { get; set; } [MaxLength(40, ErrorMessageResourceName = nameof(CommonResource.MaxLengthValidation), ErrorMessageResourceType = typeof(CommonResource))] [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameTartozkodasiCimKozteruletNev), ResourceType = typeof(ImportExportNebuloResource))] public string TartozkodasiCimKozteruletNevImportData { get; set; } [MaxLength(20, ErrorMessageResourceName = nameof(CommonResource.MaxLengthValidation), ErrorMessageResourceType = typeof(CommonResource))] [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameTartozkodasiCimKozteruletJelleg), ResourceType = typeof(ImportExportNebuloResource))] public string TartozkodasiCimKozteruletJellegImportData { get; set; } [MaxLength(30, ErrorMessageResourceName = nameof(CommonResource.MaxLengthValidation), ErrorMessageResourceType = typeof(CommonResource))] [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameTartozkodasiCimHazszam), ResourceType = typeof(ImportExportNebuloResource))] public string TartozkodasiCimHazszamImportData { get; set; } [MaxLength(250, ErrorMessageResourceName = nameof(CommonResource.MaxLengthValidation), ErrorMessageResourceType = typeof(CommonResource))] [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameAllandoLakcimOrszag), ResourceType = typeof(ImportExportNebuloResource))] public string AllandoLakcimOrszagImportData { get; set; } [MaxLength(255, ErrorMessageResourceName = nameof(CommonResource.MaxLengthValidation), ErrorMessageResourceType = typeof(CommonResource))] [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameAllandoLakcimTelepules), ResourceType = typeof(ImportExportNebuloResource))] public string AllandoLakcimTelepulesImportData { get; set; } [MaxLength(20, ErrorMessageResourceName = nameof(CommonResource.MaxLengthValidation), ErrorMessageResourceType = typeof(CommonResource))] [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameAllandoLakcimIranyitoszam), ResourceType = typeof(ImportExportNebuloResource))] public string AllandoLakcimIranyitoszamImportData { get; set; } [MaxLength(40, ErrorMessageResourceName = nameof(CommonResource.MaxLengthValidation), ErrorMessageResourceType = typeof(CommonResource))] [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameAllandoLakcimKozteruletNev), ResourceType = typeof(ImportExportNebuloResource))] public string AllandoLakcimKozteruletNevImportData { get; set; } [MaxLength(20, ErrorMessageResourceName = nameof(CommonResource.MaxLengthValidation), ErrorMessageResourceType = typeof(CommonResource))] [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameAllandoLakcimKozteruletJelleg), ResourceType = typeof(ImportExportNebuloResource))] public string AllandoLakcimKozteruletJellegImportData { get; set; } [MaxLength(30, ErrorMessageResourceName = nameof(CommonResource.MaxLengthValidation), ErrorMessageResourceType = typeof(CommonResource))] [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameAllandoLakcimHazszam), ResourceType = typeof(ImportExportNebuloResource))] public string AllandoLakcimHazszamImportData { get; set; } #region Unused Import Data [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameFenntartoAzonosito), ResourceType = typeof(ImportExportNebuloResource))] public string FenntartoAzonositoImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameFenntartoMegnevezese), ResourceType = typeof(ImportExportNebuloResource))] public string FenntartoMegnevezeseImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameErvenyesKotelezettsegTipusa), ResourceType = typeof(ImportExportNebuloResource))] public string ErvenyesKotelezettsegTipusaImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameViseltNevNevsorrend), ResourceType = typeof(ImportExportNebuloResource))] public string ViseltNevNevsorrendImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameSzuletesiElonev), ResourceType = typeof(ImportExportNebuloResource))] public string SzuletesiElonevImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameSzuletesiNevNevsorrend), ResourceType = typeof(ImportExportNebuloResource))] public string SzuletesiNevNevsorrendImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameAnyjaNeveElonev), ResourceType = typeof(ImportExportNebuloResource))] public string AnyjaNeveElonevImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameAnyjaNeveNevsorrend), ResourceType = typeof(ImportExportNebuloResource))] public string AnyjaNeveNevsorrendImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameTartozkodasiCimPontositas), ResourceType = typeof(ImportExportNebuloResource))] public string TartozkodasiCimPontositasImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameAllandoLakcimPontositas), ResourceType = typeof(ImportExportNebuloResource))] public string AllandoLakcimPontositasImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameErvenyesKotelezettsegKezdete), ResourceType = typeof(ImportExportNebuloResource))] public string ErvenyesKotelezettsegKezdeteImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameErvenyesKotelezettsegVege), ResourceType = typeof(ImportExportNebuloResource))] public string ErvenyesKotelezettsegVegeImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameHalasztasJogcime), ResourceType = typeof(ImportExportNebuloResource))] public string HalasztasJogcimeImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameHalasztastEngedelyezoSzervTipusa), ResourceType = typeof(ImportExportNebuloResource))] public string HalasztastEngedelyezoSzervTipusaImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameHalasztastEngedelyezoSzervMegnevezese), ResourceType = typeof(ImportExportNebuloResource))] public string HalasztastEngedelyezoSzervMegnevezeseImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameHalasztasHatalyaVegdatuma), ResourceType = typeof(ImportExportNebuloResource))] public string HalasztasHatalyaVegdatumaImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameKotelezettseghezKapcsolodoAktivVagySzuneteloJogviszonya), ResourceType = typeof(ImportExportNebuloResource))] public string KotelezettseghezKapcsolodoAktivVagySzuneteloJogviszonyaImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameKotelezettseghezKapcsolodoJogviszonyTipusa), ResourceType = typeof(ImportExportNebuloResource))] public string KotelezettseghezKapcsolodoJogviszonyTipusaImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameKotelezettseghezKapcsolodoJogviszonyStatusza), ResourceType = typeof(ImportExportNebuloResource))] public string KotelezettseghezKapcsolodoJogviszonyStatuszaImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameKotelezettseghezKapcsolodoJogviszonyIntezmenyOmAzonositoja), ResourceType = typeof(ImportExportNebuloResource))] public string KotelezettseghezKapcsolodoJogviszonyIntezmenyOmAzonositojaImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameKotelezettseghezKapcsolodoJogviszonyIntezmenyNeve), ResourceType = typeof(ImportExportNebuloResource))] public string KotelezettseghezKapcsolodoJogviszonyIntezmenyNeveImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameKotelezettseghezKapcsolodoJogviszonyUgyviteliHelySorszama), ResourceType = typeof(ImportExportNebuloResource))] public string KotelezettseghezKapcsolodoJogviszonyUgyviteliHelySorszamaImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameKotelezettseghezKapcsolodoJogviszonyUgyviteliHelyAzonositoja), ResourceType = typeof(ImportExportNebuloResource))] public string KotelezettseghezKapcsolodoJogviszonyUgyviteliHelyAzonositojaImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameKotelezettseghezKapcsolodoJogviszonyUgyviteliHelyNeve), ResourceType = typeof(ImportExportNebuloResource))] public string KotelezettseghezKapcsolodoJogviszonyUgyviteliHelyNeveImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameKotelezettseghezKapcsolodoJogviszonyUgyviteliHelyCime), ResourceType = typeof(ImportExportNebuloResource))] public string KotelezettseghezKapcsolodoJogviszonyUgyviteliHelyCimeImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameKotelezettseghezKapcsolodoJogviszonyKezdete), ResourceType = typeof(ImportExportNebuloResource))] public string KotelezettseghezKapcsolodoJogviszonyKezdeteImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameKotelezettseghezKapcsolodoJogviszonySzunetelesenekKezdete), ResourceType = typeof(ImportExportNebuloResource))] public string KotelezettseghezKapcsolodoJogviszonySzunetelesenekKezdeteImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameKotelezettseghezKapcsolodoJogviszonySzunetelesenekVarhatoVege), ResourceType = typeof(ImportExportNebuloResource))] public string KotelezettseghezKapcsolodoJogviszonySzunetelesenekVarhatoVegeImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameKotelezettseghezKapcsolodoJogviszonySzunetelesJogcime), ResourceType = typeof(ImportExportNebuloResource))] public string KotelezettseghezKapcsolodoJogviszonySzunetelesJogcimeImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameKotelezettsegetAzIlletekesFenntartohozTartozoIntezmenybenTeljesiti), ResourceType = typeof(ImportExportNebuloResource))] public string KotelezettsegetAzIlletekesFenntartohozTartozoIntezmenybenTeljesitiImportData { get; set; } [Display(Name = nameof(ImportExportNebuloResource.ImportHeaderNameAzUtolsoKotelezettsegetTeljesitoJogviszonyVegdatuma), ResourceType = typeof(ImportExportNebuloResource))] public string AzUtolsoKotelezettsegetTeljesitoJogviszonyVegdatumaImportData { get; set; } #endregion Unused Import Data public string Elotag => GetStringValue(ViseltElonevImportData); public string Vezeteknev => GetStringValue(ViseltVezeteknevImportData); public string Keresztnev => GetStringValue(ViseltKeresztnevImportData); public string SzuletesiVezeteknev => GetStringValue(SzuletesiVezeteknevImportData); public string SzuletesiKeresztnev => GetStringValue(SzuletesiKeresztnevImportData); public string AnyjaVezeteknev => GetStringValue(AnyjaNeveVezeteknevImportData); public string AnyjaKeresztnev => GetStringValue(AnyjaNeveKeresztnevImportData); public string SzuletesiHely => GetStringValue(SzuletesiTelepulesImportData); public DateTime? SzuletesiIdo => GetDateTimeValue(SzuletesiIdoImportData); public string SzuletesiIdoString => GetDateTimeString(SzuletesiIdo); public string OktatasiAzonositoSzama => GetStringValue(OktatasiAzonositoSzamImportData); public int? OrszagTipusId => ((int)GeneratedAdatszotarTipusEnum.OrszagTipus).GetItemIdByTypeAndName(AllandoLakcimOrszagImportData, _tanevId); public string HelysegNev => GetStringValue(AllandoLakcimTelepulesImportData); public string Iranyitoszam => GetStringValue(AllandoLakcimIranyitoszamImportData); public string KozteruletNev => GetStringValue(AllandoLakcimKozteruletNevImportData); public int? KozteruletJellegeId => ((int)GeneratedAdatszotarTipusEnum.KozteruletJelleg).GetItemIdByTypeAndName(AllandoLakcimKozteruletJellegImportData, _tanevId); public string KozteruletJellegeNev => KozteruletJellegeId.GetDisplayName(_tanevId, defaultValue: null); public string Hazszam => GetStringValue(AllandoLakcimHazszamImportData); public int? ThOrszagTipusId => ((int)GeneratedAdatszotarTipusEnum.OrszagTipus).GetItemIdByTypeAndName(TartozkodasiCimOrszagImportData, _tanevId); public string ThHelysegNev => GetStringValue(TartozkodasiCimTelepulesImportData); public string ThIranyitoszam => GetStringValue(TartozkodasiCimIranyitoszamImportData); public string ThKozteruletNev => GetStringValue(TartozkodasiCimKozteruletNevImportData); public int? ThKozteruletJellegeId => ((int)GeneratedAdatszotarTipusEnum.KozteruletJelleg).GetItemIdByTypeAndName(TartozkodasiCimKozteruletJellegImportData, _tanevId); public string ThKozteruletJellegeNev => ThKozteruletJellegeId.GetDisplayName(_tanevId, defaultValue: null); public string ThHazszam => GetStringValue(TartozkodasiCimHazszamImportData); //NOTE: A tartózkodási címe azonos, ha minden értéke üres az importban. public bool ThCimeAzonos => !ThOrszagTipusId.IsEntityId() && string.IsNullOrWhiteSpace(ThHelysegNev) && string.IsNullOrWhiteSpace(ThIranyitoszam) && string.IsNullOrWhiteSpace(ThKozteruletNev) && !ThKozteruletJellegeId.IsEntityId() && string.IsNullOrWhiteSpace(ThHazszam); public int? FeladatellatasiHelyId { get; set; } public int FelvetelStatuszaId { get; set; } #region Validate public IEnumerable Validate(ValidationContext validationContext) { //NOTE: Ha van megadva bármilyen érték az import data-ban, meg kell vizsgálni, hogy sikerült-e átkonvertálni a megfelelő típusra. if (!string.IsNullOrWhiteSpace(SzuletesiIdoImportData)) { //NOTE: Ha az érték null, akkor a bejövő adat nem megfelelő formátumú! if (!SzuletesiIdo.HasValue) { yield return new ValidationResult(string.Format(ImportExportCommonResource.InvalidDatumFormat, ImportExportNebuloResource.ImportHeaderNameSzuletesiIdo.ToLowerInvariant(), SzuletesiIdoImportData)); } else { var minimumDate = new DateTime(Now.Date.Year - 18, 1, 1); var maximumDate = new DateTime(Now.Date.Year, 1, 1); var minOk = SzuletesiIdo >= minimumDate; var maxOk = SzuletesiIdo <= maximumDate; if (!minOk || !maxOk) { yield return new ValidationResult( string.Format(BeiratkozasResource.ASzuletesiIdoCsakKozeEshet, minimumDate.ToString(Constants.ToStringPattern.HungarianDate), maximumDate.ToString(Constants.ToStringPattern.HungarianDate))); } } } //NOTE: Ha van megadva bármilyen érték az import data-ban, meg kell vizsgálni, hogy sikerült-e átkonvertálni a megfelelő típusra. if (!string.IsNullOrWhiteSpace(AllandoLakcimOrszagImportData)) { //NOTE: Ha az érték null, akkor a bejövő adat nem megfelelő formátumú! if (!OrszagTipusId.HasValue) { yield return new ValidationResult(string.Format(ImportExportCommonResource.InvalidFormat, ImportExportNebuloResource.ImportHeaderNameAllandoLakcimOrszag.ToLowerInvariant(), AllandoLakcimOrszagImportData)); } } //NOTE: Ha van megadva bármilyen érték az import data-ban, meg kell vizsgálni, hogy sikerült-e átkonvertálni a megfelelő típusra. if (!string.IsNullOrWhiteSpace(AllandoLakcimKozteruletJellegImportData)) { //NOTE: Ha az érték null, akkor a bejövő adat nem megfelelő formátumú! if (!KozteruletJellegeId.HasValue) { yield return new ValidationResult(string.Format(ImportExportCommonResource.InvalidFormat, ImportExportNebuloResource.ImportHeaderNameAllandoLakcimKozteruletJelleg.ToLowerInvariant(), AllandoLakcimKozteruletJellegImportData)); } } //NOTE: Ha van megadva bármilyen érték az import data-ban, meg kell vizsgálni, hogy sikerült-e átkonvertálni a megfelelő típusra. if (!string.IsNullOrWhiteSpace(TartozkodasiCimOrszagImportData)) { //NOTE: Ha az érték null, akkor a bejövő adat nem megfelelő formátumú! if (!ThOrszagTipusId.HasValue) { yield return new ValidationResult(string.Format(ImportExportCommonResource.InvalidFormat, ImportExportNebuloResource.ImportHeaderNameTartozkodasiCimOrszag.ToLowerInvariant(), TartozkodasiCimOrszagImportData)); } } //NOTE: Ha van megadva bármilyen érték az import data-ban, meg kell vizsgálni, hogy sikerült-e átkonvertálni a megfelelő típusra. if (!string.IsNullOrWhiteSpace(TartozkodasiCimKozteruletJellegImportData)) { //NOTE: Ha az érték null, akkor a bejövő adat nem megfelelő formátumú! if (!ThKozteruletJellegeId.HasValue) { yield return new ValidationResult(string.Format(ImportExportCommonResource.InvalidFormat, ImportExportNebuloResource.ImportHeaderNameTartozkodasiCimKozteruletJelleg.ToLowerInvariant(), TartozkodasiCimKozteruletJellegImportData)); } } } #endregion Validate } public class NebuloImportJsonItemCo : BaseImportJsonItemCo { public NebuloImportJsonItemCo(NebuloImportItemCo importItemCo, int tanevId, int intezmenyId, int felhasznaloId) : base(tanevId, intezmenyId, felhasznaloId) { Elotag = importItemCo.Elotag; Vezeteknev = importItemCo.Vezeteknev; Keresztnev = importItemCo.Keresztnev; SzuletesiVezeteknev = importItemCo.SzuletesiVezeteknev; SzuletesiKeresztnev = importItemCo.SzuletesiKeresztnev; AnyjaVezeteknev = importItemCo.AnyjaVezeteknev; AnyjaKeresztnev = importItemCo.AnyjaKeresztnev; SzuletesiHely = importItemCo.SzuletesiHely; SzuletesiIdo = importItemCo.SzuletesiIdo; SzuletesiIdoString = importItemCo.SzuletesiIdoString; OktatasiAzonositoSzama = importItemCo.OktatasiAzonositoSzama; OrszagTipusId = importItemCo.OrszagTipusId; HelysegNev = importItemCo.HelysegNev; Iranyitoszam = importItemCo.Iranyitoszam; KozteruletNev = importItemCo.KozteruletNev; KozteruletJellegeId = importItemCo.KozteruletJellegeId; KozteruletJellegeNev = importItemCo.KozteruletJellegeNev; Hazszam = importItemCo.Hazszam; ThOrszagTipusId = importItemCo.ThOrszagTipusId; ThHelysegNev = importItemCo.ThHelysegNev; ThIranyitoszam = importItemCo.ThIranyitoszam; ThKozteruletNev = importItemCo.ThKozteruletNev; ThKozteruletJellegeId = importItemCo.ThKozteruletJellegeId; ThKozteruletJellegeNev = importItemCo.ThKozteruletJellegeNev; ThHazszam = importItemCo.ThHazszam; ThCimeAzonos = SDAConvert.ToSDABoolean(importItemCo.ThCimeAzonos); FeladatellatasiHelyId = importItemCo.FeladatellatasiHelyId; FelvetelStatuszaId = importItemCo.FelvetelStatuszaId; Id = importItemCo.Id; LineNumber = importItemCo.LineNumber; Operation = importItemCo.Operation; } #region Import Json Properties [JsonProperty("C_ELOTAG")] public string Elotag { get; set; } [JsonProperty("C_TANULOCSALADINEVE")] public string Vezeteknev { get; set; } [JsonProperty("C_TANULOUTONEVE")] public string Keresztnev { get; set; } [JsonProperty("C_SZULETESICSALADINEVE")] public string SzuletesiVezeteknev { get; set; } [JsonProperty("C_SZULETESIUTONEVE")] public string SzuletesiKeresztnev { get; set; } [JsonProperty("C_EDESANYJASZULETESICSALADINEV")] public string AnyjaVezeteknev { get; set; } [JsonProperty("C_EDESANYJASZULETESIUTONEVE")] public string AnyjaKeresztnev { get; set; } [JsonProperty("C_SZULETESIHELY")] public string SzuletesiHely { get; set; } [JsonIgnore] public DateTime? SzuletesiIdo { get; set; } [JsonProperty("C_SZULETESIIDO")] public string SzuletesiIdoString { get; set; } [JsonProperty("C_OKTATASIAZONOSITOSZAMA")] public string OktatasiAzonositoSzama { get; set; } [JsonProperty("C_ORSZAGTIPUSID")] public int? OrszagTipusId { get; set; } [JsonProperty("C_HELYSEGNEV")] public string HelysegNev { get; set; } [JsonProperty("C_IRANYITOSZAM")] public string Iranyitoszam { get; set; } [JsonProperty("C_KOZTERULETNEV")] public string KozteruletNev { get; set; } [JsonProperty("C_KOZTERULETJELLEGE")] public int? KozteruletJellegeId { get; set; } [JsonProperty("C_KOZTERULETJELLEGENEV")] public string KozteruletJellegeNev { get; set; } [JsonProperty("C_HAZSZAM")] public string Hazszam { get; set; } [JsonProperty("C_THORSZAGTIPUSID")] public int? ThOrszagTipusId { get; set; } [JsonProperty("C_THHELYSEGNEV")] public string ThHelysegNev { get; set; } [JsonProperty("C_THIRANYITOSZAM")] public string ThIranyitoszam { get; set; } [JsonProperty("C_THKOZTERULETNEV")] public string ThKozteruletNev { get; set; } [JsonProperty("C_THKOZTERULETJELLEGE")] public int? ThKozteruletJellegeId { get; set; } [JsonProperty("C_THKOZTERULETJELLEGENEV")] public string ThKozteruletJellegeNev { get; set; } [JsonProperty("C_THHAZSZAM")] public string ThHazszam { get; set; } [JsonProperty("C_TARTOZKODASIHELYAZONOS")] public string ThCimeAzonos { get; set; } [JsonProperty("C_FELADATELLATASIHELYID")] public int? FeladatellatasiHelyId { get; set; } [JsonProperty("C_FELVETELSTATUSZA")] public int FelvetelStatuszaId { get; set; } #region Default Required Import Json Properties [JsonProperty("C_SZULETESIORSZAG")] public int SzuletesiOrszag => (int)OrszagTipusEnum.Magyarorszag; [JsonProperty("C_KEPVISELO2CIMEAZONOS")] public string TkCimeAzonos => SDAConvert.ToSDABoolean(true); [JsonProperty("C_ALLAMPOLGARSAGA")] public int Allampolgarsag => (int)AllampolgarsagEnum.magyar; [JsonProperty("C_ANYANYELVE")] public int Anyanyelv => (int)AnyanyelvEnum.magyar; [JsonProperty("C_TAGOZAT")] public int Tagozat => (int)TagozatTipusEnum.Normal_egesz_napos_iskola; [JsonProperty("C_ELETVITELSZERUOTTLAKASKORZET")] public string EletvitelszeruOttLakasKorzetes => SDAConvert.ToSDABoolean(true); [JsonProperty("C_SNILETSZAMSULY")] public int SniLetszamSuly => 1; [JsonProperty("C_BTMLETSZAMSULY")] public int BtmLetszamSuly => 1; #endregion Default Required Import Json Properties #endregion Import Json Properties } }