using HRM.BO; using Ease.Core.DataAccess; using System; using System.Data; namespace HRM.DA { public class ErCircularDA { internal static void InsertErCircular(ErCircular obCircular, TransactionContext tc) { string sql = SQLParser.MakeSQL( @"INSERT INTO ER_Circular ( ERCircularID, RecruitementID, PublishFromDate, PublishToDate,CREATIONDATE, CREATEDBY ) VALUES ( %n, %n, %d,%d, %d, %n )", obCircular.ID, obCircular.RecruitementID, obCircular.PublishFrom, obCircular.PublishTo, obCircular.CreatedDate, obCircular.CreatedBy); tc.ExecuteNonQuery(sql); } internal static void UpdateErCircular(ErCircular obCircular, TransactionContext tc) { int? modifiedBy = null; if (obCircular.ModifiedBy == 0) { modifiedBy = null; } else { modifiedBy = obCircular.ModifiedBy; } DateTime? modificationDate; if (obCircular.ModifiedDate == null) { modificationDate = null; } else { modificationDate = DateTime.Today; } string sql = SQLParser.MakeSQL( @"UPDATE ER_Circular SET RecruitementID = %n, PublishFromDate = %d, PublishToDate = %d, ModifiedDate = %d, ModifiedBy = %n WHERE ERCircularID = %n", obCircular.RecruitementID, obCircular.PublishFrom, obCircular.PublishTo, obCircular.ModifiedDate, obCircular.ModifiedBy, obCircular.ID); tc.ExecuteNonQuery(sql); } internal static IDataReader Get(TransactionContext tc) { string sql = SQLParser.MakeSQL(@"Select * From ER_Circular"); return tc.ExecuteReader(sql); } internal static IDataReader GetAll(TransactionContext tc) { string sql = SQLParser.MakeSQL(@"SELECT ec.*,ir.POSITIONNAME,PositionDate FROM ER_Circular ec INNER JOIN INTERNALREQRUITMENT ir ON ir.POSITIONID = ec.RecruitementID"); return tc.ExecuteReader(sql); } internal static IDataReader Get(TransactionContext tc, int iD) { string sql = SQLParser.MakeSQL(@"Select * From ER_Circular Where ERCircularID = %n", iD); return tc.ExecuteReader(sql); } internal static IDataReader GetByRecruitmentID(TransactionContext tc, int iD) { string sql = SQLParser.MakeSQL(@"Select * From ER_Circular Where RecruitementID = %n", iD); return tc.ExecuteReader(sql); } internal static void Delete(int iD, TransactionContext tc) { string sql = SQLParser.MakeSQL(@"Delete From ER_Circular Where ERCircularID = %n", iD); tc.ExecuteNonQuery(sql); } } }