Exemplo n.º 1
0
        public Core.Business.QuestionDomain Select(Guid id)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@Id", SqlDbType.UniqueIdentifier, id);
            SqlDataReader reader = sql.ExecuteSPReader("usp_SelectQuestionDomain");

            if (reader != null && !reader.IsClosed && reader.Read())
            {
                Core.Business.QuestionDomain questionDomain = new Core.Business.QuestionDomain();

                if (!reader.IsDBNull(0)) questionDomain.Id = reader.GetGuid(0);
                if (!reader.IsDBNull(1)) questionDomain.QuestionID = reader.GetGuid(1);
                if (!reader.IsDBNull(2)) questionDomain.DomainID = reader.GetGuid(2);

                reader.Close();
                return questionDomain;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }
Exemplo n.º 2
0
        public IList<Core.Business.QuestionDomain> GetAllQuestionDomain()
        {
            IList<Core.Business.QuestionDomain> questionDomainlist = new List<Core.Business.QuestionDomain>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSPReader("usp_SelectQuestionDomainsAll");

            if(reader != null)
            {
                while(reader.Read())
                {
                    Core.Business.QuestionDomain questionDomain = new Core.Business.QuestionDomain();

                    if (!reader.IsDBNull(0)) questionDomain.Id = reader.GetGuid(0);
                    if (!reader.IsDBNull(1)) questionDomain.QuestionID = reader.GetGuid(1);
                    if (!reader.IsDBNull(2)) questionDomain.DomainID = reader.GetGuid(2);

                    questionDomain.MarkOld();
                    questionDomainlist.Add(questionDomain);
                }
                reader.Close();
            }
            return questionDomainlist;
        }