This commit is contained in:
skidoodle 2024-03-13 00:33:46 +01:00
commit e124a47765
19374 changed files with 9806149 additions and 0 deletions

View file

@ -0,0 +1,48 @@
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Mvc;
using Kreta.BusinessLogic.Helpers;
using Kreta.BusinessLogic.Security;
using Kreta.Web.Areas.Tanar.Models;
using Kreta.Web.Helpers;
using Kreta.Web.Helpers.Modal;
using Kreta.Web.Models.EditorTemplates;
using Kreta.Web.Security;
namespace Kreta.Web.Areas.Tanar.Controllers
{
[MvcRoleClaimsAuthorize(true)]
[MvcRolePackageDenyAuthorize(KretaClaimPackages.IsOnlyAlkalmozott.ClaimValue, KretaClaimPackages.IsSzirIntezmeny.ClaimValue)]
[MvcRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
public class AdminOralatogatasokListajaController : Controller
{
// GET: Tanar/OralatogatasokKeresese
public ActionResult Index()
{
var model = new OralatogatasokKereseseModel() { FeladatEllatasiHelyId = ClaimData.FelhelySzuro };
return View("Index", model);
}
public ActionResult OpenOralatogatasInfoPopUp(int oralatogatasId)
{
var helper = new OralatogatasokHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType());
var co = helper.GetOralatogatas(oralatogatasId);
var viewModel = new OralatogatasokKereseseAdatModel
{
Date = co.Date,
Ora = co.Ora,
Tanar = co.Latogato,
Beosztas = co.Beosztas,
LatogatottPedagogus = co.LatogatottPedagogus,
Tantargy = co.Tantargy,
OsztalyCsoport = co.OsztalyCsoport,
Megjegyzes = Regex.Replace(HttpUtility.HtmlDecode(co.Megjegyzes), "<.*?>", string.Empty)
};
var popupModel = new PopUpModel(viewModel, "Oralatogatas_Info");
popupModel.Buttons.Add(new ModalButtonModel() { Name = "BtnCancel", Text = Resources.CommonResource.Megse, EventName = "OralatogatasokKereseseHelper.closePopUps" });
return PartialView(Constants.General.PopupView, popupModel);
}
}
}

View file

@ -0,0 +1,263 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Web.Http;
using System.Web.Mvc;
using FastReport;
using FastReport.Export.Pdf;
using FastReport.Export.RichText;
using FastReport.Utils;
using Kreta.BusinessLogic.Classes;
using Kreta.BusinessLogic.Helpers;
using Kreta.BusinessLogic.Helpers.SystemSettings;
using Kreta.BusinessLogic.Security;
using Kreta.Core;
using Kreta.Enums;
using Kreta.Enums.ManualEnums;
using Kreta.Resources;
using Kreta.Web.Areas.Nyomtatvanyok.Logic;
using Kreta.Web.Areas.Tanar.Models;
using Kreta.Web.Helpers;
using Kreta.Web.Models.EditorTemplates;
using Kreta.Web.Security;
namespace Kreta.Web.Areas.Tanar.Controllers
{
[MvcRoleClaimsAuthorize(true)]
[MvcRolePackageDenyAuthorize(KretaClaimPackages.IsOnlyAlkalmozott.ClaimValue, KretaClaimPackages.IsSzirIntezmeny.ClaimValue, KretaClaimPackages.IsDualisKepzohelyiOktato.ClaimValue)]
public class FogadooraController : Controller
{
public object Datetime { get; private set; }
[MvcRolePackageAuthorize(KretaClaimPackages.Tanar.ClaimValue)]
public ActionResult Index()
{
if (!new SystemSettingsHelper(ConnectionTypeExtensions.GetSessionConnectionType()).GetSystemSettingValue<bool>(RendszerBeallitasTipusEnum.Fogadoorak_megjelenitese))
{
return Redirect(Url.Content(CommonExtensions.GetDefaultPage()));
}
var model = new FogadooraSearchModel();
return View("Index", model);
}
[MvcRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
public ActionResult FogadooraKereso()
{
if (!new SystemSettingsHelper(ConnectionTypeExtensions.GetSessionConnectionType()).GetSystemSettingValue<bool>(RendszerBeallitasTipusEnum.Fogadoorak_megjelenitese))
{
return Redirect(Url.Content(CommonExtensions.GetDefaultPage()));
}
var model = new FogadooraSearchModel() { FeladatEllatasiHelyId = ClaimData.FelhelySzuro };
return View("FogadooraKereso", model);
}
public ActionResult OpenFogadooraJelentkezettGondviselokPopupp(int fogadooraId, string handler = "FogadooraGridHelper")
{
var helper = new FogadooraHelper(ConnectionTypeExtensions.GetActiveSessionConnectionType());
var fogadooraCo = helper.GetFogadooraById(fogadooraId);
var popUpModel = new PopUpModel(new FogadooraJelentkezesInfoModel
{
Id = fogadooraCo.Id,
TeremNev = fogadooraCo.TeremNev,
IsNemKotottMunkaido = fogadooraCo.IsNemKotottMunkaido,
FogadoOraKezdete = fogadooraCo.FogadoOraKezdete.ToShortTimeString(),
FogadoOraVege = fogadooraCo.FogadoOraVege.ToShortTimeString(),
JelentkezesekKezelese = fogadooraCo.JelentkezesekKezelese,
FogadoOraDatuma = fogadooraCo.FogadoOraDatuma.ToShortDateString()
}, "Fogadoora_Info");
popUpModel = popUpModel.AddCancelBtn(popUpModel, handler + ".detailJelentkezettGondviselokCancel");
return PartialView(Constants.General.PopupView, popUpModel);
}
public ActionResult FogadooraLetoltesPdf([FromBody] int fogadooraId) => FogadooraLetoltes(fogadooraId, NyomtatvanyFormatumEnum.PDF);
public ActionResult FogadooraLetoltesWord([FromBody] int fogadooraId) => FogadooraLetoltes(fogadooraId, NyomtatvanyFormatumEnum.Word);
private ActionResult FogadooraLetoltes(int fogadooraId, NyomtatvanyFormatumEnum fileTipus)
{
try
{
var outPut = new MemoryStream();
ActionResult fogadooraDokumentum = new FileStreamResult(outPut, "application/octet-stream");
var fogadooraHelper = new FogadooraHelper(ConnectionTypeExtensions.GetSessionConnectionType());
var ds = fogadooraHelper.GetFogadooraDokumentumAdatok(fogadooraId);
var parameters = new Dictionary<string, object>();
var frxNev = NyomtatvanyEnum.FogadooraDokumentum.ToString();
var row = ds.Tables[0].Rows[0];
parameters.Add("FogadooraDatuma", SDAConvert.ToDateTime(row["FogadooraDatuma"])?.ToString("yyyy.MM.dd."));
parameters.Add("TeremNev", SDAConvert.ToString(row["TeremNev"]).ReplaceMultipleSpacesAndTrim());
parameters.Add("FogadooraKezdete", SDAConvert.ToDateTime(row["FogadooraKezdete"])?.ToString("HH:mm"));
parameters.Add("FogadooraVege", SDAConvert.ToDateTime(row["FogadooraVege"])?.ToString("HH:mm"));
parameters.Add("IdosavokMerteke", SDAConvert.ToString(row["IdosavokMerteke"]).ReplaceMultipleSpacesAndTrim());
parameters.Add("FogadooratKiiro", SDAConvert.ToString(row["FogadooratKiiro"]).ReplaceMultipleSpacesAndTrim());
var jelentkezesHatarido = GetJelentkezesHatarido(row);
parameters.Add("Hatarido", jelentkezesHatarido);
var fogadooraCo = fogadooraHelper.GetFogadooraById(fogadooraId);
var osztalyHelper = new OsztalyCsoportHelper(ConnectionTypeExtensions.GetSessionConnectionType());
var osztalyokNeveiList = fogadooraCo.SelectedOsztalyCsoportIdList.Select(x => osztalyHelper.GetOsztalyCsoportNevById(x)).ToList();
parameters.Add("FogadooOsztalyaiCsoportjai", string.Join(",", osztalyokNeveiList));
parameters.Add("KellSorokKiegeszitese", fogadooraCo.FogadooraTipusEnumId != (int)FogadooraTipusEnum.JelentkezhetoDarabolt);
switch (fileTipus)
{
case NyomtatvanyFormatumEnum.PDF:
fogadooraDokumentum = PDFGeneralas(ds, frxNev, FogadooraResource.FogadooraDokumentumNev, parameters);
break;
case NyomtatvanyFormatumEnum.Word:
fogadooraDokumentum = WordGeneralas(ds, frxNev, FogadooraResource.FogadooraDokumentumNev, parameters);
break;
default:
break;
}
outPut.Position = 0;
return fogadooraDokumentum;
}
catch (Exception ex)
{
throw NyomtatvanyokLogic.NyomtatvanyError(ex);
}
}
private string GetJelentkezesHatarido(DataRow row)
{
var fogadooraKezdete = SDAConvert.ToDateTime(row["FogadooraKezdeteTeljes"]);
var jelentkezesHatarido = SDAConvert.ToDateTime(row["JelentkezesHatarido"]);
var hatarido = jelentkezesHatarido.HasValue ? (int?)(fogadooraKezdete.Value - jelentkezesHatarido.Value).TotalHours : null;
if (hatarido == null || hatarido == 0)
{
return FogadooraResource.Nincs;
}
return string.Format(FogadooraResource.ora, hatarido.Value);
}
private ActionResult PDFGeneralas(DataSet ds, string frxNeve, string dokumentumNeve, Dictionary<string, object> parameterek = null)
{
Config.WebMode = true;
const string _fileTemplate = "{0}/{1}.frx";
var report = new Report();
var mapPath = string.Format(_fileTemplate, ApplicationData.NyomtatasiSablonokKonyvtar, frxNeve);
report.Load(System.Web.Hosting.HostingEnvironment.MapPath(mapPath));
foreach (DataTable dt in ds.Tables)
{
report.RegisterData(dt, dt.TableName);
}
if (parameterek != null)
{
foreach (var parameter in parameterek)
{
report.SetParameterValue(parameter.Key, parameter.Value);
}
}
string script = report.ReportResourceString;
if (report.Report.Prepare())
{
PDFExport pdfExport = new PDFExport
{
ShowProgress = false,
Subject = "Subject",
Title = dokumentumNeve,
Compressed = true,
AllowPrint = true,
EmbeddingFonts = true,
Creator = Constants.ImportExport.Creator
};
var stream = new MemoryStream();
report.Report.Export(pdfExport, stream);
report.Dispose();
pdfExport.Dispose();
stream.Position = 0;
byte[] base64;
using (CryptoStream cryptoStream = new CryptoStream(stream, new ToBase64Transform(), CryptoStreamMode.Write))
using (StreamWriter streamWriter = new StreamWriter(cryptoStream))
{
streamWriter.Flush();
base64 = stream.ToArray();
}
var fileContents = Convert.ToBase64String(base64);
var dokumentumContent = new ContentResult() { Content = fileContents, ContentType = "application/pdf" };
return dokumentumContent;
}
return null;
}
private ActionResult WordGeneralas(DataSet ds, string frxNeve, string dokumentumNeve, Dictionary<string, object> parameterek = null)
{
Config.WebMode = true;
const string _fileTemplate = "{0}/{1}.frx";
var report = new Report();
var mapPath = string.Format(_fileTemplate, ApplicationData.NyomtatasiSablonokKonyvtar, frxNeve);
report.Load(System.Web.Hosting.HostingEnvironment.MapPath(mapPath));
foreach (DataTable dt in ds.Tables)
{
report.RegisterData(dt, dt.TableName);
}
if (parameterek != null)
{
foreach (var parameter in parameterek)
{
report.SetParameterValue(parameter.Key, parameter.Value);
}
}
string script = report.ReportResourceString;
if (report.Report.Prepare())
{
RTFExport textExport = new RTFExport
{
ShowProgress = false,
Creator = Constants.ImportExport.Creator
};
var stream = new MemoryStream();
report.Report.Export(textExport, stream);
report.Dispose();
textExport.Dispose();
stream.Position = 0;
byte[] base64;
using (CryptoStream cryptoStream = new CryptoStream(stream, new ToBase64Transform(), CryptoStreamMode.Write))
using (StreamWriter streamWriter = new StreamWriter(cryptoStream))
{
streamWriter.Flush();
base64 = stream.ToArray();
}
var fileContents = Convert.ToBase64String(base64);
var dokumentumContent = new ContentResult() { Content = fileContents, ContentType = "application/doc" };
return dokumentumContent;
}
return null;
}
}
}

View file

@ -0,0 +1,26 @@
using System.Web.Mvc;
using Kreta.BusinessLogic.Security;
using Kreta.Web.Areas.Tanar.Models;
using Kreta.Web.Security;
namespace Kreta.Web.Areas.Tanar.Controllers
{
[MvcRoleClaimsAuthorize(true)]
[MvcRolePackageDenyAuthorize(KretaClaimPackages.IsOnlyAlkalmozott.ClaimValue, KretaClaimPackages.IsSzirIntezmeny.ClaimValue)]
public class HaziFeladatCsatolmanyokController : Controller
{
[MvcRolePackageAuthorize(KretaClaimPackages.Tanar.ClaimValue)]
public ActionResult IndexTanar()
{
var model = new HFCsatolmanyokSearchModel();
return View("Index", model);
}
[MvcRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
public ActionResult IndexAdmin()
{
var model = new HFCsatolmanyokSearchModel() { FeladatEllatasiHelyId = ClaimData.FelhelySzuro };
return View("Index", model);
}
}
}

View file

@ -0,0 +1,44 @@
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Kreta.BusinessLogic.Classes;
using Kreta.BusinessLogic.Helpers;
using Kreta.BusinessLogic.Security;
using Kreta.Web.Areas.Tanar.Models;
using Kreta.Web.Helpers;
using Kreta.Web.Security;
namespace Kreta.Web.Areas.Tanar.Controllers
{
[MvcRoleClaimsAuthorize(true)]
[MvcRolePackageDenyAuthorize(KretaClaimPackages.IsOnlyAlkalmozott.ClaimValue)]
[MvcRolePackageAuthorize(KretaClaimPackages.Tanar.ClaimValue)]
public class HelyettesitendoTanarOraiController : Controller
{
// GET: Tanar/HelyettesitendoTanarOrai
public ActionResult Index()
{
TanarHelyettesitesekKereseseSearchModel model = new TanarHelyettesitesekKereseseSearchModel()
{
AlkalmazottList = GetTanarList(),
HelyettesitoId = ClaimData.FelhasznaloId
};
return View("Index", model);
}
private List<SelectListItem> GetTanarList()
{
var connectionType = ConnectionTypeExtensions.GetSessionConnectionType();
var felhasznalokOnlyAlkalmazottSzerepkorIds = new FelhasznaloHelper(connectionType).GetFelhasznaloIdsOnlyAlkalmazottSzerepkor();
IDictionary<string, string> lista;
var helper = new TanarHelper(connectionType);
lista = helper.GetTanarok(string.Empty, oktatasiAzonositoval: true);
lista.Remove("");
return lista.ToSelectListItemList().Where(x => !felhasznalokOnlyAlkalmazottSzerepkorIds.Contains(SDAConvert.ToInt32(x.Value))).ToList();
}
}
}

View file

@ -0,0 +1,55 @@
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Kreta.BusinessLogic.Classes;
using Kreta.BusinessLogic.Helpers;
using Kreta.BusinessLogic.Security;
using Kreta.Enums;
using Kreta.Framework.Util;
using Kreta.Web.Areas.Tanar.Models;
using Kreta.Web.Helpers;
using Kreta.Web.Security;
namespace Kreta.Web.Areas.Tanar.Controllers
{
[MvcRoleClaimsAuthorize(true)]
[MvcRolePackageDenyAuthorize(KretaClaimPackages.IsOnlyAlkalmozott.ClaimValue, KretaClaimPackages.IsSzirIntezmeny.ClaimValue)]
[MvcRolePackageAuthorize(KretaClaimPackages.Adminisztrator.ClaimValue)]
public class HelyettesitesekKereseseController : Controller
{
// GET: Tanar/HelyettesitesekKeresese
public ActionResult Index()
{
HelyettesitesSearchModel model = new HelyettesitesSearchModel
{
AlkalmazottList = GetTanarList()
};
return View("Index", model);
}
public ActionResult GetHelyettesitoTanarok(HelyettesitesGridModel model)
{
model.HelyettesitesTipusList = GetHelyettesitesTipusList();
return PartialView("HelyettesitesekKereseseDetailGrid", model);
}
private List<SelectListItem> GetTanarList()
{
var connectionType = ConnectionTypeExtensions.GetSessionConnectionType();
var felhasznalokOnlyAlkalmazottSzerepkorIds = new FelhasznaloHelper(connectionType).GetFelhasznaloIdsOnlyAlkalmazottSzerepkor();
IDictionary<string, string> lista;
var helper = new TanarHelper(connectionType);
lista = helper.GetTanarok(string.Empty, oktatasiAzonositoval: true);
lista.Remove("");
return lista.ToSelectListItemList().Where(x => !felhasznalokOnlyAlkalmazottSzerepkorIds.Contains(SDAConvert.ToInt32(x.Value))).ToList();
}
private List<SelectListItem> GetHelyettesitesTipusList()
{
List<SelectListItem> result = FrameworkEnumExtensions.EnumToList((int)GeneratedAdatszotarTipusEnum.HelyettesitesTipus, ClaimData.SelectedTanevID.Value).ToSelectListItemList();
return result;
}
}
}

View file

@ -0,0 +1,19 @@
using System.Web.Mvc;
using Kreta.BusinessLogic.Security;
using Kreta.Web.Areas.Tanar.Logic;
using Kreta.Web.Security;
namespace Kreta.Web.Areas.Tanar.Controllers
{
[MvcRoleClaimsAuthorize(true)]
[MvcRolePackageAuthorize(KretaClaimPackages.Tanar.ClaimValue)]
public class NemNaplozottTanorakController : Controller
{
public ActionResult Index(bool? csakAHelyettesiteseim = null, bool? helyettesitettOraimIs = null, bool? jovobeniOrakMegjelenitese = null)
{
var nemNaplozottTanorakSearchModel = NemNaplozottTanorakLogic.NemNaplozottTanorakSearch(csakAHelyettesiteseim, helyettesitettOraimIs, jovobeniOrakMegjelenitese);
return View("Index", nemNaplozottTanorakSearchModel);
}
}
}

View file

@ -0,0 +1,23 @@
using System.Web.Mvc;
using Kreta.BusinessLogic.Security;
using Kreta.Web.Areas.Orarend.Models;
using Kreta.Web.Security;
namespace Kreta.Web.Areas.Tanar.Controllers
{
[MvcRoleClaimsAuthorize(true)]
[MvcRolePackageDenyAuthorize(KretaClaimPackages.IsOnlyAlkalmozott.ClaimValue)]
[MvcRolePackageAuthorize(KretaClaimPackages.Osztalyfonok.ClaimValue,
KretaClaimPackages.SzuperOsztalyfonok.ClaimValue,
KretaClaimPackages.Tanar.ClaimValue
)]
public class TanarBejelentettSzamonkeresekController : Controller
{
public ActionResult Index()
{
var model = new BejelentettSzamonkeresekSearchModel();
return View("Index", model);
}
}
}

View file

@ -0,0 +1,474 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Web.Mvc;
using System.Web.Routing;
using Kreta.BusinessLogic.Classes;
using Kreta.BusinessLogic.Helpers;
using Kreta.BusinessLogic.Security;
using Kreta.Client.Eugyintezes;
using Kreta.Client.Eugyintezes.Configuration;
using Kreta.Core;
using Kreta.Core.FeatureToggle;
using Kreta.Enums.ManualEnums;
using Kreta.Framework;
using Kreta.Resources;
using Kreta.Web.Areas.Tanar.Models;
using Kreta.Web.Configuration;
using Kreta.Web.Helpers;
using Kreta.Web.Security;
using Newtonsoft.Json;
namespace Kreta.Web.Areas.Tanar.Controllers
{
[MvcRoleClaimsAuthorize(true)]
[MvcRolePackageDenyAuthorize(KretaClaimPackages.IsOnlyAlkalmozott.ClaimValue)]
[MvcRolePackageAuthorize(KretaClaimPackages.Naplo.ClaimValue)]
public class TanarDashboardController : Controller
{
private IEugyintezesClientConfiguration EugyintezesClientConfiguration { get; }
private IIdpConfiguration IdpConfiguration { get; }
private IFeatureContext FeatureContext { get; }
private const int ElemekAListaban = 8;
public TanarDashboardController(IEugyintezesClientConfiguration eugyintezesClientConfiguration, IIdpConfiguration idpConfiguration, IFeatureContext featureContext)
{
EugyintezesClientConfiguration = eugyintezesClientConfiguration ?? throw new ArgumentNullException(nameof(eugyintezesClientConfiguration));
IdpConfiguration = idpConfiguration ?? throw new ArgumentNullException(nameof(idpConfiguration));
FeatureContext = featureContext ?? throw new ArgumentNullException(nameof(idpConfiguration));
}
public ActionResult Index()
{
string shortMainVersion = KretaVersion.Instance.ShortMainVersion;
string nextUpdateDateTimeText = new AdminHelper(ConnectionTypeExtensions.GetSessionConnectionType()).GetKovTelepitesDatum().ToString("yyyy.MM.dd. HH:mm");
ViewBag.ShortMainVersion = shortMainVersion;
ViewBag.NextUpdateDateTimeText = nextUpdateDateTimeText;
var model = GetTanarDashboard();
return View("Index", model);
}
public ActionResult DownloadCovidFertozott()
{
MemoryStream stream = new AdminHelper(ConnectionTypeExtensions.GetSessionConnectionType()).GetCovidFertozottekExcel(ClaimData.FelhasznaloId);
var result = new FileStreamResult(stream, Core.Constants.ContentTypes.Xlsx) { FileDownloadName = string.Format(RendszerErtesitesResource.CovidFertozottekExcelName, DateTime.Now.ToString("yyyyMMddHHmm")) };
return result;
}
private TanarDashboardModel GetTanarDashboard()
{
var model = new TanarDashboardModel();
DataSet beNemIrtOrakDS = null;
DataSet kiirtHelyettesitesekDS = null;
DataSet mulasztasokDS = null;
DataSet bukasraAlloTanulokDS = null;
DataSet dashBoardUzenetekDS = null;
string uzenetek = null;
string ugyek = null;
bool vanCovidFertozott = false;
var isSzuperOsztalyFonok = AuthorizeHelper.CheckPackageAccess(new string[] { KretaClaimPackages.SzuperOsztalyfonok.ClaimValue });
var isTanarTTFfelVagySzuperOsztalyFonok = isSzuperOsztalyFonok || AuthorizeHelper.CheckPackageAccess(new string[] { KretaClaimPackages.Tanar.ClaimValue });
ViewData["IsTanarTTFfelVagySzuperOsztalyFonok"] = isTanarTTFfelVagySzuperOsztalyFonok;
var osztalyFonokVagyCsoportVezeto = new[]
{
KretaClaimPackages.SzuperOsztalyfonok.ClaimValue,
KretaClaimPackages.Osztalyfonok.ClaimValue,
KretaClaimPackages.CsoportVezeto.ClaimValue,
KretaClaimPackages.Evfolyamfelelos.ClaimValue,
};
var isOsztalyFonokVagyCsoportVezeto = AuthorizeHelper.CheckPackageAccess(osztalyFonokVagyCsoportVezeto);
ViewData["IsOsztalyFonokVagyCsoportVezeto"] = isOsztalyFonokVagyCsoportVezeto;
if (isTanarTTFfelVagySzuperOsztalyFonok)
{
var helper = new TanarHelper(ConnectionTypeExtensions.GetSessionConnectionType());
beNemIrtOrakDS = helper.GetUtolsoBeNemIrtOrak(ClaimData.IntezmenyId, ClaimData.FelhasznaloId, ElemekAListaban);
kiirtHelyettesitesekDS = helper.GetKiirtHelyettesitesek(ClaimData.IntezmenyId, ClaimData.FelhasznaloId, ElemekAListaban);
dashBoardUzenetekDS = helper.GetTanarDashboardUzenet(ClaimData.FelhasznaloId);
vanCovidFertozott = helper.GetCovidFertozottek(ClaimData.FelhasznaloId).Tables[0].Rows.Count > 0;
if (isOsztalyFonokVagyCsoportVezeto)
{
mulasztasokDS = helper.GetMulasztasokSzama(ClaimData.FelhasznaloId, isSzuperOsztalyFonok, ElemekAListaban);
bukasraAlloTanulokDS = helper.GetBukasokSzama(ClaimData.FelhasznaloId, ElemekAListaban);
}
EugyintezesClient eUgyClient = new EugyintezesClient(EugyintezesClientConfiguration);
var icHelper = new IntezmenyConfigHelper(ConnectionTypeExtensions.GetSystemConnectionType());
var uzenetModulFeatureEnabled = icHelper.GetIntezmenyConfig<bool>(IntezmenyConfigModulEnum.UzenetModul, IntezmenyConfigTipusEnum.IsEnabled);
var uzenetekEnabled = uzenetModulFeatureEnabled; //&& ClaimData.IsAktivUzenetekMenu;
ViewData["UzenetekEnabled"] = uzenetekEnabled;
if (uzenetekEnabled)
{
uzenetek = ExceptionLogger(() => eUgyClient.GetUzenetek(ClaimData.IntezmenyAzonosito, ClaimData.FelhasznaloIdpEgyediAzonosito, ElemekAListaban));
}
var eugyintezesFeatureEnabled = icHelper.GetIntezmenyConfig<bool>(IntezmenyConfigModulEnum.Eugyintezes, IntezmenyConfigTipusEnum.IsEnabled);
var ugyekEnabled = eugyintezesFeatureEnabled && isOsztalyFonokVagyCsoportVezeto;
ViewData["UgyekEnabled"] = ugyekEnabled;
if (ugyekEnabled)
{
ugyek = ExceptionLogger(() => eUgyClient.GetUgyek(ClaimData.IntezmenyAzonosito, ClaimData.FelhasznaloIdpEgyediAzonosito, ElemekAListaban));
}
}
model.BeNemIrtOrak = ConvertBeNemIrtOrak(beNemIrtOrakDS);
model.KiirtHelyettesitesek = ConvertKiirtHelyettesitesek(kiirtHelyettesitesekDS);
model.Uzenetek = ConvertUzenetek(uzenetek);
model.Ugyek = ConvertUgyek(ugyek);
model.Mulasztasok = ConvertMulasztasok(mulasztasokDS);
model.BukasraAlloTanulok = ConvertBukasraAlloTanulok(bukasraAlloTanulokDS);
model.DashBoardUzenetek = ConvertDashBoardUzenetek(dashBoardUzenetekDS);
model.VanCovidFertozott = vanCovidFertozott;
return model;
}
private TanarDashboardTableModel ConvertUzenetek(string uzenetek)
{
var helper = new IntezmenyConfigHelper(ConnectionTypeExtensions.GetSystemConnectionType());
var result = new TanarDashboardTableModel
{
Url = GetEugyUrl(helper.GetIntezmenyConfig<string>(IntezmenyConfigModulEnum.UzenetModul, IntezmenyConfigTipusEnum.Url)),
OpenInNewWindow = true,
Name = TanarDashBoardResource.Uzenetek,
Headers = new List<string>
{
TanarDashBoardResource.Datum,
TanarDashBoardResource.Felado,
TanarDashBoardResource.Targy,
},
Rows = new List<TanarDashboardTableRowModel>()
};
if (!string.IsNullOrWhiteSpace(uzenetek))
{
var uzenetList = TryDeserialize<List<Uzenet>>(uzenetek) ?? new List<Uzenet>();
var rows = new List<TanarDashboardTableRowModel>();
foreach (var uzenet in uzenetList)
{
var row = new TanarDashboardTableRowModel
{
Columns = new List<string>
{
SDAFormat.GetShortDateFormat(uzenet.BeerkezesIdopontja),
uzenet.FeladoNev,
uzenet.Targy,
}
};
rows.Add(row);
}
result.Rows = rows;
}
return result;
}
private TanarDashboardTableModel ConvertUgyek(string ugyek)
{
var helper = new IntezmenyConfigHelper(ConnectionTypeExtensions.GetSystemConnectionType());
var result = new TanarDashboardTableModel
{
Url = GetEugyUrl(helper.GetIntezmenyConfig<string>(IntezmenyConfigModulEnum.Eugyintezes, IntezmenyConfigTipusEnum.Url)),
OpenInNewWindow = true,
Name = TanarDashBoardResource.EUgyintezes,
Headers = new List<string>
{
TanarDashBoardResource.Nev,
TanarDashBoardResource.Osztaly,
TanarDashBoardResource.Ugytipus,
TanarDashBoardResource.BekuldesIdopontja,
},
Rows = new List<TanarDashboardTableRowModel>()
};
if (!string.IsNullOrWhiteSpace(ugyek))
{
var ugyList = TryDeserialize<List<Ugy>>(ugyek) ?? new List<Ugy>();
var rows = new List<TanarDashboardTableRowModel>();
foreach (var ugy in ugyList)
{
var row = new TanarDashboardTableRowModel
{
Columns = new List<string>
{
ugy.TanuloNev,
ugy.TanuloOsztaly,
ugy.UgyTipusKod,
SDAFormat.GetShortDateFormat(ugy.BekuldesIdopontja),
}
};
rows.Add(row);
}
result.Rows = rows;
}
return result;
}
private TanarDashboardTableModel ConvertBeNemIrtOrak(DataSet ds)
{
var result = new TanarDashboardTableModel
{
Url = GetUrl(Constants.Areas.Tanar, Constants.Controllers.NemNaplozottTanorak, "Index"),
Name = TanarDashBoardResource.BeNemIrtOrak,
Headers = new List<string>
{
TanarDashBoardResource.Datum,
TanarDashBoardResource.Oraszam,
TanarDashBoardResource.Osztalycsoport,
TanarDashBoardResource.Tantargy,
},
Rows = new List<TanarDashboardTableRowModel>()
};
if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
{
var rows = new List<TanarDashboardTableRowModel>();
foreach (DataRow dr in ds.Tables[0].Rows)
{
var row = new TanarDashboardTableRowModel
{
Columns = new List<string>
{
SDAFormat.GetShortDateFormat(dr["Datum"]),
SDAConvert.ToString(dr["Oraszam"]),
SDAConvert.ToString(dr["OsztalyCsoport"]),
SDAConvert.ToString(dr["Tantargy"])
}
};
rows.Add(row);
}
result.Rows = rows;
}
return result;
}
private TanarDashboardTableModel ConvertKiirtHelyettesitesek(DataSet ds)
{
var result = new TanarDashboardTableModel
{
Url = GetUrl(Constants.Areas.Tanar, Constants.Controllers.NemNaplozottTanorak, "Index", new Dictionary<string, object>
{
{ "csakAHelyettesiteseim", true },
{ "helyettesitettOraimIs", false },
{ "jovobeniOrakMegjelenitese", true },
}),
Name = TanarDashBoardResource.KiirtHelyettesitesek,
Headers = new List<string>
{
TanarDashBoardResource.Datum,
TanarDashBoardResource.Oraszam,
TanarDashBoardResource.Osztalycsoport,
TanarDashBoardResource.Tantargy,
},
Rows = new List<TanarDashboardTableRowModel>()
};
if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
{
var rows = new List<TanarDashboardTableRowModel>();
foreach (DataRow dr in ds.Tables[0].Rows)
{
var row = new TanarDashboardTableRowModel
{
Columns = new List<string>
{
SDAFormat.GetShortDateFormat(dr["Datum"]),
SDAConvert.ToString(dr["Oraszam"]),
SDAConvert.ToString(dr["OsztalyCsoport"]),
SDAConvert.ToString(dr["Tantargy"])
}
};
rows.Add(row);
}
result.Rows = rows;
}
return result;
}
private TanarDashboardTableModel ConvertMulasztasok(DataSet ds)
{
var result = new TanarDashboardTableModel
{
Url = GetUrl(Constants.Areas.Hianyzas, Constants.Controllers.Mulasztasok, "Index"),
Name = TanarDashBoardResource.Mulasztasok,
Headers = new List<string>
{
TanarDashBoardResource.MulasztasDatuma,
TanarDashBoardResource.MulasztasNapja,
TanarDashBoardResource.MulasztasokSzama,
},
Rows = new List<TanarDashboardTableRowModel>()
};
if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
{
var rows = new List<TanarDashboardTableRowModel>();
foreach (DataRow dr in ds.Tables[0].Rows)
{
var row = new TanarDashboardTableRowModel
{
Columns = new List<string>
{
SDAFormat.GetShortDateFormat(dr["MulasztasDatuma"]),
SDAConvert.ToString(dr["MulasztasNapja"]),
SDAConvert.ToString(dr["MulasztasokSzama"])
}
};
rows.Add(row);
}
result.Rows = rows;
}
return result;
}
private TanarDashboardTableModel ConvertBukasraAlloTanulok(DataSet ds)
{
var result = new TanarDashboardTableModel
{
Url = GetUrl(Constants.Areas.Tanulo, Constants.Controllers.TanarTanitottTanulok, "Index", new Dictionary<string, object>
{
{ "csakBukasraAllok", true },
}),
Name = TanarDashBoardResource.BukasraAlloTanulok,
Headers = new List<string>
{
TanarDashBoardResource.Nev,
TanarDashBoardResource.Osztaly,
TanarDashBoardResource.TantargyakSzama,
},
Rows = new List<TanarDashboardTableRowModel>()
};
if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
{
var rows = new List<TanarDashboardTableRowModel>();
foreach (DataRow dr in ds.Tables[0].Rows)
{
var row = new TanarDashboardTableRowModel
{
Columns = new List<string>
{
SDAConvert.ToString(dr["Nev"]),
SDAConvert.ToString(dr["Osztaly"]),
SDAConvert.ToString(dr["TantargyakSzama"])
}
};
rows.Add(row);
}
result.Rows = rows;
}
return result;
}
private List<TanarDashboardItemModel> ConvertDashBoardUzenetek(DataSet ds)
{
var result = new List<TanarDashboardItemModel>();
if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
{
foreach (DataRow row in ds.Tables[0].Rows)
{
var item = new TanarDashboardItemModel
{
Name = SDAConvert.ToString(row["C_CIM"]),
Content = SDAConvert.ToString(row["C_TARTALOM"]),
Type = (AdminDashboardTipusEnum)SDAConvert.ToInt32(row["C_DASHBOARDUZENETKATEGORIAID"]),
Sorrend = SDAConvert.ToInt32(row["SORREND"]),
EgyediAzonosito = SDAConvert.ToString(row["C_EGYEDIAZONOSITO"])
};
result.Add(item);
}
}
return result.OrderBy(o => o.Sorrend).ToList();
}
private string GetUrl(string area, string controller, string action, Dictionary<string, object> parameters = null)
{
var dictionary = new Dictionary<string, object> { { "Area", area } };
if (parameters != null)
{
dictionary = dictionary.Concat(parameters).ToDictionary(x => x.Key, x => x.Value);
}
var routeValues = new RouteValueDictionary(dictionary);
return UrlHelper.GenerateUrl(null, action, controller, routeValues, RouteTable.Routes, HttpContext.Request.RequestContext, false);
}
private string GetEugyUrl(string url)
{
return Kreta.Web.Classes.Utils.GetAuthenticationTokenRedirectUrl(url, IdpConfiguration.AuthenticationTokenKey);
}
private T ExceptionLogger<T>(Func<T> action)
{
try
{
return action();
}
catch (Exception ex)
{
SDAServer.Instance.Logger.ExceptionThrown(ex);
}
return default;
}
private T TryDeserialize<T>(string json)
{
return ExceptionLogger(() => JsonConvert.DeserializeObject<T>(json));
}
}
}

View file

@ -0,0 +1,48 @@
using System.Web.Http;
using System.Web.Mvc;
using Kreta.BusinessLogic.Helpers;
using Kreta.BusinessLogic.Logic;
using Kreta.BusinessLogic.Security;
using Kreta.Resources;
using Kreta.Web.Areas.Tanar.Models;
using Kreta.Web.Helpers;
using Kreta.Web.Helpers.Modal;
using Kreta.Web.Models.EditorTemplates;
using Kreta.Web.Security;
namespace Kreta.Web.Areas.Tanar.Controllers
{
[MvcRoleClaimsAuthorize(true)]
[MvcRolePackageAuthorize(KretaClaimPackages.Tanar.ClaimValue)]
[MvcRolePackageDenyAuthorize(KretaClaimPackages.IsDualisKepzohelyiOktato.ClaimValue)]
public class TanarOralatogatasokListajaController : Controller
{
public ActionResult Index()
{
var model = new OralatogatasokKereseseModel();
return View("Index", model);
}
public ActionResult OpenOralatogatasInfoPopUp(int oralatogatasId)
{
var helper = new OralatogatasokHelper(ConnectionTypeExtensions.GetSessionConnectionType());
var co = helper.GetOralatogatas(oralatogatasId);
var viewModel = new OralatogatasokKereseseAdatModel
{
Date = co.Date,
Ora = co.Ora,
Tanar = co.Latogato,
Beosztas = co.Beosztas,
LatogatottPedagogus = co.LatogatottPedagogus,
Tantargy = co.Tantargy,
OsztalyCsoport = co.OsztalyCsoport,
Megjegyzes = RichTextLogic.CutHtmlTagsAndDecode(co.Megjegyzes)
};
var popupModel = new PopUpModel(viewModel, "Oralatogatas_Info");
popupModel.Buttons.Add(new ModalButtonModel() { Name = "BtnCancel", Text = CommonResource.Megse, EventName = "OralatogatasokKereseseHelper.closePopUps" });
return PartialView(Constants.General.PopupView, popupModel);
}
}
}