using Ease.Core.DataAccess; using HRM.BO; using System; using System.Data; namespace HRM.DA { internal class EmployeeRetirementDA { internal static void Insert(TransactionContext tc, EmployeeRetirement item) { tc.ExecuteNonQuery("INSERT INTO EmployeeRetirement(empretirementid, EmployeeId, RetirementAge)" + " VALUES(%n, %n, %n)", item.ID, item.employeeID, item.retirementAge); } internal static IDataReader Get(TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM EmployeeRetirement "); } internal static void Update(TransactionContext tc, EmployeeRetirement oEmployee) { tc.ExecuteNonQuery("UPDATE EmployeeRetirement SET RetirementAge = %n" + " WHERE employeeID = %n ", oEmployee.retirementAge, oEmployee.employeeID); } internal static int GetById(int iD) { throw new NotImplementedException(); } internal static void UpdateIteam(TransactionContext tc, EmployeeRetirement iteam) { throw new NotImplementedException(); } internal static int GetById(TransactionContext tc, int iD) { throw new NotImplementedException(); } internal static int GetAgeById(TransactionContext tc, int id) { //return tc.ExecuteSQL("SELECT RetirementAge from EmployeeRetirement WHERE EmployeeId = %n", id); object ob = new object(); ob = tc.ExecuteScalar("SELECT RetirementAge from EmployeeRetirement WHERE EmployeeId = %n", id); if (ob == DBNull.Value) { return -1; } else return Convert.ToInt32(ob); } } }