EchoTex_Payroll/HRM.DA/DA/PMP/YearEndValuesRatingDA.cs

94 lines
4.3 KiB
C#
Raw Normal View History

2024-10-14 10:01:49 +06:00
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 Payroll.Service
{
class YearEndValuesRatingDA
{
internal static IDataReader Get(TransactionContext tc)
{
string sql = SQLParser.MakeSQL("SELECT * FROM YearEndValuesRating");
return tc.ExecuteReader(sql);
}
internal static IDataReader GetByPMPYear(TransactionContext tc, int iD)
{
string sql =
SQLParser.MakeSQL(
"select * from YearEndValuesRating where objectivesetid in(select objectivesetid from objectiveset where pmpyearid=%n)",
iD);
return tc.ExecuteReader(sql);
}
internal static IDataReader GetByObjectiveSetID(TransactionContext tc, int ObjectiveSetID)
{
string sql = SQLParser.MakeSQL("SELECT * FROM YearEndValuesRating where ObjectiveSetID=%n", ObjectiveSetID);
return tc.ExecuteReader(sql);
}
internal static IDataReader Get(TransactionContext tc, int id)
{
string sql = SQLParser.MakeSQL("SELECT * FROM YearEndValuesRating WHERE YearEndValuesRatingID = %n", id);
return tc.ExecuteReader(sql);
}
#region Update
internal static void Update(TransactionContext tc, YearEndValuesRating item)
{
string sql = SQLParser.MakeSQL(
"Update YearEndValuesRating Set ObjectivesetID=%n, ValueID = %n, EmpComments = %s, LMComments = %s, EmpCommentsDate = %d, LMCommentDate = %d, MYEmpComments = %s, MYLMComments = %s, MYEmpCommentsDate = %d, MYLMCommentDate = %d,YEEmpRating=%n,YELMRating=%n, YEEmpComments = %s, YELMComments = %s, YEEmpCommentsDate = %d, YELMCommentDate = %d where YearEndValuesRatingID= %n",
item.ObjectiveSetID, item.ValueID, item.EmpComments, item.LMComments,
DataReader.GetNullValue(item.EmpCommentsDate), DataReader.GetNullValue(item.LMCommentDate),
item.MYEmpComments, item.MYLMComments, DataReader.GetNullValue(item.MYEmpCommentsDate),
DataReader.GetNullValue(item.MYLMCommentDate), item.YEEmpRating, item.YELMRating, item.YEEmpComments,
item.YELMComments, DataReader.GetNullValue(item.YEEmpCommentsDate),
DataReader.GetNullValue(item.YELMCommentDate), item.ID);
tc.ExecuteNonQuery(sql);
}
#endregion
#region Insert
internal static void Save(TransactionContext tc, YearEndValuesRating item)
{
string sql = SQLParser.MakeSQL(
@"Insert Into YearEndValuesRating(YearEndValuesRatingID,ObjectivesetID, ValueID, EmpComments, LMComments, EmpCommentsDate,
MYEmpComments, MYLMComments, MYEmpCommentsDate,MYLMCommentDate,YEEmpRating,YELMRating,Weightage,CompetencyLevel,ItemType,YEEmpComments, YELMComments, YEEmpCommentsDate, YELMCommentDate)
Values(%n,%n, %n, %s, %s, %d,%s, %s, %d, %d,%n,%n,%n,%n,%n,%s, %s, %d, %d)",
item.ID, item.ObjectiveSetID, item.ValueID, item.EmpComments, item.LMComments,
DataReader.GetNullValue(item.EmpCommentsDate), item.MYEmpComments, item.MYLMComments,
DataReader.GetNullValue(item.MYEmpCommentsDate),
DataReader.GetNullValue(item.MYLMCommentDate), item.YEEmpRating, item.YELMRating, item.Weightage,
item.CompetencyLevel, item.ItemType, item.YEEmpComments, item.YELMComments,
DataReader.GetNullValue(item.YEEmpCommentsDate),
DataReader.GetNullValue(item.YELMCommentDate));
tc.ExecuteNonQuery(sql);
}
#endregion
#region Delete
internal static void Delete(TransactionContext tc, int id)
{
string sql = SQLParser.MakeSQL("Delete From YearEndValuesRating Where YearEndValuesRatingID = %n", id);
tc.ExecuteNonQuery(sql);
}
internal static void DeleteByObjSetID(TransactionContext tc, int id)
{
string sql = SQLParser.MakeSQL("Delete From YearEndValuesRating Where ObjectivesetID = %n", id);
tc.ExecuteNonQuery(sql);
}
#endregion
}
}