EchoTex_Payroll/HRM.DA/DA/GrievanceManagement/ComplainDA.cs

100 lines
2.8 KiB
C#
Raw Normal View History

2024-10-14 10:01:49 +06:00
using System;
using HRM.BO;
using System.Data;
using System.Linq;
using Ease.Core.Model;
using System.Data.SqlClient;
using Ease.Core.DataAccess;
using System.Collections.Generic;
using Ease.Core.DataAccess.SQL;
namespace HRM.DA
{
#region ComplainDA
internal class ComplainDA
{
#region Constructor
private ComplainDA() { }
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, Complain item)
{
tc.ExecuteNonQuery("INSERT INTO Complain(ComplainID, code, Description)" +
" VALUES(%n, %s, %s)", item.ID, item.Code, item.Description);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, Complain item)
{
tc.ExecuteNonQuery("UPDATE Complain SET code=%s, Description=%s" +
" WHERE ComplainID=%n", item.Code, item.Description, item.ID);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc, EnumStatus status)
{
return tc.ExecuteReader("SELECT * FROM Complain");
}
internal static IDataReader Get(TransactionContext tc, int nID)
{
return tc.ExecuteReader("SELECT * FROM Complain WHERE ComplainID=%n", nID);
}
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM Complain");
}
internal static IDataReader GetDAComplainPicker(TransactionContext tc, int complainid)
{
DataSet dSet = new DataSet();
string sql = string.Empty;
if (complainid > 0)
{
sql = SQLParser.TagSQL(sql) + SQLParser.MakeSQL("COMPLAINID = %n", complainid);
}
string sqlQuery = SQLParser.MakeSQL(@"select * from COMPLAIN %q", sql);
Console.WriteLine(sqlQuery);
return tc.ExecuteReader(sqlQuery);
}
internal static DataSet GetAllComplain(TransactionContext tc, int empId)
{
string sSQL = SQLParser.MakeSQL(@"SELECT EL.EMPLOYEEID, EL.EFFECTDATE, C.DESCRIPTION, C.DESCRIPTIONINBANGLA FROM EMPLIFECYCLE EL
JOIN Complain C ON EL.ComplainID = C.ComplainID
WHERE EL.EMPLOYEEID = %n AND EL.ComplainID IS NOT NULL
order by EL.EFFECTDATE DESC", empId);
return tc.ExecuteDataSet(sSQL);
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, int nID)
{
tc.ExecuteNonQuery("DELETE FROM [Complain] WHERE ComplainID=%n", nID);
}
#endregion
}
#endregion
}