using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using HRM.BO; using Ease.Core.DataAccess; using System.Data; using NPOI.OpenXmlFormats.Dml.Chart; namespace HRM.DA { internal class PMPValueBehaviorSettingDA { internal static IDataReader Get(TransactionContext tc) { return tc.ExecuteReader("Select * From PMP_ValueBehaviorSetting"); } internal static IDataReader Get(TransactionContext tc, int id) { return tc.ExecuteReader("Select * From PMP_ValueBehaviorSetting Where PMPValueBehaviorSettingID = %n", id); } internal static IDataReader GetByObjectiveSetID(TransactionContext tc, int objectiveSetId) { return tc.ExecuteReader("Select * From PMP_ValueBehaviorSetting Where OBJECTIVESETID = %n", objectiveSetId); } internal static void Insert(TransactionContext tc, PMPValueBehaviorSetting item) { string sql = SQLParser.MakeSQL("INSERT INTO dbo.PMP_ValueBehaviorSetting (PMPVALUEBEHAVIORSETTINGID, OBJECTIVESETID, PMPVALUEBEHAVIORID, WEIGHTAGE, COMPETENCYLEVEL, " + "TARGETRATING, EMPCOMMENTS, LMCOMMENTS, EMPCOMMENTSDATE, LMCOMMENTDATE, MYEMPCOMMENTS, MYLMCOMMENTS, MYEMPCOMMENTSDATE, MYLMCOMMENTDATE, " + "YEEMPRATING, YELMRATING, YEEMPCOMMENTS, YELMCOMMENTS, YEEMPCOMMENTSDATE, YELMCOMMENTDATE, ITEMTYPE) " + "VALUES (%n, %n, %n, %n, %n, %n, %s, %s, %d, %d, %s, %s, %d, %d, %n, %n, %s, %s, %d, %d, %n)",item.ID,item.ObjectiveSetID,item.PMPValueBehaviorID,item.Weightage,item.CompetencyLevel, item.TargetRating,item.EmpComments,item.LmComments,item.EmpCommentsDate,item.LmCommentDate,item.MyEmpComments,item.MyLMComments,item.MyEmpCommentsDate,item.MyLMCommentDate, item.YeEmpRating, item.YeLMRating, item.YeEmpComments, item.YeLMComments, item.YeEmpCommentsDate, item.YeLMCommentDate, item.ItemType); tc.ExecuteNonQuery(sql); } internal static void Update(TransactionContext tc, PMPValueBehaviorSetting item) { string sql = SQLParser.MakeSQL("UPDATE dbo.PMP_ValueBehaviorSetting SET OBJECTIVESETID = %n, PMPVALUEBEHAVIORID = %n, WEIGHTAGE = %n, COMPETENCYLEVEL = %n, TARGETRATING = %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, ITEMTYPE = %n where PMPVALUEBEHAVIORSETTINGID = %n", item.ObjectiveSetID, item.PMPValueBehaviorID, item.Weightage, item.CompetencyLevel, item.TargetRating, item.EmpComments, item.LmComments, item.EmpCommentsDate, item.LmCommentDate, item.MyEmpComments, item.MyLMComments, item.MyEmpCommentsDate, item.MyLMCommentDate, item.YeEmpRating, item.YeLMRating, item.YeEmpComments, item.YeLMComments, item.YeEmpCommentsDate, item.YeLMCommentDate, item.ItemType, item.ID); tc.ExecuteNonQuery(sql); } internal static void Delete(TransactionContext tc, int id) { tc.ExecuteNonQuery("Delete From PMP_ValueBehaviorSetting Where PMPValueBehaviorSettingID = %n", id); } internal static void DeleteByObjectiveSetId(TransactionContext tc, int objectiveSetId) { tc.ExecuteNonQuery("Delete From PMP_ValueBehaviorSetting Where objectiveSetID = %n", objectiveSetId); } internal static void DeleteByPMPValueBehaviorId(TransactionContext tc, int pmpValueBehaviorId, int objectiveSetId) { tc.ExecuteNonQuery("Delete From PMP_ValueBehaviorSetting Where PMPVALUEBEHAVIORID = %n and objectiveSetID = %n", pmpValueBehaviorId, objectiveSetId); } } }