CEL_Payroll/Payroll.Service/Budget/DA/EmpAppraisalRatingDA.cs
2024-09-17 14:30:13 +06:00

50 lines
2.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Ease.CoreV35.DataAccess;
using Payroll.BO;
using Ease.CoreV35.Model;
namespace Payroll.Service
{
public class EmpAppraisalRatingDA
{
internal static IDataReader Get(TransactionContext tc, DateTime appraisalyear)
{
return tc.ExecuteReader("Select * From EmpAppraisalRating where AppraisalYear=%d", Ease.CoreV35.Utility.Global.DateFunctions.LastDateOfYear(appraisalyear));
}
internal static void Insert(TransactionContext tc,EmpAppraisalRating item)
{
tc.ExecuteNonQuery("Insert into EmpAppraisalRating(EmpAppraislRatingID,AppraisalPointRatingID,AppraisalYear,EmployeeID,CreatedBy,CreationDate) Values(%n,%n,%d,%n,%n,%d)", item.ID.Integer, item.AppraisalPointRatingID.Integer, item.AppraisalYear, item.EmployeeID.Integer, item.CreatedBy.Integer, item.CreatedDate);
}
internal static void Delete(TransactionContext tc, ID id)
{
tc.ExecuteNonQuery("Delete From EmpAppraisalRating Where EmpAppraislRatingID = %n", id.Integer);
}
internal static void Update(TransactionContext tc, EmpAppraisalRating item)
{
tc.ExecuteNonQuery("Update EmpAppraisalRating Set AppraisalPointRatingID = %n ,AppraisalYear = %d,EmployeeID = %n,ModifiedBy = %n,ModifiedDate = %d Where EmpAppraislRatingID = %n", item.AppraisalPointRatingID.Integer, item.AppraisalYear, item.EmployeeID.Integer, item.ModifiedBy.Integer, item.ModifiedDate,item.ID.Integer);
}
internal static void DeleteByEmpIdAndYear(TransactionContext tc, EmpAppraisalRating item)
{
DateTime startDate = Ease.CoreV35.Utility.Global.DateFunctions.FirstDateOfYear(item.AppraisalYear);
DateTime lastDate = Ease.CoreV35.Utility.Global.DateFunctions.LastDateOfYear(item.AppraisalYear);
string query = SQLParser.MakeSQL("Delete From EmpAppraisalRating Where (AppraisalYear Between %d And %d) And EmployeeID = %n",
startDate, lastDate, item.EmployeeID.Integer);
tc.ExecuteNonQuery(query);
}
}
}