72 lines
1.7 KiB
C#
72 lines
1.7 KiB
C#
using System.Linq;
|
|
using Kreta.DataAccess.Interfaces;
|
|
using Kreta.DataAccessManual.Interfaces;
|
|
using Kreta.DataAccessManual.Util;
|
|
using Kreta.Framework.Util;
|
|
using SDA.Kreta.Entities;
|
|
|
|
namespace Kreta.DataAccessManual
|
|
{
|
|
internal class MeroallasDal : DataAccessBase, IMeroallasDal
|
|
{
|
|
public MeroallasDal(DalHandler handler, GridParameters parameters) : base(handler, parameters)
|
|
{
|
|
|
|
}
|
|
|
|
public MeroallasDal(DalHandler handler) : base(handler)
|
|
{
|
|
|
|
}
|
|
public IMeroallas Get()
|
|
{
|
|
return Meroallas.GiveAnInstance();
|
|
}
|
|
|
|
public IMeroallas Get(int id)
|
|
{
|
|
var entity = Meroallas.GiveAnInstance();
|
|
entity.LoadByID(id);
|
|
return entity;
|
|
}
|
|
|
|
public void FullUpdate(IMeroallas dto)
|
|
{
|
|
var entity = dto as Meroallas;
|
|
entity.FullUpdate(true);
|
|
DalHelper.Commit();
|
|
}
|
|
|
|
public void Update(IMeroallas dto)
|
|
{
|
|
var entity = dto as Meroallas;
|
|
entity.FullUpdate();
|
|
DalHelper.Commit();
|
|
}
|
|
|
|
public void Insert(IMeroallas dto)
|
|
{
|
|
var entity = dto as Meroallas;
|
|
entity.Insert(true);
|
|
|
|
dto.ID = entity.ID;
|
|
DalHelper.Commit();
|
|
}
|
|
|
|
public void Delete(int id)
|
|
{
|
|
Meroallas entity = Meroallas.GiveAnInstance();
|
|
entity.LoadByID(id);
|
|
|
|
entity.FeltoltottFajl.ToList().ForEach(file =>
|
|
{
|
|
entity.RemoveFromFeltoltottFajl(file);
|
|
file.Delete();
|
|
});
|
|
|
|
entity.Delete();
|
|
|
|
DalHelper.Commit();
|
|
}
|
|
}
|
|
}
|