using HRM.BO; using Ease.Core.DataAccess; using System; using System.Data; namespace HRM.DA { public class YearEndRecomendationDA { internal static IDataReader Get(TransactionContext tc) { string sql = SQLParser.MakeSQL("SELECT * FROM YearEndRecomendation"); return tc.ExecuteReader(sql); } internal static IDataReader Get(TransactionContext tc, int PMPID, EnumRecomendationLevel recomLevel) { string sql = SQLParser.MakeSQL( "select * from YearEndRecomendation where objectivesetid in(select objectivesetid from objectiveset where pmpyearid=%n)and Recomendationlevel=%n", PMPID, (int)recomLevel); return tc.ExecuteReader(sql); } internal static IDataReader Get(TransactionContext tc, int id) { string sql = SQLParser.MakeSQL("SELECT * FROM YearEndRecomendation WHERE YearEndRecomendationID = %n", id); return tc.ExecuteReader(sql); } internal static IDataReader GetYearEndRecomendation(TransactionContext tc, int iD) { string sql = SQLParser.MakeSQL("SELECT * FROM YearEndRecomendation WHERE ObjectiveSetID = %n", iD); return tc.ExecuteReader(sql); } internal static void Insert(TransactionContext tc, YearEndRecomendation item) { string sql = SQLParser.MakeSQL( "Insert Into YearEndRecomendation(YearEndRecomendationID, ObjectiveSetID, TransferLocID, PromotionLevelID, PromotionLevelRemarks, TechnicalAllowance, PerformanceAllowance, SpecialAllowance, OthersAllowance, ContractRenewalDuration, ConfirmationLevelID, OthersDetail, RecomendationBy, RecomendationDate, RecomendationLevel, RecomendationByNodeID, RecomendationType, TransferLocation, PromotionDesignationID, ConfirmationDesignationID,Confirmation) Values(%n, %n, %n,%n, %s, %s, %n, %n, %n, %s, %n, %s, %n, %d, %n, %n, %n, %s, %n, %n,%b)", item.ID, item.ObjectiveSetID, DataReader.GetNullValue(item.TransferLocID), DataReader.GetNullValue(item.PromotionLevelID), item.PromotionLevelRemarks, item.TechnicalAllowance, item.PerformanceAllowance, item.SpecialAllowance, item.OthersAllowance, item.ContractRenewalDuration, DataReader.GetNullValue(item.ConfirmationLevelID), item.OthersDetail, DataReader.GetNullValue(item.RecomendationBy), item.RecomendationDate, (int)item.RecomendationLevel, DataReader.GetNullValue(item.RecomendationByNodeID), (int)item.RecomendationType, item.TransferLocation, DataReader.GetNullValue(item.PromotionDesignationID), DataReader.GetNullValue(item.ConfirmationDesignationID), item.Confirmation); tc.ExecuteNonQuery(sql); } internal static void Update(TransactionContext tc, YearEndRecomendation item) { string sql = SQLParser.MakeSQL( "Update YearEndRecomendation Set ObjectiveSetID=%n, TransferLocID=%n, PromotionLevelID=%n, PromotionLevelRemarks=%s, TechnicalAllowance=%n, PerformanceAllowance=%n, SpecialAllowance=%n, OthersAllowance=%n, ContractRenewalDuration=%s, ConfirmationLevelID=%n, OthersDetail=%s, RecomendationBy=%n, RecomendationDate=%d, RecomendationLevel=%n, RecomendationByNodeID=%n, RecomendationType = %n, TransferLocation = %s, PromotionDesignationID = %n, ConfirmationDesignationID = %n,Confirmation=%b where YearEndRecomendationID= %n", item.ObjectiveSetID, DataReader.GetNullValue(item.TransferLocID), DataReader.GetNullValue(item.PromotionLevelID), item.PromotionLevelRemarks, item.TechnicalAllowance, item.PerformanceAllowance, item.SpecialAllowance, item.OthersAllowance, item.ContractRenewalDuration, DataReader.GetNullValue(item.ConfirmationLevelID), item.OthersDetail, DataReader.GetNullValue(item.RecomendationBy), item.RecomendationDate, item.RecomendationLevel, DataReader.GetNullValue(item.RecomendationByNodeID), (int)item.RecomendationType, item.TransferLocation, DataReader.GetNullValue(item.PromotionDesignationID), DataReader.GetNullValue(item.ConfirmationDesignationID), item.Confirmation, item.ID); tc.ExecuteNonQuery(sql); } internal static void Delete(TransactionContext tc, int id) { string sql = SQLParser.MakeSQL("Delete From YearEndRecomendation Where YearEndRecomendationID = %n", id); tc.ExecuteNonQuery(sql); } } }