init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
299
Kreta.DataAccessManual/ImportExportDal.cs
Normal file
299
Kreta.DataAccessManual/ImportExportDal.cs
Normal file
|
@ -0,0 +1,299 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Kreta.DataAccessManual.Interfaces;
|
||||
using Kreta.DataAccessManual.Util;
|
||||
using Kreta.Framework;
|
||||
using Kreta.Framework.Util;
|
||||
using SDA.DataProvider;
|
||||
|
||||
namespace Kreta.DataAccessManual
|
||||
{
|
||||
internal class ImportExportDal : DataAccessBase, IImportExportDal
|
||||
{
|
||||
public ImportExportDal(DalHandler handler, GridParameters parameters) : base(handler, parameters)
|
||||
{
|
||||
}
|
||||
|
||||
public ImportExportDal(DalHandler handler) : base(handler)
|
||||
{
|
||||
}
|
||||
|
||||
#region DynamicImport
|
||||
|
||||
public void Import(int intezmenyId, int tanevId, int userId, string importJson, bool isTorles, bool isSubTable, bool isTorlesCsakImportalt = true)
|
||||
{
|
||||
using (SDACommand command = UserContext.Instance.SDAConnection.CreateCommand())
|
||||
{
|
||||
command.CommandType = CommandType.StoredProcedure;
|
||||
command.Connection = UserContext.Instance.SDAConnection;
|
||||
command.Transaction = UserContext.Instance.SDATransaction;
|
||||
|
||||
command.CommandText = "uspDynamicImport";
|
||||
command.Parameters.Add("pIntezmenyId", intezmenyId);
|
||||
command.Parameters.Add("pTanevId", tanevId);
|
||||
command.Parameters.Add("pUserId", userId);
|
||||
command.Parameters.Add("pImportJson", importJson);
|
||||
command.Parameters.Add("pIsTorles", isTorles);
|
||||
command.Parameters.Add("pIsSubTable", isSubTable);
|
||||
command.Parameters.Add("pIsTorlesCsakImportalt", isTorlesCsakImportalt);
|
||||
command.ExecuteNonQuery();
|
||||
|
||||
DalHelper.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion DynamicImport
|
||||
|
||||
public void TantargyfelosztasImport(int intezmenyId, int tanevId, int userId, string importJson, bool isTorles)
|
||||
{
|
||||
using (SDACommand sdaCommand = UserContext.Instance.SDAConnection.CreateCommand())
|
||||
{
|
||||
sdaCommand.CommandType = CommandType.StoredProcedure;
|
||||
sdaCommand.Connection = UserContext.Instance.SDAConnection;
|
||||
sdaCommand.Transaction = UserContext.Instance.SDATransaction;
|
||||
|
||||
sdaCommand.CommandText = "uspTantargyfelosztasImport";
|
||||
sdaCommand.Parameters.Add("pIntezmenyId", intezmenyId);
|
||||
sdaCommand.Parameters.Add("pTanevId", tanevId);
|
||||
sdaCommand.Parameters.Add("pUserId", userId);
|
||||
sdaCommand.Parameters.Add("pImportJson", importJson);
|
||||
sdaCommand.Parameters.Add("pIsTorles", isTorles);
|
||||
sdaCommand.ExecuteNonQuery();
|
||||
DalHelper.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
public void OrarendImport(int intezmenyId, int tanevId, int userId, string importJson, bool isTorles, bool isModositas, bool isNapirendImport, DateTime? orarendiOraLezarasDateTime)
|
||||
{
|
||||
using (SDACommand sdaCommand = UserContext.Instance.SDAConnection.CreateCommand())
|
||||
{
|
||||
sdaCommand.CommandType = CommandType.StoredProcedure;
|
||||
sdaCommand.Connection = UserContext.Instance.SDAConnection;
|
||||
sdaCommand.Transaction = UserContext.Instance.SDATransaction;
|
||||
|
||||
sdaCommand.CommandText = "uspOrarendImport";
|
||||
sdaCommand.Parameters.Add("pIntezmenyId", intezmenyId);
|
||||
sdaCommand.Parameters.Add("pTanevId", tanevId);
|
||||
sdaCommand.Parameters.Add("pUserId", userId);
|
||||
sdaCommand.Parameters.Add("pImportJson", importJson);
|
||||
sdaCommand.Parameters.Add("pIsTorles", isTorles);
|
||||
sdaCommand.Parameters.Add("pIsModositas", isModositas);
|
||||
sdaCommand.Parameters.Add("pIsNapirendImport", isNapirendImport);
|
||||
if (orarendiOraLezarasDateTime.HasValue)
|
||||
{
|
||||
sdaCommand.Parameters.Add("pOrarendiOraLezarasDateTime", orarendiOraLezarasDateTime);
|
||||
}
|
||||
|
||||
sdaCommand.ExecuteNonQuery();
|
||||
DalHelper.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
public void TanuloKifirImport(int intezmenyId, int tanevId, int userId, string importJson)
|
||||
{
|
||||
using (SDACommand sdaCommand = UserContext.Instance.SDAConnection.CreateCommand())
|
||||
{
|
||||
sdaCommand.CommandType = CommandType.StoredProcedure;
|
||||
sdaCommand.Connection = UserContext.Instance.SDAConnection;
|
||||
sdaCommand.Transaction = UserContext.Instance.SDATransaction;
|
||||
sdaCommand.CommandText = "uspTanuloKifirImport";
|
||||
sdaCommand.Parameters.Add("pIntezmenyId", intezmenyId);
|
||||
sdaCommand.Parameters.Add("pTanevId", tanevId);
|
||||
sdaCommand.Parameters.Add("pUserId", userId);
|
||||
sdaCommand.Parameters.Add("pImportJson", importJson);
|
||||
sdaCommand.ExecuteNonQuery();
|
||||
|
||||
DalHelper.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
public void TanuloBesorolasImport(int intezmenyId, int tanevId, int userId, string importJson, DateTime besorolasDatum)
|
||||
{
|
||||
using (SDACommand sdaCommand = UserContext.Instance.SDAConnection.CreateCommand())
|
||||
{
|
||||
sdaCommand.CommandType = CommandType.StoredProcedure;
|
||||
sdaCommand.Connection = UserContext.Instance.SDAConnection;
|
||||
sdaCommand.Transaction = UserContext.Instance.SDATransaction;
|
||||
sdaCommand.CommandText = "uspTanuloBesorolasImport";
|
||||
sdaCommand.Parameters.Add("pIntezmenyId", intezmenyId);
|
||||
sdaCommand.Parameters.Add("pTanevId", tanevId);
|
||||
sdaCommand.Parameters.Add("pUserId", userId);
|
||||
sdaCommand.Parameters.Add("pImportJson", importJson);
|
||||
sdaCommand.Parameters.Add("pBesorolasDatum", besorolasDatum);
|
||||
sdaCommand.ExecuteNonQuery();
|
||||
|
||||
DalHelper.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
public void TanmenetImport(int intezmenyId, int tanevId, int userId, string importJson, bool isTorles, int tantargyId, int osztalyCsoportId)
|
||||
{
|
||||
using (SDACommand sdaCommand = UserContext.Instance.SDAConnection.CreateCommand())
|
||||
{
|
||||
sdaCommand.CommandType = CommandType.StoredProcedure;
|
||||
sdaCommand.Connection = UserContext.Instance.SDAConnection;
|
||||
sdaCommand.Transaction = UserContext.Instance.SDATransaction;
|
||||
|
||||
sdaCommand.CommandText = "uspTanmenetImport";
|
||||
sdaCommand.Parameters.Add("pIntezmenyId", intezmenyId);
|
||||
sdaCommand.Parameters.Add("pTanevId", tanevId);
|
||||
sdaCommand.Parameters.Add("pUserId", userId);
|
||||
sdaCommand.Parameters.Add("pImportJson", importJson);
|
||||
sdaCommand.Parameters.Add("pIsTorles", isTorles);
|
||||
sdaCommand.Parameters.Add("pTantargyId", tantargyId);
|
||||
sdaCommand.Parameters.Add("pOsztalyCsoportId", osztalyCsoportId);
|
||||
sdaCommand.ExecuteNonQuery();
|
||||
|
||||
DalHelper.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
public DataSet GondviseloImport(int intezmenyId, int tanevId, int userId, string importJson)
|
||||
{
|
||||
using (SDACommand sdaCommand = UserContext.Instance.SDAConnection.CreateCommand())
|
||||
{
|
||||
sdaCommand.CommandType = CommandType.StoredProcedure;
|
||||
sdaCommand.Connection = UserContext.Instance.SDAConnection;
|
||||
sdaCommand.Transaction = UserContext.Instance.SDATransaction;
|
||||
sdaCommand.CommandText = "uspGondviseloImport";
|
||||
sdaCommand.Parameters.Add("pIntezmenyId", intezmenyId);
|
||||
sdaCommand.Parameters.Add("pTanevId", tanevId);
|
||||
sdaCommand.Parameters.Add("pUserId", userId);
|
||||
sdaCommand.Parameters.Add("pImportJson", importJson);
|
||||
|
||||
var dataSet = new DataSet();
|
||||
using (var adapter = new SDADataAdapter())
|
||||
{
|
||||
adapter.SelectCommand = sdaCommand;
|
||||
adapter.Fill(dataSet);
|
||||
}
|
||||
|
||||
DalHelper.Commit();
|
||||
return dataSet;
|
||||
}
|
||||
}
|
||||
|
||||
public void OratervImport(int intezmenyId, int tanevId, int userId, string importJson)
|
||||
{
|
||||
using (SDACommand sdaCommand = UserContext.Instance.SDAConnection.CreateCommand())
|
||||
{
|
||||
sdaCommand.CommandType = CommandType.StoredProcedure;
|
||||
sdaCommand.Connection = UserContext.Instance.SDAConnection;
|
||||
sdaCommand.Transaction = UserContext.Instance.SDATransaction;
|
||||
|
||||
sdaCommand.CommandText = "uspOratervImport";
|
||||
sdaCommand.Parameters.Add("pIntezmenyId", intezmenyId);
|
||||
sdaCommand.Parameters.Add("pTanevId", tanevId);
|
||||
sdaCommand.Parameters.Add("pUserId", userId);
|
||||
sdaCommand.Parameters.Add("pImportJson", importJson);
|
||||
sdaCommand.ExecuteNonQuery();
|
||||
|
||||
DalHelper.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
public DataSet GetOrarendExcelExportData(int tanevId, DateTime orarendExportKezdete, DateTime orarendExportVege, bool isOraErvenyessegiIdovel, bool isIdoszakonKivuliElemekMegjelenitese, bool isEgyediNapOrainakKihagyasa = false, bool? isNapirendExport = null)
|
||||
{
|
||||
using (var sdaCommand = new SDACommand())
|
||||
{
|
||||
sdaCommand.Connection = UserContext.Instance.SDAConnection;
|
||||
sdaCommand.Transaction = UserContext.Instance.SDATransaction;
|
||||
|
||||
sdaCommand.CommandType = CommandType.StoredProcedure;
|
||||
sdaCommand.CommandText = "uspGetOrarendExcelExportData";
|
||||
|
||||
sdaCommand.Parameters.Add("pTanevId", tanevId);
|
||||
sdaCommand.Parameters.Add("pErvenyessegKezdete", orarendExportKezdete);
|
||||
sdaCommand.Parameters.Add("pErvenyessegVege", orarendExportVege);
|
||||
sdaCommand.Parameters.Add("pIsOraErvenyessegiIdovel", isOraErvenyessegiIdovel);
|
||||
sdaCommand.Parameters.Add("pIsNapiredExport", isNapirendExport);
|
||||
sdaCommand.Parameters.Add("pIsIdoszakonKivuliElemekMegjelenitese", isIdoszakonKivuliElemekMegjelenitese);
|
||||
sdaCommand.Parameters.Add("pIsEgyediNapOrainakKihagyasa", isEgyediNapOrainakKihagyasa);
|
||||
|
||||
var dataSet = new DataSet();
|
||||
using (var sdaDataAdapter = new SDADataAdapter())
|
||||
{
|
||||
sdaDataAdapter.SelectCommand = sdaCommand;
|
||||
sdaDataAdapter.Fill(dataSet);
|
||||
}
|
||||
|
||||
return dataSet;
|
||||
}
|
||||
}
|
||||
|
||||
public void TanulokElerhetosegiAdataikImport(int intezmenyId, int tanevId, int userId, string importJson, bool isTorles, bool isSubTable, string tableNameList)
|
||||
{
|
||||
using (SDACommand sdaCommand = UserContext.Instance.SDAConnection.CreateCommand())
|
||||
{
|
||||
sdaCommand.CommandType = CommandType.StoredProcedure;
|
||||
sdaCommand.Connection = UserContext.Instance.SDAConnection;
|
||||
sdaCommand.Transaction = UserContext.Instance.SDATransaction;
|
||||
|
||||
sdaCommand.CommandText = "uspDynamicImportJsonSplit";
|
||||
sdaCommand.Parameters.Add("pIntezmenyId", intezmenyId);
|
||||
sdaCommand.Parameters.Add("pTanevId", tanevId);
|
||||
sdaCommand.Parameters.Add("pUserId", userId);
|
||||
sdaCommand.Parameters.Add("pImportJson", importJson);
|
||||
sdaCommand.Parameters.Add("pIsTorles", isTorles);
|
||||
sdaCommand.Parameters.Add("pIsSubTable", isSubTable);
|
||||
sdaCommand.Parameters.Add("pTableNameList", tableNameList);
|
||||
sdaCommand.ExecuteNonQuery();
|
||||
|
||||
DalHelper.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateTanulokElerhetosegeiAlapertelmezett(int felhasznaloId, IEnumerable<int> alapertelmezettEmailFelhasznaloIds, IEnumerable<int> alapertelmezettTelefonFelhasznaloIds)
|
||||
{
|
||||
if (alapertelmezettEmailFelhasznaloIds.Any() || alapertelmezettTelefonFelhasznaloIds.Any())
|
||||
{
|
||||
using (var command = new SDACommand())
|
||||
{
|
||||
command.Connection = UserContext.Instance.SDAConnection;
|
||||
command.Transaction = UserContext.Instance.SDATransaction;
|
||||
command.CommandType = CommandType.Text;
|
||||
|
||||
command.Parameters.Add("pModifierId", felhasznaloId);
|
||||
|
||||
var commandTextSb = new StringBuilder();
|
||||
|
||||
if (alapertelmezettEmailFelhasznaloIds.Any())
|
||||
{
|
||||
commandTextSb.Append($@"
|
||||
UPDATE T_EMAIL SET
|
||||
C_ALAPERTELMEZETT = 'F'
|
||||
,SERIAL = SERIAL + 1
|
||||
,LASTCHANGED = GETDATE()
|
||||
,MODIFIER = :pModifierId
|
||||
WHERE TOROLT = 'F'
|
||||
AND C_ALAPERTELMEZETT = 'T'
|
||||
AND C_GONDVISELOID IS NULL
|
||||
AND C_FELHASZNALOID IN ({string.Join(",", alapertelmezettEmailFelhasznaloIds)})");
|
||||
}
|
||||
|
||||
if (alapertelmezettTelefonFelhasznaloIds.Any())
|
||||
{
|
||||
commandTextSb.Append($@"
|
||||
UPDATE T_TELEFON SET
|
||||
C_ALAPERTELMEZETT = 'F'
|
||||
,SERIAL = SERIAL + 1
|
||||
,LASTCHANGED = GETDATE()
|
||||
,MODIFIER = :pModifierId
|
||||
WHERE TOROLT = 'F'
|
||||
AND C_ALAPERTELMEZETT = 'T'
|
||||
AND C_GONDVISELOID IS NULL
|
||||
AND C_FELHASZNALOID IN ({string.Join(",", alapertelmezettTelefonFelhasznaloIds)})");
|
||||
}
|
||||
|
||||
command.CommandText = commandTextSb.ToString();
|
||||
command.ExecuteNonQuery();
|
||||
|
||||
DalHelper.Commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue