EchoTex_Payroll/HRM.DA/DA/Common/IDHelper.cs
2024-10-14 10:01:49 +06:00

42 lines
1.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using Ease.Core;
using Ease.Core.DataAccess;
namespace HRM.DA
{
public class IDHelper
{
static string _sTableName = "";
public static string GetIDs(TransactionContext tc, string sIDs, out string sTableName)
{
string sSubquery = "";
string[] values = sIDs.Split(',');
if (values.Length > 50000)
{
string sCreateQuery = "Create Table ";
// _sTableName = "temp" + Payroll.BO.User.CurrentUser.ID.Integer + DateTime.Now.ToString("ddmmyyhhmmss");
_sTableName = "temp" + DateTime.Now.ToString("ddmmyyhhmmss");
sCreateQuery += _sTableName;
sCreateQuery += "(ID number(18))";
tc.ExecuteNonQuery(sCreateQuery);
for (int i = 0; i < values.Length; i++)
{
tc.ExecuteNonQuery("INSERT INTO %q(ID )VALUES(%n)", _sTableName, Convert.ToInt16(values[i].Trim()));
}
sSubquery = "select ID from " + _sTableName;
sTableName = _sTableName;
}
else
{
sTableName = "";
sSubquery = sIDs;
}
return sSubquery;
}
}
}