101 lines
3.5 KiB
C#
101 lines
3.5 KiB
C#
using HRM.BO;
|
|
using Ease.Core.DataAccess;
|
|
using System;
|
|
using System.Data;
|
|
|
|
|
|
namespace HRM.DA
|
|
{
|
|
#region PMSUpdateHistory
|
|
|
|
internal class PMSUpdateHistoryDA
|
|
{
|
|
#region Constructor
|
|
|
|
private PMSUpdateHistoryDA()
|
|
{
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Insert function
|
|
|
|
internal static void Insert(TransactionContext tc, PMSUpdateHistory item)
|
|
{
|
|
string sql = SQLParser.MakeSQL(
|
|
"INSERT INTO PMSUpdateHistory(PMSUpdateHistoryID, ObjectiveSetID, PMPYearID,ObjectID, Description, ActorType, ChangeType, PmpStatus,Sequence, CreatedBy, CreationDate)" +
|
|
" VALUES(%n, %n, %n, %n,%s, %n, %n,%n,%n, %n, %d)", item.ID, item.ObjectiveSetID, item.PMPYearID,
|
|
DataReader.GetNullValue(item.ObjectID), item.Description, (int)item.ActorType, (int)item.ChangeType,
|
|
(int)item.PmpStatus, item.Sequence, item.CreatedBy, item.CreatedDate);
|
|
tc.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Update function
|
|
|
|
internal static void Update(TransactionContext tc, PMSUpdateHistory item)
|
|
{
|
|
tc.ExecuteNonQuery(
|
|
"UPDATE PMSUpdateHistory SET ObjectiveSetID=%n, PMPYearID=%n, ObjectID=%n, Description=%s, ActorType=%n, ChangeType=%n, PmpStatus=%n, ModifiedBy=%n, ModifiedDate=%d" +
|
|
" WHERE PMSUpdateHistoryID=%n", item.ObjectiveSetID, item.PMPYearID,
|
|
DataReader.GetNullValue(item.ObjectID), item.Description, (int)item.ActorType, (int)item.ChangeType,
|
|
(int)item.PmpStatus, item.ModifiedBy, item.ModifiedDate, item.ID);
|
|
|
|
//tc.ExecuteNonQuery("UPDATE IncomeTaxYearly SET ItemCode=-222,Itemid=-222 WHERE Description='L.T.A. / Medical Allowance'"); Neeed to Discuss With Boss
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Get Function
|
|
|
|
internal static IDataReader Get(TransactionContext tc)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM PMSUpdateHistory ");
|
|
}
|
|
|
|
internal static int GetSequence(TransactionContext tc, EnumPMPStatus pmsStatus,
|
|
EnumObjectiveChangeType changeType, EnumActor actor)
|
|
{
|
|
int nSequnce = 0;
|
|
object obj =
|
|
tc.ExecuteScalar(
|
|
"SELECT Max(Sequence) FROM PMSUpdateHistory WHERE PMPSTATUS=%n AND CHANGETYPE=%n AND ACTORTYPE=%n ",
|
|
(int)pmsStatus, (int)changeType, (int)actor);
|
|
if (obj != DBNull.Value)
|
|
{
|
|
nSequnce = Convert.ToInt32(obj);
|
|
}
|
|
|
|
return nSequnce + 1;
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc, int nID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM PMSUpdateHistory WHERE PMSUpdateHistoryID=%n", nID);
|
|
}
|
|
|
|
internal static IDataReader GetByPMSYearID(TransactionContext tc, int PMPID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM PMSUpdateHistory WHERE PMPYearID=%s", PMPID);
|
|
}
|
|
|
|
internal static IDataReader GetByObjectiveSetID(TransactionContext tc, int ObjectiveSetID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM PMSUpdateHistory WHERE ObjectiveSetID=%n", ObjectiveSetID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Delete function
|
|
|
|
internal static void Delete(TransactionContext tc, int nID)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM PMSUpdateHistory WHERE PMSUpdateHistoryID=%n", nID);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
#endregion
|
|
} |