using HRM.BO; using Ease.Core.DataAccess; using System; using System.Data; namespace HRM.DA { class ObjectiveEmployeesDA { internal static IDataReader Get(TransactionContext tc) { string sql = SQLParser.MakeSQL("SELECT * FROM ObjectiveEmployees"); return tc.ExecuteReader(sql); } internal static IDataReader GetByObjIDs(TransactionContext tc, string sObjIDs) { string sql = SQLParser.MakeSQL("SELECT * FROM ObjectiveEmployees where objectiveID in (%q)", sObjIDs); return tc.ExecuteReader(sql); } internal static IDataReader Get(TransactionContext tc, int id) { string sql = SQLParser.MakeSQL("SELECT * FROM ObjectiveEmployees WHERE ObjectiveEmployeesID = %n", id); return tc.ExecuteReader(sql); } internal static IDataReader GetByEmployeeID(TransactionContext tc, int empID, int pmpID) { string sql = SQLParser.MakeSQL( "SELECT * FROM ObjectiveEmployees oe,Objective o WHERE oe.ObjectiveID=o.ObjectiveID AND oe.EmployeeID=%n AND o.PMPYearID= %n", empID, pmpID); return tc.ExecuteReader(sql); } internal static void Save(TransactionContext tc, ObjectiveEmployees item) { string sql = SQLParser.MakeSQL( "Insert Into ObjectiveEmployees(ObjectiveEmployeesID, EmployeeID, ObjectiveID, ObjectiveNodeID) Values(%n, %n, %n, %n)", item.ID, item.EmployeeID, item.ObjectiveID, item.ObjectiveNodeID); tc.ExecuteNonQuery(sql); } internal static void Update(TransactionContext tc, ObjectiveEmployees item) { string sql = SQLParser.MakeSQL( "Update ObjectiveEmployees Set EmployeeID = %n, ObjectiveID = %n, ObjectiveNodeID = %n where ObjectiveEmployeesID= %n", item.EmployeeID, item.ObjectiveID, item.ObjectiveNodeID, item.ID); tc.ExecuteNonQuery(sql); } internal static void Delete(TransactionContext tc, int id) { string sql = SQLParser.MakeSQL("Delete From ObjectiveEmployees Where ObjectiveEmployeesID = %n", id); tc.ExecuteNonQuery(sql); } } }