EchoTex_Payroll/HRM.DA/DA/SearchTools/DbColumnsDA.cs

83 lines
2.6 KiB
C#
Raw Permalink Normal View History

2024-10-14 10:01:49 +06:00
using HRM.BO;
using Ease.Core.DataAccess;
using System;
using System.Data;
using System.Text;
namespace HRM.DA
{
internal class DbColumnsDA
{
#region Constructor
public DbColumnsDA()
{
}
#endregion
#region Action Query
internal static void Insert(TransactionContext tc, DbColumns g)
{
tc.ExecuteNonQuery("INSERT INTO DbColumns(ColumnId, TableId, TableName, ColumnName,DataType,Size,AllowNull)"
+ " VALUES(%n,%n,%n,%s,%s,%s,%n,%n)", g.ID, g.TableId, g.TableName, g.ColumnName,
g.DataType, g.Size, g.AllowNull);
}
internal static void Update(TransactionContext tc, DbColumns g)
{
tc.ExecuteNonQuery(
"UPDATE DbColumns SET TableId=%n, TableName=%s, ColumnName=%s,DataType=%s,Size=%n,AllowNull=%n WHERE ColumnId=%n",
g.TableId, g.TableName, g.ColumnName, g.DataType, g.Size, g.AllowNull, g.ID);
}
internal static void Delete(TransactionContext tc, int groupID)
{
tc.ExecuteNonQuery("DELETE FROM DbColumns WHERE DbColumnsID=%n", groupID);
}
#endregion
#region Select Query
internal static int GenID(TransactionContext tc)
{
return tc.GenerateID("DbColumns", "DbColumnsID");
}
internal static IDataReader Get(TransactionContext tc, int groupID)
{
return tc.ExecuteReader("SELECT * FROM DbColumns WHERE DbColumnsID=%n", groupID);
}
internal static IDataReader GetAll(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM DbColumns");
}
internal static IDataReader GetByTableName(TransactionContext tc, int tableId)
{
return tc.ExecuteReader("SELECT * FROM DbColumns WHERE tableId=%n", tableId);
}
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM DbColumns ORDER BY Name");
}
internal static IDataReader Get(TransactionContext tc, bool isObjectGroup)
{
return tc.ExecuteReader("SELECT * FROM DbColumns WHERE IsObjectGroup=%n ORDER BY Name", isObjectGroup);
}
internal static IDataReader GetByParent(TransactionContext tc, int parentID, bool isObjectGroup)
{
return tc.ExecuteReader(
"SELECT * FROM DbColumns WHERE ObjectDbColumnsID=%n AND IsObjectGroup=%n ORDER BY Name", parentID,
isObjectGroup);
}
#endregion
}
}