using System; using System.Collections.Generic; using System.Linq; using System.Text; using Ease.CoreV35.DataAccess; using System.Data; using HRM.BO; using Ease.Core.DataAccess; namespace HRM.DA { class AttnProcessRunSummaryDA { #region Get internal static IDataReader GetByID(TransactionContext tc, int ID) { return tc.ExecuteReader("SELECT * FROM AttnProcessRunSummary Where AttnProcessRunSummaryID = %n", ID); } internal static IDataReader Get(TransactionContext tc, int payrollTypeID) { return tc.ExecuteReader("SELECT * FROM AttnProcessRunSummary Where PayrollTypeID = %n", payrollTypeID); } //internal static IDataReader GetByStatus(TransactionContext tc, EnumProcessStatus ProcessStatus, // int payrollTypeID) //{ // return tc.ExecuteReader( // "SELECT * FROM AttnProcessRunSummary aprs WHERE aprs.ProcessStatus = %n And PayrollTypeID = %n", // (int)ProcessStatus, payrollTypeID); //} internal static IDataReader GetByMode(TransactionContext tc, EnumProcessMode ProcessMode, int payrollTypeID) { return tc.ExecuteReader( "SELECT * FROM AttnProcessRunSummary aprs WHERE aprs.ProcessMode = %n And PayrollTypeID = %n", (int)ProcessMode, payrollTypeID); } internal static IDataReader Get(TransactionContext tc, int id, int payrollTypeID) { return tc.ExecuteReader( "SELECT * FROM AttnProcessRunSummary Where AttnProcessRunSummeryID=%n And PayrollTypeID = %n", id, payrollTypeID); } internal static IDataReader GetAttnProcessRunDetails(TransactionContext tc, int id) { return tc.ExecuteReader("SELECT * FROM AttnProcessRunDetail aprd WHERE aprd.AttnProcessSummaryID = %n", id); } #endregion #region Insert internal static void Insert(TransactionContext tc, AttnProcessRunSummary oAttnProcessRunSummary, int payrollTypeID) { string sql = SQLParser.MakeSQL( @"INSERT INTO AttnProcessRunSummary(AttnProcessRunSummeryID, ProcessDate, ProcessMode, ProcessBy, ProcessStatus,PayrollTypeID)" + " VALUES(%n, %d, %n, %n, %n,%n)", oAttnProcessRunSummary.ID, oAttnProcessRunSummary.ProcessDate, (int)oAttnProcessRunSummary.ProcessMode, DataReader.GetNullValue(oAttnProcessRunSummary.ProcessBy, 0), (int)oAttnProcessRunSummary.ProcessStatus, payrollTypeID); tc.ExecuteNonQuery(sql); } internal static void InsertAttnProcessRunDetail(TransactionContext tc, AttnProcessRunDetail item) { string sql = SQLParser.MakeSQL( @"INSERT INTO AttnProcessRunDetail(AttnProcessRunDetailID, AttnProcessSummaryID, ErrorType, EmployeeNo, EmployeeName,Description, LocationID)" + " VALUES(%n, %n, %n, %s, %s,%s, %n)", item.ID, item.ProcessSummaryID, (int)item.EnumErrorType, item.EmployeeNo, item.EmployeeName, item.Description, DataReader.GetNullValue(item.LocationID, 0)); tc.ExecuteNonQuery(sql); } #endregion #region Update internal static void Update(TransactionContext tc, AttnProcessRunSummary oAttnProcessRunSummary) { string sql = SQLParser.MakeSQL( "Update AttnProcessRunSummary Set ProcessDate = %d, ProcessMode = %n, ProcessBy = %n, ProcessStatus = %n where AttnProcessRunSummeryID = %n", oAttnProcessRunSummary.ProcessDate, (int)oAttnProcessRunSummary.ProcessMode, DataReader.GetNullValue(oAttnProcessRunSummary.ProcessBy, 0), (int)oAttnProcessRunSummary.ProcessStatus, oAttnProcessRunSummary.ID); tc.ExecuteNonQuery(sql); } #endregion #region Delete internal static void DeleteAttnProcessRunDetails(TransactionContext tc, int iD) { tc.ExecuteNonQuery("Delete From AttnProcessRunDetail Where AttnProcessSummaryID=%n", iD); } #endregion } }