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 { [Serializable] internal class ReportAuthorizationDA { #region Constructor private ReportAuthorizationDA() { } #endregion #region Insert function internal static void Insert(TransactionContext tc, ReportAuthorization item) { string sSQL = SQLParser.MakeSQL("INSERT into REPORTAUTHORISATION(ReportID, PersonID, Position)" + " Values(%n, %n, %n) " , item.ReportID.Integer, item.AuthorizePersionId.Integer, item.Position); tc.ExecuteNonQuery(sSQL); } #endregion #region Update function internal static void Update(TransactionContext tc, ReportAuthorization item) { string sSQL = SQLParser.MakeSQL("UPDATE REPORTAUTHORISATION Set PersonID = %n, Position=%n Where ReportID = %n", item.AuthorizePersionId.Integer, item.Position, item.ReportID.Integer); tc.ExecuteNonQuery(sSQL); } #endregion #region Get Function internal static IDataReader Get(TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM REPORTAUTHORISATION"); } internal static IDataReader Get(TransactionContext tc, ID nID) { return tc.ExecuteReader("SELECT * FROM REPORTAUTHORISATION Where ReportID = %n", nID.Integer); } internal static IDataReader Get(TransactionContext tc, ID nID, int psition) { return tc.ExecuteReader("SELECT * FROM REPORTAUTHORISATION Where ReportID = %n AND Position=%n", nID.Integer,psition); } #endregion #region Delete Function internal static void Delete(TransactionContext tc, ID nID) { tc.ExecuteNonQuery("DELETE FROM [REPORTAUTHORISATION] WHERE ReportID=%n", nID.Integer); } #endregion } }