Ejemplo n.º 1
0
        //Question Related Section

        public static bool InsertQuestion(ref QuestionInfo entity)
        {
            return Instance.InsertQuestion(ref entity);
        }
Ejemplo n.º 2
0
 public static bool UpdateQuestion(QuestionInfo entity)
 {
     return Instance.UpdateQuestion(entity);
 }
Ejemplo n.º 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;
            }
Ejemplo n.º 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);
        }
Ejemplo n.º 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;
            }

        }
Ejemplo n.º 6
0
 public abstract bool UpdateQuestion(QuestionInfo entity);
Ejemplo n.º 7
0
 public abstract bool InsertQuestion(ref QuestionInfo entity);