Ejemplo n.º 1
0
        //Answer Related Section

        public static bool InsertAnswer(ref AnswerInfo entity)
        {
            return Instance.InsertAnswer(ref entity);
        }
Ejemplo n.º 2
0
 public static bool UpdateAnswer(AnswerInfo entity)
 {
     return Instance.UpdateAnswer(entity);
 }
Ejemplo n.º 3
0
 public static AnswerInfo AnswerGet(DataRow dr)
 {
     AnswerInfo a = new AnswerInfo();
     a.Id = GetInt(dr["ID"]);
     a.QuestionId = GetInt(dr["QuestionID"]);
     a.Answer = GetString(dr["Answer"]);
     a.Correct = GetBool(dr["Correct"]);
     return a;
 }
Ejemplo n.º 4
0
        public override bool UpdateAnswer(AnswerInfo entity)
        {
            DbCommand cmd = SqlHelpers.CreateCommand(this._connectionString);
            cmd.CommandText = "dbo.mon_elrn_UPDATE_ANSWER";

            cmd.Parameters.Add(SqlHelpers.CreateInputParam("@Id", SqlDbType.Int) { Value = entity.Id));
            cmd.Parameters.Add(SqlHelpers.CreateInputParam("@QuestionId", SqlDbType.Int) { Value = entity.QuestionId));
            cmd.Parameters.Add(SqlHelpers.CreateInputParam("@Answer", SqlDbType.VarChar) { Value = entity.Answer));
            cmd.Parameters.Add(SqlHelpers.CreateInputParam("@Correct",SqlDbType.Bit) { Value = entity.Correct));

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

            return Convert.ToBoolean(results);
        }
Ejemplo n.º 5
0
        //

        public override bool InsertAnswer(ref AnswerInfo entity)
        {
            DbCommand cmd = SqlHelpers.CreateCommand(this._connectionString);
            cmd.CommandText = "dbo.mon_elrn_INSERT_ANSWER";
            cmd.Parameters.Add(SqlHelpers.CreateInputParam("@QuestionId", SqlDbType.Int) { Value = entity.QuestionId));
            cmd.Parameters.Add(SqlHelpers.CreateInputParam("@Answer", SqlDbType.VarChar) { Value = entity.Answer));
            cmd.Parameters.Add(SqlHelpers.CreateInputParam("@Correct",SqlDbType.Bit) { Value = entity.Correct));

            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 UpdateAnswer(AnswerInfo entity);
Ejemplo n.º 7
0
 public abstract bool InsertAnswer(ref AnswerInfo entity);