87 lines
2.9 KiB
C#
87 lines
2.9 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 BranchDA
|
|||
|
|
|||
|
internal class BranchDA
|
|||
|
{
|
|||
|
#region Constructor
|
|||
|
|
|||
|
private BranchDA() { }
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Insert function
|
|||
|
|
|||
|
internal static void Insert(TransactionContext tc, Branch item)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("INSERT INTO Branches(BranchID, Code, Name, Address, Telephone, BankID, CreatedBy, CreationDate, SequenceNo, Status)" +
|
|||
|
" VALUES(%n, %s, %s, %s, %s, %n, %n, %d, %n, %n)", item.ID.Integer, item.Code, item.Name, item.Address, item.Telephone, item.BankID.Integer, item.CreatedBy.Integer, item.CreatedDate, item.Sequence, item.Status);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Update function
|
|||
|
|
|||
|
internal static void Update(TransactionContext tc, Branch item)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("UPDATE Branches SET Code=%s, Name=%s, Address=%s, Telephone=%s, BankID=%n, ModifiedBy=%n, ModifiedDate=%d, SequenceNo=%n, Status=%n" +
|
|||
|
"WHERE BranchID=%n",item.Code, item.Name, item.Address, item.Telephone, item.BankID.Integer, item.ModifiedBy.Integer, item.ModifiedDate, item.Sequence, item.Status,item.ID.Integer);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Get Function
|
|||
|
|
|||
|
internal static IDataReader GetChild(TransactionContext tc, ID bankID)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM Branches Where BankID=%n Order by Name", bankID.Integer);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader GetOldBranchByID(TransactionContext tc, ID branchID)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM GP_Branches Where BRANCHID=%n Order by Name", branchID.Integer);
|
|||
|
}
|
|||
|
|
|||
|
internal static IDataReader Get(TransactionContext tc, EnumStatus status)
|
|||
|
{
|
|||
|
if (EnumStatus.Active == status || EnumStatus.Inactive == status)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM Branches Where Status=%n Order by sequenceNo", status);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM Branches Order by sequenceNo");
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
internal static IDataReader Get(TransactionContext tc, ID nID)
|
|||
|
{
|
|||
|
return tc.ExecuteReader("SELECT * FROM Branches WHERE BranchID=%n",nID.Integer );
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Delete function
|
|||
|
|
|||
|
internal static void Delete(TransactionContext tc, ID nID)
|
|||
|
{
|
|||
|
tc.ExecuteNonQuery("UPDATE Branches SET CreatedBy=%n Where BranchID=%n", Payroll.BO.User.CurrentUser.ID.Integer, nID.Integer);
|
|||
|
tc.ExecuteNonQuery("DELETE FROM Branches WHERE BranchID=%n", nID.Integer);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|