using System; using System.Collections.Generic; using System.Linq; using System.Text; using Ease.CoreV35.DataAccess; using Payroll.BO; using System.Data; namespace Payroll.Service { 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.Integer,item.employeeID.Integer,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.Integer); } internal static int GetById(Ease.CoreV35.Model.ID iD) { throw new NotImplementedException(); } internal static void UpdateIteam(TransactionContext tc, EmployeeRetirement iteam) { throw new NotImplementedException(); } internal static int GetById(TransactionContext tc, Ease.CoreV35.Model.ID iD) { throw new NotImplementedException(); } internal static int GetAgeById(TransactionContext tc, Ease.CoreV35.Model.ID id) { //return tc.ExecuteSQL("SELECT RetirementAge from EmployeeRetirement WHERE EmployeeId = %n", id.Integer); object ob = new object(); ob = tc.ExecuteScalar("SELECT RetirementAge from EmployeeRetirement WHERE EmployeeId = %n", id.Integer); if (ob == DBNull.Value) { return -1; } else return Convert.ToInt32(ob); } } }