kreta/KretaWeb/Areas/Hianyzas/Models/MulasztasSearchModel.cs
2024-03-13 00:33:46 +01:00

163 lines
6.8 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using Kreta.BusinessLogic.Classes;
using Kreta.BusinessLogic.HelperClasses;
using Kreta.BusinessLogic.Helpers;
using Kreta.BusinessLogic.Helpers.SystemSettings;
using Kreta.Enums.ManualEnums;
using Kreta.Resources;
using Kreta.Web.Helpers;
using Kreta.Web.Security;
namespace Kreta.Web.Areas.Hianyzas.Models
{
public class MulasztasSearchModel
{
public MulasztasSearchModel()
{
if (ClaimData.IsVegyes)
{
FeladatKategoriaId = new SystemSettingsHelper(ConnectionTypeExtensions.GetSessionConnectionType()).GetSystemSettingValue<int>(Enums.RendszerBeallitasTipusEnum.Default_Feladat_Kategoria);
}
var naploNezetDatum = DateTime.Today;
var tanev = new TanevHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType()).GetTanevInfo();
var tanevKezdoNap = tanev.KezdoNap;
if (naploNezetDatum < tanevKezdoNap)
{
naploNezetDatum = tanevKezdoNap;
}
var tanevUtolsoNap = tanev.UtolsoNap;
if (naploNezetDatum > tanevUtolsoNap)
{
naploNezetDatum = tanevUtolsoNap;
}
NaploNezetDatum = naploNezetDatum;
NaploNezetDatumMinDate = tanevKezdoNap;
NaploNezetDatumMaxDate = tanevUtolsoNap;
}
[Display(Name = nameof(HianyzasResource.MulasztasiIdoszak), ResourceType = typeof(HianyzasResource))]
public DateTime? DatumTol { get; set; }
[Display(Name = nameof(HianyzasResource.MulasztasiIdoszak), ResourceType = typeof(HianyzasResource))]
public DateTime? DatumIg { get; set; }
public DateTime? NaploNezetDatum { get; set; }
public DateTime NaploNezetDatumMinDate { get; set; }
public DateTime NaploNezetDatumMaxDate { get; set; }
[Display(Name = nameof(TanuloResource.TanuloNeve), ResourceType = typeof(TanuloResource))]
public string TanuloNeve { get; set; }
[Display(Name = nameof(OsztalyCsoportResource.OsztalyCsoport), ResourceType = typeof(OsztalyCsoportResource))]
public int? OsztalyCsoportId { get; set; }
[Display(Name = nameof(OrarendResource.KapcsolodoCsoportok), ResourceType = typeof(OrarendResource))]
public bool KellKapcsolodoCsoportok { get; set; }
public int? TanuloId { get; set; }
[Display(Name = nameof(OrarendResource.CsoportTipusa), ResourceType = typeof(OrarendResource))]
public int? CsoportTipus { get; set; }
[Display(Name = nameof(TantargyfelosztasResource.Foglalkozas), ResourceType = typeof(TantargyfelosztasResource))]
public int? FoglalkozasId { get; set; }
[Display(Name = nameof(OrarendResource.Tantargy), ResourceType = typeof(OrarendResource))]
public int? TantargyId { get; set; }
[Display(Name = nameof(HianyzasResource.MulasztasTipusa), ResourceType = typeof(HianyzasResource))]
public int? MulasztasTipus { get; set; }
[KretaRange(1, 99999)]
[Display(Name = nameof(HianyzasResource.KesesIdotartama), ResourceType = typeof(HianyzasResource))]
public int? KesesPercben { get; set; }
[Display(Name = nameof(HianyzasResource.IgazoltsagAllapota), ResourceType = typeof(HianyzasResource))]
public int? IgazoltsagAllapota { get; set; }
[Display(Name = nameof(HianyzasResource.IgazolasTipusa), ResourceType = typeof(HianyzasResource))]
public int? IgazolasTipus { get; set; }
public int? IgazoltSearch { get; set; }
public bool IsCustomForm { get; set; } = false;
public string CustomFormName { get; set; } = null;
public bool GridUseToolBar { get; set; } = true;
public bool ChildGridHasDelete { get; set; } = true;
public List<SelectListItem> OsztalyCsoportList { get; set; }
[Display(Name = nameof(HianyzasResource.NemBesoroltTanulokMulasztasainakMegjelenitese), ResourceType = typeof(HianyzasResource))]
public bool IsNemBesoroltTanulokMulasztasainakMegjelenitese { get; set; } = false;
[Display(Name = nameof(HianyzasResource.NemJelenlevoTanulokMegjelenitese), ResourceType = typeof(HianyzasResource))]
public bool IsNemJelenlevoTanulokMegjelenitese { get; set; } = false;
[Display(Name = nameof(OsztalyCsoportResource.EllatottKoznevelesiFeladatTipus), ResourceType = typeof(OsztalyCsoportResource))]
public int? FeladatKategoriaId { get; set; }
[Display(Name = nameof(CommonResource.Feladatellatasihely), ResourceType = typeof(CommonResource))]
public int? FeladatEllatasiHelyId { get; set; }
[Display(Name = nameof(OrarendResource.OnlineOra), ResourceType = typeof(OrarendResource))]
public int? IsOnlineOra { get; set; }
[Display(Name = nameof(DualisResource.KepzohelyNeve), ResourceType = typeof(DualisResource))]
public string SzervezetNevSzovegSearch { get; set; }
[Display(Name = nameof(DualisResource.KepzohelyAdoszama), ResourceType = typeof(DualisResource))]
public string SzervezetAzonositoSzovegSearch { get; set; }
public int? SzervezetTipusId { get; set; }
public int? SzervezetId { get; set; }
public SzervezetTipusEnum? SzervezetTipusEnum { get; set; } = null;
public bool IsFromSzervezet => SzervezetTipusEnum.HasValue;
public string ControllerName { get; set; } = Constants.Controllers.MulasztasKereso;
public string ApiControllerName { get; set; } = Constants.ApiControllers.MulasztasKeresoApi;
public bool IsSzakkepzo { get; set; }
public MulasztasokCo ConvertModelToCo()
{
return new MulasztasokCo
{
Tol = DatumTol,
Ig = DatumIg,
TanuloNev = TanuloNeve,
OsztCsop = OsztalyCsoportId,
KapcsCsop = KellKapcsolodoCsoportok,
CsopTip = CsoportTipus,
Fogl = FoglalkozasId,
TantargyId = TantargyId,
MulTip = MulasztasTipus,
KesIdo = KesesPercben ?? 0,
IgazoltsagAllapota = IgazoltsagAllapota,
IgazolasTipus = IgazolasTipus,
IsNemBesoroltTanulokMulasztasainakMegjelenitese = IsNemBesoroltTanulokMulasztasainakMegjelenitese,
IsNemJelenlevoTanulokMegjelenitese = IsNemJelenlevoTanulokMegjelenitese,
FeladatKategoriaId = FeladatKategoriaId,
FeladatEllatasiHelyId = FeladatEllatasiHelyId,
IsOnlineOra = IsOnlineOra,
SzervezetNev = SzervezetNevSzovegSearch,
SzervezetAzonosito = SzervezetAzonositoSzovegSearch,
SzervezetTipusId = SzervezetTipusId,
SzervezetId = SzervezetId
};
}
}
}