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 GradeSegmentDA internal class GradeSegmentDA { #region Constructor private GradeSegmentDA() { } #endregion #region Insert function internal static void Insert(TransactionContext tc, GradeSegment item) { tc.ExecuteNonQuery("INSERT INTO GradeSegment(GradeSegmentID, code, description,BasicPer, CreatedBy, CreationDate, SequenceNo, Status)" + " VALUES(%n, %s, %s, %n, %n,%d, %n, %n)", item.ID.Integer, item.Code, item.Name,item.BasicPer, item.CreatedBy.Integer, item.CreatedDate, item.Sequence, 1); } #endregion #region Update function internal static void Update(TransactionContext tc, GradeSegment item) { tc.ExecuteNonQuery("UPDATE GradeSegment SET code=%s, description=%s,BasicPer=%n, ModifiedBy=%n, ModifiedDate=%d, SequenceNo=%n, Status=%n" + " WHERE GradeSegmentID=%n", item.Code, item.Name, item.BasicPer,item.ModifiedBy.Integer, 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 GradeSegment Where Status=%n Order By SequenceNo", status); } else { return tc.ExecuteReader("SELECT * FROM GradeSegment Order By SequenceNo"); } } internal static IDataReader Get(TransactionContext tc, ID nID) { return tc.ExecuteReader("SELECT * FROM GradeSegment WHERE GradeSegmentID=%n", nID.Integer); } internal static IDataReader Get(TransactionContext tc, string sCode) { return tc.ExecuteReader("SELECT * FROM GradeSegment WHERE Code=%s", sCode); } #endregion #region Delete function internal static void Delete(TransactionContext tc, ID nID) { tc.ExecuteNonQuery("UPDATE [GradeSegment] SET CreatedBy=%n,ModifiedBy=%n Where GradeSegmentID=%n", Payroll.BO.User.CurrentUser.ID.Integer, Payroll.BO.User.CurrentUser.ID.Integer, nID.Integer); tc.ExecuteNonQuery("DELETE FROM [GradeSegment] WHERE GradeSegmentID=%n", nID.Integer); } #endregion } #endregion }