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; using Ease.CoreV35.DataAccess.SQL; namespace Payroll.Service { internal class SurveyOrganizationDA { #region Constructor private SurveyOrganizationDA() { } #endregion #region Insert function internal static void Insert(TransactionContext tc, SurveyOrganization item) { tc.ExecuteNonQuery("INSERT INTO SurveyOrganization(SurveyID,GradeID,CompanyID,DepartmentID, LocationID)" + " VALUES(%n, %n, %n, %n, %n)", item.SurveyID.Integer, DataReader.GetNullValue(item.GradeID, IDType.Integer), DataReader.GetNullValue(item.CompanyID, IDType.Integer), DataReader.GetNullValue(item.DepartmentID, IDType.Integer), DataReader.GetNullValue(item.LocationID, IDType.Integer)); } #endregion #region Update function internal static void Update(TransactionContext tc, SurveyOrganization item) { tc.ExecuteNonQuery("UPDATE SurveyOrganization SET GradeID=%n,CompanyID=%n,DepartmentID=%n, LocationID=%n" + " WHERE SurveyID=%n", item.GradeID.Integer, item.CompanyID.Integer, item.DepartmentID.Integer, item.LocationID.Integer, item.SurveyID.Integer); } #endregion #region Get Function internal static IDataReader Get(TransactionContext tc,EnumStatus status) { if (EnumStatus.Active == status || EnumStatus.Inactive == status) { return tc.ExecuteReader("SELECT * FROM SurveyOrganization where Status=%n", status); } else { return tc.ExecuteReader("SELECT * FROM SurveyOrganization"); } } public static IDataReader GetSurveyOrganization(TransactionContext tc, int nSurveyId) { return tc.ExecuteReader("SELECT * FROM SurveyOrganization WHERE SurveyId=%n", nSurveyId); } internal static IDataReader Get(TransactionContext tc, ID nID) { return tc.ExecuteReader("SELECT * FROM SurveyOrganization WHERE SurveyID=%n", nID.Integer); } internal static IDataReader Get(TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM SurveyOrganization"); } #endregion #region Delete function internal static void Delete(TransactionContext tc, ID nID) { tc.ExecuteNonQuery("DELETE FROM [SurveyOrganization] WHERE SurveyID=%n", nID.Integer); } public static void DeleteSurveyOrganization(TransactionContext tc, int nSurveyId) { tc.ExecuteNonQuery("DELETE FROM [SurveyOrganization] WHERE SurveyId=%n", nSurveyId); } #endregion } }