77 lines
2.2 KiB
C#
77 lines
2.2 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 CompanyDA
|
|
|
|
internal class CompanyDA
|
|
{
|
|
#region Constructor
|
|
|
|
private CompanyDA() { }
|
|
|
|
#endregion
|
|
|
|
#region Insert function
|
|
|
|
internal static void Insert(TransactionContext tc, Company item)
|
|
{
|
|
tc.ExecuteNonQuery("INSERT INTO Company(CompanyID, code, description, CreatedBy, CreatedDate, SequenceNo, Status)" +
|
|
" VALUES(%n, %s, %s, %n, %d, %n, %n)", item.ID.Integer, item.Code, item.Name, item.CreatedBy.Integer, item.CreatedDate, item.Sequence, item.Status);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Update function
|
|
|
|
internal static void Update(TransactionContext tc, Company item)
|
|
{
|
|
tc.ExecuteNonQuery("UPDATE Company SET code=%s, description=%s, ModifiedBy=%n, ModifiedDate=%d, SequenceNo=%n, Status=%n" +
|
|
" WHERE CompanyID=%n", item.Code, item.Name, item.ModifiedBy.Integer, item.ModifiedDate, item.Sequence, item.Status, item.ID.Integer);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Get Function
|
|
|
|
internal static IDataReader Get(TransactionContext tc, EnumStatus status)
|
|
{
|
|
if (EnumStatus.Active == status || EnumStatus.Inactive == status)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM Company where Status=%n Order By SequenceNo", status);
|
|
}
|
|
else
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM Company Order By SequenceNo");
|
|
}
|
|
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc, ID nID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM Company WHERE CompanyID=%n", nID.Integer);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Delete function
|
|
|
|
internal static void Delete(TransactionContext tc, ID nID)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM [Company] WHERE CompanyID=%n", nID.Integer);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
#endregion
|
|
}
|