CEL_Payroll/Payroll.Service/IDHelper.cs

40 lines
1.3 KiB
C#
Raw Normal View History

2024-09-17 14:30:13 +06:00
using Ease.CoreV35.DataAccess;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Payroll.Service
{
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 > 990)
{
string sCreateQuery = "Create Table ";
_sTableName = "temp" + Payroll.BO.User.CurrentUser.ID.Integer + 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;
}
}
}