96 lines
2.9 KiB
C#
96 lines
2.9 KiB
C#
using HRM.BO;
|
|
using Ease.Core.DataAccess;
|
|
using System;
|
|
using System.Data;
|
|
|
|
|
|
namespace HRM.DA.Fund
|
|
{
|
|
#region class InvestmentCategoryDA
|
|
|
|
internal class InvestmentCategoryDA
|
|
{
|
|
#region Constructor
|
|
|
|
public InvestmentCategoryDA()
|
|
{
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Insert function
|
|
|
|
internal static void Insert(TransactionContext tc, InvestmentCategory oItem)
|
|
{
|
|
tc.ExecuteNonQuery(
|
|
"INSERT INTO InvestmentCategory(InvestmentCategoryID, Name, Code, UserObjectName, MinValue,CreatedBy, CreatedDate, ProjectID)" +
|
|
" VALUES(%n, %s, %s, %s, %n, %n, %D, %n)", oItem.ID, oItem.Name, oItem.Code, oItem.UserObjectName,
|
|
oItem.MinValue, oItem.CreatedBy, oItem.CreatedDate, oItem.ID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Update function
|
|
|
|
internal static void Update(TransactionContext tc, InvestmentCategory oItem)
|
|
{
|
|
tc.ExecuteNonQuery(
|
|
"UPDATE InvestmentCategory SET Name=%s, Code=%s, UserObjectName=%s, MinValue=%n,ModifiedBy = %n, ModifiedDate = %D " +
|
|
"WHERE InvestmentCategoryID = %n", oItem.Name, oItem.Code, oItem.UserObjectName, oItem.MinValue,
|
|
oItem.ModifiedBy, oItem.ModifiedDate, oItem.ID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region IsExist
|
|
|
|
internal static bool IsExist(TransactionContext tc, string code, int fundtypeid)
|
|
{
|
|
object ob = tc.ExecuteScalar(" SELECT COUNT(*) FROM InvestmentCategory WHERE Code = %s AND ProjectID = %n",
|
|
code, fundtypeid);
|
|
return Convert.ToInt32(ob) > 0;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region int Generation function
|
|
|
|
internal static int GetNewID(TransactionContext tc)
|
|
{
|
|
return tc.GenerateID("InvestmentCategory", "InvestmentCategoryID");
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Get Function
|
|
|
|
internal static IDataReader Getbyfundtype(TransactionContext tc, int fundtypeid)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM InvestmentCategory WHERE ProjectID = %n", fundtypeid);
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc, int InvestmentCategoryID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM InvestmentCategory WHERE InvestmentCategoryID=%n",
|
|
InvestmentCategoryID);
|
|
}
|
|
|
|
internal static IDataReader GetbyProjectid(TransactionContext tc, int ID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM InvestmentCategory WHERE ProjectID=%n", ID);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Delete function
|
|
|
|
internal static void Delete(TransactionContext tc, int InvestmentCategoryID)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM [InvestmentCategory] WHERE InvestmentCategoryID=%n", InvestmentCategoryID);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
#endregion
|
|
} |