using HRM.BO; using Ease.Core.DataAccess; using System; using System.Data; namespace HRM.DA { #region ProductionBonusSetupDA internal class ProductionBonusSetupDA { #region Constructor private ProductionBonusSetupDA() { } #endregion #region Insert function internal static void Insert(TransactionContext tc, ProductionBonusSetup item) { string sql = SQLParser.MakeSQL( "INSERT INTO ProductionBonusSetup(ProductionBonusSetupID, ProgramName, AchivedPercent, OTHour, SalaryMonth, DesignNo, FromDate, ToDate, MaxPerson, CreatedBy, CreationDate, Status)" + " VALUES(%n, %s, %n, %n, %d, %s, %d, %d, %n, %d, %n)", item.ID, item.ProgramName, item.AchivedPercent, item.OTHour, item.SalaryMonth, item.DesignNo, item.FromDate, item.ToDate, item.MaxPerson, item.CreatedBy, item.CreatedDate, item.Status); tc.ExecuteNonQuery(sql); } #endregion #region Update function internal static void Update(TransactionContext tc, ProductionBonusSetup item) { tc.ExecuteNonQuery( "UPDATE ProductionBonusSetup SET ProgramName=%s, AchivedPercent=%n, OTHour=%n, SalaryMonth=%d, DesignNo=%s, FromDate=%d, ToDate=%d, MaxPerson=%n, Status=%n " + " WHERE ProductionBonusSetupID=%n", item.ProgramName, item.AchivedPercent, item.OTHour, item.SalaryMonth, item.DesignNo, item.FromDate, item.ToDate, item.MaxPerson, item.Status, item.ID); } #endregion #region Get Function internal static IDataReader Get(TransactionContext tc, DateTime dtSalaryMonth) { return tc.ExecuteReader( "SELECT * FROM ProductionBonusSetup where Month(SalaryMonth)=%n AND Year(SalaryMonth)=%n", dtSalaryMonth.Month, dtSalaryMonth.Year); } internal static IDataReader Get(TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM ProductionBonusSetup"); } internal static IDataReader Get(TransactionContext tc, EnumBonusStatus status) { return tc.ExecuteReader("SELECT * FROM ProductionBonusSetup Where Status=%n", status); } internal static IDataReader Get(TransactionContext tc, int nID) { return tc.ExecuteReader("SELECT * FROM ProductionBonusSetup WHERE ProductionBonusSetupID=%n", nID); } internal static IDataReader Get(TransactionContext tc, string DesignNo) { return tc.ExecuteReader("SELECT * FROM ProductionBonusSetup WHERE DesignNo=%s", DesignNo); } internal static IDataReader GetProductionBonusLine(TransactionContext tc, int id) { return tc.ExecuteReader("SELECT * FROM ProdBonusLine WHERE ProdBonusSetupID=%n", id); } internal static IDataReader GetProductionBonusLine(TransactionContext tc, string ids) { return tc.ExecuteReader("SELECT * FROM ProdBonusLine WHERE ProdBonusSetupID in (%q)", ids); } internal static IDataReader GetProdBonusWorkSchedules(TransactionContext tc, int id) { return tc.ExecuteReader("SELECT * FROM ProdBonusWorkSchedule WHERE ProdBonusSetupID=%n", id); } internal static IDataReader GetProdBonusParameters(TransactionContext tc, int id) { return tc.ExecuteReader("SELECT * FROM ProdBonusParameter WHERE ProdBonusSetupID=%n", id); } internal static DataTable GetLayout(TransactionContext tc, DateTime dtSalaryMonth) { return tc.ExecuteDataTable( "SELECT ProductionBonusSetupID as id, DesignNo as design FROM ProductionBonusSetup where Salarymonth >= %d", GlobalFunctions.FirstDateOfMonth(dtSalaryMonth)); } internal static DataTable GetLayoutMonthly(TransactionContext tc, DateTime dtSalaryMonth) { return tc.ExecuteDataTable( "SELECT ProductionBonusSetupID as id, DesignNo as design FROM ProductionBonusSetup where Month(SalaryMonth) = %n and YEAR(SalaryMonth) = %n", dtSalaryMonth.Month, dtSalaryMonth.Year); } #endregion #region Delete function internal static void Delete(TransactionContext tc, int nID) { tc.ExecuteNonQuery("DELETE FROM ProductionBonusSetup WHERE ProductionBonusSetupID=%n", nID); } internal static void DeleteAttn(TransactionContext tc, int nID) { tc.ExecuteNonQuery("DELETE FROM ProdBonusAttn WHERE ProdBonusSetupID=%n", nID); } internal static void DeleteSupervisor(TransactionContext tc, int nID) { tc.ExecuteNonQuery("DELETE FROM ProdBonusSupervisor WHERE ProdBonusSetupID=%n", nID); } internal static void DeleteParameter(TransactionContext tc, int nID) { tc.ExecuteNonQuery("DELETE FROM ProdBonusParameter WHERE ProdBonusSetupID=%n", nID); } internal static void DeleteSchedule(TransactionContext tc, int nID) { tc.ExecuteNonQuery("DELETE FROM ProdBonusWorkSchedule WHERE ProdBonusWorkScheduleID=%n", nID); } internal static void DeleteLine(TransactionContext tc, int nID) { tc.ExecuteNonQuery("DELETE FROM ProdBonusLine WHERE ProdBonusLineID=%n", nID); } #endregion } #endregion }