using HRM.BO; using Ease.Core.DataAccess; using System; using System.Data; namespace HRM.DA { public class ErCircularDetailDA { internal static void InsertErCircularDetail(ErCircularDetail obCircular, TransactionContext tc) { string sql = SQLParser.MakeSQL( @"INSERT INTO ER_CircularDetail ( ERCircularDetailID, Column_Type,Description, Remarks, SequenceNo,ERCircularID ) VALUES ( %n,%n, %s, %s,%n,%n )", obCircular.ID, (int)obCircular.ColumnType, obCircular.Description, obCircular.Remarks,obCircular.SequenceNo, obCircular.ERCircularID ); tc.ExecuteNonQuery(sql); } internal static void UpdateErCircularDetail(ErCircularDetail obCircular, TransactionContext tc) { string sql = SQLParser.MakeSQL( @"UPDATE ER_CircularDetail SET Column_Type = %s, Description = %s, Remarks = %s, SequenceNo = %n, ERCircularID = %n, WHERE ERCircularDetailID = %n", (int)obCircular.ColumnType, obCircular.Description,obCircular.Remarks, obCircular.SequenceNo, obCircular.ERCircularID,obCircular.ID); tc.ExecuteNonQuery(sql); } internal static IDataReader Get(TransactionContext tc) { string sql = SQLParser.MakeSQL(@"Select * From ER_CircularDetail"); return tc.ExecuteReader(sql); } internal static IDataReader Get(TransactionContext tc, int iD) { string sql = SQLParser.MakeSQL(@"Select * From ER_CircularDetail Where ERCircularDetailID = %n", iD); return tc.ExecuteReader(sql); } internal static IDataReader GetByParentID(TransactionContext tc, int iD) { string sql = SQLParser.MakeSQL(@"Select * From ER_CircularDetail Where ERCircularID = %n", iD); return tc.ExecuteReader(sql); } internal static void Delete(int iD, TransactionContext tc) { string sql = SQLParser.MakeSQL(@"Delete From ER_CircularDetail Where ERCircularDetailID = %n", iD); tc.ExecuteNonQuery(sql); } internal static void DeleteByParentID(int iD, TransactionContext tc) { string sql = SQLParser.MakeSQL(@"Delete From ER_CircularDetail Where ERCircularID = %n", iD); tc.ExecuteNonQuery(sql); } internal static int GetSequenceNo(TransactionContext tc) { int nSequnceNo = 0; object obj = tc.ExecuteScalar("SELECT Max(SequenceNo) FROM ER_CircularDetail"); if (obj != DBNull.Value) { nSequnceNo = Convert.ToInt32(obj); } return nSequnceNo; } } }