//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 //{ // class LeaveScheduleDA // { // public LeaveScheduleDA() { } // #region Insert Funcion // public static void Insert(TransactionContext tc, LeaveSchedule oItem) // { // tc.ExecuteNonQuery("INSERT INTO LEAVESCHEDULE(LEAVESCHEDULEID, LEAVEID, EMPLOYEEID, SBUID,SCHEDULEDATE,FROMDATE, TODATE, TOTALDAYS,REMARKS,UserID,EntryID)" + // " VALUES(%n, %n, %n, %n,%d,%d, %d, %n,%s,%n,%n)", oItem.ID.Integer, oItem.LeaveId, oItem.EmployeeId, oItem.SBUId,oItem.ScheduleDate, oItem.FromDate, oItem.ToDate, oItem.TotalDays,oItem.Remarks,oItem.UserID,oItem.EntryID); // } // #endregion // #region Update function // public static void Update(TransactionContext tc, LeaveSchedule oItem) // { // tc.ExecuteNonQuery("UPDATE LEAVESCHEDULE SET LEAVEID=%n, EMPLOYEEID=%n, SBUID=%n, SCHEDULEDATE=%d,FROMDATE=%d, TODATE=%d, TOTALDAYS=%n,REMARKS=%s,UserID=%n,EntryID=%n" + // " WHERE LEAVESCHEDULEID=%n", oItem.LeaveId, oItem.EmployeeId, oItem.SBUId,oItem.ScheduleDate, oItem.FromDate, oItem.ToDate, oItem.TotalDays,oItem.Remarks,oItem.UserID,oItem.ID.Integer); // } // #endregion // #region ID Generation function // public static int GetNewID(TransactionContext tc) // { // return tc.GenerateID("LEAVESCHEDULE", "LEAVESCHEDULEID"); // } // #endregion // public static IDataReader Get(TransactionContext tc,int leaveScheduleId) // { // return tc.ExecuteReader("Select * from LEAVESCHEDULE where LeaveScheduleId=%n", leaveScheduleId); // } // public static IDataReader Get(TransactionContext tc, DateTime startDate, DateTime endDate) // { // return tc.ExecuteReader("Select * from LEAVESCHEDULE where FromDate<=%d and ToDate>=%d",endDate,startDate); // } // public static IDataReader Get(TransactionContext tc,string EmpIds, DateTime startDate, DateTime endDate) // { // string inSQL; // inSQL = "in ("+ EmpIds +")"; // //return tc.ExecuteReader("Select * from LEAVESCHEDULE where FromDate<=%d and ToDate>=%d and EmployeeId %q", endDate, startDate,inSQL); // //return tc.ExecuteReader("Select LE.*,LP.LeaveID as LeaveID_LP from LeaveEntry LE,LeaveParameter LP where " + // // " AprFromDate<=%d and AprToDate>=%d and (LE.LeaveStatus=%n or LE.LeaveStatus=%n) and " // // + " EmpId %q ", endDate, startDate, (int)EnumLeaveStatus.Approved, (int)EnumLeaveStatus.Availed, inSQL); // string sql = SQLParser.MakeSQL("Select LE.*,LE.LeaveID as LeaveID_LP from LeaveEntry LE where " + // " AprFromDate<=%d and AprToDate>=%d and (LE.LeaveStatus=%n) and " // + " EmpId %q ORDER BY LE.LeaveID", endDate, startDate, (int)EnumLeaveStatus.Approved, inSQL); // return tc.ExecuteReader(sql); // } // public static IDataReader GetLID(TransactionContext tc, string EmpIds, DateTime startDate, DateTime endDate) // { // string inSQL; // inSQL = "in (" + EmpIds + ")"; // //return tc.ExecuteReader("Select * from LEAVESCHEDULE where FromDate<=%d and ToDate>=%d and EmployeeId %q", endDate, startDate,inSQL); // //return tc.ExecuteReader("Select LE.*,LP.LeaveID as LeaveID_LP from LeaveEntry LE,LeaveParameter LP where " + // // " AprFromDate<=%d and AprToDate>=%d and (LE.LeaveStatus=%n or LE.LeaveStatus=%n) and " // // + " EmpId %q ", endDate, startDate, (int)EnumLeaveStatus.Approved, (int)EnumLeaveStatus.Availed, inSQL); // string sql = SQLParser.MakeSQL("Select LE.*,LE.LeaveID as LeaveID_LP from LeaveEntry LE where " + // " AprFromDate<=%d and AprToDate>=%d and (LE.LeaveStatus=%n) and " // + " EmpId %q ORDER BY LE.LeaveID", endDate, startDate, (int)EnumLeaveStatus.Approved, inSQL); // return tc.ExecuteReader(sql); // } // public static IDataReader Get(TransactionContext tc,int leaveid,string EmpIds, DateTime startDate, DateTime endDate) // { // string inSQL; // inSQL = "in (" + EmpIds + ")"; // //return tc.ExecuteReader("Select * from LEAVESCHEDULE where FromDate<=%d and ToDate>=%d and LEAVEID=%n and EmployeeId %q", endDate, startDate,leaveid,inSQL); // return tc.ExecuteReader("Select LE.*,LP.LeaveID as LeaveID_LP from LeaveEntry LE,LeaveParameter LP where " + // " AprFromDate<=%d and AprToDate>=%d and " // + " AprParamID in(select LeaveParamID from LeaveParameter LP1 where LP1.LeaveID=%n) and (LE.LeaveStatus=%n or LE.LeaveStatus=%n) and " // + " EmpID %q and LP.LeaveParamID=LE.AppParamID", endDate, startDate, leaveid, (int)EnumLeaveStatus.Approved, (int)EnumLeaveStatus.Availed, inSQL); // } // public static IDataReader Get(TransactionContext tc,int sbuId, DateTime startDate, DateTime endDate) // { // return tc.ExecuteReader("Select * from LEAVESCHEDULE where FromDate<=%d and ToDate>=%d and sbuId=%n", endDate, startDate,sbuId); // } // public static void Delete(TransactionContext tc, int leaveScheduleId) // { // tc.ExecuteNonQuery("Delete from LEAVESCHEDULE where LeaveScheduleId=%n", leaveScheduleId); // } // public static void DeleteByEntryID(TransactionContext tc, int entryID) // { // tc.ExecuteNonQuery("Delete from LEAVESCHEDULE where EntryID=%n", entryID); // } // } //}