83 lines
3.1 KiB
C#
83 lines
3.1 KiB
C#
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 CarFuelItem
|
|
internal class CarFuelItemDA
|
|
{
|
|
#region Constructor
|
|
|
|
public CarFuelItemDA() { }
|
|
|
|
#endregion
|
|
|
|
#region Insert function
|
|
internal static void Insert(TransactionContext tc, CarFuelItem oItem)
|
|
{
|
|
tc.ExecuteNonQuery("INSERT INTO CarFuelItem(CarFuelItemID, Code, Name, CarFuelType, SequenceNO, Status, CreatedBy, CreationDate)" +
|
|
" VALUES(%n, %s, %s, %n, %n, %n, %n, %d)", oItem.ID.Integer, oItem.Code, oItem.Name, oItem.CarFuelType, oItem.Sequence, oItem.Status, DataReader.GetNullValue(oItem.CreatedBy.Integer), DataReader.GetNullValue(oItem.CreatedDate));
|
|
}
|
|
#endregion
|
|
|
|
#region Update function
|
|
internal static void Update(TransactionContext tc, CarFuelItem oItem)
|
|
{
|
|
tc.ExecuteNonQuery("UPDATE CarFuelItem SET Code=%s, Name=%s, CarFuelType=%n, SequenceNO=%n, Status=%n, ModifiedBy=%n, ModifiedDate=%d" +
|
|
" WHERE CarFuelItemID=%n", oItem.Code, oItem.Name, oItem.CarFuelType, oItem.Sequence, oItem.Status, DataReader.GetNullValue(oItem.ModifiedBy.Integer), DataReader.GetNullValue(oItem.ModifiedDate), oItem.ID.Integer);
|
|
}
|
|
#endregion
|
|
|
|
#region Get Function
|
|
internal static IDataReader Get(TransactionContext tc)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM CarFuelItem WHERE STATUS=%n Order By Code",(int)EnumStatus.Active);
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc, ID nID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM CarFuelItem WHERE CarFuelItemID=%n", nID.Integer);
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc, EnumStatus status)
|
|
{
|
|
if (EnumStatus.Active == status || EnumStatus.Inactive == status)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM CarFuelItem where Status=%n Order By SequenceNo", status);
|
|
}
|
|
else
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM CarFuelItem Order By SequenceNo");
|
|
}
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc, EnumCarFuelType CarFuelType, EnumStatus status)
|
|
{
|
|
if (EnumStatus.Active == status || EnumStatus.Inactive == status)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM CarFuelItem WHERE CarFuelType=%n AND Status=%n", CarFuelType, status);
|
|
}
|
|
else
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM CarFuelItem WHERE CarFuelType=%n", CarFuelType);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region Delete function
|
|
internal static void Delete(TransactionContext tc, ID nID)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM [CarFuelItem] WHERE CarFuelItemID=%n", nID.Integer);
|
|
}
|
|
#endregion
|
|
}
|
|
#endregion
|
|
}
|