//Answer Related Section public static bool InsertAnswer(ref AnswerInfo entity) { return Instance.InsertAnswer(ref entity); }
public static bool UpdateAnswer(AnswerInfo entity) { return Instance.UpdateAnswer(entity); }
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; }
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); }
// 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; } }
public abstract bool UpdateAnswer(AnswerInfo entity);
public abstract bool InsertAnswer(ref AnswerInfo entity);