EchoTex_Payroll/HRM.DA/DA/Bonus/DolarRateDA.cs

90 lines
3.2 KiB
C#
Raw Permalink Normal View History

2024-10-14 10:01:49 +06:00
using HRM.BO;
using Ease.Core.DataAccess;
using System;
using System.Data;
namespace HRM.DA
{
internal class DolarRateDA
{
#region Constructor
private DolarRateDA()
{
}
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, DolarRate item)
{
tc.ExecuteNonQuery(
"INSERT INTO DolarRate(MonthDate, Rate, Amount, DAPACode, DDescription, DAccountNo, CAPACode, CDescription, CAccountNo,HBInterestRate,PersonalInterestRate,VehicleInterestRate)" +
" VALUES(%d, %n, %n, %s, %s, %s, %s, %s, %s,%n,%n,%n)", item.MonthDate, item.Rate, item.Amount,
item.DAPACode, item.DDescription, item.DAccountNo, item.CAPACode, item.CDescription, item.CAccountNo,
item.HBInterestRate, item.PersonalInterestRate, item.VehicleInterestRate);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, DolarRate item)
{
tc.ExecuteNonQuery(
"UPDATE DolarRate SET Rate=%n, Amount=%n, DAPACode=%s, DDescription=%s, DAccountNo=%s, CAPACode=%s, CDescription=%s, CAccountNo=%s,HBInterestRate=%n,PersonalInterestRate=%n,VehicleInterestRate=%n" +
" WHERE MonthDate=%d", item.Rate, item.Amount, item.DAPACode, item.DDescription, item.DAccountNo,
item.CAPACode, item.CDescription, item.CAccountNo, item.HBInterestRate, item.PersonalInterestRate,
item.VehicleInterestRate, item.MonthDate);
}
#endregion
#region Get Function
public static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM DolarRate");
}
public static IDataReader GetLastSixMonth(TransactionContext tc)
{
DateTime dt = PayrollGlobalFunctions.PayrollFirstDateOfMonth(DateTime.Today.AddMonths(-6));
return tc.ExecuteReader("SELECT * FROM DolarRate where monthdate>%d", dt);
}
public static IDataReader Get(TransactionContext tc, DateTime dMonthDate)
{
return tc.ExecuteReader("SELECT * FROM DolarRate WHERE MonthDate=%d", dMonthDate);
}
//public static IDataReader GetByCategory(TransactionContext tc, int nCategoryId)
//{
// return tc.ExecuteReader("SELECT * FROM DolarRate WHERE CategoryId=%n", nCategoryId);
//}
//public static bool IsTagged(TransactionContext tc, int DolarRateID)
//{
// object ob;
// ob = tc.ExecuteScalar("SELECT count(*) FROM SurveyDolarRate where DolarRateId=%n", DolarRateID);
// return ob == DBNull.Value ? false : Convert.ToInt32(ob) > 0 ? true : false;
//}
#endregion
#region Delete function
public static void Delete(TransactionContext tc, DateTime dMonthDate)
{
tc.ExecuteNonQuery("DELETE FROM DolarRate WHERE MonthDate=%d", dMonthDate);
}
internal static void Delete(TransactionContext tc, int id)
{
//tc.ExecuteNonQuery("DELETE FROM [DolarRate] WHERE MonthDate=%d", dMonthDate);
}
#endregion
}
}