using System; using Payroll.BO; using System.Data; using System.Linq; using Ease.CoreV35.Model; using System.Data.SqlClient; using Ease.CoreV35.DataAccess; using System.Collections.Generic; using Ease.CoreV35.DataAccess.SQL; namespace Payroll.Service { #region ReligionDA internal class ReligionDA { #region Constructor private ReligionDA() { } #endregion #region Insert function internal static void Insert(TransactionContext tc, Religion item) { tc.ExecuteNonQuery("INSERT INTO Religion(ReligionID, code, name, CreatedBy, CreationDate, SequenceNo, Status)" + " VALUES(%n, %s, %s, %n, %d, %n, %n)", item.ID.Integer, item.Code, item.Name, DataReader.GetNullValue(item.CreatedBy.Integer),DataReader.GetNullValue(item.CreatedDate), item.Sequence, item.Status); } #endregion #region Update function internal static void Update(TransactionContext tc, Religion item) { tc.ExecuteNonQuery("UPDATE Religion SET code=%s, name=%s, ModifiedBy=%n, ModifiedDate=%d, SequenceNo=%n, Status=%n" + " WHERE ReligionID=%n", item.Code, item.Name, DataReader.GetNullValue(item.ModifiedBy.Integer), DataReader.GetNullValue(item.ModifiedDate), item.Sequence, item.Status, item.ID.Integer); } #endregion #region Get Function internal static IDataReader Get(TransactionContext tc,EnumStatus status) { if (EnumStatus.Active == status || EnumStatus.Inactive == status) { return tc.ExecuteReader("SELECT * FROM Religion Where Status=%n Order By SequenceNo",status); } else { return tc.ExecuteReader("SELECT * FROM Religion Order By SequenceNo"); } } internal static IDataReader Get(TransactionContext tc, ID nID) { return tc.ExecuteReader("SELECT * FROM Religion WHERE ReligionID=%n", nID.Integer); } internal static IDataReader Get(TransactionContext tc, string sCode) { return tc.ExecuteReader("SELECT * FROM Religion WHERE Code=%s", sCode); } internal static IDataReader Get(TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM Religion"); } #endregion #region Delete function internal static void Delete(TransactionContext tc, ID nID) { tc.ExecuteNonQuery("UPDATE [Religion] SET CreatedBy=%n,ModifiedBy=%n Where ReligionID=%n", Payroll.BO.User.CurrentUser.ID.Integer, Payroll.BO.User.CurrentUser.ID.Integer, nID.Integer); tc.ExecuteNonQuery("DELETE FROM [Religion] WHERE ReligionID=%n", nID.Integer); } #endregion } #endregion }