using HRM.BO; using Ease.Core.DataAccess; using System; using System.Data; namespace HRM.DA { public class WebAPPFormParamDA { #region Insert internal static void Insert(TransactionContext tc, WebAPPFormParam appItem) { tc.ExecuteNonQuery("INSERT INTO AssessmentMaster(WebAPPParamID, AssessmentFormType, FormID," + " ObjectID, AssessmentBy, AssessmentFor,AssessmentDate,CreatedBy, CreationDate)" + " VALUES(%n, %n, %n, %n, %n, %n,%d,%n,%d)", appItem.ID, Convert.ToInt32(appItem.AssessmentFormType), appItem.FormID, appItem.ObjectID, appItem.AssessmentBy, Convert.ToInt32(appItem.AssessmentFor), appItem.AssessmentDate, DataReader.GetNullValue(appItem.CreatedBy), DataReader.GetNullValue(appItem.CreatedDate)); } #endregion #region Update internal static void Update(TransactionContext tc, WebAPPFormParam appItem) { string sSQL = SQLParser.MakeSQL("UPDATE AssessmentMaster SET [AssessmentFormType]=%n," + " [FormID]=%n,[ObjectID]=%n,[AssessmentBy]=%n,[AssessmentFor]=%n,[AssessmentDate]=%d," + " [ModifiedBy]=%n,[ModifiedDate]=%d WHERE [WebAPPParamID]=%n", Convert.ToInt32(appItem.AssessmentFormType), appItem.FormID, appItem.ObjectID, appItem.AssessmentBy, Convert.ToInt32(appItem.AssessmentFor), appItem.AssessmentDate, DataReader.GetNullValue(appItem.ModifiedBy), DataReader.GetNullValue(appItem.ModifiedDate), appItem.ID); tc.ExecuteNonQuery(sSQL); } #endregion #region Delete internal static void Delete(TransactionContext tc, int formId, int objectID) { tc.ExecuteNonQuery("DELETE FROM AssessmentMaster WHERE FormID=%n AND ObjectID=%n", formId, objectID); } #endregion #region Get internal static System.Data.IDataReader Get(TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM AssessmentMaster"); } internal static System.Data.IDataReader Get(TransactionContext tc, int formId, int objectID) { return tc.ExecuteReader("SELECT * FROM AssessmentMaster WHERE FormID=%n AND ObjectID=%n", formId, objectID); } internal static IDataReader GetParams(TransactionContext tc, int formId, int objectID) { return tc.ExecuteReader("SELECT * FROM AssessmentMaster WHERE FormID=%n AND ObjectID=%n", formId, objectID); } #endregion internal static void DeleteParamDetails(TransactionContext tc, int id) { string sSQL = SQLParser.MakeSQL("DELETE From AssessmentDetail WHERE WebAPPParamID=%n", id); tc.ExecuteNonQuery(sSQL); } internal static void Delete(TransactionContext tc, int id) { tc.ExecuteNonQuery("DELETE FROM AssessmentMaster WHERE WebAPPParamID=%n", id); } internal static void InsertParamDetails(TransactionContext tc, WebAPPFormParamDetails ParamDetails) { tc.ExecuteNonQuery("INSERT INTO AssessmentDetail(ParamDetailsID, WebAPPParamID," + " ParamID, Value, DataType)" + " VALUES(%n, %n, %n, %s, %n)", ParamDetails.ID, ParamDetails.WebAPPParamID, ParamDetails.ParamID, ParamDetails.Value, Convert.ToInt32(ParamDetails.DataType)); } internal static IDataReader GetParamDetails(TransactionContext tc, int ParamId) { return tc.ExecuteReader("SELECT * FROM AssessmentDetail where WebAPPParamID=%n", ParamId); } internal static IDataReader Get(TransactionContext tc, int id) { return tc.ExecuteReader("SELECT * FROM AssessmentMaster where WebAPPParamID=%n", id); } } }