using HRM.BO;
using Ease.Core.DataAccess;
using System;
using System.Data;


namespace HRM.DA
{
    #region PFinterestProvisionDA

    internal class PFinterestProvisionDA
    {
        #region Constructor

        private PFinterestProvisionDA()
        {
        }

        #endregion

        #region Insert function

        internal static void Insert(TransactionContext tc, PFinterestProvision item)
        {
            tc.ExecuteNonQuery(
                "INSERT INTO PFINTPROVISION(employeeID, processedMonthDate, pFamount, cPFAmount, pFIntProvision, cPFIntProvision, pending, CreatedBy, CreationDate)" +
                " VALUES(%n, %d, %n, %n, %n, %n, %b, %n, %d)", item.EmployeeID, item.ProcessedMonthDate, item.PFamount,
                item.CPFAmount, item.PFIntProvision, item.CPFIntProvision, item.Pending, item.CreatedBy,
                item.CreatedDate);
        }

        #endregion

        #region Update function

        internal static void Update(TransactionContext tc, PFinterestProvision item)
        {
            tc.ExecuteNonQuery(
                "UPDATE PFINTPROVISION SET processedMonthDate=%d, pFamount=%n, cPFAmount=%n, pFIntProvision=%n, cPFIntProvision=%n, pending=%b, ModifiedBy=%n, ModifiedDate=%d" +
                " WHERE employeeID=%n", item.ProcessedMonthDate, item.PFamount, item.CPFAmount, item.PFIntProvision,
                item.CPFIntProvision, item.Pending, item.ModifiedBy, item.ModifiedDate, item.EmployeeID);
        }

        #endregion

        #region Get Function

        internal static IDataReader Get(TransactionContext tc)
        {
            return tc.ExecuteReader("SELECT * FROM PFINTPROVISION");
        }

        internal static IDataReader Get(TransactionContext tc, int nEmpID)
        {
            return tc.ExecuteReader("SELECT * FROM PFINTPROVISION WHERE employeeID=%n", nEmpID);
        }

        #endregion

        #region Delete function

        internal static void Delete(TransactionContext tc, int nID)
        {
            tc.ExecuteNonQuery("DELETE FROM PFINTPROVISION WHERE PFinterestProvisionID=%n", nID);
        }

        #endregion
    }

    #endregion
}