using System; using System.Data; using Ease.Core.DataAccess; using HRM.BO; namespace HRM.DA { public class MedicalBenifitSetupDA { #region Constructor public MedicalBenifitSetupDA() { } #endregion #region Insert function public static void Insert(TransactionContext tc, MedicalBenifitSetup oItem) { tc.ExecuteNonQuery("INSERT INTO MedicalBenifitSetup(SetupID, GradeID, MemberAmount, AllowedPerson)" + " VALUES(%n, %n, %n,%n)", oItem.ID, oItem.GradeID, oItem.MemberAmount, oItem.AllowedPerson); } #endregion #region Update function public static void Update(TransactionContext tc, MedicalBenifitSetup oItem) { tc.ExecuteNonQuery("UPDATE MedicalBenifitSetup SET MemberAmount=%n, AllowedPerson=%n" + " WHERE GradeID=%n", oItem.MemberAmount, oItem.AllowedPerson, oItem.GradeID); } #endregion #region Get function public static IDataReader Get(TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM MedicalBenifitSetup ORDER BY GradeID"); } public static IDataReader Get(TransactionContext tc, int gradeID) { return tc.ExecuteReader("SELECT * FROM MedicalBenifitSetup where GradeID = %n", gradeID); } #endregion #region Other function public static bool IsExist(TransactionContext tc, int gradeID) { bool Exist = false; Object obj = tc.ExecuteScalar("Select COUNT (*) FROM MedicalBenifitSetup WHERE GradeID=%n ", gradeID); Exist = Convert.ToInt32(obj) > 0 ? true : false; return Exist; } #endregion } }