using HRM.BO; using Ease.Core.DataAccess; using System; using System.Data; namespace HRM.DA { #region ReplaceEmployeesObjectives internal class ReplaceEmployeesObjectivesDA { #region Constructor private ReplaceEmployeesObjectivesDA() { } #endregion #region Insert function internal static void Insert(TransactionContext tc, ReplaceEmployeesObjectives item) { tc.ExecuteNonQuery( "INSERT INTO ReplaceEmployeesObjectives(ReplaceEmployeesObjectivesID, RequestedEmployeeID, AssignedForEmployeeID, AssignedToEmployeeID, PMPYearID, IsApproved)" + " VALUES(%n, %n, %n, %n, %n,%b)", item.ID, item.RequestedEmployeeID, DataReader.GetNullValue(item.AssignedForEmployeeID), DataReader.GetNullValue(item.AssignedToEmployeeID), item.PMPYearID, item.IsApproved); } #endregion #region Update function internal static void Update(TransactionContext tc, ReplaceEmployeesObjectives item) { tc.ExecuteNonQuery( "UPDATE ReplaceEmployeesObjectives SET RequestedEmployeeID=%n, AssignedForEmployeeID=%n, AssignedToEmployeeID=%n, PMPYearID=%n, IsApproved=%b,ApprovedBy=%n,ApprovalDate=%d" + " WHERE ReplaceEmployeesObjectivesID=%n", item.RequestedEmployeeID, DataReader.GetNullValue(item.AssignedForEmployeeID), DataReader.GetNullValue(item.AssignedToEmployeeID), item.PMPYearID, item.IsApproved, DataReader.GetNullValue(item.ApprovedBy), item.ApprovalDate, item.ID); } #endregion #region Get Function internal static IDataReader Get(TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM ReplaceEmployeesObjectives"); } internal static IDataReader Get(TransactionContext tc, int nPMPYearID) { return tc.ExecuteReader("SELECT * FROM ReplaceEmployeesObjectives where PMPYearID=%n", nPMPYearID); } internal static IDataReader Get(TransactionContext tc, int nPMPYearID, int nEmpID) { return tc.ExecuteReader( "SELECT * FROM ReplaceEmployeesObjectives where PMPYearID=%n AND AssignedToEmployeeID=%n AND IsApproved=%b", nPMPYearID, nEmpID, true); } #endregion #region Delete function internal static void Delete(TransactionContext tc, int nID) { tc.ExecuteNonQuery("DELETE FROM [ReplaceEmployeesObjectives] WHERE ReplaceEmployeesObjectivesID=%n", nID); } #endregion } #endregion }