using HRM.BO; using Ease.Core.DataAccess; using System; using System.Data; namespace HRM.DA { #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,EMPID,EMPIDTwo,IsFinal,type)" + " VALUES(%n, %s, %s, %b, %n, %d, %n, %n,%b,%b,%s,%n,%n,%b,%n)", item.ID, item.Code, item.Name, item.IsTaxable, item.CreatedBy, item.CreatedDate, item.Sequence, item.Status, item.IsLoan, item.IsPaymenttoVendor, item.Remarks,item.EmpID,item.EmpIDTwo,item.IsFinal,item.Type); } #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, type=%n, empid=%n, EMPIDTwo=%n" + " WHERE FSHeadID=%n", item.Code, item.Name, item.IsTaxable, item.ModifiedBy, item.ModifiedDate, item.Sequence, item.Status, item.IsLoan, item.IsPaymenttoVendor, item.Remarks, item.Type, item.EmpID, item.EmpIDTwo, item.ID); } #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, int nID) { return tc.ExecuteReader("SELECT * FROM FSHead Where FSHeadID=%n", nID); } internal static IDataReader GetByEmpId(TransactionContext tc,int currentEmpId) { return tc.ExecuteReader("SELECT * FROM FSHEAD AS f WHERE f.EMPID=%n OR f.EMPIDTwo=%n", currentEmpId, currentEmpId); } #endregion #region Delete function internal static void Delete(TransactionContext tc, int nID) { tc.ExecuteNonQuery("DELETE FROM FSHead Where FSHeadID=%n", nID); } #endregion } #endregion }