示例#1
0
        //Answer Related Section

        public static bool InsertAnswer(ref AnswerInfo entity)
        {
            return Instance.InsertAnswer(ref entity);
        }
示例#2
0
 public static bool UpdateAnswer(AnswerInfo entity)
 {
     return Instance.UpdateAnswer(entity);
 }
示例#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;
 }
示例#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);
        }
示例#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;
            }
        }
示例#6
0
 public abstract bool UpdateAnswer(AnswerInfo entity);
示例#7
0
 public abstract bool InsertAnswer(ref AnswerInfo entity);