82 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			82 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
using HRM.BO;
 | 
						|
using Ease.Core.DataAccess;
 | 
						|
using System.Data;
 | 
						|
 | 
						|
 | 
						|
namespace HRM.DA
 | 
						|
{
 | 
						|
    internal class AchievementDA
 | 
						|
    {
 | 
						|
        #region constructor
 | 
						|
 | 
						|
        public AchievementDA()
 | 
						|
        {
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region Insert function
 | 
						|
 | 
						|
        internal static void Insert(TransactionContext tc, Achievement item)
 | 
						|
        {
 | 
						|
            tc.ExecuteNonQuery(
 | 
						|
                "INSERT INTO ACHIEVEMENT(ACHIEVEMENTID, CODE, DESCRIPTION, SEQUENCENO, STATUS, CREATEDBY, CREATIONDATE)" +
 | 
						|
                " VALUES(%n, %s, %s, %n, %n, %n, %d)", item.ID, item.Code, item.Description, item.Sequence, item.Status,
 | 
						|
                item.CreatedBy, item.CreatedDate);
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region Update function
 | 
						|
 | 
						|
        internal static void Update(TransactionContext tc, Achievement item)
 | 
						|
        {
 | 
						|
            tc.ExecuteNonQuery(
 | 
						|
                "UPDATE ACHIEVEMENT SET code=%s, description=%s, sequencenO=%n, status=%n, modifiedby=%n, modifieddate=%d" +
 | 
						|
                " WHERE ACHIEVEMENTID=%n", item.Code, item.Description, item.Sequence, item.Status, item.ModifiedBy,
 | 
						|
                item.ModifiedDate, item.ID);
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region Get function
 | 
						|
 | 
						|
        internal static IDataReader Get(TransactionContext tc)
 | 
						|
        {
 | 
						|
            return tc.ExecuteReader("SELECT * FROM ACHIEVEMENT");
 | 
						|
        }
 | 
						|
 | 
						|
        internal static IDataReader Get(TransactionContext tc, EnumStatus status)
 | 
						|
        {
 | 
						|
            if (EnumStatus.Active == status)
 | 
						|
            {
 | 
						|
                return tc.ExecuteReader("SELECT * FROM ACHIEVEMENT Where Status=%n Order By SequenceNo", status);
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                return tc.ExecuteReader("SELECT * FROM ACHIEVEMENT Order By SequenceNo");
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        internal static IDataReader Get(TransactionContext tc, int ID)
 | 
						|
        {
 | 
						|
            return tc.ExecuteReader("SELECT * FROM ACHIEVEMENT WHERE ACHIEVEMENTID=%n", ID);
 | 
						|
        }
 | 
						|
 | 
						|
        internal static IDataReader Get(TransactionContext tc, string sCode)
 | 
						|
        {
 | 
						|
            return tc.ExecuteReader("SELECT * FROM ACHIEVEMENT WHERE Code=%s", sCode);
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region Delete function
 | 
						|
 | 
						|
        internal static void Delete(TransactionContext tc, int ID)
 | 
						|
        {
 | 
						|
            tc.ExecuteNonQuery("DELETE FROM ACHIEVEMENT WHERE ACHIEVEMENTID=%n", ID);
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
    }
 | 
						|
} |