80 lines
3.0 KiB
C#
80 lines
3.0 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using Ease.CoreV35.DataAccess;
|
|||
|
|
|||
|
using Ease.CoreV35.DataAccess.SQL;
|
|||
|
using Payroll.BO;
|
|||
|
using System.Data;
|
|||
|
using Ease.CoreV35.Model;
|
|||
|
|
|||
|
|
|||
|
namespace Payroll.Service.Basic.DA
|
|||
|
{
|
|||
|
class MonthlyWorkingHourDA
|
|||
|
{
|
|||
|
|
|||
|
#region Insert Function
|
|||
|
internal static void Insert(TransactionContext tc,MonthlyWorkingHour item)
|
|||
|
{
|
|||
|
|
|||
|
tc.ExecuteNonQuery("Insert Into MonthlyWorkingHour (MonthlyWorkingHourID, WorkingMonth,EmployeeID,RegularHour,SpecialHour,CreatedBy,CreatedDate )" +
|
|||
|
"Values (%n,%d,%n,%n,%n,%n,%d )", item.ID.Integer, item.WorkingMonth, item.EmployeeID.Integer, item.RegularHour, item.SpecialHour, item.CreatedBy.Integer, item.CreatedDate);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
#region Update Function
|
|||
|
internal static void Update(TransactionContext tc, MonthlyWorkingHour item)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("Update MonthlyWorkingHour set WorkingMonth=%d, EmployeeID=%n, RegularHour=%n,SpecialHour=%n, CreatedBy=%n, CreatedDate=%d, Where MonthlyWorkingHourID=%n", item.WorkingMonth , item.EmployeeID.Integer , item.RegularHour ,item.SpecialHour , item.CreatedBy.Integer, item.CreatedDate, item.ID.Integer );
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Delete Function
|
|||
|
internal static void Delete(TransactionContext tc, ID id)
|
|||
|
{
|
|||
|
|
|||
|
tc.ExecuteNonQuery("Delete from MonthlyWorkingHour where MonthlyWorkingHourID=%n", id.Integer);
|
|||
|
}
|
|||
|
internal static void Delete(TransactionContext tc, MonthlyWorkingHour item)
|
|||
|
{
|
|||
|
|
|||
|
tc.ExecuteNonQuery("Delete from MonthlyWorkingHour where WorkingMonth between %d and %d", GlobalFunctions.FirstDateOfMonth(item.WorkingMonth),GlobalExtensions.LastDateOfMonth(item.WorkingMonth));
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Get Function
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc, ID nID)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM MonthlyWorkingHour WHERE MonthlyWorkingHourID=%n", nID.Integer);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc, DateTime date)
|
|||
|
{
|
|||
|
DateTime startDate = GlobalFunctions.FirstDateOfMonth(date);
|
|||
|
DateTime endDate = GlobalFunctions.LastDateOfMonth(date);
|
|||
|
|
|||
|
string sql = SQLParser.MakeSQL("SELECT * FROM MonthlyWorkingHour WHERE WorkingMonth Between %d AND %d", startDate, endDate);
|
|||
|
return tc.ExecuteReader(sql);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc)
|
|||
|
{
|
|||
|
|
|||
|
return tc.ExecuteReader("Select * from MonthlyWorkingHour");
|
|||
|
}
|
|||
|
|
|||
|
internal static bool IsExist(TransactionContext tc, MonthlyWorkingHour MonthlyWorkingHour)
|
|||
|
{
|
|||
|
object ob = tc.ExecuteScalar("SELECT COUNT(*) FROM MonthlyWorkingHour WHERE MonthlyWorkingHourID=%n", MonthlyWorkingHour.ID.Integer);
|
|||
|
return Convert.ToInt32(ob) > 0;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|