Beispiel #1
0
 public static bool InsertTestResult(ref TestResultInfo entity)
 {
     return Instance.InsertTestResult(ref entity);
 }
Beispiel #2
0
 public static bool UpdateTestResult(TestResultInfo entity)
 {
     return Instance.UpdateTestResult(entity); ;
 }
Beispiel #3
0
        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;
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
        //

        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;
            }

        }
Beispiel #6
0
 public abstract bool UpdateTestResult(TestResultInfo entity);
Beispiel #7
0
 //TestResult related functions
 public abstract bool InsertTestResult(ref TestResultInfo entity);