using System.ComponentModel.DataAnnotations; using Foolproof; using Kreta.BusinessLogic.Classes; using Kreta.Enums; using Kreta.Resources; using Kreta.Web.Security; namespace Kreta.Web.Models { public class AmiKepzesiJellemzokModel { [RequiredIf("MuveszetiAgValidationAttr", true, ErrorMessageResourceName = nameof(ErrorResource.MufajMegadasaKotelezo), ErrorMessageResourceType = typeof(ErrorResource))] [Display(Name = nameof(TantargyResource.Mufaj), ResourceType = typeof(TantargyResource))] public int? MufajTipusId { get; set; } [Display(Name = nameof(TantargyResource.Mufaj), ResourceType = typeof(TantargyResource))] public string MufajTipus_DNAME => MufajTipusId.GetDisplayName(ClaimData.SelectedTanevID.Value); [Display(Name = nameof(TantargyResource.Tanszak), ResourceType = typeof(TantargyResource))] [RequiredIf("IsRequiredAmiKepzesiJellemzok", true, ErrorMessageResourceName = nameof(ErrorResource.TanszakMegadasaKotelezo), ErrorMessageResourceType = typeof(ErrorResource))] public int? TanszakTipusId { get; set; } [Display(Name = nameof(TantargyResource.Tanszak), ResourceType = typeof(TantargyResource))] public string TanszakTipus_DNAME => TanszakTipusId.GetDisplayName(ClaimData.SelectedTanevID.Value); [Display(Name = nameof(TantargyResource.MuveszetiAg), ResourceType = typeof(TantargyResource))] [RequiredIf("IsRequiredAmiKepzesiJellemzok", true, ErrorMessageResourceName = nameof(ErrorResource.MuveszetiAgMegadasaKotelezo), ErrorMessageResourceType = typeof(ErrorResource))] public int? MuveszetiAgId { get; set; } [Display(Name = nameof(TantargyResource.MuveszetiAg), ResourceType = typeof(TantargyResource))] public string MuveszetiAg_DNAME => MuveszetiAgId.GetDisplayName(ClaimData.SelectedTanevID.Value); public int ZenemuveszetiAgId => (int)MuveszetiAgEnum.ZenemuveszetiAg; public int MufajTipusIdDefaultValue => (int)MufajTipusEnum.na; public bool MuveszetiAgValidationAttr { get { return MuveszetiAgId == (int)MuveszetiAgEnum.ZenemuveszetiAg; } } public bool IsRequiredAmiKepzesiJellemzok { get; set; } = false; } public class AmiKepzesiJellemzokModelForTanulo : AmiKepzesiJellemzokModel { [RequiredIf("MuveszetiAgValidationAttr", true, ErrorMessageResourceName = nameof(ErrorResource.MufajMegadasaKotelezoTanugyFul), ErrorMessageResourceType = typeof(ErrorResource))] public new int? MufajTipusId { get; set; } [RequiredIf("IsRequiredAmiKepzesiJellemzok", true, ErrorMessageResourceName = nameof(ErrorResource.TanszakMegadasaKotelezoTanugyFul), ErrorMessageResourceType = typeof(ErrorResource))] public new int? TanszakTipusId { get; set; } [RequiredIf("IsRequiredAmiKepzesiJellemzok", true, ErrorMessageResourceName = nameof(ErrorResource.MuveszetiAgMegadasaKotelezoTanugyFul), ErrorMessageResourceType = typeof(ErrorResource))] public new int? MuveszetiAgId { get; set; } public new bool MuveszetiAgValidationAttr { get { return MuveszetiAgId == (int)MuveszetiAgEnum.ZenemuveszetiAg; } } } }