public static bool InsertTestResult(ref TestResultInfo entity) { return Instance.InsertTestResult(ref entity); }
public static bool UpdateTestResult(TestResultInfo entity) { return Instance.UpdateTestResult(entity); ; }
public override TestResultInfo GetTestResultByTestId(System.Int32 testId, Guid userId) { DbCommand cmd = SqlHelpers.CreateCommand(this._connectionString); cmd.CommandText = "dbo.mon_elrn_GET_TEST_RESULTByTestId"; cmd.Parameters.Add(SqlHelpers.CreateInputParam("@TestId", SqlDbType.Int) { Value = testId)); cmd.Parameters.Add(SqlHelpers.CreateInputParam("@UserId", SqlDbType.UniqueIdentifier) { Value = userId)); TestResultInfo entity = null; try { DataTable table = cmd.ExecuteSelectTable(); if (table.Rows.Count > 0) entity = new TestResultInfo(table.Rows[0]); } finally { } return entity; }
public override bool UpdateTestResult(TestResultInfo entity) { DbCommand cmd = SqlHelpers.CreateCommand(this._connectionString); cmd.CommandText = "dbo.mon_elrn_UPDATE_TEST_RESULT"; cmd.Parameters.Add(SqlHelpers.CreateInputParam("@Id", SqlDbType.Int) { Value = entity.Id)); cmd.Parameters.Add(SqlHelpers.CreateInputParam("@TestId", SqlDbType.Int) { Value = entity.TestId)); cmd.Parameters.Add(SqlHelpers.CreateInputParam("@ClassId", SqlDbType.Int) { Value = entity.ClassId)); cmd.Parameters.Add(SqlHelpers.CreateInputParam("@UserId", SqlDbType.UniqueIdentifier) { Value = entity.UserId)); cmd.Parameters.Add(SqlHelpers.CreateInputParam("@Score", SqlDbType.Int) { Value = entity.Score)); int results = 0; results = SqlHelpers.ExecuteNonQuery(cmd); return Convert.ToBoolean(results); }
// public override bool InsertTestResult(ref TestResultInfo entity) { DbCommand cmd = SqlHelpers.CreateCommand(this._connectionString); cmd.CommandText = "dbo.mon_elrn_INSERT_TEST_RESULT"; cmd.Parameters.Add(SqlHelpers.CreateInputParam("@TestId", SqlDbType.Int) { Value = entity.TestId)); cmd.Parameters.Add(SqlHelpers.CreateInputParam("@ClassId", SqlDbType.Int) { Value = entity.ClassId)); cmd.Parameters.Add(SqlHelpers.CreateInputParam("@UserId", SqlDbType.UniqueIdentifier) { Value = entity.UserId)); cmd.Parameters.Add(SqlHelpers.CreateInputParam("@Score", SqlDbType.Int) { Value = entity.Score)); int results = 0; try { results = Convert.ToInt32(SqlHelpers.ExecuteScalar(cmd)); if (results > 0) { entity.Id = results; return true; } else return false; } catch { return false; } }
public abstract bool UpdateTestResult(TestResultInfo entity);
//TestResult related functions public abstract bool InsertTestResult(ref TestResultInfo entity);