85 lines
3.8 KiB
C#
85 lines
3.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using Kreta.BusinessLogic.HelperClasses;
|
|
using Kreta.BusinessLogic.Interfaces;
|
|
using Kreta.Core.CustomAttributes;
|
|
using Kreta.Resources;
|
|
|
|
namespace Kreta.Web.Areas.GRModul.Models
|
|
{
|
|
public class KotvallGridModel : IKretaIdentity
|
|
{
|
|
public const string KotvallGridExportAttributeId = nameof(KotvallGridExportAttributeId);
|
|
|
|
public KotvallGridModel()
|
|
{
|
|
|
|
}
|
|
|
|
public KotvallGridModel(KotvallItemCo co, Guid felhasznaloIdpEgyediAzonosito)
|
|
{
|
|
ID = co.Id.ToString();
|
|
Sorszam = co.Sorszam;
|
|
BejelentoNeve = co.BejelentoNeve;
|
|
BejelentoIdpEgyediAzonosito = co.BejelentoIdpEgyediAzonosito;
|
|
StatuszNeve = co.StatuszNeve;
|
|
StatuszId = co.StatuszId;
|
|
Leiras = co.Leiras;
|
|
BeszerzesTargya = co.BeszerzesTargya;
|
|
BruttoErtek = co.BruttoErtek;
|
|
IsViewEnabled = true;
|
|
IsEditEnabled = (felhasznaloIdpEgyediAzonosito == BejelentoIdpEgyediAzonosito) && new List<int> { 2 }.Contains(StatuszId);
|
|
IsDeleteEnabled = (felhasznaloIdpEgyediAzonosito == BejelentoIdpEgyediAzonosito) && new List<int> { 1 }.Contains(StatuszId);
|
|
IsInfoEnabled = StatuszId == 2 || StatuszId == 7;
|
|
}
|
|
|
|
public string ID { get; set; }
|
|
|
|
[SimpleExportColumn(KotvallGridExportAttributeId, 00, nameof(KotvallKezelesResource.BeszerzesSorszam), typeof(KotvallKezelesResource))]
|
|
[Display(Name = nameof(KotvallKezelesResource.Sorszam), ResourceType = typeof(KotvallKezelesResource))]
|
|
public string Sorszam { get; set; }
|
|
|
|
[SimpleExportColumn(KotvallGridExportAttributeId, 01, nameof(KotvallKezelesResource.BejelentoNeve), typeof(KotvallKezelesResource))]
|
|
[Display(Name = nameof(KotvallKezelesResource.BejelentoNeve), ResourceType = typeof(KotvallKezelesResource))]
|
|
public string BejelentoNeve { get; set; }
|
|
|
|
public Guid BejelentoIdpEgyediAzonosito { get; set; }
|
|
|
|
[SimpleExportColumn(KotvallGridExportAttributeId, 02, nameof(KotvallKezelesResource.BeszerzesStatusz), typeof(KotvallKezelesResource))]
|
|
[Display(Name = nameof(KotvallKezelesResource.Statusz), ResourceType = typeof(KotvallKezelesResource))]
|
|
public string StatuszNeve { get; set; }
|
|
|
|
public int StatuszId { get; set; }
|
|
|
|
[SimpleExportColumn(KotvallGridExportAttributeId, 03, nameof(KotvallKezelesResource.BeszerzesTargya), typeof(KotvallKezelesResource))]
|
|
[Display(Name = nameof(KotvallKezelesResource.BeszerzesTargya), ResourceType = typeof(KotvallKezelesResource))]
|
|
public string BeszerzesTargya { get; set; }
|
|
|
|
[SimpleExportColumn(KotvallGridExportAttributeId, 05, nameof(KotvallKezelesResource.BruttoErtek), typeof(KotvallKezelesResource))]
|
|
[Display(Name = nameof(KotvallKezelesResource.BruttoErtek), ResourceType = typeof(KotvallKezelesResource))]
|
|
public int BruttoErtek { get; set; }
|
|
|
|
[SimpleExportColumn(KotvallGridExportAttributeId, 04, nameof(KotvallKezelesResource.BeszerzesLeirasa), typeof(KotvallKezelesResource))]
|
|
[Display(Name = nameof(KotvallKezelesResource.BeszerzesLeirasa), ResourceType = typeof(KotvallKezelesResource))]
|
|
public string Leiras { get; set; }
|
|
|
|
public bool IsViewEnabled { get; set; }
|
|
public bool IsEditEnabled { get; set; }
|
|
public bool IsDeleteEnabled { get; set; }
|
|
public bool IsInfoEnabled { get; set; }
|
|
|
|
public KotvallItemCo ConvertToCo()
|
|
{
|
|
return new KotvallItemCo
|
|
{
|
|
BejelentoNeve = BejelentoNeve,
|
|
BeszerzesTargya = BeszerzesTargya,
|
|
BruttoErtek = BruttoErtek,
|
|
Sorszam = Sorszam,
|
|
StatuszNeve = StatuszNeve,
|
|
StatuszId = StatuszId,
|
|
};
|
|
}
|
|
}
|
|
}
|