init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
143
Kreta.BusinessLogic/Helpers/GondviseloHelper.cs
Normal file
143
Kreta.BusinessLogic/Helpers/GondviseloHelper.cs
Normal file
|
@ -0,0 +1,143 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using Kreta.BusinessLogic.Classes;
|
||||
using Kreta.BusinessLogic.HelperClasses;
|
||||
using Kreta.Core;
|
||||
using Kreta.Core.ConnectionType;
|
||||
using Kreta.DataAccessManual;
|
||||
using SDA.Kreta.Entities;
|
||||
|
||||
namespace Kreta.BusinessLogic.Helpers
|
||||
{
|
||||
public class GondviseloHelper : LogicBase
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
public GondviseloHelper(IConnectionType connectionType) : base(connectionType) { }
|
||||
|
||||
#endregion Constructors
|
||||
|
||||
public List<GondviseloItemCo> GetGondviseloCoList()
|
||||
{
|
||||
DataSet dataSet = Dal.CustomConnection.Run(ConnectionType, dalHandler => dalHandler.Gondviselo().GetGondviseloDataSet(TanevId));
|
||||
|
||||
var gondviseloItemCoList = new List<GondviseloItemCo>();
|
||||
foreach (DataRow dataRow in dataSet.Tables[0].Rows)
|
||||
{
|
||||
GondviseloItemCo gondviseloItemCo;
|
||||
int gondviseloId = SDAConvert.ToInt32(dataRow["Id"]);
|
||||
//NOTE: Csak akkor adunk hozzá új gondviselőt a listához, ha még nincs a listában, különben a már benne lévővel dolgozunk tovább!
|
||||
// Erre azért van szükség, mert a left join-ok miatt többször visszajöhet!
|
||||
if (gondviseloItemCoList.All(x => x.Id != gondviseloId))
|
||||
{
|
||||
gondviseloItemCo = new GondviseloItemCo(dataRow, TanevId);
|
||||
gondviseloItemCoList.Add(gondviseloItemCo);
|
||||
}
|
||||
else
|
||||
{
|
||||
gondviseloItemCo = gondviseloItemCoList.Single(x => x.Id == gondviseloId);
|
||||
}
|
||||
|
||||
int? cimId = SDAConvert.ToNullableInt32(dataRow["CimId"]);
|
||||
//NOTE: Csak akkor adjuk hozzá a gondviselőhöz az címet, ha az létezik és még nincs hozzáadva korábban!
|
||||
// Erre azért van szükség, mert a left join-ok miatt többször visszajöhet!
|
||||
if (cimId.IsEntityId() && gondviseloItemCo.CimList.All(x => x.Id != cimId.Value))
|
||||
{
|
||||
var cimItemCo = new CimItemCo(gondviseloItemCo, dataRow);
|
||||
gondviseloItemCo.CimList.Add(cimItemCo);
|
||||
}
|
||||
|
||||
int? emailId = SDAConvert.ToNullableInt32(dataRow["EmailId"]);
|
||||
//NOTE: Csak akkor adjuk hozzá a gondviselőhöz az email-t, ha az létezik és még nincs hozzáadva korábban!
|
||||
// Erre azért van szükség, mert a left join-ok miatt többször visszajöhet!
|
||||
if (emailId.IsEntityId() && gondviseloItemCo.EmailList.All(x => x.Id != emailId.Value))
|
||||
{
|
||||
var emailItemCo = new EmailItemCo(gondviseloItemCo, dataRow);
|
||||
gondviseloItemCo.EmailList.Add(emailItemCo);
|
||||
}
|
||||
|
||||
int? telefonId = SDAConvert.ToNullableInt32(dataRow["TelefonId"]);
|
||||
//NOTE: Csak akkor adjuk hozzá a gondviselőhöz az telefont, ha az létezik és még nincs hozzáadva korábban!
|
||||
// Erre azért van szükség, mert a left join-ok miatt többször visszajöhet!
|
||||
if (telefonId.IsEntityId() && gondviseloItemCo.TelefonList.All(x => x.Id != telefonId.Value))
|
||||
{
|
||||
var telefonItemCo = new TelefonItemCo(gondviseloItemCo, dataRow);
|
||||
gondviseloItemCo.TelefonList.Add(telefonItemCo);
|
||||
}
|
||||
}
|
||||
|
||||
return gondviseloItemCoList;
|
||||
}
|
||||
|
||||
public List<GondviseloItemCo> GetTanuloGonviseloiItemCoList(int tanuloId)
|
||||
{
|
||||
return Dal.CustomConnection.Run(ConnectionType, (h) =>
|
||||
{
|
||||
var gonviselokDs = h.Tanulo().GetGondviselok(tanuloId, TanevId);
|
||||
|
||||
var gondviseloItemCoList = new List<GondviseloItemCo>();
|
||||
|
||||
foreach (DataRow dataRow in gonviselokDs.Tables[0].Rows)
|
||||
{
|
||||
gondviseloItemCoList.Add(GondviseloItemCo.ConvertToGondviseloItemCoFromTanuloDalGetGondviselok(dataRow));
|
||||
}
|
||||
|
||||
return gondviseloItemCoList;
|
||||
});
|
||||
}
|
||||
|
||||
public bool IsCsokkentettGondviselo(int gondviseloId)
|
||||
{
|
||||
return Dal.CustomConnection.Run(ConnectionType, (h) =>
|
||||
{
|
||||
return h.Felhasznalo().IsCsokkentettGondviselo(gondviseloId, IntezmenyId, TanevId);
|
||||
});
|
||||
}
|
||||
|
||||
public bool HasTanuloTorvenyesGondviselo(int tanuloId)
|
||||
{
|
||||
var tanuloGondviseloje = GetTanuloGonviseloiItemCoList(tanuloId);
|
||||
return tanuloGondviseloje.Any(t => t.IsTorvenyesKepviselo);
|
||||
}
|
||||
|
||||
public Felhasznalo4TAdatokCo GetGondviselo4TAdatok(int gondviseloId)
|
||||
{
|
||||
return Dal.CustomConnection.Run(ConnectionType, (h) =>
|
||||
{
|
||||
return (Gondviselo)h.Gondviselo().Get(gondviseloId);
|
||||
});
|
||||
}
|
||||
|
||||
/// INFO: Mobil használja
|
||||
public void SaveGondviselo4TAdatok(int gondviseloId, Felhasznalo4TAdatokCo co)
|
||||
{
|
||||
Dal.CustomConnection.Run(ConnectionType, (h) =>
|
||||
{
|
||||
var dal = h.Gondviselo();
|
||||
var gondviselo = dal.Get(gondviseloId);
|
||||
gondviselo.AnyjaUtonev = co.AnyjaUtonev.ReplaceMultipleSpacesAndTrim();
|
||||
gondviselo.AnyjaVezeteknev = co.AnyjaVezeteknev.ReplaceMultipleSpacesAndTrim();
|
||||
gondviselo.Elotag = Extensions.NameExtensions.CleanElotag(co.Elotag);
|
||||
gondviselo.SzuletesiDatum = co.SzuletesiDatum;
|
||||
gondviselo.SzuletesiHely = co.SzuletesiHely.ReplaceMultipleSpacesAndTrim();
|
||||
gondviselo.SzuletesiUtonev = co.SzuletesiUtonev.ReplaceMultipleSpacesAndTrim();
|
||||
gondviselo.SzuletesiVezeteknev = co.SzuletesiVezeteknev.ReplaceMultipleSpacesAndTrim();
|
||||
gondviselo.Utonev = co.Utonev.ReplaceMultipleSpacesAndTrim();
|
||||
gondviselo.Vezeteknev = co.Vezeteknev.ReplaceMultipleSpacesAndTrim();
|
||||
|
||||
gondviselo.Nev = Extensions.NameExtensions.GetNevSorrendben("F", gondviselo.Elotag, gondviselo.Vezeteknev, gondviselo.Utonev);
|
||||
|
||||
dal.Update(gondviselo);
|
||||
});
|
||||
}
|
||||
|
||||
public bool IsGondviseloTanuloinakEvfolyamTipusaLetezik(int gondviseloId, IEnumerable<int> evfolyamTipusIdList)
|
||||
{
|
||||
return Dal.CustomConnection.Run(ConnectionType, (h) =>
|
||||
{
|
||||
return h.Gondviselo().IsGondviseloTanuloinakEvfolyamTipusaLetezik(gondviseloId, IntezmenyId, TanevId, evfolyamTipusIdList);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue