Ejemplo n.º 1
0
 public static bool InsertTest(ref TestInfo entity)
 {
     return Instance.InsertTest(ref entity);
 }
Ejemplo n.º 2
0
 public static bool UpdateTest(TestInfo entity)
 {
     return Instance.UpdateTest(entity);
 }
Ejemplo n.º 3
0
            // Test Info

            public static TestInfo GetTestInfo(DataRow dr)
            {
                TestInfo t = new TestInfo();
                t.Id = GetInt(dr["ID"]);
                t.ClassId = GetInt(dr["ClassId"]);
                t.QuestionCount = GetInt(dr["QuestionCount"]);
                t.Title = GetString(dr["Title"]);
                t.Description = GetString(dr["Description"]);
                t.MinPassingScorePercentage = GetInt(dr["MinPassingScorePercentage"]);
                t.Visible = GetBool(dr["Visible"]);
                t.CreatedTimestamp = GetDate(dr["CreatedTimestamp"]);
                t.UpdatedTimestamp = GetDate(dr["UpdatedTimestamp"]);

                return t;
            }
Ejemplo n.º 4
0
        public override bool UpdateTest(TestInfo entity)
        {
            DbCommand cmd = SqlHelpers.CreateCommand(this._connectionString);
            cmd.CommandText = "dbo.mon_elrn_UPDATE_TEST";

            cmd.Parameters.Add(SqlHelpers.CreateInputParam("@Id", SqlDbType.Int) { Value = entity.Id));
            cmd.Parameters.Add(SqlHelpers.CreateInputParam("@ClassId", SqlDbType.Int) { Value = entity.ClassId));
            cmd.Parameters.Add(SqlHelpers.CreateInputParam("@Title", SqlDbType.VarChar) { Value = entity.Title));
            cmd.Parameters.Add(SqlHelpers.CreateInputParam("@Description", SqlDbType.VarChar) { Value = entity.Description));
            cmd.Parameters.Add(SqlHelpers.CreateInputParam("@MinPassingScorePercentage", SqlDbType.Int) { Value = entity.MinPassingScorePercentage));
            cmd.Parameters.Add(SqlHelpers.CreateInputParam("@Visible",SqlDbType.Bit) { Value = entity.Visible));
            cmd.Parameters.Add(SqlHelpers.CreateInputParam("@CreatedTimestamp", SqlDbType.SmallDateTime) { Value =  entity.CreatedTimestamp));
            cmd.Parameters.Add(SqlHelpers.CreateInputParam("@UpdatedTimestamp", SqlDbType.SmallDateTime) { Value =  entity.UpdatedTimestamp));

            int results = 0;
            results = SqlHelpers.ExecuteNonQuery(cmd);

            return Convert.ToBoolean(results);
        }
Ejemplo n.º 5
0
        public override bool InsertTest(ref TestInfo entity)
        {
            DbCommand cmd = SqlHelpers.CreateCommand(this._connectionString);
            cmd.CommandText = "dbo.mon_elrn_INSERT_TEST";

            cmd.Parameters.Add(SqlHelpers.CreateInputParam("@ClassId", SqlDbType.Int) { Value = entity.ClassId));
            cmd.Parameters.Add(SqlHelpers.CreateInputParam("@Title", SqlDbType.VarChar) { Value = entity.Title));
            cmd.Parameters.Add(SqlHelpers.CreateInputParam("@Description", SqlDbType.VarChar) { Value = entity.Description));
            cmd.Parameters.Add(SqlHelpers.CreateInputParam("@MinPassingScorePercentage", SqlDbType.Int) { Value = entity.MinPassingScorePercentage));
            cmd.Parameters.Add(SqlHelpers.CreateInputParam("@Visible",SqlDbType.Bit) { Value = entity.Visible));
            cmd.Parameters.Add(SqlHelpers.CreateInputParam("@CreatedTimestamp", SqlDbType.SmallDateTime) { Value =  entity.CreatedTimestamp));
            cmd.Parameters.Add(SqlHelpers.CreateInputParam("@UpdatedTimestamp", SqlDbType.SmallDateTime) { Value =  entity.UpdatedTimestamp));

            int results = 0;
            try
            {
                results = Convert.ToInt32(SqlHelpers.ExecuteScalar(cmd));
                if (results > 0)
                {
                    entity.Id = results;
                    return true;
                }
                else
                    return false;
            }
            catch
            {
                return false;
            }
        }
Ejemplo n.º 6
0
 public abstract bool UpdateTest(TestInfo entity);
Ejemplo n.º 7
0
 //Test related functions
 public abstract bool InsertTest(ref TestInfo entity);