using HRM.BO; using Ease.Core.DataAccess; using System; using System.Data; namespace HRM.DA { public class PMPRatingDA { internal static IDataReader Get(TransactionContext tc, EnumStatus status) { if (status == EnumStatus.Regardless) { return tc.ExecuteReader("Select * From PMP_Rating order by PMPRATINGTYPE, PMPRATINGVALUE, PMPYEARID"); } else { return tc.ExecuteReader("Select * From PMP_Rating Where Status = %n order by PMPRATINGTYPE, PMPRATINGVALUE, PMPYEARID", status); } } internal static void Delete(TransactionContext tc, int id) { tc.ExecuteNonQuery("Delete From PMP_Rating Where PMPRatingID = %n", id); } internal static void Insert(TransactionContext tc, PMPRating oPMPRating) { tc.ExecuteNonQuery( "Insert Into PMP_Rating(PMPRatingID,PMPRatingName,PMPRatingDescription,PMPRatingvalue,PMPRATINGTYPE,PMPYEARID,BELLCURVETYPE,INCREMENTPERCENT,FromPercent,ToPercent,CreatedBy,CreatedDate,Status,Sequence,HeadCount)Values(%n,%s,%s,%n,%n,%n,%n,%n,%n,%n,%n,%d,%n,%n,%n)", oPMPRating.ID, oPMPRating.Name, oPMPRating.Description, oPMPRating.RatingValue, oPMPRating.PMPRatingType, oPMPRating.PMPYearId, oPMPRating.BellCurveType, oPMPRating.IncrementPercent, oPMPRating.FromPercent, oPMPRating.ToPercent, oPMPRating.CreatedBy, oPMPRating.CreatedDate, oPMPRating.Status, oPMPRating.Sequence, oPMPRating.HeadCount); } internal static void Update(TransactionContext tc, PMPRating oPMPRating) { tc.ExecuteNonQuery( "Update PMP_Rating Set PMPRatingName = %s,PMPRatingDescription=%s, PMPRatingvalue = %n, PMPRATINGTYPE = %n, PMPYEARID = %n, BELLCURVETYPE = %n, INCREMENTPERCENT = %n, FROMPERCENT = %n, TOPERCENT = %n, ModifiedBy = %n, ModifiedDate = %d, Status = %n,Sequence = %n, HeadCount = %n " + "Where PMPRatingID = %n", oPMPRating.Name, oPMPRating.Description, oPMPRating.RatingValue, oPMPRating.PMPRatingType, oPMPRating.PMPYearId, oPMPRating.BellCurveType, oPMPRating.IncrementPercent, oPMPRating.FromPercent, oPMPRating.ToPercent, oPMPRating.ModifiedBy, oPMPRating.ModifiedDate, oPMPRating.Status, oPMPRating.Sequence, oPMPRating.HeadCount, oPMPRating.ID); } internal static IDataReader GetById(TransactionContext tc, int id) { return tc.ExecuteReader("Select * From PMP_Rating Where PMPRatingID = %n", id); } internal static IDataReader GetPMPRatingByTypeAndYear(TransactionContext tc, EnumPMPRatingType type, int pmpYearId) { return tc.ExecuteReader("SELECT * FROM PMP_RATING WHERE PMPRATINGTYPE = %n and PMPYEARID = %n order by PMPRATINGTYPE, PMPRATINGVALUE, PMPYEARID", type, pmpYearId); } } }