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

namespace HRM.DA
{
    #region PhotoPathDA

    internal class PhotoPathDA
    {
        #region Constructor

        private PhotoPathDA()
        {
        }

        #endregion

        #region Insert function

        internal static void Insert(TransactionContext tc, PhotoPath item)
        {
            tc.ExecuteNonQuery(
                "INSERT INTO PhotoPath(PathID, EmployeePhoto, EmployeeSignature, NomineePhoto, NomineeSignature, HospitalizationPhoto,LetterTempPath,ERRSFilePath,TrainingOutlinePath, AttendanceSourceFilePath, AttendanceBackUpFilePath, BadliAttnSourceFilePath, BadliAttnBackUpFilePath)" +
                " VALUES(%n,%s, %s, %s, %s, %s,%s,%s,%s, %s, %s, %s, %s)", item.ID, item.EmployeePhoto,
                item.EmployeeSignature, item.NomineePhoto, item.NomineeSignature, item.HospitalizationPhoto,
                item.LetterTempPath, item.ERRSFilePath, item.TrainingOutlinePath, item.AttendanceSourceFilePath,
                item.AttendanceBackUpFilePath, item.BadliAttendanceSourceFilePath, item.BadliAttendanceBackUpFilePath);
        }

        #endregion

        #region Update function

        internal static void Update(TransactionContext tc, PhotoPath item)
        {
            tc.ExecuteNonQuery(
                "UPDATE PhotoPath SET EmployeePhoto=%s, EmployeeSignature=%s, NomineePhoto=%s, NomineeSignature=%s, HospitalizationPhoto=%s,LetterTempPath=%s,ERRSFilePath=%s,TrainingOutlinePath=%s, AttendanceSourceFilePath =%s, AttendanceBackUpFilePath=%s, BadliAttnSourceFilePath=%s, BadliAttnBackUpFilePath=%s" +
                " WHERE PathID=%n", item.EmployeePhoto, item.EmployeeSignature, item.NomineePhoto,
                item.NomineeSignature, item.HospitalizationPhoto, item.LetterTempPath, item.ERRSFilePath,
                item.TrainingOutlinePath, item.AttendanceSourceFilePath, item.AttendanceBackUpFilePath,
                item.BadliAttendanceSourceFilePath, item.BadliAttendanceBackUpFilePath, item.ID);
        }

        #endregion

        #region Get Function

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

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

        #endregion

        #region Delete function

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

        #endregion
    }

    #endregion
}