示例#1
0
        //Question Related Section

        public static bool InsertQuestion(ref QuestionInfo entity)
        {
            return Instance.InsertQuestion(ref entity);
        }
示例#2
0
 public static bool UpdateQuestion(QuestionInfo entity)
 {
     return Instance.UpdateQuestion(entity);
 }
示例#3
0
            // 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;
            }
示例#4
0
        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);
        }
示例#5
0
        //

        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;
            }

        }
示例#6
0
 public abstract bool UpdateQuestion(QuestionInfo entity);
示例#7
0
 public abstract bool InsertQuestion(ref QuestionInfo entity);