CEL_Payroll/Payroll.Service/Bonus/DA/DolarRateDA.cs

88 lines
3.2 KiB
C#
Raw Normal View History

2024-09-17 14:30:13 +06:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Payroll.BO;
using System.Data;
using Ease.CoreV35.Model;
using System.Data.SqlClient;
using Ease.CoreV35.DataAccess;
using Ease.CoreV35.DataAccess.SQL;
namespace Payroll.Service
{
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 =GlobalFunctions.FirstDateOfMonth(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, ID id)
{
//tc.ExecuteNonQuery("DELETE FROM [DolarRate] WHERE MonthDate=%d", dMonthDate);
}
#endregion
}
}