EchoTex_Payroll/HRM.DA/DA/Recruitement/ErCircularSurveyDA.cs

100 lines
3.4 KiB
C#
Raw Normal View History

2024-10-14 10:01:49 +06:00
using HRM.BO;
using Ease.Core.DataAccess;
using System;
using System.Data;
namespace HRM.DA
{
public class ErCircularSurveyDA
{
internal static void InsertErCircularSurvey(ErCircularSurvey obCircular, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(
@"INSERT INTO ER_CircularSurvey
(
SurveyID, ERCircularID
)
VALUES
(
%n,%n
)", obCircular.SurveyID, obCircular.ERCircularID
);
tc.ExecuteNonQuery(sql);
}
internal static void UpdateErCircularSurvey(ErCircularSurvey obCircular, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(
@"UPDATE ER_CircularSurvey
SET
SurveyID = %n,
ERCircularID = %n,
WHERE ERSurveyCircularID = %n",
obCircular.ErCircularSurveyID, obCircular.ERCircularID,obCircular.ID);
tc.ExecuteNonQuery(sql);
}
internal static IDataReader Get(TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"Select * From ER_CircularSurvey");
return tc.ExecuteReader(sql);
}
internal static IDataReader Get(TransactionContext tc, int iD)
{
string sql = SQLParser.MakeSQL(@"Select * From ER_CircularSurvey Where ERSurveyCircularID = %n", iD);
return tc.ExecuteReader(sql);
}
internal static IDataReader GetBySurveyID(TransactionContext tc, int iD)
{
string sql = SQLParser.MakeSQL(@"Select * From ER_CircularSurvey Where SurveyID = %n", iD);
return tc.ExecuteReader(sql);
}
internal static IDataReader GetByCircularID(TransactionContext tc, int iD)
{
string sql = SQLParser.MakeSQL(@"Select * From ER_CircularSurvey Where ERCircularID = %n", iD);
return tc.ExecuteReader(sql);
}
public static IDataReader GetByErCircularID(TransactionContext tc, int iD)
{
string sql = SQLParser.MakeSQL(@"Select ecs.* From ER_CircularSurvey ecs INNER JOIN ER_Circular er ON ecs.ERCircularID = er.ERCircularID Where ecs.ERCircularID = %n", iD);
return tc.ExecuteReader(sql);
}
internal static void Delete(int iD, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"Delete From ER_CircularSurvey Where ERSurveyCircularID = %n", iD);
tc.ExecuteNonQuery(sql);
}
internal static void DeleteByCircularID(int iD, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"Delete From ER_CircularSurvey Where ERCircularID = %n", iD);
tc.ExecuteNonQuery(sql);
}
internal static void DeleteBySurveyID(int iD, TransactionContext tc)
{
string sql = SQLParser.MakeSQL(@"Delete From ER_CircularSurvey Where SurveyID = %n", iD);
tc.ExecuteNonQuery(sql);
}
internal static int GetSequenceNo(TransactionContext tc)
{
int nSequnceNo = 0;
object obj = tc.ExecuteScalar("SELECT Max(SequenceNo) FROM ER_CircularSurvey");
if (obj != DBNull.Value)
{
nSequnceNo = Convert.ToInt32(obj);
}
return nSequnceNo;
}
}
}