using HRM.BO; using Ease.Core.DataAccess; using System; using System.Collections.Generic; using System.Data; namespace HRM.DA { class TrainingNdAnalysisTimeSchDA { #region Get Function public static IDataReader Get(TransactionContext tc, int id) { return tc.ExecuteReader("SELECT * from TrainingNdAnalysisTimeSch WHERE TNATimeSchID=%n", id); } public static IDataReader Get(TransactionContext tc) { return tc.ExecuteReader("SELECT * from TrainingNdAnalysisTimeSch"); } public static IDataReader GetByTrainingNeedAnalysisID(TransactionContext tc, int TrainingNeedAnalysisID) { return tc.ExecuteReader("SELECT * from TrainingNdAnalysisTimeSch where TrainingNeedAnalysisID=%n", TrainingNeedAnalysisID); } #endregion #region Insert Function public static void Insert(TransactionContext tc, TrainingNdAnalysisTimeSch oItem) { tc.ExecuteNonQuery( "INSERT INTO TrainingNdAnalysisTimeSch(TNATimeSchID, TrainingNeedAnalysisID, Month,Participent, Remarks)" + " VALUES(%n,%n,%n,%n,%s)", oItem.ID, DataReader.GetNullValue(oItem.TrainingNeedAnalysisID, 0), oItem.Month, oItem.Participent, oItem.Remarks); } #endregion #region Update Function public static void Update(TransactionContext tc, TrainingNdAnalysisTimeSch oItem) { tc.ExecuteNonQuery( "UPDATE TrainingNdAnalysisTimeSch SET TrainingNeedAnalysisID=%n,Month=%n,Participent=%n,Remarks=%s" + " WHERE TNATimeSchID=%n", DataReader.GetNullValue(oItem.TrainingNeedAnalysisID, 0), oItem.Month, oItem.Participent, oItem.Remarks, oItem.ID); } #endregion #region Delete Function public static void Delete(TransactionContext tc, int id) { tc.ExecuteNonQuery("Delete from TrainingNdAnalysisTimeSch where TNATimeSchID=%n", id); } public static void DeletebyTrainingNeedAnalysisID(TransactionContext tc, int TrainingNeedAnalysisID) { tc.ExecuteNonQuery("Delete from TrainingNdAnalysisTimeSch where TrainingNeedAnalysisID=%n", TrainingNeedAnalysisID); } #endregion public static bool DoesTrainingNdAnalysisTimeSchExists(TransactionContext tc, int TNATimeSchID) { object ob = tc.ExecuteScalar("SELECT COUNT(*) FROM TrainingNdAnalysisTimeSch WHERE TNATimeSchID=%n", TNATimeSchID); return (Convert.ToInt32(ob) > 0); } } }