111 lines
4.5 KiB
C#
111 lines
4.5 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using Ease.CoreV35.DataAccess;
|
|||
|
using System.Data;
|
|||
|
using HRM.BO;
|
|||
|
using Ease.Core.DataAccess;
|
|||
|
|
|||
|
namespace HRM.DA
|
|||
|
{
|
|||
|
#region UPDAttendanceDA
|
|||
|
|
|||
|
internal class UPDAttendanceDA
|
|||
|
{
|
|||
|
#region Constructor
|
|||
|
|
|||
|
private UPDAttendanceDA()
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Insert function
|
|||
|
|
|||
|
internal static void Insert(TransactionContext tc, UPDAttendance item)
|
|||
|
{
|
|||
|
string sql = SQLParser.MakeSQL(
|
|||
|
"INSERT INTO UPDAttendance(AttendanceID ,EmployeeID ,EmployeeNo ,AttnDate,InTime ,OutTime ,UpdStatus ,ChangeStatus ,EmpRemarks ,LMRemarks ,EmpRemarksDate ,LMRemarksDate )" +
|
|||
|
" VALUES(%n, %s, %D, %D, %D, %n, %n, %s, %s, %D, %D)", item.ID, item.EmployeeID, item.EmployeeNo,
|
|||
|
item.AttnDate, item.InTime, item.OutTime, item.UpdStatus, item.ChangeStatus, item.EmpRemarks,
|
|||
|
item.LMRemarks, DataReader.GetNullValue(item.EmpRemarksDate),
|
|||
|
DataReader.GetNullValue(item.LMRemarksDate));
|
|||
|
|
|||
|
tc.ExecuteNonQuery(sql);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Update function
|
|||
|
|
|||
|
internal static void Update(TransactionContext tc, UPDAttendance item)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery(
|
|||
|
"UPDATE UPDAttendance SET EmployeeID=%n ,EmployeeNo=%s ,AttnDate=%D,InTime=%D ,OutTime=%D ,UpdStatus=%n ,ChangeStatus=%n ,EmpRemarks=%s ,LMRemarks=%s ,EmpRemarksDate=%D ,LMRemarksDate=%D,LMID=%n,HRID=%n,HRRemarks=%s WHERE AttendanceID=%n",
|
|||
|
item.EmployeeID, item.EmployeeNo, item.AttnDate, item.InTime, item.OutTime, item.UpdStatus,
|
|||
|
item.ChangeStatus, item.EmpRemarks, item.LMRemarks, DataReader.GetNullValue(item.EmpRemarksDate),
|
|||
|
DataReader.GetNullValue(item.LMRemarksDate), DataReader.GetNullValue(item.LMID, 0),
|
|||
|
DataReader.GetNullValue(item.HRID, 0), item.HRRemarks, item.ID);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Get Function
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc, DateTime dt, EnumUPDStatus eType)
|
|||
|
{
|
|||
|
if (eType == EnumUPDStatus.None)
|
|||
|
return tc.ExecuteReader(
|
|||
|
"SELECT * FROM UPDAttendance where Month(AttnDate)=%n AND Year(AttnDate)=%n AND Day(AttnDate)=%n",
|
|||
|
dt.Month, dt.Year, dt.Day);
|
|||
|
else
|
|||
|
return tc.ExecuteReader(
|
|||
|
"SELECT * FROM UPDAttendance where UpdStatus=%n AND Month(AttnDate)=%n AND Year(AttnDate)=%n AND Day(AttnDate)=%n",
|
|||
|
eType, dt.Month, dt.Year, dt.Day);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc, DateTime dtFrom, DateTime dtTo, int EmpID,
|
|||
|
EnumUPDStatus eType)
|
|||
|
{
|
|||
|
if (eType == EnumUPDStatus.None)
|
|||
|
return tc.ExecuteReader(
|
|||
|
"SELECT * FROM UPDAttendance Where EmployeeID=%n And attndate between dateadd(d, datediff(d, 0, %d), 0) AND DATEADD(day, DATEDIFF(day, 0 , %d), '23:59') ORDER BY attndate",
|
|||
|
EmpID, dtFrom, dtTo);
|
|||
|
else
|
|||
|
return tc.ExecuteReader(
|
|||
|
"SELECT * FROM UPDAttendance Where UpdStatus=%n AND EmployeeID=%n And attndate between dateadd(d, datediff(d, 0, %d), 0) AND DATEADD(day, DATEDIFF(day, 0 , %d), '23:59') ORDER BY attndate",
|
|||
|
eType, EmpID, dtFrom, dtTo);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc, DateTime dtFrom, DateTime dtTo, EnumUPDStatus eType)
|
|||
|
{
|
|||
|
if (eType == EnumUPDStatus.None)
|
|||
|
return tc.ExecuteReader(
|
|||
|
"SELECT * FROM UPDAttendance Where attndate between dateadd(d, datediff(d, 0, %d), 0) AND DATEADD(day, DATEDIFF(day, 0 , %d), '23:59')",
|
|||
|
dtFrom, dtTo);
|
|||
|
else
|
|||
|
return tc.ExecuteReader(
|
|||
|
"SELECT * FROM UPDAttendance Where UpdStatus=%n AND attndate between dateadd(d, datediff(d, 0, %d), 0) AND DATEADD(day, DATEDIFF(day, 0 , %d), '23:59')",
|
|||
|
eType, dtFrom, dtTo);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc, int nID)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM UPDAttendance WHERE AttendanceID=%n", nID);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Delete function
|
|||
|
|
|||
|
internal static void Delete(TransactionContext tc, int nID)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("DELETE FROM UPDAttendance WHERE AttendanceID=%n", nID);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|