65 lines
3 KiB
C#
65 lines
3 KiB
C#
using System.Collections.Generic;
|
|
using Kreta.BusinessLogic.Helpers;
|
|
using Kreta.BusinessLogic.Helpers.SystemSettings;
|
|
using Kreta.Enums;
|
|
using Kreta.Web.Helpers;
|
|
using Kreta.Web.Security;
|
|
|
|
namespace Kreta.Web.Models
|
|
{
|
|
public class ZaradekModel
|
|
{
|
|
public ZaradekModel()
|
|
{
|
|
BuborekModelList = new List<ZaradekBuborekModel>();
|
|
SetOfoRogzithetZaradekot(null);
|
|
}
|
|
|
|
public ZaradekModel(int tanuloCsoportId, int? tanuloId = null)
|
|
{
|
|
var connectionType = ConnectionTypeExtensions.GetSessionConnectionType();
|
|
var zaradekHelper = new ZaradekHelper(connectionType);
|
|
var systemSettingsHelper = new SystemSettingsHelper(connectionType);
|
|
|
|
SetOfoRogzithetZaradekot(systemSettingsHelper);
|
|
|
|
BuborekModelList = zaradekHelper.GetZaradekok(systemSettingsHelper.GetSystemSettingValue<List<int>>(RendszerBeallitasTipusEnum.Nemzeti_Nyelvi_Dokumentum_Nyelvek), tanuloCsoportId, tanuloId)
|
|
.ConvertAll(co => new ZaradekBuborekModel
|
|
{
|
|
Id = co.Id.Value,
|
|
ZaradekSzovegek = co.ZaradekSzovegek,
|
|
ZaradekokListaja = co.ZaradekSzovegList.ConvertAll(x => new ZaradekSzovegModel { NyelvId = x.NyelvId, Szoveg = x.Szoveg }),
|
|
KeltezesDatuma = co.KeltezesDatuma.Value,
|
|
UtolsoModositasDatuma = co.UtolsoModositasDatuma,
|
|
IsSzerkesztheto = ClaimData.IsAdministrator || (co.RogzitoId == ClaimData.FelhasznaloId && ClaimData.IsOsztalyfonok && ((IsOfoRogzithetEvkoziZaradekot && !co.IsKiVagyAtsorolasiZaradek) || IsOfoRogzithetKiVagyAtsorolasiZaradekot)),
|
|
OsztalyNev = co.OsztalyNev,
|
|
IsKapcsolodo = co.IsKapcsolodo,
|
|
IsTorolheto = co.IsTorolheto || !co.IsKiVagyAtsorolasiZaradek,
|
|
IsOsztaly = co.IsOsztaly
|
|
});
|
|
|
|
BuborekModelList.Sort(ZaradekBuborekModel.Comparison);
|
|
TanuloCsoportId = tanuloCsoportId;
|
|
}
|
|
|
|
public List<ZaradekBuborekModel> BuborekModelList { get; set; }
|
|
|
|
public bool IsViewMod { get; set; }
|
|
|
|
public int? TanuloCsoportId { get; set; }
|
|
|
|
public bool IsOfoRogzithetEvkoziZaradekot { get; set; }
|
|
|
|
public bool IsOfoRogzithetKiVagyAtsorolasiZaradekot { get; set; }
|
|
|
|
public bool IsKapcsolodoZaradekokMegjelennek { get; set; }
|
|
|
|
private void SetOfoRogzithetZaradekot(SystemSettingsHelper systemSettingsHelper)
|
|
{
|
|
systemSettingsHelper = systemSettingsHelper ?? new SystemSettingsHelper(ConnectionTypeExtensions.GetSessionConnectionType());
|
|
|
|
IsOfoRogzithetEvkoziZaradekot = systemSettingsHelper.GetSystemSettingValue<bool>(RendszerBeallitasTipusEnum.Osztalyfonok_megtekintheti_modosithatja_osztalyaba_jaro_tanulok_zaradekat);
|
|
IsOfoRogzithetKiVagyAtsorolasiZaradekot = systemSettingsHelper.GetSystemSettingValue<bool>(RendszerBeallitasTipusEnum.Osztalyfonok_kiegeszitheti_osztalyaba_jaro_tanulok_ki_vagy_atsorolsasi_zaradekat);
|
|
}
|
|
}
|
|
}
|