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 UnAuthorizeLeaveDA internal class UnAuthorizeLeaveDA { #region Constructor private UnAuthorizeLeaveDA() { } #endregion #region Insert function internal static void Insert(TransactionContext tc, UnAuthorizeLeave item) { tc.ExecuteNonQuery("INSERT INTO LEAVESUSPENSETYPE(LeaveID, leaveDesc, code, CreatedBy, CreationDate, SequenceNo, Status)" + " VALUES(%n, %s, %s, %n, %d, %n, %n)", item.ID.Integer, item.Name, item.Code, item.CreatedBy.Integer, item.CreatedDate, item.Sequence, item.Status); } #endregion #region Update function internal static void Update(TransactionContext tc, UnAuthorizeLeave item) { tc.ExecuteNonQuery("UPDATE LEAVESUSPENSETYPE SET leaveDesc=%s, code=%s, ModifiedBy=%n, ModifiedDate=%d, SequenceNo=%n, Status=%n" + " WHERE LeaveID=%n", item.Name, item.Code, item.ModifiedBy.Integer, item.ModifiedDate, item.Sequence, item.Status, item.ID.Integer); } #endregion #region Get Function internal static IDataReader Get(TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM LEAVESUSPENSETYPE"); } internal static IDataReader Get(TransactionContext tc, ID nID) { return tc.ExecuteReader("SELECT * FROM LEAVESUSPENSETYPE WHERE LeaveID=%n", nID.Integer); } internal static IDataReader Get(TransactionContext tc, string sCode) { return tc.ExecuteReader("SELECT * FROM LEAVESUSPENSETYPE WHERE Code = %s",sCode); } #endregion #region Delete function internal static void Delete(TransactionContext tc, ID nID) { tc.ExecuteNonQuery("DELETE FROM [LEAVESUSPENSETYPE] WHERE LeaveID=%n", nID.Integer); } internal static void UpdateUnauthorizedLeave(TransactionContext tc, int nEmpID,int nDays,DateTime dt) { tc.ExecuteNonQuery("UPDATE MONTHLYLEAVEENTRY set RemainingDays=%n WHERE EMPLOYEEID=%n and MONTHDATE=%d", nDays,nEmpID,dt); } #endregion } #endregion }