109 lines
4.6 KiB
C#
109 lines
4.6 KiB
C#
using Ease.Core.DataAccess;
|
|
using HRM.BO;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace HRM.DA
|
|
{
|
|
public class RDReportRowDA
|
|
{
|
|
public RDReportRowDA() { }
|
|
public static IDataReader GetByReoprtIDAndFundTypeID(TransactionContext tc, int nReportID, int fundTypeID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM FM_RDReportRow WHERE ReportID=%n AND FundTypeID=%n ORDER BY SerialNo", nReportID, fundTypeID);
|
|
}
|
|
|
|
public static IDataReader Get(TransactionContext tc, int nRowID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM FM_RDReportRow WHERE ColRowID=%n Order BY SerialNo", nRowID);
|
|
}
|
|
public static IDataReader GetByReoprtID(TransactionContext tc, int nReportID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM FM_RDReportRow WHERE ReportID=%n ORDER BY SerialNo", nReportID);
|
|
}
|
|
|
|
#region Insert function
|
|
public static void Insert(TransactionContext tc, RDReportRow oItem)
|
|
{
|
|
tc.ExecuteNonQuery("INSERT INTO FM_RDReportRow(ColRowID, RowCode, RowDescription, ReportID, SerialNo,RowType,AmountFrom,FromOtherSourceType, FromOtherSourceOperator, Note, FundTypeID)" +
|
|
" VALUES(%n, %s, %s, %n, %n,%n,%n,%n, %n, %s, %n)", oItem.ID, oItem.RowCode, oItem.RowDescription, oItem.ReportID, oItem.SerialNo, oItem.RowType, oItem.AmountFrom, (int)oItem.FromOtherSourceType, oItem.FromOtherSourceOperator, oItem.Note, oItem.FundTypeID);
|
|
}
|
|
#endregion
|
|
|
|
#region Update function
|
|
public static void Update(TransactionContext tc, RDReportRow oItem)
|
|
{
|
|
tc.ExecuteNonQuery("UPDATE FM_RDReportRow SET RowCode=%s, RowDescription=%s, ReportID=%n, SerialNo=%n, RowType=%n,AmountFrom=%n,FromOtherSourceType=%n , FromOtherSourceOperator=%n, Note=%s, FundTypeID=%n" +
|
|
" WHERE ColRowID=%n", oItem.RowCode, oItem.RowDescription, oItem.ReportID, oItem.SerialNo, oItem.RowType, oItem.AmountFrom, (int)oItem.FromOtherSourceType, oItem.FromOtherSourceOperator, oItem.Note, oItem.FundTypeID, oItem.ID);
|
|
}
|
|
|
|
public static void UpdatePosition(TransactionContext tc, RDReportRow oItem)
|
|
{
|
|
tc.ExecuteNonQuery("UPDATE FM_RDReportRow SET SerialNo=%n WHERE ColRowID=%n", oItem.SerialNo, oItem.ID);
|
|
}
|
|
#endregion
|
|
|
|
#region ID Generation function
|
|
public static int GetNewID(TransactionContext tc)
|
|
{
|
|
return tc.GenerateID("FM_RDReportRow", "ColRowID");
|
|
}
|
|
#endregion
|
|
|
|
#region Get Function
|
|
public static IDataReader Get(TransactionContext tc)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM FM_RDReportRow Order BY SerialNo");
|
|
}
|
|
|
|
public static bool IsNotExist(TransactionContext tc, int nReportID, string sNotes)
|
|
{
|
|
object bNotes = tc.ExecuteScalar("SELECT Count(*) FROM FM_RDReportRow Where ReportID=%n AND Note=%s", nReportID, sNotes);
|
|
|
|
if (bNotes == null || bNotes == DBNull.Value || Convert.ToInt32(bNotes) == 0)
|
|
{
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public static int GetSerialNo(TransactionContext tc)
|
|
{
|
|
Object nSerialNo = null;
|
|
|
|
nSerialNo = tc.ExecuteScalar("SELECT MAX(SerialNo) FROM FM_RDReportRow ");
|
|
return nSerialNo == null || nSerialNo == DBNull.Value ? 1 : Convert.ToInt32(nSerialNo) + 1;
|
|
}
|
|
|
|
public static IDataReader Get(TransactionContext tc, string sCode)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM FM_RDReportRow WHERE RowCode=%s Order BY SerialNo", sCode);
|
|
}
|
|
public static IDataReader Get(TransactionContext tc, int nReportID, string sCode)
|
|
{
|
|
string Squery = SQLParser.MakeSQL("SELECT * FROM FM_RDReportRow WHERE ReportID=%n AND RowCode=%s Order BY SerialNo", nReportID, sCode);
|
|
return tc.ExecuteReader(Squery);
|
|
}
|
|
|
|
public static IDataReader GetByReoprtIDAndProjectID(TransactionContext tc, int nReportID, int fundTypeID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM FM_RDReportRow WHERE ReportID=%n AND FundTypeID=%n ORDER BY SerialNo", nReportID, fundTypeID);
|
|
}
|
|
#endregion
|
|
|
|
#region Delete function
|
|
public static void Delete(TransactionContext tc, int nRowID)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM [FM_RDReportRow] WHERE ColRowID=%n", nRowID);
|
|
}
|
|
#endregion
|
|
}
|
|
}
|