using HRM.BO; using Ease.Core.DataAccess; using System; using System.Data; namespace HRM.DA { public class PMPValueBehaviorDA { internal static IDataReader Get(TransactionContext tc, EnumStatus status) { if (status == EnumStatus.Regardless) return tc.ExecuteReader("Select * From PMP_ValueBehavior"); else { return tc.ExecuteReader("Select * From PMP_ValueBehavior Where Status = %n", status); } } internal static IDataReader Get(TransactionContext tc, EnumStatus status,int payrollTypeID) { if (status == EnumStatus.Regardless) return tc.ExecuteReader("Select * From PMP_ValueBehavior where payrolltypeID=%n", payrollTypeID); else { return tc.ExecuteReader("Select * From PMP_ValueBehavior Where Status = %n and payrolltypeID=%n", status, payrollTypeID); } } internal static void Insert(TransactionContext tc, PMPValueBehavior item) { tc.ExecuteNonQuery( "Insert Into PMP_ValueBehavior(PMPValueBehaviorID,Name,CreatedBy,CreatedDate,Status,Sequence,DESCRIPTION, TIRE, PARENTID, PayrollTypeID,Code) Values(%n,%s,%n,%d,%n,%n,%s,%n,%n,%n,%s)", item.ID, item.Name, item.CreatedBy, item.CreatedDate, item.Status, item.Sequence,item.Description, item.Tier,item.ParentID,item.PayrollTypeID,item.Code); } internal static void Update(TransactionContext tc, PMPValueBehavior item) { tc.ExecuteNonQuery( "Update PMP_ValueBehavior Set Code = %s, Name = %s, Description=%s, ModifiedBy = %n, ModifiedDate = %d, Status = %n , Sequence = %n,TIRE=%n,PARENTID=%n,PayrollTypeID=%n Where PMPValueBehaviorID = %n", item.Code, item.Name, item.Description, item.ModifiedBy, item.ModifiedDate, item.Status, item.Sequence,item.Tier,item.ParentID, item.PayrollTypeID, item.ID); } internal static void Delete(TransactionContext tc, int id) { tc.ExecuteNonQuery("Delete From PMP_ValueBehavior Where PMPValueBehaviorID = %n", id); } internal static IDataReader Get(TransactionContext tc, int id) { return tc.ExecuteReader("Select * From PMP_ValueBehavior Where PMPValueBehaviorID = %n", id); } internal static IDataReader Get(TransactionContext tc) { return tc.ExecuteReader("Select * From PMP_ValueBehavior"); } } }