init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
77
KretaWeb/Areas/Adatszolgaltatasok/Models/MeroallasModel.cs
Normal file
77
KretaWeb/Areas/Adatszolgaltatasok/Models/MeroallasModel.cs
Normal file
|
@ -0,0 +1,77 @@
|
|||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Kreta.BusinessLogic.Classes;
|
||||
using Kreta.BusinessLogic.HelperClasses;
|
||||
using Kreta.Resources;
|
||||
using Kreta.Web.Areas.Intezmeny.Models;
|
||||
using ModelStateDictionary = System.Web.Http.ModelBinding.ModelStateDictionary;
|
||||
|
||||
namespace Kreta.Web.Areas.Adatszolgaltatasok.Models
|
||||
{
|
||||
public class MeroallasModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public int MerohelyId { get; set; }
|
||||
|
||||
[KretaRequired(typeof(KozmuAdatszolgaltatasResource), nameof(KozmuAdatszolgaltatasResource.MeroallasMegadasaKotelezo))]
|
||||
[Display(Name = nameof(KozmuAdatszolgaltatasResource.Meroallas), ResourceType = typeof(KozmuAdatszolgaltatasResource))]
|
||||
[KretaRange(0.00, Core.Constants.MinMaxValues.MerohelyMaxValue, StringResourcesId = 4178)] //Az érték nem esik a megengedett tartományba
|
||||
public double? Meroallas { get; set; }
|
||||
|
||||
[Display(Name = nameof(KozmuAdatszolgaltatasResource.LeolvasasDatuma), ResourceType = typeof(KozmuAdatszolgaltatasResource))]
|
||||
[KretaRequired(typeof(KozmuAdatszolgaltatasResource), nameof(KozmuAdatszolgaltatasResource.MeroallasLeolvasasDatumaNakMegadasaKotelezo))]
|
||||
public DateTime? LeolvasasDatuma { get; set; }
|
||||
|
||||
public int? PictureId { get; set; }
|
||||
|
||||
public UploadedFile MeroallasKep { get; set; }
|
||||
|
||||
public bool IsDeleteImage { get; set; }
|
||||
|
||||
public MeroallasCO ConvertToCo()
|
||||
{
|
||||
var co = new MeroallasCO();
|
||||
co.MeroallasKep = new MeroallasUploadedFileCO();
|
||||
co.Id = Id;
|
||||
co.MerohelyId = MerohelyId;
|
||||
co.MeroallasErtek = Meroallas;
|
||||
co.LeolvasasDatuma = LeolvasasDatuma;
|
||||
co.IsDeleteImage = IsDeleteImage;
|
||||
co.KepId = PictureId;
|
||||
|
||||
if (MeroallasKep != null)
|
||||
{
|
||||
co.MeroallasKep.ContentAsBase64EncodedString = MeroallasKep.ContentAsBase64EncodedString;
|
||||
co.MeroallasKep.Name = MeroallasKep.Name;
|
||||
}
|
||||
|
||||
return co;
|
||||
}
|
||||
|
||||
public ModelStateDictionary Validate()
|
||||
{
|
||||
var modelStateDictionary = new ModelStateDictionary();
|
||||
|
||||
if (LeolvasasDatuma.HasValue)
|
||||
{
|
||||
var mindate = new DateTime(1900, 1, 1);
|
||||
if (LeolvasasDatuma.Value < mindate || LeolvasasDatuma.Value > DateTime.Today)
|
||||
{
|
||||
modelStateDictionary.AddModelError(nameof(LeolvasasDatuma), string.Format(KozmuAdatszolgaltatasResource.ALeolvasasDatumaCsakKozeEshet, mindate.ToString("yyyy. MM. dd."), DateTime.Today.ToString("yyyy. MM. dd.")));
|
||||
}
|
||||
}
|
||||
if (Meroallas.HasValue)
|
||||
{
|
||||
if (Meroallas.Value < 0 || Meroallas.Value > Kreta.Core.Constants.MinMaxValues.MerohelyMaxValue)
|
||||
{
|
||||
modelStateDictionary.AddModelError(nameof(Meroallas), string.Format(KozmuAdatszolgaltatasResource.AMeroallasCsakKozeEshet, "0", Core.Constants.MinMaxValues.MerohelyMaxValue.ToString()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return modelStateDictionary;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue