89 lines
2.9 KiB
C#
89 lines
2.9 KiB
C#
|
using System;
|
|||
|
using Payroll.BO;
|
|||
|
using System.Data;
|
|||
|
using System.Linq;
|
|||
|
using System.Data.SqlClient;
|
|||
|
using Ease.CoreV35.DataAccess;
|
|||
|
using System.Collections.Generic;
|
|||
|
using Ease.Core.DataAccess;
|
|||
|
|
|||
|
namespace Payroll.Service
|
|||
|
{
|
|||
|
internal class ClaimDisbursementDA
|
|||
|
{
|
|||
|
#region Constructor
|
|||
|
private ClaimDisbursementDA()
|
|||
|
{ }
|
|||
|
#endregion
|
|||
|
|
|||
|
#region ClaimRembursement
|
|||
|
|
|||
|
#region Insert function
|
|||
|
|
|||
|
internal static void Insert(TransactionContext tc, ClaimDisbursement item)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery(@"INSERT INTO ClaimDisbursementPermission(ClaimDisbursementID, UserID, LocationID,
|
|||
|
CreatedBy, CreationDate)" +
|
|||
|
" VALUES(%n,%n,%n,%n,%d)",
|
|||
|
DataReader.GetNullValue(item.ID), item.UserID, item.LocationID,
|
|||
|
DataReader.GetNullValue(item.CreatedBy), DataReader.GetNullValue(item.CreatedDate));
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Update function
|
|||
|
|
|||
|
internal static void Update(TransactionContext tc, ClaimDisbursement item)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery(@"UPDATE ClaimDisbursementPermission SET UserID=%n, LocationID=%n,
|
|||
|
ModifiedBy=%n, ModifiedDate=%d" +
|
|||
|
" WHERE ClaimDisbursementID=%n", item.UserID, item.LocationID,
|
|||
|
DataReader.GetNullValue(item.ModifiedBy), DataReader.GetNullValue(item.ModifiedDate),
|
|||
|
DataReader.GetNullValue(item.ID));
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Get Function
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc)
|
|||
|
{
|
|||
|
return tc.ExecuteReader(@"SELECT * FROM ClaimDisbursementPermission");
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc, int nID)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM ClaimDisbursementPermission WHERE ClaimDisbursementID=%n", nID);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Delete function
|
|||
|
|
|||
|
internal static void Delete(TransactionContext tc, int nID)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("DELETE FROM ClaimDisbursementPermission WHERE ClaimDisbursementID=%n", nID);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetUserLocation(TransactionContext tc)
|
|||
|
{
|
|||
|
return tc.ExecuteReader(@"SELECT cdp.*,u.LOGINID,u.USERNAME,l.[DESCRIPTION],l.CODE
|
|||
|
FROM ClaimDisbursementPermission cdp
|
|||
|
INNER JOIN USERS AS u ON cdp.userID=u.USERID
|
|||
|
INNER JOIN Location AS l ON cdp.locationID=l.locationID");
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader CheckUserLocationExist(TransactionContext tc, ClaimDisbursement item)
|
|||
|
{
|
|||
|
return tc.ExecuteReader(@"SELECT COUNT(locationID) LocationCount FROM ClaimDisbursementPErmission
|
|||
|
WHERE userID=%n and locationID=%n
|
|||
|
GROUP BY UserID,locationID",item.UserID,item.LocationID);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
}
|
|||
|
}
|