kreta/Kreta.BusinessLogic/Logic/TanuloErtekeles/TanuloErtekelesLogicWeb.cs
2024-03-13 00:33:46 +01:00

1287 lines
73 KiB
C#

using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Text;
using System.Web;
using Kreta.BusinessLogic.Classes;
using Kreta.BusinessLogic.HelperClasses;
using Kreta.Core;
using Kreta.Enums;
using Kreta.Enums.ManualEnums;
using Kreta.Framework;
using Kreta.Framework.Caching;
using Kreta.Framework.Util;
using Kreta.KretaServer.Exceptions;
using Kreta.Resources;
using OfficeOpenXml;
using static Kreta.Core.Constants;
namespace Kreta.BusinessLogic.Logic.TanuloErtekeles
{
public class TanuloErtekelesLogicWeb : TanuloErtekelesLogicBase
{
public static DataSet GetTanuloErtekelesDataSetByTantargyForGrid(TanuloErtekelesGridHelperCo tanuloErtekelesGridHelperCo)
{
List<DictionaryItem> osztalyzatTipusDictionaryItemList = ((int)GeneratedAdatszotarTipusEnum.OsztalyzatTipus).GetItemsByType(tanuloErtekelesGridHelperCo.TanevId).OrderBy(x => x.Value).ToList();
var tanuloErtekelesGridRowList = new List<TanuloErtekelesTanuloListByTantargyGridRowCo>();
foreach (DataRow dataRow in tanuloErtekelesGridHelperCo.DataSet.Tables[0].Rows)
{
int rowId = SDAConvert.ToInt32(dataRow["TanuloId"]);
if (tanuloErtekelesGridRowList.All(x => x.RowId != rowId))
{
var co = new TanuloErtekelesTanuloListByTantargyGridRowCo();
SetTanuloErtekelesBaseGridRowCo(co, rowId, dataRow, tanuloErtekelesGridHelperCo.FelevVegeDatum);
SetTanuloErtekelesTanuloListBaseGridRowCo(co, dataRow);
co.ErtkelesMentesseg = SDAConvert.ToBooleanFromTF(dataRow["ErtkelesMentesseg"]);
co.SzovegesenErtekelheto = SDAConvert.ToBooleanFromTF(dataRow["SzovegesenErtekelheto"]);
co.MentessegOka = dataRow["MentessegOka"].ToString();
tanuloErtekelesGridRowList.Add(co);
}
TanuloErtekelesGridItemCo tanuloErtekelesGridItem = GetTanuloErtekelesGridItem(dataRow, osztalyzatTipusDictionaryItemList);
if (tanuloErtekelesGridItem != null)
{
tanuloErtekelesGridRowList.Single(x => x.RowId == rowId).TanuloErtekelesGridItemList.Add(tanuloErtekelesGridItem);
}
}
foreach (TanuloErtekelesTanuloListByTantargyGridRowCo tanuloErtekelesGridRow in tanuloErtekelesGridRowList)
{
tanuloErtekelesGridRow.Atlag = SetAtlag(tanuloErtekelesGridRow);
}
DataTable gridDataTable = SetTanuloErtekelesBaseGridDataTableBaseColumns(tanuloErtekelesGridHelperCo.Datum?.ToConvertableDateString(), tanuloErtekelesGridHelperCo.IsJegyekAtlagaMegjelenik);
SetTanuloErtekelesTanuloListBaseGridDataTableColumns(gridDataTable);
SetTanuloErtekelesHaviAtlagColumns(gridDataTable);
gridDataTable.Columns.Add(new DataColumn("ErtkelesMentesseg", typeof(bool)));
gridDataTable.Columns.Add(new DataColumn("SzovegesenSemErtekelheto", typeof(bool)));
gridDataTable.Columns.Add(new DataColumn("MentessegOka", typeof(string)));
DataSet gridDataSet = new DataSet();
gridDataSet.Tables.Add(gridDataTable);
foreach (TanuloErtekelesTanuloListByTantargyGridRowCo tanuloErtekelesGridRow in tanuloErtekelesGridRowList)
{
DataRow gridDataRow = SetTanuloErtekelesBaseGridDataTableBaseValues(tanuloErtekelesGridHelperCo, gridDataSet, tanuloErtekelesGridRow, tanuloErtekelesGridHelperCo.NaplozarasDatuma, tanuloErtekelesGridHelperCo.ErtekelesModDictionary);
SetTanuloErtekelesTanuloListBaseGridDataTableValues(gridDataRow, tanuloErtekelesGridRow);
SetTanuloErtekelesHaviAtlagValues(tanuloErtekelesGridHelperCo, gridDataRow, tanuloErtekelesGridRow);
gridDataRow.SetField("ErtkelesMentesseg", tanuloErtekelesGridRow.ErtkelesMentesseg);
gridDataRow.SetField("SzovegesenSemErtekelheto", tanuloErtekelesGridRow.SzovegesenSemErtekelheto);
gridDataRow.SetField("MentessegOka", tanuloErtekelesGridRow.MentessegOka);
gridDataTable.Rows.Add(gridDataRow);
}
return gridDataSet;
}
public static DataSet GetTanuloErtekelesDataSetByMagatartasSzorgalomForGrid(TanuloErtekelesGridHelperCo tanuloErtekelesGridHelperCo)
{
List<DictionaryItem> osztalyzatTipusDictionaryItemList = ((int)GeneratedAdatszotarTipusEnum.OsztalyzatTipus).GetItemsByType(tanuloErtekelesGridHelperCo.TanevId).OrderBy(x => x.Value).ToList();
var tanuloErtekelesGridRowList = new List<TanuloErtekelesTanuloListByMagatartasSzorgalomGridRowCo>();
foreach (DataRow dataRow in tanuloErtekelesGridHelperCo.DataSet.Tables[0].Rows)
{
int rowId = SDAConvert.ToInt32(dataRow["TanuloId"]);
if (tanuloErtekelesGridRowList.All(x => x.RowId != rowId))
{
var co = new TanuloErtekelesTanuloListByMagatartasSzorgalomGridRowCo();
SetTanuloErtekelesBaseGridRowCo(co, rowId, dataRow, tanuloErtekelesGridHelperCo.FelevVegeDatum);
SetTanuloErtekelesTanuloListBaseGridRowCo(co, dataRow);
co.EllatottFeladatTipusId = dataRow.Field<int>("EllatottFeladatTipusId");
tanuloErtekelesGridRowList.Add(co);
}
TanuloErtekelesGridItemCo tanuloErtekelesGridItem = GetTanuloErtekelesGridItem(dataRow, osztalyzatTipusDictionaryItemList);
if (tanuloErtekelesGridItem != null)
{
tanuloErtekelesGridRowList.Single(x => x.RowId == rowId).TanuloErtekelesGridItemList.Add(tanuloErtekelesGridItem);
}
}
foreach (TanuloErtekelesTanuloListByMagatartasSzorgalomGridRowCo tanuloErtekelesGridRow in tanuloErtekelesGridRowList)
{
tanuloErtekelesGridRow.Atlag = SetAtlag(tanuloErtekelesGridRow);
}
DataTable gridDataTable = SetTanuloErtekelesBaseGridDataTableBaseColumns(tanuloErtekelesGridHelperCo.Datum?.ToConvertableDateString(), tanuloErtekelesGridHelperCo.IsJegyekAtlagaMegjelenik);
SetTanuloErtekelesTanuloListBaseGridDataTableColumns(gridDataTable);
gridDataTable.Columns.Add(new DataColumn("EllatottFeladatTipusId", typeof(int)));
DataSet gridDataSet = new DataSet();
gridDataSet.Tables.Add(gridDataTable);
foreach (TanuloErtekelesTanuloListByMagatartasSzorgalomGridRowCo tanuloErtekelesGridRow in tanuloErtekelesGridRowList)
{
DataRow gridDataRow = SetTanuloErtekelesBaseGridDataTableBaseValues(tanuloErtekelesGridHelperCo, gridDataSet, tanuloErtekelesGridRow, tanuloErtekelesGridHelperCo.NaplozarasDatuma, tanuloErtekelesGridHelperCo.ErtekelesModDictionary);
SetTanuloErtekelesTanuloListBaseGridDataTableValues(gridDataRow, tanuloErtekelesGridRow);
gridDataRow.SetField("EllatottFeladatTipusId", tanuloErtekelesGridRow.EllatottFeladatTipusId);
gridDataTable.Rows.Add(gridDataRow);
}
return gridDataSet;
}
public static DataSet GetTanuloErtekelesDataSetByTanuloForGrid(TanuloErtekelesGridHelperCo tanuloErtekelesGridHelperCo)
{
List<DictionaryItem> targyKategoriaTipusDictionaryItemList = ((int)GeneratedAdatszotarTipusEnum.TargyKategoriaTipus).GetItemsByType(tanuloErtekelesGridHelperCo.TanevId);
List<DictionaryItem> osztalyzatTipusDictionaryItemList = ((int)GeneratedAdatszotarTipusEnum.OsztalyzatTipus).GetItemsByType(tanuloErtekelesGridHelperCo.TanevId).OrderBy(x => x.Value).ToList();
var tanuloErtekelesGridRowList = new List<TanuloErtekelesTantargyListByTanuloGridRowCo>();
foreach (DataRow dataRow in tanuloErtekelesGridHelperCo.DataSet.Tables[0].Rows)
{
int rowId = SDAConvert.ToInt32(dataRow["TantargyId"]);
if (tanuloErtekelesGridRowList.All(x => x.RowId != rowId))
{
var co = new TanuloErtekelesTantargyListByTanuloGridRowCo();
SetTanuloErtekelesBaseGridRowCo(co, rowId, dataRow, tanuloErtekelesGridHelperCo.FelevVegeDatum);
SetTanuloErtekelesTantargyListBaseGridRowCo(co, dataRow, targyKategoriaTipusDictionaryItemList);
tanuloErtekelesGridRowList.Add(co);
}
TanuloErtekelesGridItemCo tanuloErtekelesGridItem = GetTanuloErtekelesGridItem(dataRow, osztalyzatTipusDictionaryItemList, tanuloErtekelesGridHelperCo.TanuloErtekelesVisibilityCo);
if (tanuloErtekelesGridItem != null)
{
tanuloErtekelesGridRowList.Single(x => x.RowId == rowId).TanuloErtekelesGridItemList.Add(tanuloErtekelesGridItem);
}
}
//NOTE: Az alábbiak szerint kell sorrendezni a tantárgyakat:
// - A tantárgyak tantárgykategóriája szerint, ha altárgy, akkor a főtárgy tantárgykategóriája szerint.
// - A tantárgyak neve szerinti ABC sorrendben, ha altárgy, akkor a főtárgy neve szerinti ABC sorrendben.
// - A főtárgyakat az altárgyak elé soroljuk.
// - A tantárgyak neve szerinti ABC sorrendben(ez a rész a főtárgyak alatt lévő altárgyakat fogja rendezni).
List<TanuloErtekelesTantargyListByTanuloGridRowCo> orderedTanuloErtekelesGridRowList = tanuloErtekelesGridRowList
.OrderBy(x => x.IsFotargy ? x.TantargyKategoriaOrder ?? 10000 : x.FotargyTantargyKategoriaOrder ?? 10000)
.ThenBy(x => x.IsFotargy ? x.TantargyNev : x.FotargyNev)
.ThenBy(x => x.IsFotargy ? 0 : 1)
.ThenBy(x => x.TantargyNev)
.ToList();
foreach (TanuloErtekelesTantargyListByTanuloGridRowCo tanuloErtekelesGridRow in orderedTanuloErtekelesGridRowList)
{
tanuloErtekelesGridRow.Atlag = SetAtlag(tanuloErtekelesGridRow);
}
DataTable gridDataTable = SetTanuloErtekelesBaseGridDataTableBaseColumns(null, tanuloErtekelesGridHelperCo.IsJegyekAtlagaMegjelenik);
SetTanuloErtekelesTantargyListBaseGridDataTableColumns(gridDataTable);
SetTanuloErtekelesHaviAtlagColumns(gridDataTable);
gridDataTable.Columns.Add(new DataColumn("TantargyIsTanulmanyiAtlagbaNemSzamit", typeof(bool)));
DataSet gridDataSet = new DataSet();
gridDataSet.Tables.Add(gridDataTable);
foreach (TanuloErtekelesTantargyListByTanuloGridRowCo tanuloErtekelesGridRow in orderedTanuloErtekelesGridRowList)
{
DataRow gridDataRow = SetTanuloErtekelesBaseGridDataTableBaseValues(tanuloErtekelesGridHelperCo, gridDataSet, tanuloErtekelesGridRow, tanuloErtekelesGridHelperCo.NaplozarasDatuma, tanuloErtekelesGridHelperCo.ErtekelesModDictionary, false);
SetTanuloErtekelesTantargyListBaseGridDataTableValues(gridDataRow, tanuloErtekelesGridRow);
SetTanuloErtekelesHaviAtlagValues(tanuloErtekelesGridHelperCo, gridDataRow, tanuloErtekelesGridRow);
gridDataRow.SetField("TantargyIsTanulmanyiAtlagbaNemSzamit", tanuloErtekelesGridRow.TanuloErtekelesGridItemList.Any(e => e.IsTanulmanyiAtlagbaNemSzamit == true));
gridDataTable.Rows.Add(gridDataRow);
}
return gridDataSet;
}
public static DataSet GetTanuloErtekelesDataSetByFotargyAltargyForGrid(TanuloErtekelesGridHelperCo tanuloErtekelesGridHelperCo)
{
List<DictionaryItem> targyKategoriaTipusDictionaryItemList = ((int)GeneratedAdatszotarTipusEnum.TargyKategoriaTipus).GetItemsByType(tanuloErtekelesGridHelperCo.TanevId);
List<DictionaryItem> osztalyzatTipusDictionaryItemList = ((int)GeneratedAdatszotarTipusEnum.OsztalyzatTipus).GetItemsByType(tanuloErtekelesGridHelperCo.TanevId).OrderBy(x => x.Value).ToList();
var tanuloErtekelesGridRowList = new List<TanuloErtekelesTantargyListByFotargyAltargyGridRowCo>();
foreach (DataRow dataRow in tanuloErtekelesGridHelperCo.DataSet.Tables[0].Rows)
{
int rowId = SDAConvert.ToInt32(dataRow["TantargyId"]);
if (tanuloErtekelesGridRowList.All(x => x.RowId != rowId))
{
var co = new TanuloErtekelesTantargyListByFotargyAltargyGridRowCo();
SetTanuloErtekelesBaseGridRowCo(co, rowId, dataRow, tanuloErtekelesGridHelperCo.FelevVegeDatum);
SetTanuloErtekelesTantargyListBaseGridRowCo(co, dataRow, targyKategoriaTipusDictionaryItemList);
tanuloErtekelesGridRowList.Add(co);
}
TanuloErtekelesGridItemCo tanuloErtekelesGridItem = GetTanuloErtekelesGridItem(dataRow, osztalyzatTipusDictionaryItemList);
if (tanuloErtekelesGridItem != null)
{
tanuloErtekelesGridRowList.Single(x => x.RowId == rowId).TanuloErtekelesGridItemList.Add(tanuloErtekelesGridItem);
}
}
//NOTE: Az alábbiak szerint kell sorrendezni a tantárgyakat:
// - Ha van főtárgy a listában az kerül előre(Itt csak és kizárólag egy főtárgy lehet).
// - A tantárgyak neve szerinti ABC sorrendben(ez a rész a főtárgyak alatt lévő altárgyakat fogja rendezni).
List<TanuloErtekelesTantargyListByFotargyAltargyGridRowCo> orderedTanuloErtekelesGridRowList = tanuloErtekelesGridRowList
.OrderBy(x => x.IsFotargy ? 0 : 1)
.ThenBy(x => x.TantargyNev)
.ToList();
foreach (TanuloErtekelesTantargyListByFotargyAltargyGridRowCo tanuloErtekelesGridRow in orderedTanuloErtekelesGridRowList)
{
tanuloErtekelesGridRow.Atlag = SetAtlag(tanuloErtekelesGridRow);
}
DataTable gridDataTable = SetTanuloErtekelesBaseGridDataTableBaseColumns(tanuloErtekelesGridHelperCo.Datum?.ToConvertableDateString(), tanuloErtekelesGridHelperCo.IsJegyekAtlagaMegjelenik);
SetTanuloErtekelesTantargyListBaseGridDataTableColumns(gridDataTable);
DataSet gridDataSet = new DataSet();
gridDataSet.Tables.Add(gridDataTable);
foreach (TanuloErtekelesTantargyListByFotargyAltargyGridRowCo tanuloErtekelesGridRow in orderedTanuloErtekelesGridRowList)
{
DataRow gridDataRow = SetTanuloErtekelesBaseGridDataTableBaseValues(tanuloErtekelesGridHelperCo, gridDataSet, tanuloErtekelesGridRow, tanuloErtekelesGridHelperCo.NaplozarasDatuma, tanuloErtekelesGridHelperCo.ErtekelesModDictionary, false, false);
SetTanuloErtekelesTantargyListBaseGridDataTableValues(gridDataRow, tanuloErtekelesGridRow);
gridDataTable.Rows.Add(gridDataRow);
}
return gridDataSet;
}
public static DataSet GetDolgozatErtekelesDataSetForGrid(DolgozatGridHelperCo dolgozatGridHelperCo)
{
int rowId = 1;
dolgozatGridHelperCo.DataSet.Tables[0].Columns.Add(new DataColumn("RowId", typeof(int)));
foreach (DataRow dataRow in dolgozatGridHelperCo.DataSet.Tables[0].Rows)
{
dataRow.SetField("RowId", SDAConvert.ToInt32(rowId));
rowId++;
}
return dolgozatGridHelperCo.DataSet;
}
public static void SetTanuloErtekelesDataSetForDetailGridDataTable(DataTable dataTable, int ertekelesMegjelenesFajtaEnumId, DateTime naplozarasDatuma, int tanevId)
{
dataTable.Columns.Add("ModosithatoByNaplozaras", typeof(bool));
List<DataRow> dataRowList = dataTable.Rows.Cast<DataRow>().ToList();
foreach (var dataRow in dataRowList)
{
dataRow["ModosithatoByNaplozaras"] = naplozarasDatuma <= DateTime.Parse(dataRow["Datum"].ToString());
}
switch (ertekelesMegjelenesFajtaEnumId)
{
case (int)ErtekelesMegjelenesFajtaEnum.Tantargy:
dataTable.Columns.Add("ErtekelesText");
List<DataRow> ertekelesRows = dataRowList;
foreach (var row in ertekelesRows)
{
row["ErtekelesText"] = GetErtekelesText(row, tanevId);
}
break;
case (int)ErtekelesMegjelenesFajtaEnum.MagatartasSzorgalom:
dataTable.Columns.Add("MagatartasText");
dataTable.Columns.Add("SzorgalomText");
List<DataRow> magatartasSzorgalomRows = dataRowList;
foreach (var row in magatartasSzorgalomRows)
{
row["MagatartasText"] = GetMagatartasText(row, tanevId);
row["SzorgalomText"] = GetSzorgalomText(row, tanevId);
}
break;
case (int)ErtekelesMegjelenesFajtaEnum.Tanulo:
dataTable.Columns.Add("TanuloErtekelesText");
List<DataRow> tanuloErtekelesRowList = dataRowList;
foreach (var row in tanuloErtekelesRowList)
{
row["TanuloErtekelesText"] = GetTanuloErtekelesText(row, tanevId);
}
break;
}
}
public static void SetTanuloErtekelesListGridDataSet(DataSet dataSet, int tanevId, bool pErtekelesTextTemaval = false)
{
DataTable dataTable = dataSet.Tables[0];
dataTable.Columns.Add("TanuloErtekelesText");
foreach (DataRow dataRow in dataTable.Rows.Cast<DataRow>().ToList())
{
dataRow["TanuloErtekelesText"] = RichTextLogic.CutHtmlTagsAndDecodeAndBR2Space(GetTanuloErtekelesText(dataRow, tanevId, pErtekelesTextTemaval));
dataRow["ErtekelesModId_DNAME"] = string.IsNullOrWhiteSpace(dataRow["ErtekelesModId_DNAME"].ToString()) ? "-" : dataRow["ErtekelesModId_DNAME"];
}
}
public static QuadrupleList<string, string, string, string> GetTanuloLegfrissebbTanuloErtekelesList(DataSet tanuloErtekelesDataSet, List<int> egyszerAdhatoErtekelesTipusIds)
{
var result = new QuadrupleList<string, string, string, string>();
foreach (DataRow tanuloErtekeles in tanuloErtekelesDataSet.Tables[0].AsEnumerable())
{
if (tanuloErtekeles["C_ERTEKELESOSZTALYZATID"] != DBNull.Value)
{
result.Add(
GetOsztalyzatTextShort(SDAConvert.ToInt32(tanuloErtekeles["C_ERTEKELESOSZTALYZATID"]), egyszerAdhatoErtekelesTipusIds, tipusId: SDAConvert.ToInt32(tanuloErtekeles["C_TIPUSID"]), tema: SDAConvert.ToString(tanuloErtekeles["C_ERTEKELESTEMA"])),
SDAConvert.ToString(tanuloErtekeles["C_ROVIDNEV"]),
SDAConvert.ToDateTime(tanuloErtekeles["C_DATUM"])?.ToString("MMMM d."),
SDAConvert.ToString(tanuloErtekeles["ID"]));
continue;
}
if (tanuloErtekeles["C_ERTEKELESSZAZALEK"] != DBNull.Value)
{
result.Add(
$"{SDAConvert.ToInt32(tanuloErtekeles["C_ERTEKELESSZAZALEK"])}%",
SDAConvert.ToString(tanuloErtekeles["C_ROVIDNEV"]),
SDAConvert.ToDateTime(tanuloErtekeles["C_DATUM"])?.ToString("MMMM d."),
SDAConvert.ToString(tanuloErtekeles["ID"]));
continue;
}
if (tanuloErtekeles["C_ERTEKELESSZOVEG"] != DBNull.Value)
{
result.Add(
"Szöveges",
SDAConvert.ToString(tanuloErtekeles["C_ROVIDNEV"]),
SDAConvert.ToDateTime(tanuloErtekeles["C_DATUM"])?.ToString("MMMM d."),
SDAConvert.ToString(tanuloErtekeles["ID"]));
}
}
return result;
}
public static MemoryStream GetTanulokJegyeiByTipusIdExcelExport(DataTable dataTable, int tipusId)
{
var memoryStream = new MemoryStream();
using (var excelPackage = new ExcelPackage(memoryStream))
{
ExcelWorksheet excelWorksheet;
switch (tipusId)
{
case (int)ErtekelesTipusEnum.evvegi_jegy_ertekeles:
excelWorksheet = excelPackage.Workbook.Worksheets.Add(TanuloErtekelesResource.TanulokEvVegiJegyei);
break;
case (int)ErtekelesTipusEnum.felevi_jegy_ertekeles:
excelWorksheet = excelPackage.Workbook.Worksheets.Add(TanuloErtekelesResource.TanulokFeleviJegyei);
break;
default:
excelWorksheet = excelPackage.Workbook.Worksheets.Add(TanuloErtekelesResource.TanulokEvkoziJegyei);
break;
}
excelWorksheet.Cells[1, 1].LoadFromDataTable(dataTable, true);
ExportLogic.SetHeaderStyles(excelWorksheet.Cells[1, 1, 1, dataTable.Columns.Count]);
excelWorksheet.Cells.AutoFitColumns();
excelPackage.Save();
}
memoryStream.Position = 0;
return memoryStream;
}
private static void SetTanuloErtekelesTanuloListBaseGridRowCo(TanuloErtekelesTanuloListBaseGridRowCo co, DataRow dataRow)
{
co.TanuloNev = dataRow["TanuloNev"].ToString();
co.TanuloNevElotagNelkul = dataRow["TanuloNevElotagNelkul"].ToString();
co.AnyjaNeve = dataRow["AnyjaNeve"].ToString();
co.SzuletesiIdo = SDAConvert.ToDateTime(dataRow["SzuletesiIdo"]).Value;
co.OsztalyNev = dataRow["OsztalyNev"].ToString();
co.FeladatKategoriaId = SDAConvert.ToInt32(dataRow["FeladatKategoriaId"]);
co.AmiFotargy = dataRow.Field<string>("AmiFotargyId_DNAME");
co.AmiTantargyKotelezoseg = dataRow.Field<string>("AmiTantargyKotelezosegId_DNAME");
co.EvfolyamNev = dataRow.Field<string>("EvfolyamId_DNAME");
co.AmiTagozat = dataRow.Field<string>("AmiTagozatId_DNAME");
}
private static void SetTanuloErtekelesTanuloListBaseGridDataTableColumns(DataTable gridDataTable)
{
gridDataTable.Columns.Add(new DataColumn("TanuloNev", typeof(string)));
gridDataTable.Columns.Add(new DataColumn("TanuloNevElotagNelkul", typeof(string)));
gridDataTable.Columns.Add(new DataColumn("AnyjaNeve", typeof(string)));
gridDataTable.Columns.Add(new DataColumn("SzuletesiIdo", typeof(DateTime)));
gridDataTable.Columns.Add(new DataColumn("SzuletesiIdoFormatted", typeof(string)));
gridDataTable.Columns.Add(new DataColumn("OsztalyNev", typeof(string)));
gridDataTable.Columns.Add(new DataColumn("FeladatKategoriaId", Nullable.GetUnderlyingType(typeof(int)) ?? typeof(int)));
gridDataTable.Columns.Add(new DataColumn("AmiTagozat", typeof(string)));
gridDataTable.Columns.Add(new DataColumn("AmiFotargy", typeof(string)));
gridDataTable.Columns.Add(new DataColumn("AmiTantargyKotelezoseg", typeof(string)));
gridDataTable.Columns.Add(new DataColumn("Evfolyam", typeof(string)));
}
private static void SetTanuloErtekelesTanuloListBaseGridDataTableValues(DataRow gridDataRow, TanuloErtekelesTanuloListBaseGridRowCo tanuloErtekelesGridRow)
{
gridDataRow.SetField("TanuloNev", tanuloErtekelesGridRow.TanuloNev);
gridDataRow.SetField("TanuloNevElotagNelkul", tanuloErtekelesGridRow.TanuloNevElotagNelkul);
gridDataRow.SetField("AnyjaNeve", tanuloErtekelesGridRow.AnyjaNeve);
gridDataRow.SetField("SzuletesiIdo", tanuloErtekelesGridRow.SzuletesiIdo);
gridDataRow.SetField("SzuletesiIdoFormatted", tanuloErtekelesGridRow.SzuletesiIdoFormatted);
gridDataRow.SetField("OsztalyNev", tanuloErtekelesGridRow.OsztalyNev);
gridDataRow.SetField("FeladatKategoriaId", tanuloErtekelesGridRow.FeladatKategoriaId);
gridDataRow.SetField("AmiTagozat", tanuloErtekelesGridRow.AmiTagozat);
gridDataRow.SetField("AmiFotargy", tanuloErtekelesGridRow.AmiFotargy);
gridDataRow.SetField("AmiTantargyKotelezoseg", tanuloErtekelesGridRow.AmiTantargyKotelezoseg);
gridDataRow.SetField("Evfolyam", tanuloErtekelesGridRow.EvfolyamNev);
}
private static void SetTanuloErtekelesTantargyListBaseGridRowCo(TanuloErtekelesTantargyListBaseGridRowCo co, DataRow dataRow, List<DictionaryItem> targyKategoriaTipusDictionaryItemList)
{
co.TantargyNev = dataRow["TantargyNev"].ToString();
int? tantargyKategoriaId = SDAConvert.ToNullableInt32(dataRow["TantargyKategoriaId"]);
co.TantargyKategoriaId = tantargyKategoriaId;
co.TantargyKategoriaOrder = co.IsMagatartasSzorgalom ? 0 : tantargyKategoriaId.IsEntityId() ? targyKategoriaTipusDictionaryItemList.Single(x => x.Id == tantargyKategoriaId.Value).Order : null;
co.FotargyId = SDAConvert.ToNullableInt32(dataRow["FotargyId"]);
co.FotargyNev = dataRow["FotargyNev"].ToString();
int? fotargyTantargyKategoriaId = SDAConvert.ToNullableInt32(dataRow["FotargyTantargyKategoriaId"]);
co.FotargyTantargyKategoriaId = fotargyTantargyKategoriaId;
co.FotargyTantargyKategoriaOrder = fotargyTantargyKategoriaId.IsEntityId() ? targyKategoriaTipusDictionaryItemList.Single(x => x.Id == fotargyTantargyKategoriaId.Value).Order : null;
}
private static void SetTanuloErtekelesTantargyListBaseGridDataTableColumns(DataTable gridDataTable)
{
gridDataTable.Columns.Add(new DataColumn("TantargyNev", typeof(string)));
}
private static void SetTanuloErtekelesTantargyListBaseGridDataTableValues(DataRow gridDataRow, TanuloErtekelesTantargyListBaseGridRowCo tanuloErtekelesGridRow)
{
gridDataRow.SetField("TantargyNev", tanuloErtekelesGridRow.TantargyNev);
}
private static void SetTanuloErtekelesBaseGridRowCo(TanuloErtekelesBaseGridRowCo co, int rowId, DataRow dataRow, DateTime felevVegeDatum)
{
co.RowId = rowId;
co.TanuloId = SDAConvert.ToNullableInt32(dataRow["TanuloId"]);
co.TantargyId = SDAConvert.ToNullableInt32(dataRow["TantargyId"]);
co.FelevVegeDatum = felevVegeDatum;
co.IsMagatartasSzorgalom = SDAConvert.ToBooleanFromTF(dataRow["IsMagatartasSzorgalom"]);
co.TanuloErtekelesGridItemList = new List<TanuloErtekelesGridItemCo>();
}
private static DataTable SetTanuloErtekelesBaseGridDataTableBaseColumns(string datumDefaultValueString, bool isJegyekAtlagaMegjelenik)
{
DataTable gridDataTable = new DataTable();
gridDataTable.Columns.Add(new DataColumn("ID", typeof(int)));
gridDataTable.Columns.Add(new DataColumn("TanuloId", Nullable.GetUnderlyingType(typeof(int)) ?? typeof(int)));
gridDataTable.Columns.Add(new DataColumn("TantargyId", Nullable.GetUnderlyingType(typeof(int)) ?? typeof(int)));
gridDataTable.Columns.Add(new DataColumn("Szeptember", typeof(string)));
gridDataTable.Columns.Add(new DataColumn("Oktober", typeof(string)));
gridDataTable.Columns.Add(new DataColumn("November", typeof(string)));
gridDataTable.Columns.Add(new DataColumn("December", typeof(string)));
gridDataTable.Columns.Add(new DataColumn("JanuarI", typeof(string)));
gridDataTable.Columns.Add(new DataColumn("I", typeof(string)));
gridDataTable.Columns.Add(new DataColumn("JanuarII", typeof(string)));
gridDataTable.Columns.Add(new DataColumn("Februar", typeof(string)));
gridDataTable.Columns.Add(new DataColumn("Marcius", typeof(string)));
gridDataTable.Columns.Add(new DataColumn("Aprilis", typeof(string)));
gridDataTable.Columns.Add(new DataColumn("Majus", typeof(string)));
gridDataTable.Columns.Add(new DataColumn("Junius", typeof(string)));
gridDataTable.Columns.Add(new DataColumn("II", typeof(string)));
gridDataTable.Columns.Add(new DataColumn("Atlag", typeof(double)));
gridDataTable.Columns.Add(new DataColumn("IsJegyekAtlagaMegjelenik", typeof(bool)));
gridDataTable.Columns["IsJegyekAtlagaMegjelenik"].DefaultValue = isJegyekAtlagaMegjelenik;
gridDataTable.Columns.Add(new DataColumn("Datum", Nullable.GetUnderlyingType(typeof(DateTime)) ?? typeof(DateTime)));
gridDataTable.Columns["Datum"].DefaultValue = datumDefaultValueString;
return gridDataTable;
}
private static DataRow SetTanuloErtekelesBaseGridDataTableBaseValues(TanuloErtekelesGridHelperCo tanuloErtekelesGridHelperCo, DataSet gridDataSet, TanuloErtekelesBaseGridRowCo tanuloErtekelesGridRow, DateTime naplozarasDatuma, Dictionary<int, ErtekelesModCo> ertekelesModDictionary, bool hasClickEvent = true, bool isMainGrid = true)
{
DataRow gridDataRow = gridDataSet.Tables[0].NewRow();
gridDataRow.SetField("ID", tanuloErtekelesGridRow.RowId);
int? tanuloId = tanuloErtekelesGridRow.TanuloId;
gridDataRow.SetField("TanuloId", tanuloId);
gridDataRow.SetField("TantargyId", tanuloErtekelesGridRow.TantargyId);
bool isMagatartasSzorgalom = tanuloErtekelesGridRow.IsMagatartasSzorgalom;
gridDataRow.SetField("Szeptember", AddTanuloErtelelesekSpanToData(tanuloErtekelesGridHelperCo, tanuloErtekelesGridRow.Szeptember, naplozarasDatuma, ertekelesModDictionary, tanuloId, isMagatartasSzorgalom, hasClickEvent, isMainGrid));
gridDataRow.SetField("Oktober", AddTanuloErtelelesekSpanToData(tanuloErtekelesGridHelperCo, tanuloErtekelesGridRow.Oktober, naplozarasDatuma, ertekelesModDictionary, tanuloId, isMagatartasSzorgalom, hasClickEvent, isMainGrid));
gridDataRow.SetField("November", AddTanuloErtelelesekSpanToData(tanuloErtekelesGridHelperCo, tanuloErtekelesGridRow.November, naplozarasDatuma, ertekelesModDictionary, tanuloId, isMagatartasSzorgalom, hasClickEvent, isMainGrid));
gridDataRow.SetField("December", AddTanuloErtelelesekSpanToData(tanuloErtekelesGridHelperCo, tanuloErtekelesGridRow.December, naplozarasDatuma, ertekelesModDictionary, tanuloId, isMagatartasSzorgalom, hasClickEvent, isMainGrid));
gridDataRow.SetField("JanuarI", AddTanuloErtelelesekSpanToData(tanuloErtekelesGridHelperCo, tanuloErtekelesGridRow.JanuarI, naplozarasDatuma, ertekelesModDictionary, tanuloId, isMagatartasSzorgalom, hasClickEvent, isMainGrid));
var iTanuloErtekelesGridRow = tanuloErtekelesGridRow.I == null ? new List<TanuloErtekelesGridItemCo>() : new List<TanuloErtekelesGridItemCo> { tanuloErtekelesGridRow.I };
gridDataRow.SetField("I", AddTanuloErtelelesekSpanToData(tanuloErtekelesGridHelperCo, iTanuloErtekelesGridRow, naplozarasDatuma, ertekelesModDictionary, tanuloId, isMagatartasSzorgalom, hasClickEvent, isMainGrid));
gridDataRow.SetField("JanuarII", AddTanuloErtelelesekSpanToData(tanuloErtekelesGridHelperCo, tanuloErtekelesGridRow.JanuarII, naplozarasDatuma, ertekelesModDictionary, tanuloId, isMagatartasSzorgalom, hasClickEvent, isMainGrid));
gridDataRow.SetField("Februar", AddTanuloErtelelesekSpanToData(tanuloErtekelesGridHelperCo, tanuloErtekelesGridRow.Februar, naplozarasDatuma, ertekelesModDictionary, tanuloId, isMagatartasSzorgalom, hasClickEvent, isMainGrid));
gridDataRow.SetField("Marcius", AddTanuloErtelelesekSpanToData(tanuloErtekelesGridHelperCo, tanuloErtekelesGridRow.Marcius, naplozarasDatuma, ertekelesModDictionary, tanuloId, isMagatartasSzorgalom, hasClickEvent, isMainGrid));
gridDataRow.SetField("Aprilis", AddTanuloErtelelesekSpanToData(tanuloErtekelesGridHelperCo, tanuloErtekelesGridRow.Aprilis, naplozarasDatuma, ertekelesModDictionary, tanuloId, isMagatartasSzorgalom, hasClickEvent, isMainGrid));
gridDataRow.SetField("Majus", AddTanuloErtelelesekSpanToData(tanuloErtekelesGridHelperCo, tanuloErtekelesGridRow.Majus, naplozarasDatuma, ertekelesModDictionary, tanuloId, isMagatartasSzorgalom, hasClickEvent, isMainGrid));
gridDataRow.SetField("Junius", AddTanuloErtelelesekSpanToData(tanuloErtekelesGridHelperCo, tanuloErtekelesGridRow.Junius, naplozarasDatuma, ertekelesModDictionary, tanuloId, isMagatartasSzorgalom, hasClickEvent, isMainGrid));
var iiTanuloErtekelesGridRow = tanuloErtekelesGridRow.II == null ? new List<TanuloErtekelesGridItemCo>() : new List<TanuloErtekelesGridItemCo> { tanuloErtekelesGridRow.II };
gridDataRow.SetField("II", AddTanuloErtelelesekSpanToData(tanuloErtekelesGridHelperCo, iiTanuloErtekelesGridRow, naplozarasDatuma, ertekelesModDictionary, tanuloId, isMagatartasSzorgalom, hasClickEvent, isMainGrid));
gridDataRow.SetField("Atlag", tanuloErtekelesGridRow.Atlag);
return gridDataRow;
}
private static TanuloErtekelesGridItemCo GetTanuloErtekelesGridItem(DataRow dataRow, List<DictionaryItem> osztalyzatTipusDictionaryItemList, TanuloErtekelesVisibilityCo tanuloErtekelesVisibilityCo = null)
{
int? id = SDAConvert.ToNullableInt32(dataRow["ID"]);
//NOTE: Ha nincs id, akkor az azt jelenti, hogy az adott sornak(akár tanuló, akár tantárgy) nincs értékelése, de magát az üres sort meg kell jelenítenünk, ezért null-al térünk vissza!
if (!id.IsEntityId())
{
return null;
}
int tipusId = SDAConvert.ToInt32(dataRow["TipusId"]);
DateTime created = SDAConvert.ToDateTime(dataRow["Created"]).Value;
//NOTE: Ha tanuló nézet, csak akkor kell vizsgálni a többi szűrő feltételt, különben vissza kell adnunk az értékelést mindenképpen.
if (tanuloErtekelesVisibilityCo != null && tanuloErtekelesVisibilityCo.IsTanuloView)
{
bool isErtesitesElkuldve = SDAConvert.ToBooleanFromTF(dataRow["IsErtesitesElkuldve"]);
//NOTE: Ha nincs elküldve az értesítés, csak akkor kell vizsgálni a többi szűrő feltételt, különben vissza kell adnunk az értékelést mindenképpen.
if (!isErtesitesElkuldve)
{
//NOTE: Nem adjuk vissza a tanuló értékelést, ha...
// - az étrékelés típusa bármelyik egyszer adható értékelés és el kell rejtenünk.
// - a megjelenítési időpont(created + késleltés óraszám) későbbi, mint a DateTime.Now.
if (tipusId == (int)ErtekelesTipusEnum.I_ne_jegy_ertekeles && tanuloErtekelesVisibilityCo.IsINegyedevesJegyHidden ||
tipusId == (int)ErtekelesTipusEnum.II_ne_jegy_ertekeles && tanuloErtekelesVisibilityCo.IsIiNegyedevesJegyHidden ||
tipusId == (int)ErtekelesTipusEnum.felevi_jegy_ertekeles && tanuloErtekelesVisibilityCo.IsFeleviJegyHidden ||
tipusId == (int)ErtekelesTipusEnum.III_ne_jegy_ertekeles && tanuloErtekelesVisibilityCo.IsIiiNegyedevesJegyHidden ||
tipusId == (int)ErtekelesTipusEnum.IV_ne_jegy_ertekeles && tanuloErtekelesVisibilityCo.IsIvNegyedevesJegyHidden ||
tipusId == (int)ErtekelesTipusEnum.evvegi_jegy_ertekeles && tanuloErtekelesVisibilityCo.IsEvvegiJegyHidden ||
created.AddHours(tanuloErtekelesVisibilityCo.KesleltetettMegjelenitesOraszam) > DateTime.Now)
{
return null;
}
}
}
var result = new TanuloErtekelesGridItemCo
{
Id = id.Value,
Datum = SDAConvert.ToDateTime(dataRow["Datum"]).Value,
RogzitesDatum = SDAConvert.ToDateTime(dataRow["RogzitesDatum"]).Value,
TipusId = tipusId,
ErtekeloNyomtatasiNev = dataRow["ErtekeloNyomtatasiNev"].ToString(),
Modosithato = SDAConvert.ToBooleanFromTF(dataRow["Modosithato"]),
Created = created
};
bool isMagatartasSzorgalom = SDAConvert.ToBooleanFromTF(dataRow["IsMagatartasSzorgalom"]);
if (!isMagatartasSzorgalom)
{
int? ertekelesOsztalyzatId = SDAConvert.ToNullableInt32(dataRow["ErtekelesOsztalyzatId"]);
result.ErtekelesOsztalyzatId = ertekelesOsztalyzatId;
result.ErtekelesOsztalyzat = ertekelesOsztalyzatId.IsEntityId() ? osztalyzatTipusDictionaryItemList.Single(x => x.Id == ertekelesOsztalyzatId.Value).Value : null;
result.Suly = SDAConvert.ToNullableInt32(dataRow["Suly"]);
result.ErtekelesSzoveg = dataRow["ErtekelesSzoveg"].ToString();
result.ErtekelesSzovegRovidNev = dataRow["ErtekelesSzovegRovidNev"].ToString();
result.ErtekelesSzazalek = SDAConvert.ToNullableInt32(dataRow["ErtekelesSzazalek"]);
result.ErtekelesModId = SDAConvert.ToNullableInt32(dataRow["ErtekelesModId"]);
result.ErtekelesTema = dataRow["ErtekelesTema"].ToString();
result.IsTanulmanyiAtlagbaNemSzamit = SDAConvert.ToNullableBoolean(dataRow["IsTanulmanyiAtlagbaNemSzamit_BOOL"]);
}
else
{
result.MagatartasOsztalyzatId = SDAConvert.ToNullableInt32(dataRow["MagatartasOsztalyzatId"]);
result.MagatartasSzoveg = dataRow["MagatartasSzoveg"].ToString();
result.MagatartasSzovegRovidNev = dataRow["MagatartasSzovegRovidNev"].ToString();
result.MagatartasErtekId = SDAConvert.ToNullableInt32(dataRow["MagatartasErtekId"]);
result.SzorgalomOsztalyzatId = SDAConvert.ToNullableInt32(dataRow["SzorgalomOsztalyzatId"]);
result.SzorgalomSzoveg = dataRow["SzorgalomSzoveg"].ToString();
result.SzorgalomSzovegRovidNev = dataRow["SzorgalomSzovegRovidNev"].ToString();
result.SzorgalomErtekId = SDAConvert.ToNullableInt32(dataRow["SzorgalomErtekId"]);
}
return result;
}
private static double? SetAtlag(TanuloErtekelesBaseGridRowCo tanuloErtekelesGridRow)
{
List<TanuloErtekelesGridItemCo> atlagolhatoTanuloErtekelesek = tanuloErtekelesGridRow.TanuloErtekelesGridItemList
.Where(x => x.TipusId == (int)ErtekelesTipusEnum.evkozi_jegy_ertekeles && x.ErtekelesOsztalyzat.IsNotNullAndPositive()
&& (!x.IsTanulmanyiAtlagbaNemSzamit.HasValue || !x.IsTanulmanyiAtlagbaNemSzamit.Value)).ToList();
double? result = atlagolhatoTanuloErtekelesek.Any() ? atlagolhatoTanuloErtekelesek.WeightedAverage(x => x.ErtekelesOsztalyzat.Value, x => x.Suly ?? 100, 2) : null;
return result;
}
private static string AddTanuloErtelelesekSpanToData(TanuloErtekelesGridHelperCo tanuloErtekelesGridHelperCo, List<TanuloErtekelesGridItemCo> tanuloErtekelesGridItemList, DateTime naplozarasDatuma, Dictionary<int, ErtekelesModCo> ertekelesModDictionary, int? tanuloId, bool isMagatartasSzorgalom, bool hasClickEvent = true, bool isMainGrid = true)
{
var result = new StringBuilder();
foreach (TanuloErtekelesGridItemCo tanuloErtekelesGridItem in tanuloErtekelesGridItemList)
{
if (result.Length != 0)
{
result.Append(' ');
}
result.Append("<span");
result.AppendFormat(" data-tanuloertekelesid='{0}'", tanuloErtekelesGridItem.Id);
result.AppendFormat(" data-datum='{0}'", tanuloErtekelesGridItem.Datum.ToShortDateString());
bool modosithato = hasClickEvent && tanuloErtekelesGridItem.Modosithato && naplozarasDatuma <= tanuloErtekelesGridItem.Datum;
result.AppendFormat(" data-modosithato='{0}'", modosithato);
result.AppendFormat(" class='{0}'", GetTanuloErtekelesSpanClass(isMainGrid, tanuloId, modosithato));
result.AppendFormat(" data-ertekelonyomtatasinev='{0}'", GetTanuloErtekelesSpanErtekeloNyomtatasiNev(tanuloErtekelesGridItem));
bool isEvkoziErtekeles = tanuloErtekelesGridItem.TipusId == (int)ErtekelesTipusEnum.evkozi_jegy_ertekeles;
result.AppendFormat(" data-ertekelestema='{0}'", GetTanuloErtekelesSpanErtekelesTema(tanuloErtekelesGridItem, isEvkoziErtekeles));
result.AppendFormat(" data-tipusmod='{0}'", GetTanuloErtekelesSpanTipusMod(tanuloErtekelesGridHelperCo.TanevId, tanuloErtekelesGridItem, isEvkoziErtekeles, isMagatartasSzorgalom, out int? ertekelesModId));
result.AppendFormat(" style='{0}'", GetTanuloErtekelesStyle(tanuloErtekelesGridItem.TipusId, ertekelesModId, ertekelesModDictionary));
result.AppendFormat(" data-tooltipstyle='{0}'", GetToolTipStyle(tanuloErtekelesGridItem.TipusId, ertekelesModId, ertekelesModDictionary));
(string tanuloErtekelesText, string tanuloErtekelesShortText) = GetTanuloErtekelesSpanTanuloErtekelesText(tanuloErtekelesGridHelperCo, tanuloErtekelesGridItem, isMagatartasSzorgalom, out bool isErtekelesOsztalyzatSelected);
result.AppendFormat(" data-suly='{0}'", GetTanuloErtekelesSpanSuly(tanuloErtekelesGridItem, isErtekelesOsztalyzatSelected, isEvkoziErtekeles));
result.AppendFormat(" data-tanuloertekeles='{0}'", tanuloErtekelesText);
result.Append('>');
result.Append(tanuloErtekelesShortText);
result.Append("</span>");
}
return result.ToString();
}
private static string GetTanuloErtekelesSpanTipusMod(int tanevId, TanuloErtekelesGridItemCo tanuloErtekelesGridItem, bool isEvkoziErtekeles, bool isMagatartasSzorgalom, out int? ertekelesModId)
{
ertekelesModId = null;
var tipusMod = string.Empty;
if (isEvkoziErtekeles && !isMagatartasSzorgalom)
{
if (tanuloErtekelesGridItem.ErtekelesModId.IsEntityId())
{
ertekelesModId = tanuloErtekelesGridItem.ErtekelesModId;
tipusMod = HttpUtility.HtmlEncode(ertekelesModId.GetDisplayName<ErtekelesModEnum>(tanevId));
}
}
else
{
tipusMod = HttpUtility.HtmlEncode(tanuloErtekelesGridItem.TipusId.GetDisplayName<ErtekelesTipusEnum>(tanevId));
}
return tipusMod;
}
private static string GetTanuloErtekelesSpanErtekelesTema(TanuloErtekelesGridItemCo tanuloErtekelesGridItem, bool isEvkoziErtekeles)
{
var ertekelesTemaSb = new StringBuilder();
ertekelesTemaSb.Append(isEvkoziErtekeles ? "Téma: " : "Feljegyzés: ");
ertekelesTemaSb.Append(!string.IsNullOrWhiteSpace(tanuloErtekelesGridItem.ErtekelesTema) ? HttpUtility.HtmlEncode(tanuloErtekelesGridItem.ErtekelesTema) : "-");
return ertekelesTemaSb.ToString();
}
private static string GetTanuloErtekelesSpanSuly(TanuloErtekelesGridItemCo tanuloErtekelesGridItem, bool isErtekelesOsztalyzatSelected, bool isEvkoziErtekeles)
{
var suly = string.Empty;
if (tanuloErtekelesGridItem.Suly.HasValue && isErtekelesOsztalyzatSelected && isEvkoziErtekeles)
{
suly = $"Súly: {tanuloErtekelesGridItem.Suly}%";
}
return suly;
}
private static string GetTanuloErtekelesSpanErtekeloNyomtatasiNev(TanuloErtekelesGridItemCo tanuloErtekelesGridItem)
{
var ertekeloNyomtatasiNev = string.Empty;
if (!string.IsNullOrWhiteSpace(tanuloErtekelesGridItem.ErtekeloNyomtatasiNev))
{
ertekeloNyomtatasiNev = HttpUtility.HtmlEncode(tanuloErtekelesGridItem.ErtekeloNyomtatasiNev);
}
return ertekeloNyomtatasiNev;
}
private static (string tanuloErtekelesText, string tanuloErtekelesShortText) GetTanuloErtekelesSpanTanuloErtekelesText(TanuloErtekelesGridHelperCo tanuloErtekelesGridHelperCo, TanuloErtekelesGridItemCo tanuloErtekelesGridItem, bool isMagatartasSzorgalom, out bool isErtekelesOsztalyzatSelected)
{
isErtekelesOsztalyzatSelected = false;
string tanuloErtekelesText;
string tanuloErtekelesShortText;
if (!isMagatartasSzorgalom)
{
if (tanuloErtekelesGridItem.ErtekelesOsztalyzatId.IsEntityId())
{
string ertekelesOsztalyzat = GetOsztalyzatTextShort(
tanuloErtekelesGridItem.ErtekelesOsztalyzatId,
tanuloErtekelesGridHelperCo.EgyszerAdhatoErtekelesTipusIds,
tipusId: tanuloErtekelesGridItem.TipusId,
tema: tanuloErtekelesGridItem.ErtekelesTema);
tanuloErtekelesText = ertekelesOsztalyzat;
tanuloErtekelesShortText = ertekelesOsztalyzat;
isErtekelesOsztalyzatSelected = true;
}
else if (!string.IsNullOrWhiteSpace(tanuloErtekelesGridItem.ErtekelesSzoveg))
{
string ertekelesSzoveg = string.IsNullOrWhiteSpace(tanuloErtekelesGridItem.ErtekelesSzovegRovidNev) ? "sz" : HttpUtility.HtmlEncode(tanuloErtekelesGridItem.ErtekelesSzovegRovidNev);
tanuloErtekelesText = ertekelesSzoveg;
tanuloErtekelesShortText = ertekelesSzoveg;
}
else if (tanuloErtekelesGridItem.ErtekelesSzazalek.HasValue)
{
string ertekelesSzazalek = tanuloErtekelesGridItem.ErtekelesSzazalek + "%";
tanuloErtekelesText = ertekelesSzazalek;
tanuloErtekelesShortText = ertekelesSzazalek;
}
else
{
var ex = new KretaException(ErrorResource.HibaTortentAMuveletKozben);
SDAServer.Instance.Logger.ExceptionThrown(ex);
throw ex;
}
}
else
{
if (tanuloErtekelesGridItem.MagatartasOsztalyzatId.IsEntityId() || tanuloErtekelesGridItem.SzorgalomOsztalyzatId.IsEntityId())
{
tanuloErtekelesText = $"{GetOsztalyzatTextShort(tanuloErtekelesGridItem.MagatartasOsztalyzatId, tanuloErtekelesGridHelperCo.EgyszerAdhatoErtekelesTipusIds)}<br/>{GetOsztalyzatTextShort(tanuloErtekelesGridItem.SzorgalomOsztalyzatId, tanuloErtekelesGridHelperCo.EgyszerAdhatoErtekelesTipusIds)}";
tanuloErtekelesShortText = $"{GetOsztalyzatTextShort(tanuloErtekelesGridItem.MagatartasOsztalyzatId, tanuloErtekelesGridHelperCo.EgyszerAdhatoErtekelesTipusIds)}/{GetOsztalyzatTextShort(tanuloErtekelesGridItem.SzorgalomOsztalyzatId, tanuloErtekelesGridHelperCo.EgyszerAdhatoErtekelesTipusIds)}";
}
else if (!string.IsNullOrWhiteSpace(tanuloErtekelesGridItem.MagatartasSzoveg) || !string.IsNullOrWhiteSpace(tanuloErtekelesGridItem.SzorgalomSzoveg))
{
string magatartasSzoveg;
if (string.IsNullOrWhiteSpace(tanuloErtekelesGridItem.MagatartasSzoveg))
{
magatartasSzoveg = "-";
}
else
{
magatartasSzoveg = string.IsNullOrWhiteSpace(tanuloErtekelesGridItem.MagatartasSzovegRovidNev) ? "sz" : HttpUtility.HtmlEncode(tanuloErtekelesGridItem.MagatartasSzovegRovidNev);
}
string szorgalomSzoveg;
if (string.IsNullOrWhiteSpace(tanuloErtekelesGridItem.SzorgalomSzoveg))
{
szorgalomSzoveg = "-";
}
else
{
szorgalomSzoveg = string.IsNullOrWhiteSpace(tanuloErtekelesGridItem.SzorgalomSzovegRovidNev) ? "sz" : HttpUtility.HtmlEncode(tanuloErtekelesGridItem.SzorgalomSzovegRovidNev);
}
tanuloErtekelesText = $"{magatartasSzoveg}<br/>{szorgalomSzoveg}";
tanuloErtekelesShortText = $"{magatartasSzoveg}/{szorgalomSzoveg}";
}
else if (tanuloErtekelesGridItem.MagatartasErtekId.IsEntityId() || tanuloErtekelesGridItem.SzorgalomErtekId.IsEntityId())
{
tanuloErtekelesText = $"{GetMagatartasErtek(tanuloErtekelesGridItem.MagatartasErtekId, tanuloErtekelesGridHelperCo.TanevId)}<br/>{GetSzorgalomErtek(tanuloErtekelesGridItem.SzorgalomErtekId, tanuloErtekelesGridHelperCo.TanevId)}";
tanuloErtekelesShortText = $"{GetMagatartasErtekShort(tanuloErtekelesGridItem.MagatartasErtekId)}/{GetSzorgalomErtekShort(tanuloErtekelesGridItem.SzorgalomErtekId)}";
}
else
{
var ex = new KretaException(ErrorResource.HibaTortentAMuveletKozben);
SDAServer.Instance.Logger.ExceptionThrown(ex);
throw ex;
}
}
return (tanuloErtekelesText, tanuloErtekelesShortText);
}
private static string GetTanuloErtekelesSpanClass(bool isMainGrid, int? tanuloId, bool modosithato)
{
var classSb = new StringBuilder("kendoTooltip tanuloErtekelesKendoTooltip");
if (!isMainGrid && tanuloId.IsEntityId())
{
classSb.Append("_" + tanuloId);
}
if (modosithato)
{
classSb.Append(" clickable");
}
return classSb.ToString();
}
private static string GetTanuloErtekelesText(DataRow dataRow, int tanevId, bool pErtekelesTextTemaval = false)
{
var isMagatartasSzorgalom = SDAConvert.ToBoolean(dataRow["IsMagatartasSzorgalom_BOOL"]);
string tanuloErtekelesText;
if (!isMagatartasSzorgalom)
{
tanuloErtekelesText = GetErtekelesText(dataRow, tanevId);
}
else
{
var magatartasText = GetMagatartasText(dataRow, tanevId);
var szorgalomText = GetSzorgalomText(dataRow, tanevId);
tanuloErtekelesText = string.Format(TanuloErtekelesResource.MagatartasSzorgalomText, magatartasText, szorgalomText);
}
var ertekelesTema = dataRow["ErtekelesTema"].ToString();
tanuloErtekelesText += !string.IsNullOrWhiteSpace(ertekelesTema) && pErtekelesTextTemaval ? " - " + ertekelesTema : string.Empty;
return tanuloErtekelesText;
}
private static string GetErtekelesText(DataRow dataRow, int tanevId)
{
string ertekelesText;
if (SDAConvert.ToNullableInt32(dataRow["ErtekelesOsztalyzatId"]).IsEntityId())
{
ertekelesText = SDAConvert.ToNullableInt32(dataRow["TantargyKategoriaId"]) == (int)TargyKategoriaTipusEnum.Szorgalom ?
GetOsztalyzatTextSzorgalom(SDAConvert.ToInt32(dataRow["ErtekelesOsztalyzatId"]), tanevId) :
GetOsztalyzatText(SDAConvert.ToInt32(dataRow["ErtekelesOsztalyzatId"]), tanevId);
}
else if (!string.IsNullOrWhiteSpace(dataRow["ErtekelesSzoveg"].ToString()))
{
var ertekelesFormazott = dataRow["ErtekelesSzovegFormazott"].ToString();
ertekelesText = !string.IsNullOrWhiteSpace(ertekelesFormazott) ?
ertekelesFormazott :
dataRow["ErtekelesSzoveg"].ToString();
}
else if (!string.IsNullOrWhiteSpace(dataRow["ErtekelesSzazalek"].ToString()))
{
ertekelesText = SDAConvert.ToInt32(dataRow["ErtekelesSzazalek"]) + "%";
}
else
{
var ex = new KretaException(ErrorResource.HibaTortentAMuveletKozben);
SDAServer.Instance.Logger.ExceptionThrown(ex);
throw ex;
}
return ertekelesText;
}
private static string GetMagatartasText(DataRow dataRow, int tanevId)
{
string magatartasText = string.Empty;
if (SDAConvert.ToNullableInt32(dataRow["MagatartasOsztalyzatId"]).IsEntityId() || SDAConvert.ToNullableInt32(dataRow["SzorgalomOsztalyzatId"]).IsEntityId())
{
if (SDAConvert.ToNullableInt32(dataRow["MagatartasOsztalyzatId"]).IsEntityId())
{
magatartasText = GetOsztalyzatText(SDAConvert.ToInt32(dataRow["MagatartasOsztalyzatId"]), tanevId);
}
}
else if (!string.IsNullOrWhiteSpace(dataRow["MagatartasSzoveg"].ToString()) || !string.IsNullOrWhiteSpace(dataRow["SzorgalomSzoveg"].ToString()))
{
if (!string.IsNullOrWhiteSpace(dataRow["MagatartasSzoveg"].ToString()))
{
var magatartasFormazott = dataRow["MagatartasSzovegFormazott"].ToString();
magatartasText = !string.IsNullOrWhiteSpace(magatartasFormazott) ?
magatartasFormazott :
dataRow["MagatartasSzoveg"].ToString();
}
}
else if (SDAConvert.ToNullableInt32(dataRow["MagatartasErtekId"]).IsEntityId() || SDAConvert.ToNullableInt32(dataRow["SzorgalomErtekId"]).IsEntityId())
{
if (SDAConvert.ToNullableInt32(dataRow["MagatartasErtekId"]).IsEntityId())
{
magatartasText = GetMagatartasErtek(SDAConvert.ToInt32(dataRow["MagatartasErtekId"]), tanevId);
}
}
else
{
var ex = new KretaException(ErrorResource.HibaTortentAMuveletKozben);
SDAServer.Instance.Logger.ExceptionThrown(ex);
throw ex;
}
return magatartasText;
}
private static string GetSzorgalomText(DataRow dataRow, int tanevId)
{
string szorgalomText = string.Empty;
if (SDAConvert.ToNullableInt32(dataRow["MagatartasOsztalyzatId"]).IsEntityId() || SDAConvert.ToNullableInt32(dataRow["SzorgalomOsztalyzatId"]).IsEntityId())
{
if (SDAConvert.ToNullableInt32(dataRow["SzorgalomOsztalyzatId"]).IsEntityId())
{
szorgalomText = GetOsztalyzatText(SDAConvert.ToInt32(dataRow["SzorgalomOsztalyzatId"]), tanevId);
}
}
else if (!string.IsNullOrWhiteSpace(dataRow["MagatartasSzoveg"].ToString()) || !string.IsNullOrWhiteSpace(dataRow["SzorgalomSzoveg"].ToString()))
{
if (!string.IsNullOrWhiteSpace(dataRow["SzorgalomSzoveg"].ToString()))
{
var szorgalomFormazott = dataRow["SzorgalomSzovegFormazott"].ToString();
szorgalomText = !string.IsNullOrWhiteSpace(szorgalomFormazott) ?
szorgalomFormazott :
dataRow["SzorgalomSzoveg"].ToString();
}
}
else if (SDAConvert.ToNullableInt32(dataRow["MagatartasErtekId"]).IsEntityId() || SDAConvert.ToNullableInt32(dataRow["SzorgalomErtekId"]).IsEntityId())
{
if (SDAConvert.ToNullableInt32(dataRow["SzorgalomErtekId"]).IsEntityId())
{
szorgalomText = GetSzorgalomErtek(SDAConvert.ToInt32(dataRow["SzorgalomErtekId"]), tanevId);
}
}
else
{
var ex = new KretaException(ErrorResource.HibaTortentAMuveletKozben);
SDAServer.Instance.Logger.ExceptionThrown(ex);
throw ex;
}
return szorgalomText;
}
private static string GetToolTipStyle(int tipusId, int? ertekelesModId, Dictionary<int, ErtekelesModCo> ertekelesModDictionary)
{
string result;
switch (tipusId)
{
case (int)ErtekelesTipusEnum.evkozi_jegy_ertekeles:
result = GetJegyStyle(ertekelesModId, ertekelesModDictionary, TanuloErtekelesColorCodes.Evkozi);
break;
case (int)ErtekelesTipusEnum.felevi_jegy_ertekeles:
result = GetJegyStyle(ertekelesModId, ertekelesModDictionary, TanuloErtekelesColorCodes.Felevi);
break;
case (int)ErtekelesTipusEnum.evvegi_jegy_ertekeles:
result = GetJegyStyle(ertekelesModId, ertekelesModDictionary, TanuloErtekelesColorCodes.Evvegi);
break;
case (int)ErtekelesTipusEnum.I_ne_jegy_ertekeles:
result = GetJegyStyle(ertekelesModId, ertekelesModDictionary, TanuloErtekelesColorCodes.I_Ne);
break;
case (int)ErtekelesTipusEnum.II_ne_jegy_ertekeles:
result = GetJegyStyle(ertekelesModId, ertekelesModDictionary, TanuloErtekelesColorCodes.II_Ne);
break;
case (int)ErtekelesTipusEnum.III_ne_jegy_ertekeles:
result = GetJegyStyle(ertekelesModId, ertekelesModDictionary, TanuloErtekelesColorCodes.III_Ne);
break;
case (int)ErtekelesTipusEnum.IV_ne_jegy_ertekeles:
result = GetJegyStyle(ertekelesModId, ertekelesModDictionary, TanuloErtekelesColorCodes.IV_Ne);
break;
case (int)ErtekelesTipusEnum.modulzaro_vizsga:
result = GetJegyStyle(ertekelesModId, ertekelesModDictionary, TanuloErtekelesColorCodes.Modulzaro);
break;
case (int)ErtekelesTipusEnum.potvizsga:
result = GetJegyStyle(ertekelesModId, ertekelesModDictionary, TanuloErtekelesColorCodes.Potvizsga);
break;
case (int)ErtekelesTipusEnum.osztalyozo_vizsga:
result = GetJegyStyle(ertekelesModId, ertekelesModDictionary, TanuloErtekelesColorCodes.Osztalyozo);
break;
case (int)ErtekelesTipusEnum.kulonbozeti_vizsga:
result = GetJegyStyle(ertekelesModId, ertekelesModDictionary, TanuloErtekelesColorCodes.Kulonbozeti);
break;
case (int)ErtekelesTipusEnum.na:
result = GetJegyStyle(ertekelesModId, ertekelesModDictionary, TanuloErtekelesColorCodes.Na);
break;
default:
result = GetJegyStyle(ertekelesModId, ertekelesModDictionary, TanuloErtekelesColorCodes.Na);
break;
}
return result;
}
private static string GetTanuloErtekelesStyle(int tipusId, int? ertekelesModId, Dictionary<int, ErtekelesModCo> ertekelesModDictionary)
{
string result;
switch (tipusId)
{
case (int)ErtekelesTipusEnum.evkozi_jegy_ertekeles:
result = GetJegyStyle(ertekelesModId, ertekelesModDictionary, TanuloErtekelesColorCodes.Evkozi);
break;
case (int)ErtekelesTipusEnum.felevi_jegy_ertekeles:
result = GetJegyStyle(ertekelesModId, ertekelesModDictionary, TanuloErtekelesColorCodes.Felevi, isBackgrouded: true);
break;
case (int)ErtekelesTipusEnum.evvegi_jegy_ertekeles:
result = GetJegyStyle(ertekelesModId, ertekelesModDictionary, TanuloErtekelesColorCodes.Evvegi, isBackgrouded: true);
break;
case (int)ErtekelesTipusEnum.I_ne_jegy_ertekeles:
result = GetJegyStyle(ertekelesModId, ertekelesModDictionary, TanuloErtekelesColorCodes.I_Ne, isBackgrouded: true);
break;
case (int)ErtekelesTipusEnum.II_ne_jegy_ertekeles:
result = GetJegyStyle(ertekelesModId, ertekelesModDictionary, TanuloErtekelesColorCodes.II_Ne, isBackgrouded: true);
break;
case (int)ErtekelesTipusEnum.III_ne_jegy_ertekeles:
result = GetJegyStyle(ertekelesModId, ertekelesModDictionary, TanuloErtekelesColorCodes.III_Ne, isBackgrouded: true);
break;
case (int)ErtekelesTipusEnum.IV_ne_jegy_ertekeles:
result = GetJegyStyle(ertekelesModId, ertekelesModDictionary, TanuloErtekelesColorCodes.IV_Ne, isBackgrouded: true);
break;
case (int)ErtekelesTipusEnum.modulzaro_vizsga:
result = GetJegyStyle(ertekelesModId, ertekelesModDictionary, TanuloErtekelesColorCodes.Modulzaro, isBordered: true);
break;
case (int)ErtekelesTipusEnum.potvizsga:
result = GetJegyStyle(ertekelesModId, ertekelesModDictionary, TanuloErtekelesColorCodes.Potvizsga, isBordered: true);
break;
case (int)ErtekelesTipusEnum.osztalyozo_vizsga:
result = GetJegyStyle(ertekelesModId, ertekelesModDictionary, TanuloErtekelesColorCodes.Osztalyozo, isBordered: true);
break;
case (int)ErtekelesTipusEnum.kulonbozeti_vizsga:
result = GetJegyStyle(ertekelesModId, ertekelesModDictionary, TanuloErtekelesColorCodes.Kulonbozeti, isBordered: true);
break;
case (int)ErtekelesTipusEnum.na:
result = GetJegyStyle(ertekelesModId, ertekelesModDictionary, TanuloErtekelesColorCodes.Na, isBordered: true);
break;
default:
result = GetJegyStyle(ertekelesModId, ertekelesModDictionary, TanuloErtekelesColorCodes.Na);
break;
}
return result;
}
private static string GetJegyStyle(int? ertekelesModId, Dictionary<int, ErtekelesModCo> ertekelesModDictionary, string defaultColor, bool isBackgrouded = false, bool isBordered = false)
{
string colorCode = defaultColor;
bool isBold = false;
if (ertekelesModId.IsEntityId())
{
colorCode = ertekelesModDictionary[ertekelesModId.Value].Color;
isBold = ertekelesModDictionary[ertekelesModId.Value].IsBold;
}
string style = isBackgrouded ? $"color: #FFFFFF; background-color: #{colorCode}; " : $"color: #{colorCode}; ";
style += isBordered ? $"padding: 0px 2px 0px 2px; border: solid 1px #{colorCode}; " : "padding: 1px 3px 1px 3px; ";
if (isBold)
{
style += " font-weight: bold; ";
}
return style;
}
public static string GetOsztalyzatText(int? osztalyzat, int tanevId)
{
switch (osztalyzat)
{
case (int)OsztalyzatTipusEnum.elegtelen_1_:
return OsztalyzatTipusEnum.elegtelen_1_.GetDisplayName(tanevId);
case (int)OsztalyzatTipusEnum.elegseges_2_:
return OsztalyzatTipusEnum.elegseges_2_.GetDisplayName(tanevId);
case (int)OsztalyzatTipusEnum.kozepes_3_:
return OsztalyzatTipusEnum.kozepes_3_.GetDisplayName(tanevId);
case (int)OsztalyzatTipusEnum.jo_4_:
return OsztalyzatTipusEnum.jo_4_.GetDisplayName(tanevId);
case (int)OsztalyzatTipusEnum.jeles_5_:
return OsztalyzatTipusEnum.jeles_5_.GetDisplayName(tanevId);
default:
return "-";
}
}
public static string GetOsztalyzatTextSzorgalom(int? osztalyzat, int tanevId)
{
switch (osztalyzat)
{
case (int)OsztalyzatTipusEnum.elegtelen_1_:
return OsztalyzatTipusEnum.elegtelen_1_.GetDisplayName(tanevId);
case (int)OsztalyzatTipusEnum.elegseges_2_:
return TanuloErtekelesResource.HanyagFullText;
case (int)OsztalyzatTipusEnum.kozepes_3_:
return TanuloErtekelesResource.ValtozoFullText;
case (int)OsztalyzatTipusEnum.jo_4_:
return TanuloErtekelesResource.JoFullText;
case (int)OsztalyzatTipusEnum.jeles_5_:
return TanuloErtekelesResource.PeldasFullText;
default:
return "-";
}
}
public static string GetMagatartasErtek(int? magatartasErtekId, int tanevId)
{
switch (magatartasErtekId)
{
case (int)MagatartasErtekelesTipusEnum.rossz:
return MagatartasErtekelesTipusEnum.rossz.GetDisplayName(tanevId);
case (int)MagatartasErtekelesTipusEnum.valtozo:
return MagatartasErtekelesTipusEnum.valtozo.GetDisplayName(tanevId);
case (int)MagatartasErtekelesTipusEnum.jo:
return MagatartasErtekelesTipusEnum.jo.GetDisplayName(tanevId);
case (int)MagatartasErtekelesTipusEnum.peldas:
return MagatartasErtekelesTipusEnum.peldas.GetDisplayName(tanevId);
default:
return "-";
}
}
private static string GetMagatartasErtekShort(int? magatartasErtekId)
{
switch (magatartasErtekId)
{
case (int)MagatartasErtekelesTipusEnum.rossz:
return "R";
case (int)MagatartasErtekelesTipusEnum.valtozo:
return "V";
case (int)MagatartasErtekelesTipusEnum.jo:
return "J";
case (int)MagatartasErtekelesTipusEnum.peldas:
return "P";
default:
return "-";
}
}
public static string GetSzorgalomErtek(int? szorgalomErtekId, int tanevId)
{
switch (szorgalomErtekId)
{
case (int)SzorgalomErtekelesTipusEnum.hanyag:
return SzorgalomErtekelesTipusEnum.hanyag.GetDisplayName(tanevId);
case (int)SzorgalomErtekelesTipusEnum.valtozo:
return SzorgalomErtekelesTipusEnum.valtozo.GetDisplayName(tanevId);
case (int)SzorgalomErtekelesTipusEnum.jo:
return SzorgalomErtekelesTipusEnum.jo.GetDisplayName(tanevId);
case (int)SzorgalomErtekelesTipusEnum.peldas:
return SzorgalomErtekelesTipusEnum.peldas.GetDisplayName(tanevId);
default:
return "-";
}
}
private static string GetSzorgalomErtekShort(int? szorgalomErtekId)
{
switch (szorgalomErtekId)
{
case (int)SzorgalomErtekelesTipusEnum.hanyag:
return "H";
case (int)SzorgalomErtekelesTipusEnum.valtozo:
return "V";
case (int)SzorgalomErtekelesTipusEnum.jo:
return "J";
case (int)SzorgalomErtekelesTipusEnum.peldas:
return "P";
default:
return "-";
}
}
private static void SetTanuloErtekelesHaviAtlagColumns(DataTable gridDataTable)
{
gridDataTable.Columns.Add(new DataColumn(TanuloErtekelesHaviAtlagColumnNames.Szeptember_HaviAtlag, typeof(string)));
gridDataTable.Columns.Add(new DataColumn(TanuloErtekelesHaviAtlagColumnNames.Oktober_HaviAtlag, typeof(string)));
gridDataTable.Columns.Add(new DataColumn(TanuloErtekelesHaviAtlagColumnNames.November_HaviAtlag, typeof(string)));
gridDataTable.Columns.Add(new DataColumn(TanuloErtekelesHaviAtlagColumnNames.December_HaviAtlag, typeof(string)));
gridDataTable.Columns.Add(new DataColumn(TanuloErtekelesHaviAtlagColumnNames.JanuarI_HaviAtlag, typeof(string)));
gridDataTable.Columns.Add(new DataColumn(TanuloErtekelesHaviAtlagColumnNames.I_HaviAtlag, typeof(string)));
gridDataTable.Columns.Add(new DataColumn(TanuloErtekelesHaviAtlagColumnNames.JanuarII_HaviAtlag, typeof(string)));
gridDataTable.Columns.Add(new DataColumn(TanuloErtekelesHaviAtlagColumnNames.Februar_HaviAtlag, typeof(string)));
gridDataTable.Columns.Add(new DataColumn(TanuloErtekelesHaviAtlagColumnNames.Marcius_HaviAtlag, typeof(string)));
gridDataTable.Columns.Add(new DataColumn(TanuloErtekelesHaviAtlagColumnNames.Aprilis_HaviAtlag, typeof(string)));
gridDataTable.Columns.Add(new DataColumn(TanuloErtekelesHaviAtlagColumnNames.Majus_HaviAtlag, typeof(string)));
gridDataTable.Columns.Add(new DataColumn(TanuloErtekelesHaviAtlagColumnNames.Junius_HaviAtlag, typeof(string)));
gridDataTable.Columns.Add(new DataColumn(TanuloErtekelesHaviAtlagColumnNames.II_HaviAtlag, typeof(string)));
}
private static void SetTanuloErtekelesHaviAtlagValues(TanuloErtekelesGridHelperCo tanuloErtekelesGridHelperCo, DataRow gridDataRow, TanuloErtekelesBaseGridRowCo tanuloErtekelesGridRow)
{
if (!tanuloErtekelesGridRow.IsMagatartasSzorgalom)
{
gridDataRow.SetField(TanuloErtekelesHaviAtlagColumnNames.Szeptember_HaviAtlag, AddTanuloErtelelesekHaviAtlagJson(tanuloErtekelesGridHelperCo, tanuloErtekelesGridRow.Szeptember));
gridDataRow.SetField(TanuloErtekelesHaviAtlagColumnNames.Oktober_HaviAtlag, AddTanuloErtelelesekHaviAtlagJson(tanuloErtekelesGridHelperCo, tanuloErtekelesGridRow.Oktober));
gridDataRow.SetField(TanuloErtekelesHaviAtlagColumnNames.November_HaviAtlag, AddTanuloErtelelesekHaviAtlagJson(tanuloErtekelesGridHelperCo, tanuloErtekelesGridRow.November));
gridDataRow.SetField(TanuloErtekelesHaviAtlagColumnNames.December_HaviAtlag, AddTanuloErtelelesekHaviAtlagJson(tanuloErtekelesGridHelperCo, tanuloErtekelesGridRow.December));
gridDataRow.SetField(TanuloErtekelesHaviAtlagColumnNames.JanuarI_HaviAtlag, AddTanuloErtelelesekHaviAtlagJson(tanuloErtekelesGridHelperCo, tanuloErtekelesGridRow.JanuarI));
var iTanuloErtekelesGridRow = tanuloErtekelesGridRow.I == null ? new List<TanuloErtekelesGridItemCo>() : new List<TanuloErtekelesGridItemCo> { tanuloErtekelesGridRow.I };
gridDataRow.SetField(TanuloErtekelesHaviAtlagColumnNames.I_HaviAtlag, AddTanuloErtelelesekHaviAtlagJson(tanuloErtekelesGridHelperCo, iTanuloErtekelesGridRow));
gridDataRow.SetField(TanuloErtekelesHaviAtlagColumnNames.JanuarII_HaviAtlag, AddTanuloErtelelesekHaviAtlagJson(tanuloErtekelesGridHelperCo, tanuloErtekelesGridRow.JanuarII));
gridDataRow.SetField(TanuloErtekelesHaviAtlagColumnNames.Februar_HaviAtlag, AddTanuloErtelelesekHaviAtlagJson(tanuloErtekelesGridHelperCo, tanuloErtekelesGridRow.Februar));
gridDataRow.SetField(TanuloErtekelesHaviAtlagColumnNames.Marcius_HaviAtlag, AddTanuloErtelelesekHaviAtlagJson(tanuloErtekelesGridHelperCo, tanuloErtekelesGridRow.Marcius));
gridDataRow.SetField(TanuloErtekelesHaviAtlagColumnNames.Aprilis_HaviAtlag, AddTanuloErtelelesekHaviAtlagJson(tanuloErtekelesGridHelperCo, tanuloErtekelesGridRow.Aprilis));
gridDataRow.SetField(TanuloErtekelesHaviAtlagColumnNames.Majus_HaviAtlag, AddTanuloErtelelesekHaviAtlagJson(tanuloErtekelesGridHelperCo, tanuloErtekelesGridRow.Majus));
gridDataRow.SetField(TanuloErtekelesHaviAtlagColumnNames.Junius_HaviAtlag, AddTanuloErtelelesekHaviAtlagJson(tanuloErtekelesGridHelperCo, tanuloErtekelesGridRow.Junius));
var iiTanuloErtekelesGridRow = tanuloErtekelesGridRow.II == null ? new List<TanuloErtekelesGridItemCo>() : new List<TanuloErtekelesGridItemCo> { tanuloErtekelesGridRow.II };
gridDataRow.SetField(TanuloErtekelesHaviAtlagColumnNames.II_HaviAtlag, AddTanuloErtelelesekHaviAtlagJson(tanuloErtekelesGridHelperCo, iiTanuloErtekelesGridRow));
}
}
private static string AddTanuloErtelelesekHaviAtlagJson(TanuloErtekelesGridHelperCo tanuloErtekelesGridHelperCo, List<TanuloErtekelesGridItemCo> tanuloErtekelesGridItemList)
{
string result = null;
var tanuloErtekelesHaviAtlagJsonList = new List<(string Ertekeles, string Suly)>();
foreach (var tanuloErtekelesGridItem in tanuloErtekelesGridItemList.Where(e => e.ErtekelesOsztalyzatId.IsEntityId() && e.IsTanulmanyiAtlagbaNemSzamit == false && !HaviAtlagbaNemSzamitoErtekelesTipusIdList.Contains(e.TipusId)))
{
var ertekeles = GetOsztalyzatTextShort(tanuloErtekelesGridItem.ErtekelesOsztalyzatId, tanuloErtekelesGridHelperCo.EgyszerAdhatoErtekelesTipusIds);
var suly = "100";
if (tanuloErtekelesGridItem.Suly != null && tanuloErtekelesGridItem.TipusId == (int)ErtekelesTipusEnum.evkozi_jegy_ertekeles)
{
suly = tanuloErtekelesGridItem.Suly.ToString();
}
tanuloErtekelesHaviAtlagJsonList.Add((ertekeles, suly));
}
if (tanuloErtekelesHaviAtlagJsonList.Any())
{
var jsonFormat = "{{ \"haviAtlagErtekek\": [{0}] }}";
var jsonList = tanuloErtekelesHaviAtlagJsonList.Select(e => $"{{ \"ertekeles\": {e.Ertekeles}, \"suly\": {e.Suly} }}");
result = string.Format(jsonFormat, string.Join(",", jsonList));
}
return result;
}
}
}