EchoTex_Payroll/HRM.DA/DA/Fund/Basic/TrustyInfoDA.cs

114 lines
3.5 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;
namespace HRM.DA.Fund
{
#region class TrustyInfoDA
internal class TrustyInfoDA
{
#region Constructor
public TrustyInfoDA()
{
}
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, TrustyInfo oItem)
{
tc.ExecuteNonQuery(
"INSERT INTO TrustyInfo(TrustyID, Name, Code, Email, Contacts, Status, ProjectID,CreatedBy,CreatedDate)" +
" VALUES(%n, %s, %s, %s, %s, %n, %n, %n, %D)", oItem.ID, oItem.Name, oItem.Code, oItem.Email,
oItem.Contacts, oItem.Status, oItem.ID, oItem.CreatedBy, oItem.CreatedDate);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, TrustyInfo oItem)
{
tc.ExecuteNonQuery(
"UPDATE TrustyInfo SET Name=%s,Code=%s, Email=%s, Contacts=%s, Status=%n, ProjectID=%n, ModifiedBy = %n, ModifiedDate = %D" +
" WHERE TrustyID=%n", oItem.Name, oItem.Code, oItem.Email, oItem.Contacts, oItem.Status, oItem.ID,
oItem.ModifiedBy, oItem.ModifiedDate, oItem.ID);
;
}
#endregion
internal static bool IsExist(TransactionContext tc, string TrustyInfoCode, int fundtypeid)
{
object ob = tc.ExecuteScalar("SELECT COUNT(*) FROM TrustyInfo WHERE Code=%s AND ProjectID = %n",
TrustyInfoCode, fundtypeid);
return Convert.ToInt32(ob) > 0;
}
#region IsInMinutes
internal static bool IsInMinutes(TransactionContext tc, int trusteeID)
{
object ob = tc.ExecuteScalar("SELECT COUNT(*) FROM TrustyMinutesInfoRelation WHERE TrustyID = %n ",
trusteeID);
return Convert.ToInt32(ob) > 0;
}
#endregion
#region int Generation function
internal static int GetNewID(TransactionContext tc)
{
return tc.GenerateID("TrustyInfo", "TrustyID");
}
#endregion
#region Get Function
internal static IDataReader Getbyfundtype(TransactionContext tc, int fundtypeid)
{
return tc.ExecuteReader("SELECT * FROM TrustyInfo Where ProjectID = %n", fundtypeid);
}
internal static IDataReader Get(TransactionContext tc, int TrustyID)
{
return tc.ExecuteReader("SELECT * FROM TrustyInfo WHERE TrustyID=%n", TrustyID);
}
internal static IDataReader GetByProjectID(TransactionContext tc, int projectID)
{
return tc.ExecuteReader("SELECT * FROM TrustyInfo WHERE ProjectID=%n", projectID);
}
internal static IDataReader GetByStatusAndProjectID(TransactionContext tc, int projectID,
EnumTrustyStatus status)
{
return tc.ExecuteReader("SELECT * FROM TrustyInfo WHERE ProjectID=%n AND Status = %n", projectID, status);
}
internal static IDataReader GetbyStatus(TransactionContext tc, int Type, int fundtypeid)
{
return tc.ExecuteReader("SELECT * FROM TrustyInfo WHERE Status=%n AND ProjectID = %n", Type, fundtypeid);
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, int TrustyInfoID)
{
tc.ExecuteNonQuery("DELETE FROM [TrustyInfo] WHERE TrustyID=%n", TrustyInfoID);
}
#endregion
}
#endregion
}