using System; using System.Collections.Generic; using System.Linq; using System.Text; using Payroll.BO; using System.Data; using Ease.CoreV35.Model; using System.Data.SqlClient; using Ease.CoreV35.DataAccess; namespace Payroll.Service { internal class SurveyWeightDefinitionDA { #region Constructor private SurveyWeightDefinitionDA() { } #endregion #region Insert function internal static void Insert(TransactionContext tc, SurveyWeightDefinition item) { tc.ExecuteNonQuery("INSERT INTO SurveyWeightDefinition(SurveyID, FromWeight,ToWeight,Remark)" + " VALUES(%n, %n,%n,%s)", item.SurveyID.Integer, item.FromWeight,item.ToWeight,item.Remark); } #endregion #region Update function internal static void Update(TransactionContext tc, SurveyWeightDefinition item) { tc.ExecuteNonQuery("UPDATE SurveyWeightDefinition SET FromWeight=%n,ToWeight=%n,Remark=%s" + " WHERE SurveyID=%n", item.FromWeight, item.ToWeight, item.Remark, item.SurveyID.Integer); } #endregion #region Get Function public static IDataReader GetSurveyWeightDefinition(TransactionContext tc, int nSurveyId) { return tc.ExecuteReader("SELECT * FROM SurveyWeightDefinition WHERE SurveyId=%n", nSurveyId); } public static IDataReader GetSurveyWeightDefinition(TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM SurveyWeightDefinition"); } #endregion #region Delete function internal static void Delete(TransactionContext tc, ID nID) { tc.ExecuteNonQuery("DELETE FROM [SurveyWeightDefinition] WHERE SurveyID=%n", nID.Integer); } public static void DeleteSurveyWeightDefinition(TransactionContext tc, int nSurveyId) { tc.ExecuteNonQuery("DELETE FROM [SurveyWeightDefinition] WHERE SurveyId=%n", nSurveyId); } #endregion } }