using HRM.BO; using Ease.Core.DataAccess; using System; using System.Data; using HRM.BO.Fund; namespace HRM.DA { internal class FmFundDA { #region Constructor public FmFundDA() { } #endregion #region Insert Function internal static void Insert(TransactionContext tc, FmFund fund) { string sql = SQLParser.MakeSQL( "INSERT INTO Fund (FundTypeID,ProjectID,UserObjectName,Code,Description,CreatedBy,CreatedDate)" + " VALUES(%n,%n,%s,%s,%s,%n,%D)", fund.ID, fund.ProjectID, DataReader.GetNullValue(fund.UserObjectName), fund.Code, fund.Description, fund.CreatedBy, fund.CreatedDate); tc.ExecuteNonQuery(sql); } #endregion #region Update function internal static void Update(TransactionContext tc, FmFund fund) { string sql = SQLParser.MakeSQL( "UPDATE Fund Set ProjectID = %n,UserObjectName = %s, Code = %s, Description = %s, ModifiedBy = %n, ModifiedDate = %D" + "WHERE FundTypeID = %n ", fund.ProjectID, DataReader.GetNullValue(fund.UserObjectName), fund.Code, fund.Description, fund.ModifiedBy, fund.ModifiedDate, fund.ID); tc.ExecuteNonQuery(sql); } #endregion #region Delete Function internal static void Delete(TransactionContext tc, int fundId) { tc.ExecuteNonQuery("DELETE FROM Fund WHERE FundTypeID=%n", fundId); } #endregion #region Get Function internal static IDataReader Get(TransactionContext tc, int fundID) { return tc.ExecuteReader("SELECT * FROM Fund WHERE FundTypeID=%n AND ProjectID=%n", fundID); //r, User.CurrentUser.ProjectID.Integer } internal static IDataReader Get(TransactionContext tc, string desc) { return tc.ExecuteReader("SELECT * FROM Fund WHERE Description=%s AND ProjectID=%n", desc); //,User.CurrentUser.ProjectID.Integer } internal static IDataReader Get(TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM Fund Where ProjectID=%n"); //, User.CurrentUser.ProjectID.Integer } internal static IDataReader GetByProjectID(TransactionContext tc, int projectID) { return tc.ExecuteReader("SELECT * FROM Fund WHERE ProjectID = %n", projectID); } #endregion } }