using System; using Payroll.BO; using System.Data; using System.Linq; using Ease.CoreV35.Model; using System.Data.SqlClient; using Ease.CoreV35.DataAccess; using System.Collections.Generic; using Ease.CoreV35.DataAccess.SQL; namespace Payroll.Service { #region UnAuthorizeLeaveParameterDA internal class UnAuthorizeLeaveParameterDA { #region Constructor private UnAuthorizeLeaveParameterDA() { } #endregion #region Insert function internal static void Insert(TransactionContext tc, UnAuthorizeLeaveParam item) { tc.ExecuteNonQuery("INSERT INTO UALeaveParam(UaLeaveParamID, UaLeaveID, CreatedBy, CreationDate)" + " VALUES(%n, %n, %n, %d)", item.ID.Integer, item.UnAhuthorizeLeaveID.Integer, item.CreatedBy.Integer, item.CreatedDate); } internal static void Insert(TransactionContext tc, UnAuthorizeLeaveParamDetail item) { tc.ExecuteNonQuery("INSERT INTO LEAVESUSPENSEDEDUCT(LeaveID,ParamDetailID, UaLeaveParamID, allowanceID, valueInPercent, Type)" + " VALUES(%n,%n, %n, %n, %n, %n)", item.LeaveID.Integer,item.ID.Integer, item.UNLeaveParamID.Integer, item.AllowanceID.Integer, item.ValueInPercent,item.Type); } #endregion #region Update function internal static void Update(TransactionContext tc, UnAuthorizeLeaveParam item) { tc.ExecuteNonQuery("UPDATE UALeaveParam SET UaLeaveID=%n, ModifiedBy=%n, ModifiedDate=%d" + " WHERE UaLeaveParamID=%n", item.UnAhuthorizeLeaveID.Integer, item.ModifiedBy.Integer, item.ModifiedDate, item.ID.Integer); } #endregion #region Get Function internal static IDataReader Get(TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM UALeaveParam"); } internal static IDataReader Get(TransactionContext tc, ID nID) { return tc.ExecuteReader("SELECT * FROM UALeaveParam WHERE UaLeaveParamID=%n", nID.Integer); } internal static IDataReader GetDetail(TransactionContext tc, ID nID) { return tc.ExecuteReader("SELECT * FROM LEAVESUSPENSEDEDUCT WHERE UaLeaveParamID=%n", nID.Integer); } internal static IDataReader GetByLeaveID(TransactionContext tc, ID nLeaveID) { return tc.ExecuteReader("SELECT * FROM UALeaveParam WHERE UaLeaveID=%n", nLeaveID.Integer); } #endregion #region Delete function internal static void DeleteDetail(TransactionContext tc, ID nID) { tc.ExecuteNonQuery("DELETE FROM [LEAVESUSPENSEDEDUCT] WHERE UaLeaveParamID=%n", nID.Integer); } internal static void Delete(TransactionContext tc, ID nID) { tc.ExecuteNonQuery("DELETE FROM [LEAVESUSPENSEDEDUCT] WHERE UaLeaveParamID=%n", nID.Integer); tc.ExecuteNonQuery("DELETE FROM [UALeaveParam] WHERE UaLeaveParamID=%n", nID.Integer); } internal static void DeleteByLeaveID(TransactionContext tc, ID nID) { tc.ExecuteNonQuery("DELETE FROM [LEAVESUSPENSEDEDUCT] WHERE UaLeaveParamID IN (SELECT UaLeaveParamID FROM UALeaveParam WHERE UaLeaveID =%n)", nID.Integer); tc.ExecuteNonQuery("DELETE FROM [UALeaveParam] WHERE UaLeaveID=%n", nID.Integer); } #endregion } #endregion }