EchoTex_Payroll/HRM.DA/DA/PMP/PMSReviewDA.cs
2024-10-14 10:01:49 +06:00

85 lines
4.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Ease.CoreV35.DataAccess;
using Ease.Core.DataAccess;
using HRM.BO;
namespace HRM.DA
{
public class PMSReviewDA
{
internal static IDataReader Get(TransactionContext tc)
{
string sql = SQLParser.MakeSQL("SELECT * FROM PMSReview");
return tc.ExecuteReader(sql);
}
internal static IDataReader Get(TransactionContext tc, int id)
{
string sql = SQLParser.MakeSQL("SELECT * FROM PMSReview WHERE PMSReviewID = %n", id);
return tc.ExecuteReader(sql);
}
internal static IDataReader Get(TransactionContext tc, int empid, int pmpyearid)
{
string sql = SQLParser.MakeSQL("SELECT * FROM PMSReview WHERE PMSProcessID = %n and EmployeeID=%n",
pmpyearid, empid);
return tc.ExecuteReader(sql);
}
internal static void Insert(TransactionContext tc, PMSReview item)
{
string sql = SQLParser.MakeSQL(
@"Insert Into PMSReview (PMSReviewID, EmployeeID, CTC,PreviousRating,CurrentRating, IncrementPercent, CashBonus, Promotion,
NewGradeID,COLA, MeritIcrement, PositionIncrement, MarketAdjusment, TotalIncrement, BonusAmount, LTIAPercent, LTIATK,
NewBasic, NewGross, NewCTC,PMSProcessID,CreatedBy,CreatedDate)
Values(%n, %n, %n, %s,%s,%n, %n, %b,%n, %n, %n, %n, %n, %n, %n, %n, %n, %n, %n, %n,%n, %n, %d)",
item.ID, item.EmployeeID, item.CTC,
item.PreviousRating, item.CurrentRating, item.IncrementPercent, item.CashBonus, item.Promotion,
DataReader.GetNullValue(item.NewGradeID), item.COLA,
item.MeritIcrement, item.PositionIncrement,
item.MarketAdjusment, item.TotalIncrement, item.BonusAmount, item.LTIAPercent, item.LTIATK,
item.NewBasic,
item.NewGross, item.NewCTC, item.PMSProcessID,
item.CreatedBy, item.CreatedDate);
tc.ExecuteNonQuery(sql);
}
internal static void Update(TransactionContext tc, PMSReview item)
{
string sql = SQLParser.MakeSQL(
@"Update PMSReview Set EmployeeID = %n, CTC = %n,PreviousRating=%s,CurrentRating=%s, IncrementPercent = %n, CashBonus = %n, Promotion = %b,
NewGradeID = %n, COLA = %n, MeritIcrement = %n, PositionIncrement = %n, MarketAdjusment = %n, TotalIncrement = %n, BonusAmount = %n, LTIAPercent=%n, LTIATK=%n, NewBasic=%n,
NewGross = %n, NewCTC = %n, PMSProcessID = %n, ModifiedBy = %n,ModifiedDate=%d where PMSReviewID= %n",
item.EmployeeID, item.CTC,
item.PreviousRating, item.CurrentRating, item.IncrementPercent, item.CashBonus, item.Promotion,
DataReader.GetNullValue(item.NewGradeID), item.COLA,
item.MeritIcrement, item.PositionIncrement,
item.MarketAdjusment, item.TotalIncrement, item.BonusAmount, item.LTIAPercent, item.LTIATK,
item.NewBasic,
item.NewGross, item.NewCTC, item.PMSProcessID,
item.ModifiedBy, item.ModifiedDate, item.ID);
tc.ExecuteNonQuery(sql);
}
internal static void Delete(TransactionContext tc, int id)
{
string sql = SQLParser.MakeSQL("Delete From PMSReview Where PMSReviewID = %n", id);
tc.ExecuteNonQuery(sql);
}
internal static void Delete(TransactionContext tc, int pmsProcessID, string employeeIDs)
{
if (!string.IsNullOrWhiteSpace(employeeIDs))
{
string sql = SQLParser.MakeSQL("Delete From PMSReview Where PMSProcessID = %n AND EmployeeID in (%q)",
pmsProcessID, employeeIDs);
tc.ExecuteNonQuery(sql);
}
}
}
}