//Question Related Section public static bool InsertQuestion(ref QuestionInfo entity) { return Instance.InsertQuestion(ref entity); }
public static bool UpdateQuestion(QuestionInfo entity) { return Instance.UpdateQuestion(entity); }
// Question Info public static QuestionInfo GetQuestionInfo(DataRow dr) { QuestionInfo t = new QuestionInfo(); t.Id = GetInt(dr["ID"]); t.TestId = GetInt(dr["TestId"]); t.Question = GetString(dr["Question"]); t.AnswerCount = GetInt(dr["AnswerCount"]); return t; }
public override bool UpdateQuestion(QuestionInfo entity) { DbCommand cmd = SqlHelpers.CreateCommand(this._connectionString); cmd.CommandText = "dbo.mon_elrn_UPDATE_QUESTION"; 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("@Question", SqlDbType.VarChar) { Value = entity.Question)); int results = 0; results = SqlHelpers.ExecuteNonQuery(cmd); return Convert.ToBoolean(results); }
// public override bool InsertQuestion(ref QuestionInfo entity) { DbCommand cmd = SqlHelpers.CreateCommand(this._connectionString); cmd.CommandText = "dbo.mon_elrn_INSERT_QUESTION"; cmd.Parameters.Add(SqlHelpers.CreateInputParam("@TestId", SqlDbType.Int) { Value = entity.TestId)); cmd.Parameters.Add(SqlHelpers.CreateInputParam("@Question", SqlDbType.VarChar) { Value = entity.Question)); 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 UpdateQuestion(QuestionInfo entity);
public abstract bool InsertQuestion(ref QuestionInfo entity);