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 FSHeadDA internal class FSHeadDA { #region Constructor private FSHeadDA() { } #endregion #region Insert function internal static void Insert(TransactionContext tc, FSHead item) { tc.ExecuteNonQuery("INSERT INTO FSHead(FSHeadID, Code, Name, IsTaxable, CreatedBy, CreationDate, SequenceNo, Status,IsLoan,IsPaymenttoVendor,Remarks)" + " VALUES(%n, %s, %s, %b, %n, %d, %n, %n,%b,%b,%s)", item.ID.Integer, item.Code, item.Name, item.IsTaxable, item.CreatedBy.Integer, item.CreatedDate, item.Sequence, item.Status,item.IsLoan,item.IsPaymenttoVendor,item.Remarks); } #endregion #region Update function internal static void Update(TransactionContext tc, FSHead item) { tc.ExecuteNonQuery("UPDATE FSHead SET Code=%s, Name=%s, IsTaxable=%b, ModifiedBy=%n, ModifiedDate=%d, SequenceNo=%n, Status=%n,IsLoan=%b,IsPaymenttoVendor=%b,Remarks=%s" + "WHERE FSHeadID=%n", item.Code, item.Name, item.IsTaxable, item.ModifiedBy.Integer, item.ModifiedDate, item.Sequence, item.Status, item.IsLoan, item.IsPaymenttoVendor,item.Remarks, item.ID.Integer); } #endregion #region Get Function internal static IDataReader Get(TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM FSHead Order By SequenceNO"); } internal static IDataReader Get(TransactionContext tc, EnumStatus status) { if (EnumStatus.Active == status) { return tc.ExecuteReader("SELECT * FROM FSHead where Status=%n order by SequenceNO", status); } else { return tc.ExecuteReader("SELECT * FROM FSHead order by SequenceNO"); } } internal static IDataReader Get(TransactionContext tc, ID nID) { return tc.ExecuteReader("SELECT * FROM FSHead Where FSHeadID=%n", nID.Integer); } #endregion #region Delete function internal static void Delete(TransactionContext tc, ID nID) { tc.ExecuteNonQuery("DELETE FROM FSHead Where FSHeadID=%n", nID.Integer); } #endregion } #endregion }