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 SkillLevelMappingDA { #region Constructor private SkillLevelMappingDA() { } #endregion #region Insert internal static void Insert(TransactionContext tc, SkillLevelMapping oSkillLevelMapping) { tc.ExecuteNonQuery( "INSERT INTO SkillLevelMapping(SkillLevelMappingID, PMPYearID, GradeID, CategoryID,SkillID,LEVELID,CreatedBy, CreationDate)" + " VALUES(%n, %n, %n,%n, %n,%n,%n, %d)", oSkillLevelMapping.ID, oSkillLevelMapping.PMPYearID, oSkillLevelMapping.GradeID, oSkillLevelMapping.CategoryID, oSkillLevelMapping.SkillID, oSkillLevelMapping.LevelID, oSkillLevelMapping.CreatedBy, oSkillLevelMapping.CreatedDate); } #endregion #region Update internal static void Update(TransactionContext tc, SkillLevelMapping oSkillLevelMapping) { tc.ExecuteNonQuery( "UPDATE SkillLevelMapping SET PMPYearID=%n, GradeID=%n, CategoryID = %n, SkillID = %n, LEVELID = %n, ModifiedBy=%n, ModifiedDate=%d WHERE SkillLevelMappingID=%n)" , oSkillLevelMapping.PMPYearID, oSkillLevelMapping.GradeID, oSkillLevelMapping.CategoryID, oSkillLevelMapping.SkillID, oSkillLevelMapping.LevelID, oSkillLevelMapping.ModifiedBy, oSkillLevelMapping.ModifiedDate, oSkillLevelMapping.ID); } #endregion #region Get internal static IDataReader Get(TransactionContext tc, int id) { return tc.ExecuteReader("SELECT * FROM SkillLevelMapping Where SkillLevelMappingID=%n", id); } internal static IDataReader Get(TransactionContext tc, int pmpYearID, int gradeID) { return tc.ExecuteReader("SELECT * FROM SkillLevelMapping Where PMPYearID=%n and GradeID=%n", pmpYearID, gradeID); } internal static IDataReader GetCompetency(TransactionContext tc, int pmpYearID, int gradeID) { return tc.ExecuteReader(@"SELECT slm.* FROM SkillLevelMapping slm INNER JOIN SKILL s ON slm.SkillID = s.SKILLID WHERE slm.PMPYearID = %n AND slm.GradeID = %n AND s.skilltype = 1 AND slm.CategoryID = 65", pmpYearID, gradeID); } internal static IDataReader Get(TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM ReviewRole"); } #endregion #region Delete internal static void Delete(TransactionContext tc, int id) { tc.ExecuteNonQuery("DELETE FROM SkillLevelMapping Where PMPYearID=%n", id); } internal static void DeleteWithYearGrade(TransactionContext tc, int pmpYearID, int gradeID) { tc.ExecuteNonQuery("DELETE FROM SkillLevelMapping Where PMPYearID=%n and GradeID=%n", pmpYearID, gradeID); } #endregion } }