using HRM.BO; using Ease.Core.DataAccess; using System; using System.Data; namespace HRM.DA { public class EmpAppraisalRatingDA { internal static IDataReader Get(TransactionContext tc, DateTime appraisalyear) { return tc.ExecuteReader("Select * From EmpAppraisalRating where AppraisalYear=%d", Ease.Core.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, item.AppraisalPointRatingID, item.AppraisalYear, item.EmployeeID, item.CreatedBy, item.CreatedDate); } internal static void Delete(TransactionContext tc, int id) { tc.ExecuteNonQuery("Delete From EmpAppraisalRating Where EmpAppraislRatingID = %n", id); } 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, item.AppraisalYear, item.EmployeeID, item.ModifiedBy, item.ModifiedDate, item.ID); } internal static void DeleteByEmpIdAndYear(TransactionContext tc, EmpAppraisalRating item) { DateTime startDate = Ease.Core.Utility.Global.DateFunctions.FirstDateOfYear(item.AppraisalYear); DateTime lastDate = Ease.Core.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); tc.ExecuteNonQuery(query); } } }