init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
148
Kreta.BusinessLogic/Logic/Naplozas/NaplozasLogic.cs
Normal file
148
Kreta.BusinessLogic/Logic/Naplozas/NaplozasLogic.cs
Normal file
|
@ -0,0 +1,148 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Kreta.BusinessLogic.HelperClasses;
|
||||
using Kreta.BusinessLogic.Helpers;
|
||||
using Kreta.BusinessLogic.Helpers.SystemSettings;
|
||||
using Kreta.BusinessLogic.Interfaces;
|
||||
using Kreta.BusinessLogic.Logic.Naplozas.Elokeszites;
|
||||
using Kreta.BusinessLogic.Logic.Naplozas.Validacio;
|
||||
using Kreta.Client.CoreApi;
|
||||
using Kreta.Enums;
|
||||
|
||||
namespace Kreta.BusinessLogic.Logic.Naplozas
|
||||
{
|
||||
public class NaplozasLogic : NaplozasElokeszitesLogic
|
||||
{
|
||||
public NaplozasLogic(NaploValidacio validator, NaplozasCo input) : base(validator)
|
||||
{
|
||||
FillInnerModel(input);
|
||||
}
|
||||
|
||||
public NaplozasLogic(NaploValidacio validator, NaplozasMobilCo input) : base(validator)
|
||||
{
|
||||
FillInnerModel(input);
|
||||
}
|
||||
|
||||
private void FillInnerModel(NaplozasCo input)
|
||||
{
|
||||
Model = new NaplozasElokeszitesModel(ConnectionType.FelhasznaloId, input.SzervezetTipusId)
|
||||
{
|
||||
IsEgyediNaplozas = input.IsEgyediNaplozas
|
||||
};
|
||||
|
||||
var osztalyHelper = new OsztalyHelper(ConnectionType);
|
||||
var orarendiOraHelper = new OrarendiOraHelper(ConnectionType);
|
||||
var orarendHelper = new OrarendHelper(ConnectionType);
|
||||
|
||||
if (!Model.IsEgyediNaplozas)
|
||||
{
|
||||
var thelper = new TanoraHelper(ConnectionType);
|
||||
|
||||
var oraCo = thelper.GetTanoraByOrarendiId(input.OraAdat.TanitasiOraId ?? input.OraAdat.OrarendiOraId.Value, input.OraAdat.OraKezdete.Date, input.OraAdat.TanitasiOraId.HasValue, isTanuloOrGondviselo: false);
|
||||
|
||||
var systemSettingsHelper = new SystemSettingsHelper(ConnectionType);
|
||||
var helyettesitesEsetenFelugyeletAlapertelmezettenSorszamozando = systemSettingsHelper.GetSystemSettingValue<bool>(RendszerBeallitasTipusEnum.Helyettesites_eseten_felugyelet_alapertelmezetten_sorszamozando);
|
||||
|
||||
Model.OraAdat.Fill(oraCo, helyettesitesEsetenFelugyeletAlapertelmezettenSorszamozando);
|
||||
Model.OraAdat.Fill(input);
|
||||
|
||||
SetTantargyOsztalycsoport();
|
||||
SetOsztalyfonok(osztalyHelper);
|
||||
SetElozoOraAdatai(orarendiOraHelper);
|
||||
SetTemaLista(thelper);
|
||||
SetMentessegList(orarendHelper);
|
||||
|
||||
Model.OraTulajdonsag.Fill(input);
|
||||
|
||||
Model.Helyettesites.Fill(oraCo);
|
||||
Model.Helyettesites.Fill(input, Model.IsEgyediNaplozas);
|
||||
|
||||
Model.Hazifeladat.Fill(input);
|
||||
Model.Mulasztas.Fill(input, Model.MaxKeses);
|
||||
}
|
||||
else
|
||||
{
|
||||
Model.OraAdat.Fill(input);
|
||||
Model.OraTulajdonsag.Fill(input);
|
||||
Model.Helyettesites.Fill(input, Model.IsEgyediNaplozas);
|
||||
SetTantargyOsztalycsoport();
|
||||
SetOsztalyfonok(osztalyHelper);
|
||||
SetElozoOraAdatai(orarendiOraHelper);
|
||||
SetMentessegList(orarendHelper);
|
||||
|
||||
Model.Hazifeladat.Fill(input);
|
||||
Model.Mulasztas.Fill(input, Model.MaxKeses);
|
||||
}
|
||||
}
|
||||
|
||||
private void FillInnerModel(NaplozasMobilCo input)
|
||||
{
|
||||
var thelper = new TanoraHelper(ConnectionType);
|
||||
|
||||
var oraCo = thelper.GetTanoraByOrarendiId(input.OraAdat.TanitasiOraId ?? input.OraAdat.OrarendiOraId.Value, input.OraAdat.Datum, input.OraAdat.TanitasiOraId.HasValue, isTanuloOrGondviselo: false);
|
||||
|
||||
Model = new NaplozasElokeszitesModel(ConnectionType.FelhasznaloId);
|
||||
|
||||
var systemSettingsHelper = new SystemSettingsHelper(ConnectionType);
|
||||
var helyettesitesEsetenFelugyeletAlapertelmezettenSorszamozando = systemSettingsHelper.GetSystemSettingValue<bool>(RendszerBeallitasTipusEnum.Helyettesites_eseten_felugyelet_alapertelmezetten_sorszamozando);
|
||||
|
||||
Model.OraAdat.Fill(oraCo, helyettesitesEsetenFelugyeletAlapertelmezettenSorszamozando);
|
||||
Model.OraAdat.Fill(input);
|
||||
|
||||
SetOsztalyfonok(new OsztalyHelper(ConnectionType));
|
||||
SetElozoOraAdatai(new OrarendiOraHelper(ConnectionType));
|
||||
SetTemaLista(thelper);
|
||||
SetMentessegList(new OrarendHelper(ConnectionType));
|
||||
|
||||
Model.OraTulajdonsag.Fill(oraCo);
|
||||
Model.Helyettesites.Fill(oraCo);
|
||||
|
||||
Model.Hazifeladat.Fill(input);
|
||||
Model.Mulasztas.Fill(ConnectionType, input, Model.MaxKeses, Model.OraAdat.TanitasiOraId);
|
||||
}
|
||||
|
||||
/// INFO @DevKornel: Mobil használja
|
||||
public NaplozasResultCo SaveNaplozas(IFileServiceHelper fileServiceHelper, ICoreApiClient coreApiClient)
|
||||
{
|
||||
if (Model.OraAdat.IsMobilNaplozott)
|
||||
{
|
||||
Validator.MobilValidateModel(Model);
|
||||
}
|
||||
else if (!Model.IsElmaradtOra)
|
||||
{
|
||||
Validator.ValidateModel(Model);
|
||||
}
|
||||
|
||||
var tanoraCo = new TanoraCO();
|
||||
Model.ConvertTo(tanoraCo);
|
||||
|
||||
//Ha van órarendióra akkor nem számít mi jön a felületről az óra kezdete és vége az órarendiórában lévő érték lesz
|
||||
if (Model.OraAdat.OrarendiOraId.HasValue)
|
||||
{
|
||||
var oo = new OrarendiOraHelper(ConnectionType).GetOrarendiOraById(Model.OraAdat.OrarendiOraId.Value);
|
||||
|
||||
var tsKezd = new TimeSpan(oo.OraKezdete.Hour, oo.OraKezdete.Minute, 0);
|
||||
var tsVeg = new TimeSpan(oo.OraVege.Hour, oo.OraVege.Minute, 0);
|
||||
tanoraCo.OraKezd = tanoraCo.OraKezd.Date + tsKezd;
|
||||
tanoraCo.OraVeg = tanoraCo.OraVeg.Date + tsVeg;
|
||||
}
|
||||
|
||||
var mulasztasCoList = new List<MulasztasokCo>();
|
||||
Model.ConvertTo(mulasztasCoList);
|
||||
|
||||
return new TanoraHelper(ConnectionType).TanoraNaplozas(tanoraCo, mulasztasCoList, fileServiceHelper, coreApiClient);
|
||||
}
|
||||
|
||||
public void SaveNemMegtartottNaplozas(IFileServiceHelper fileServiceHelper, ICoreApiClient coreApiClient)
|
||||
{
|
||||
Model.OraAdat.IsElmaradt = true;
|
||||
SaveNaplozas(fileServiceHelper, coreApiClient);
|
||||
}
|
||||
|
||||
public void NaplozasValidacio()
|
||||
{
|
||||
Validator.NaplozasDatumValidacio(Model);
|
||||
Validator.LezartNaploValidacio(Model);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue