using System.ComponentModel.DataAnnotations; using Kreta.BusinessLogic.Classes; using Kreta.BusinessLogic.HelperClasses; using Kreta.BusinessLogic.Interfaces; using Kreta.Core.CustomAttributes; using Kreta.Enums.ManualEnums; using Kreta.Resources; using Kreta.Web.Security; using static Kreta.Core.Constants; namespace Kreta.Web.Areas.Hianyzas.Models { public class FelmentesekGridModel : IKretaIdentity { #region Fields public const string FelmentesekGridExportAttributeId = nameof(FelmentesekGridExportAttributeId); public const string AktivFelmentesekGridExportAttributeId = nameof(AktivFelmentesekGridExportAttributeId); public const string ToroltFelmentesekGridExportAttributeId = nameof(ToroltFelmentesekGridExportAttributeId); #endregion public FelmentesekGridModel() { } public FelmentesekGridModel(FelmentesGridItemCo itemCo, bool isTeljesFelmentesOka = false) { ID = itemCo.ID; TanuloNeve = itemCo.TanuloNeve; TanuloOsztalya = itemCo.TanuloOsztalya; TantargyNev = itemCo.TantargyNev; KezdeteDate = itemCo.KezdeteDate.HasValue ? itemCo.KezdeteDate.Value.ToString(ToStringPattern.HungarianDate) : "-"; VegeDate = itemCo.VegeDate.HasValue ? itemCo.VegeDate.Value.ToString(ToStringPattern.HungarianDate) : "-"; TanoraLatogatasaAloli = itemCo.IsTanoraLatogatasaAloli ? IgenNemEnum.Igen.GetDisplayName(ClaimData.SelectedTanevID.Value) : IgenNemEnum.Nem.GetDisplayName(ClaimData.SelectedTanevID.Value); ErtekelesAloli = itemCo.IsErtekelesAloli ? IgenNemEnum.Igen.GetDisplayName(ClaimData.SelectedTanevID.Value) : IgenNemEnum.Nem.GetDisplayName(ClaimData.SelectedTanevID.Value); SzovegesenErtekelheto = itemCo.IsSzovegesenErtekelheto ? IgenNemEnum.Igen.GetDisplayName(ClaimData.SelectedTanevID.Value) : IgenNemEnum.Nem.GetDisplayName(ClaimData.SelectedTanevID.Value); FelmentesOka = itemCo.FelmentesOka.Length > 16 && !isTeljesFelmentesOka ? itemCo.FelmentesOka.Substring(0, 12) + "..." : itemCo.FelmentesOka; RogzitesDate = itemCo.RogzitesDate.HasValue ? itemCo.RogzitesDate.Value.ToString(Kreta.Core.Constants.ToStringPattern.HungarianDate) : "-"; RogzitoNeve = itemCo.RogzitoNeve == SpecialUserName.KretaTechnicalUserName ? AdatszolgaltatasokResource.NincsAdat : itemCo.RogzitoNeve; ModositasDate = itemCo.ModositasDate.HasValue ? itemCo.ModositasDate.Value.ToString(Kreta.Core.Constants.ToStringPattern.HungarianDate) : "-"; ModositoNeve = itemCo.ModositoNeve == SpecialUserName.KretaTechnicalUserName ? AdatszolgaltatasokResource.NincsAdat : itemCo.ModositoNeve; Torolt = itemCo.Torolt; } public string ID { get; set; } public int TanuloId { get; set; } [SimpleExportColumn(FelmentesekGridExportAttributeId, 00, nameof(FelmentesResource.TanuloNeve), typeof(FelmentesResource))] [SimpleExportColumn(ToroltFelmentesekGridExportAttributeId, 00, nameof(FelmentesResource.TanuloNeve), typeof(FelmentesResource))] [SimpleExportColumn(AktivFelmentesekGridExportAttributeId, 00, nameof(FelmentesResource.TanuloNeve), typeof(FelmentesResource))] [Display(Name = nameof(FelmentesResource.TanuloNeve), ResourceType = typeof(FelmentesResource))] public string TanuloNeve { get; set; } [SimpleExportColumn(FelmentesekGridExportAttributeId, 01, nameof(FelmentesResource.TanuloOsztalya), typeof(FelmentesResource))] [SimpleExportColumn(ToroltFelmentesekGridExportAttributeId, 01, nameof(FelmentesResource.TanuloOsztalya), typeof(FelmentesResource))] [SimpleExportColumn(AktivFelmentesekGridExportAttributeId, 01, nameof(FelmentesResource.TanuloOsztalya), typeof(FelmentesResource))] [Display(Name = nameof(FelmentesResource.TanuloOsztalya), ResourceType = typeof(FelmentesResource))] public string TanuloOsztalya { get; set; } [SimpleExportColumn(FelmentesekGridExportAttributeId, 02, nameof(FelmentesResource.Tantargy), typeof(FelmentesResource))] [SimpleExportColumn(ToroltFelmentesekGridExportAttributeId, 02, nameof(FelmentesResource.Tantargy), typeof(FelmentesResource))] [SimpleExportColumn(AktivFelmentesekGridExportAttributeId, 02, nameof(FelmentesResource.Tantargy), typeof(FelmentesResource))] [Display(Name = nameof(FelmentesResource.Tantargy), ResourceType = typeof(FelmentesResource))] public string TantargyNev { get; set; } [SimpleExportColumn(FelmentesekGridExportAttributeId, 03, nameof(FelmentesResource.KezdeteDate), typeof(FelmentesResource))] [SimpleExportColumn(ToroltFelmentesekGridExportAttributeId, 03, nameof(FelmentesResource.KezdeteDate), typeof(FelmentesResource))] [SimpleExportColumn(AktivFelmentesekGridExportAttributeId, 03, nameof(FelmentesResource.KezdeteDate), typeof(FelmentesResource))] [Display(Name = nameof(FelmentesResource.KezdeteDate), ResourceType = typeof(FelmentesResource))] public string KezdeteDate { get; set; } [SimpleExportColumn(FelmentesekGridExportAttributeId, 04, nameof(FelmentesResource.VegeDate), typeof(FelmentesResource))] [SimpleExportColumn(ToroltFelmentesekGridExportAttributeId, 04, nameof(FelmentesResource.VegeDate), typeof(FelmentesResource))] [SimpleExportColumn(AktivFelmentesekGridExportAttributeId, 04, nameof(FelmentesResource.VegeDate), typeof(FelmentesResource))] [Display(Name = nameof(FelmentesResource.VegeDate), ResourceType = typeof(FelmentesResource))] public string VegeDate { get; set; } [SimpleExportColumn(FelmentesekGridExportAttributeId, 05, nameof(FelmentesResource.IsTanoraLatogatasaAloli), typeof(FelmentesResource))] [SimpleExportColumn(ToroltFelmentesekGridExportAttributeId, 05, nameof(FelmentesResource.IsTanoraLatogatasaAloli), typeof(FelmentesResource))] [SimpleExportColumn(AktivFelmentesekGridExportAttributeId, 05, nameof(FelmentesResource.IsTanoraLatogatasaAloli), typeof(FelmentesResource))] [Display(Name = nameof(FelmentesResource.IsTanoraLatogatasaAloli), ResourceType = typeof(FelmentesResource))] public string TanoraLatogatasaAloli { get; set; } [SimpleExportColumn(FelmentesekGridExportAttributeId, 06, nameof(FelmentesResource.IsErtekelesAloli), typeof(FelmentesResource))] [SimpleExportColumn(ToroltFelmentesekGridExportAttributeId, 06, nameof(FelmentesResource.IsErtekelesAloli), typeof(FelmentesResource))] [SimpleExportColumn(AktivFelmentesekGridExportAttributeId, 06, nameof(FelmentesResource.IsErtekelesAloli), typeof(FelmentesResource))] [Display(Name = nameof(FelmentesResource.IsErtekelesAloli), ResourceType = typeof(FelmentesResource))] public string ErtekelesAloli { get; set; } [SimpleExportColumn(FelmentesekGridExportAttributeId, 07, nameof(FelmentesResource.IsSzovegesenErtekelheto), typeof(FelmentesResource))] [SimpleExportColumn(ToroltFelmentesekGridExportAttributeId, 07, nameof(FelmentesResource.IsSzovegesenErtekelheto), typeof(FelmentesResource))] [SimpleExportColumn(AktivFelmentesekGridExportAttributeId, 07, nameof(FelmentesResource.IsSzovegesenErtekelheto), typeof(FelmentesResource))] [Display(Name = nameof(FelmentesResource.IsSzovegesenErtekelheto), ResourceType = typeof(FelmentesResource))] public string SzovegesenErtekelheto { get; set; } [SimpleExportColumn(FelmentesekGridExportAttributeId, 08, nameof(FelmentesResource.FelmentesOka), typeof(FelmentesResource))] [SimpleExportColumn(ToroltFelmentesekGridExportAttributeId, 08, nameof(FelmentesResource.FelmentesOka), typeof(FelmentesResource))] [SimpleExportColumn(AktivFelmentesekGridExportAttributeId, 08, nameof(FelmentesResource.FelmentesOka), typeof(FelmentesResource))] [Display(Name = nameof(FelmentesResource.FelmentesOka), ResourceType = typeof(FelmentesResource))] public string FelmentesOka { get; set; } [SimpleExportColumn(FelmentesekGridExportAttributeId, 09, nameof(FelmentesResource.RogzitesDate), typeof(FelmentesResource))] [SimpleExportColumn(ToroltFelmentesekGridExportAttributeId, 09, nameof(FelmentesResource.RogzitesDate), typeof(FelmentesResource))] [SimpleExportColumn(AktivFelmentesekGridExportAttributeId, 09, nameof(FelmentesResource.RogzitesDate), typeof(FelmentesResource))] [Display(Name = nameof(FelmentesResource.RogzitesDate), ResourceType = typeof(FelmentesResource))] public string RogzitesDate { get; set; } [SimpleExportColumn(FelmentesekGridExportAttributeId, 10, nameof(FelmentesResource.RogzitoNeve), typeof(FelmentesResource))] [SimpleExportColumn(ToroltFelmentesekGridExportAttributeId, 10, nameof(FelmentesResource.RogzitoNeve), typeof(FelmentesResource))] [SimpleExportColumn(AktivFelmentesekGridExportAttributeId, 10, nameof(FelmentesResource.RogzitoNeve), typeof(FelmentesResource))] [Display(Name = nameof(FelmentesResource.RogzitoNeve), ResourceType = typeof(FelmentesResource))] public string RogzitoNeve { get; set; } [SimpleExportColumn(FelmentesekGridExportAttributeId, 11, nameof(FelmentesResource.ModositasDate), typeof(FelmentesResource))] [SimpleExportColumn(ToroltFelmentesekGridExportAttributeId, 11, nameof(FelmentesResource.ModositasDate), typeof(FelmentesResource))] [SimpleExportColumn(AktivFelmentesekGridExportAttributeId, 11, nameof(FelmentesResource.ModositasDate), typeof(FelmentesResource))] [Display(Name = nameof(FelmentesResource.ModositasDate), ResourceType = typeof(FelmentesResource))] public string ModositasDate { get; set; } [SimpleExportColumn(FelmentesekGridExportAttributeId, 12, nameof(FelmentesResource.ModositoNeve), typeof(FelmentesResource))] [SimpleExportColumn(ToroltFelmentesekGridExportAttributeId, 12, nameof(FelmentesResource.ModositoNeve), typeof(FelmentesResource))] [SimpleExportColumn(AktivFelmentesekGridExportAttributeId, 12, nameof(FelmentesResource.ModositoNeve), typeof(FelmentesResource))] [Display(Name = nameof(FelmentesResource.ModositoNeve), ResourceType = typeof(FelmentesResource))] public string ModositoNeve { get; set; } public bool Torolt { get; set; } [SimpleExportColumn(FelmentesekGridExportAttributeId, 13, nameof(FelmentesResource.ToroltStr), typeof(FelmentesResource))] public string Torolt_Str => Torolt ? IgenNemEnum.Igen.GetDisplayName(ClaimData.SelectedTanevID.Value) : IgenNemEnum.Nem.GetDisplayName(ClaimData.SelectedTanevID.Value); } }