using System; using System.Collections.Generic; using System.Linq; using System.Text; using Ease.CoreV35.Model; using System.Data.SqlClient; using Ease.CoreV35.DataAccess; using Payroll.BO; using System.Data; using Ease.CoreV35.DataAccess.SQL; namespace Payroll.Service { 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.Integer, Convert.ToInt32(appItem.AssessmentFormType), appItem.FormID, appItem.ObjectID,appItem.AssessmentBy.Integer, Convert.ToInt32(appItem.AssessmentFor), appItem.AssessmentDate, DataReader.GetNullValue(appItem.CreatedBy.Integer), 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.Integer, Convert.ToInt32(appItem.AssessmentFor), appItem.AssessmentDate, DataReader.GetNullValue(appItem.ModifiedBy.Integer), DataReader.GetNullValue(appItem.ModifiedDate), appItem.ID.Integer); 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, ID id) { tc.ExecuteNonQuery("DELETE FROM [AssessmentMaster] WHERE WebAPPParamID=%n", id.Integer); } 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.Integer, ParamDetails.WebAPPParamID.Integer, 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, ID id) { return tc.ExecuteReader("SELECT * FROM AssessmentMaster where WebAPPParamID=%n", id.Integer); } } }