init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
344
Kreta.DataAccessManual/BeszerzesiModulDAL.cs
Normal file
344
Kreta.DataAccessManual/BeszerzesiModulDAL.cs
Normal file
|
@ -0,0 +1,344 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
using Kreta.Core;
|
||||
using Kreta.DataAccess.Interfaces;
|
||||
using Kreta.DataAccessManual.Interfaces;
|
||||
using Kreta.DataAccessManual.ParameterClasses;
|
||||
using Kreta.DataAccessManual.Util;
|
||||
using Kreta.Framework;
|
||||
using Kreta.Framework.Util;
|
||||
using SDA.DataProvider;
|
||||
using SDA.Kreta.Entities;
|
||||
|
||||
namespace Kreta.DataAccessManual
|
||||
{
|
||||
internal class BeszerzesiModulDAL : DataAccessBase, IBeszerzesiModulDAL
|
||||
{
|
||||
public BeszerzesiModulDAL(DalHandler handler) : base(handler)
|
||||
{
|
||||
}
|
||||
|
||||
public BeszerzesiModulDAL(DalHandler handler, GridParameters gridParameters) : base(handler, gridParameters)
|
||||
{
|
||||
}
|
||||
|
||||
#region BaseCRUD
|
||||
|
||||
public IBeszerzesiIgeny GetBeszerzesiIgeny(int? id = null)
|
||||
{
|
||||
var entity = BeszerzesiIgeny.GiveAnInstance();
|
||||
if (id.HasValue)
|
||||
{
|
||||
entity.LoadByID(id.Value);
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
public IBeszerzesiAnyag GetBeszerzesiAnyag(int? id = null)
|
||||
{
|
||||
var entity = BeszerzesiAnyag.GiveAnInstance();
|
||||
if (id.HasValue)
|
||||
{
|
||||
entity.LoadByID(id.Value);
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
public IBeszerzesiAnyagtorzs GetBeszerzesiAnyagtorzs(int? id = null)
|
||||
{
|
||||
var entity = BeszerzesiAnyagtorzs.GiveAnInstance();
|
||||
if (id.HasValue)
|
||||
{
|
||||
entity.LoadByID(id.Value);
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
public IBeszerzesiSzallito GetBeszerzesiSzallito(int? id = null)
|
||||
{
|
||||
var entity = BeszerzesiSzallito.GiveAnInstance();
|
||||
if (id.HasValue)
|
||||
{
|
||||
entity.LoadByID(id.Value);
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
public IBeszerzesiIgenyMegjegyzes GetBeszerzesiIgenyMegjegyzes(int? id = null)
|
||||
{
|
||||
var entity = BeszerzesiIgenyMegjegyzes.GiveAnInstance();
|
||||
if (id.HasValue)
|
||||
{
|
||||
entity.LoadByID(id.Value);
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
public int InsertOrUpdateBeszerzesiIgeny(IBeszerzesiIgeny dto)
|
||||
{
|
||||
if (dto is BeszerzesiIgeny entity)
|
||||
{
|
||||
if (dto.ID.IsEntityId())
|
||||
{
|
||||
entity.FullUpdate();
|
||||
}
|
||||
else
|
||||
{
|
||||
entity.Insert();
|
||||
}
|
||||
|
||||
dto.ID = entity.ID;
|
||||
}
|
||||
|
||||
DalHelper.Commit();
|
||||
return dto.ID;
|
||||
}
|
||||
|
||||
public int InsertOrUpdateBeszerzesiAnyag(IBeszerzesiAnyag dto)
|
||||
{
|
||||
if (dto is BeszerzesiAnyag entity)
|
||||
{
|
||||
if (dto.ID.IsEntityId())
|
||||
{
|
||||
entity.FullUpdate();
|
||||
}
|
||||
else
|
||||
{
|
||||
entity.Insert();
|
||||
}
|
||||
dto.ID = entity.ID;
|
||||
}
|
||||
|
||||
DalHelper.Commit();
|
||||
return dto.ID;
|
||||
}
|
||||
|
||||
public int InsertOrUpdateBeszerzesiSzallito(IBeszerzesiSzallito dto)
|
||||
{
|
||||
if (dto is BeszerzesiSzallito entity)
|
||||
{
|
||||
if (dto.ID.IsEntityId())
|
||||
{
|
||||
entity.FullUpdate();
|
||||
}
|
||||
else
|
||||
{
|
||||
entity.Insert();
|
||||
}
|
||||
dto.ID = entity.ID;
|
||||
}
|
||||
|
||||
DalHelper.Commit();
|
||||
return dto.ID;
|
||||
}
|
||||
|
||||
public int InsertOrUpdateBeszerzesiIgenyMegjegyzes(IBeszerzesiIgenyMegjegyzes dto)
|
||||
{
|
||||
if (dto is BeszerzesiIgenyMegjegyzes entity)
|
||||
{
|
||||
if (dto.ID.IsEntityId())
|
||||
{
|
||||
entity.FullUpdate();
|
||||
}
|
||||
else
|
||||
{
|
||||
entity.Insert();
|
||||
}
|
||||
dto.ID = entity.ID;
|
||||
}
|
||||
|
||||
DalHelper.Commit();
|
||||
return dto.ID;
|
||||
}
|
||||
|
||||
public void Update(IBeszerzesiIgeny dto)
|
||||
{
|
||||
var entity = dto as BeszerzesiIgeny;
|
||||
entity.FullUpdate();
|
||||
DalHelper.Commit();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public DataSet BeszerzesiIgenyKereses(BeszerzesiIgenySearchPco pco)
|
||||
{
|
||||
List<CommandParameter> paramlist = new List<CommandParameter>();
|
||||
paramlist.Add(new CommandParameter("pTanevId", pco.TanevId));
|
||||
|
||||
StringBuilder command = new StringBuilder(@"
|
||||
SELECT
|
||||
bi.ID as ID
|
||||
,bi.CREATED as IgenylesKezdete
|
||||
,ba.C_NEV as Anyag
|
||||
,bi.C_STATUSZID as StatuszId
|
||||
FROM T_BESZERZESIIGENY bi
|
||||
JOIN T_BESZERZESIANYAG ba on ba.C_BESZERZESIIGENYID = bi.ID and ba.TOROLT = 'F'
|
||||
WHERE
|
||||
bi.TOROLT = 'F'
|
||||
");
|
||||
|
||||
if (pco.IgenylesKezdete.HasValue)
|
||||
{
|
||||
command.Append($" AND bi.CREATED = :pSrcIgenylesKezdete");
|
||||
paramlist.Add(new CommandParameter("pSrcIgenylesKezdete", pco.IgenylesKezdete.Value));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(pco.AnyagNev))
|
||||
{
|
||||
command.Append($" AND ba.C_NEV LIKE '%' + :pSrcAnyag + '%'");
|
||||
paramlist.Add(new CommandParameter("pSrcAnyag", pco.AnyagNev));
|
||||
}
|
||||
|
||||
if (pco.StatuszId.HasValue)
|
||||
{
|
||||
command.Append($" AND bi.C_STATUSZID = :pSrcStatusz");
|
||||
paramlist.Add(new CommandParameter("pSrcStatusz", pco.StatuszId.Value));
|
||||
}
|
||||
|
||||
DataSet ds = GetData(command.ToString(), paramlist, dictionaryItemColumns: "StatuszId");
|
||||
return ds;
|
||||
}
|
||||
|
||||
public DataSet BeszerzesiIgenyDokList(int igenylesId, int tanevId)
|
||||
{
|
||||
using (var command = new SDACommand())
|
||||
{
|
||||
command.Connection = UserContext.Instance.SDAConnection;
|
||||
command.Transaction = UserContext.Instance.SDATransaction;
|
||||
command.CommandType = CommandType.StoredProcedure;
|
||||
command.CommandText = "uspBeszerzesiIgenyDokList";
|
||||
|
||||
command.Parameters.Add("pIgenylesId", igenylesId);
|
||||
command.Parameters.Add("pTanevId", tanevId);
|
||||
|
||||
var dataSet = new DataSet();
|
||||
using (var sdaDataAdapter = new SDADataAdapter())
|
||||
{
|
||||
sdaDataAdapter.SelectCommand = command;
|
||||
sdaDataAdapter.Fill(dataSet);
|
||||
}
|
||||
|
||||
return dataSet;
|
||||
}
|
||||
}
|
||||
|
||||
public DataSet BeszerzesiIgenyMegjegyzesList(int igenylesId, int tanevId)
|
||||
{
|
||||
using (var command = new SDACommand())
|
||||
{
|
||||
command.Connection = UserContext.Instance.SDAConnection;
|
||||
command.Transaction = UserContext.Instance.SDATransaction;
|
||||
command.CommandType = CommandType.StoredProcedure;
|
||||
command.CommandText = "uspBeszerzesiIgenyMegjegyzesList";
|
||||
|
||||
command.Parameters.Add("pTanevId", tanevId);
|
||||
command.Parameters.Add("pIgenylesId", igenylesId);
|
||||
|
||||
var dataSet = new DataSet();
|
||||
using (var sdaDataAdapter = new SDADataAdapter())
|
||||
{
|
||||
sdaDataAdapter.SelectCommand = command;
|
||||
sdaDataAdapter.Fill(dataSet);
|
||||
}
|
||||
|
||||
return dataSet;
|
||||
}
|
||||
}
|
||||
|
||||
public DataSet GetAnyagTorzsList(string filterString)
|
||||
{
|
||||
var parameters = new List<CommandParameter>();
|
||||
|
||||
string command = @"
|
||||
SELECT
|
||||
1 AS ID
|
||||
,'Lufifújó' AS Nev
|
||||
|
||||
-- FROM T_BESZERZESIANYAGTORZS torzs
|
||||
-- WHERE torzs.TOROLT = 'F'
|
||||
";
|
||||
|
||||
if (string.IsNullOrWhiteSpace(filterString) || CheckRowCount(command, parameters) > 100)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return GetData(command, parameters);
|
||||
}
|
||||
|
||||
public IBeszerzesiAnyagtorzs GetAnyagtorzsAdat(int torzsId)
|
||||
{
|
||||
//TODO: temp megoldás
|
||||
var entity = GetBeszerzesiAnyagtorzs();
|
||||
entity.Nev = "Lufifújó";
|
||||
entity.SAPKod = "324";
|
||||
entity.Leiras = "Rövid leírás";
|
||||
entity.MennyisegiEgysegId = 1;
|
||||
entity.TetelNev = "Lufik";
|
||||
entity.Egysegar = 300;
|
||||
//entity.LoadByID(torzsId);
|
||||
return entity;
|
||||
}
|
||||
|
||||
public DataSet GetSzallitoTorzsList(string filterString)
|
||||
{
|
||||
var parameters = new List<CommandParameter>();
|
||||
|
||||
string command = @"
|
||||
SELECT
|
||||
1 AS ID
|
||||
,'Lufifújó Kft.' AS Nev
|
||||
|
||||
-- FROM T_BESZERZESISZALLITOTORZS torzs
|
||||
-- WHERE torzs.TOROLT = 'F'
|
||||
";
|
||||
|
||||
if (string.IsNullOrWhiteSpace(filterString) || CheckRowCount(command, parameters) > 100)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return GetData(command, parameters);
|
||||
}
|
||||
|
||||
public IBeszerzesiSzallito/*torzs*/ GetSzallitoTorzsAdat(int torzsId)
|
||||
{
|
||||
//TODO: temp megoldás
|
||||
var entity = GetBeszerzesiSzallito();
|
||||
entity.Nev = "Lufifújó Kft.";
|
||||
entity.SAPKod = "SAPLufi";
|
||||
entity.IrSzam = "1111";
|
||||
entity.HelysegNev = "Budapest";
|
||||
entity.KozteruletNev = "Budafoki";
|
||||
entity.KozteruletJellegId = 1;
|
||||
entity.Hazszam = "59";
|
||||
entity.Emelet = "";
|
||||
entity.Ajto = "";
|
||||
entity.Adoszam = "";
|
||||
entity.KepviseloNev = "";
|
||||
entity.EmailCim = "";
|
||||
entity.Telefonszam = "";
|
||||
//entity. = "";
|
||||
//entity.LoadByID(torzsId);
|
||||
return entity;
|
||||
}
|
||||
|
||||
public string IsLeader(int alkalmazottId, int tanevId)
|
||||
{
|
||||
using (var command = new SDACommand())
|
||||
{
|
||||
command.Connection = UserContext.Instance.SDAConnection;
|
||||
command.Transaction = UserContext.Instance.SDATransaction;
|
||||
command.CommandType = CommandType.StoredProcedure;
|
||||
command.CommandText = "uspIsLeader";
|
||||
|
||||
command.Parameters.Add("pTanevId", tanevId);
|
||||
command.Parameters.Add("pAlkalmazottId", alkalmazottId);
|
||||
|
||||
var result = command.ExecuteScalar();
|
||||
return result?.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue