using Ease.Core.DataAccess; using System; using System.Data; using HRM.BO; namespace HRM.DA { internal class ApproveFinantialDataDA { #region Constructor private ApproveFinantialDataDA() { } #endregion #region Insert function internal static void Insert(TransactionContext tc, ApproveFinantialData item) { tc.ExecuteNonQuery( "INSERT INTO ApproveFinantialData(ApproveID,FinanatialDataType, EmployeeID, ObjectID,SalaryMonth,Approvedby,ApprovedDate)" + " VALUES(%n, %n,%n,%n,%d,%n,%D)", item.ID, item.FinantialDataType, item.EmployeeID, item.ObjectID, item.SalaryMonth, item.Approvedby, item.ApprovedDate); } #endregion #region Update function internal static void Update(TransactionContext tc, ApproveFinantialData item) { tc.ExecuteNonQuery( "UPDATE ApproveFinantialData SET FinanatialDataType=%n, EmployeeID=%n, ObjectID=%n,SalaryMonth=%d,Approvedby=%n,ApprovedDate=%D" + "WHERE ApproveID=%n", item.FinantialDataType, item.EmployeeID, item.ObjectID, item.SalaryMonth, item.Approvedby, item.ApprovedDate, item.ID); } #endregion #region Get Function internal static IDataReader Get(TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM ApproveFinantialData Order By FinanatialDataType"); } internal static IDataReader Get(TransactionContext tc, int EmpID, DateTime dt) { return tc.ExecuteReader("SELECT * FROM ApproveFinantialData WHERE EmployeeID=%n AND SalaryMonth=%d", EmpID, dt); } internal static IDataReader Get(TransactionContext tc, int ID) { return tc.ExecuteReader("SELECT * FROM ApproveFinantialData Where ObjectID=%n", ID); } internal static IDataReader GetByType(TransactionContext tc, int selectedType) { return tc.ExecuteReader("SELECT * FROM ApproveFinantialData where FinanatialDataType = %n Order By FinanatialDataType", selectedType); } internal static IDataReader GetByMonth(TransactionContext tc, DateTime dtStart, DateTime dtEnd) { return tc.ExecuteReader("SELECT * FROM ApproveFinantialData Where SalaryMonth between %d AND %d", dtStart, dtEnd); } #endregion #region Delete function internal static void Delete(TransactionContext tc, ApproveFinantialData item) { tc.ExecuteNonQuery("DELETE FROM ApproveFinantialData Where objectID=%n AND FinanatialDataType=%n", item.ObjectID, (int)item.FinantialDataType); } #endregion } }