134 lines
4.5 KiB
C#
134 lines
4.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using Kreta.BusinessLogic.Classes;
|
|
using Kreta.BusinessLogic.HelperClasses;
|
|
using Kreta.Core.ConnectionType;
|
|
using Kreta.DataAccessManual;
|
|
using Kreta.Enums;
|
|
|
|
namespace Kreta.BusinessLogic.Helpers
|
|
{
|
|
public class NaptariNapHelper : LogicBase
|
|
{
|
|
public NaptariNapHelper(IConnectionType connectionType) : base(connectionType) { }
|
|
|
|
public bool IsTanitasiNap(DateTime datum)
|
|
{
|
|
return Dal.CustomConnection.Run(ConnectionType, (h) =>
|
|
{
|
|
var dal = h.NaptariNap();
|
|
return dal.IsTanitasiNap(datum, GetTanitasiNapIdList(), TanevId);
|
|
});
|
|
}
|
|
|
|
/// INFO @DevKornel: Mobil használja
|
|
public int? GetNaptariNapId(DateTime datum)
|
|
{
|
|
return Dal.CustomConnection.Run(ConnectionType, (h) =>
|
|
{
|
|
var dal = h.NaptariNap();
|
|
return dal.GetNaptariNapId(datum);
|
|
});
|
|
}
|
|
|
|
public Dictionary<int, string> GetNaplozottOrakTanarai(int? naptariNapId)
|
|
{
|
|
var ds = Dal.CustomConnection.Run(ConnectionType, (h) =>
|
|
{
|
|
var dal = h.NaptariNap();
|
|
return dal.GetNaplozottOrakTanarai(naptariNapId);
|
|
});
|
|
|
|
var result = new Dictionary<int, string>();
|
|
if (ds == null)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
foreach (DataRow row in ds.Tables[0].Rows)
|
|
{
|
|
result.Add(row.Field<int>("ID"), row.Field<string>("Nev"));
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
public Dictionary<int, string> GetNaplozottOrakTanarai(DateTime? datum)
|
|
{
|
|
return GetNaplozottOrakTanarai(GetNaptariNapId(datum.Value));
|
|
}
|
|
|
|
public List<int> GetTanitasiNapIdList()
|
|
{
|
|
var tanitasiNapIdList = new List<int>
|
|
{
|
|
(int)NapTipusEnum.tanitasi_nap,
|
|
(int)NapTipusEnum.roviditett_orakat_tartalmazo_tanitasi_nap,
|
|
(int)NapTipusEnum.elso_tanitasi_nap,
|
|
(int)NapTipusEnum.utolso_tanitasi_nap,
|
|
(int)NapTipusEnum.elso_felev_vege,
|
|
(int)NapTipusEnum.vizsganap,
|
|
(int)NapTipusEnum.utolso_tanitasi_nap_a_vegzos_evfolyamokon,
|
|
(int)NapTipusEnum.I_negyedev_vege,
|
|
(int)NapTipusEnum.III_negyedev_vege,
|
|
(int)NapTipusEnum.RendkivuliTanitasiNap,
|
|
(int)NapTipusEnum.Nyilt_nap
|
|
};
|
|
|
|
return tanitasiNapIdList;
|
|
}
|
|
|
|
public DataSet GetNaptariNapData(DateTime datum)
|
|
{
|
|
return Dal.CustomConnection.Run(ConnectionType, (h) =>
|
|
{
|
|
var dal = h.NaptariNap();
|
|
return dal.GetNaptariNapData(datum, TanevId);
|
|
});
|
|
}
|
|
|
|
public bool GetIsEgyediNapByDate(DateTime datum)
|
|
{
|
|
return Dal.CustomConnection.Run(ConnectionType, (h) =>
|
|
{
|
|
var dal = h.NaptariNap();
|
|
return dal.GetIsEgyediNapByDate(datum, TanevId);
|
|
});
|
|
}
|
|
|
|
public DataSet GetNapTipusData(int naptipus)
|
|
{
|
|
return Dal.CustomConnection.Run(ConnectionType, (h) =>
|
|
{
|
|
var dal = h.NaptariNap();
|
|
return dal.GetNapTipusData(naptipus, TanevId);
|
|
});
|
|
}
|
|
|
|
public bool GetIsEgyediNapByDateAndOsztalyCsoportId(DateTime datum, int osztalyCsoportId)
|
|
{
|
|
return Dal.CustomConnection.Run(ConnectionType, h =>
|
|
{
|
|
var dal = h.NaptariNap();
|
|
return dal.GetIsEgyediNapByDateAndOsztalyCsoportId(datum, TanevId, osztalyCsoportId);
|
|
});
|
|
}
|
|
|
|
public EgyediNapCo GetIsEgyediNapByDateAndOsztalyCsoportNev(DateTime datum, string osztalyCsoportNev)
|
|
{
|
|
return Dal.CustomConnection.Run(ConnectionType, h =>
|
|
{
|
|
var dal = h.NaptariNap();
|
|
var dataSet = dal.GetIsEgyediNapByDateAndOsztalyCsoportNev(datum, TanevId, osztalyCsoportNev);
|
|
var dataRow = dataSet.Tables[0].Rows[0];
|
|
var result = new EgyediNapCo
|
|
{
|
|
IsEgyediNap = SDAConvert.ToBooleanFromTF(dataRow["IsEgyediNap"]),
|
|
HetNapjaTipusId = SDAConvert.ToNullableInt32(dataRow["HetNapjaTipusId"]),
|
|
};
|
|
return result;
|
|
});
|
|
}
|
|
}
|
|
}
|