示例#1
0
        public IList<Core.Business.BlogType> GetAllBlogType()
        {
            IList<Core.Business.BlogType> blogTypelist = new List<Core.Business.BlogType>();
            SqlServerUtility sql = new SqlServerUtility(SqlConnection);

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

            if(reader != null)
            {
                while(reader.Read())
                {
                    Core.Business.BlogType blogType = new Core.Business.BlogType();

                    if (!reader.IsDBNull(0)) blogType.Id = reader.GetInt64(0);
                    if (!reader.IsDBNull(1)) blogType.DateCreated = reader.GetDateTime(1);
                    if (!reader.IsDBNull(2)) blogType.AccountId = reader.GetInt64(2);
                    if (!reader.IsDBNull(3)) blogType.Name = reader.GetString(3);

                    blogType.MarkOld();
                    blogTypelist.Add(blogType);
                }
                reader.Close();
            }
            return blogTypelist;
        }
示例#2
0
        public IList<CY.UME.Core.Business.BlogType> GetBlogTypesByAccountId(CY.UME.Core.Business.Account account)
        {
            IList<Core.Business.BlogType> blogTypelist = new List<Core.Business.BlogType>();

            if (account == null)
            {
                return blogTypelist;
            }

            SqlServerUtility sql = new SqlServerUtility(SqlConnection);

            sql.AddParameter("@AccountId", SqlDbType.BigInt, account.Id);

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

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.BlogType blogType = new Core.Business.BlogType();

                    if (!reader.IsDBNull(0)) blogType.Id = reader.GetInt64(0);
                    if (!reader.IsDBNull(1)) blogType.DateCreated = reader.GetDateTime(1);
                    if (!reader.IsDBNull(2)) blogType.AccountId = reader.GetInt64(2);
                    if (!reader.IsDBNull(3)) blogType.Name = reader.GetString(3);

                    blogType.MarkOld();
                    blogTypelist.Add(blogType);
                }
                reader.Close();
            }
            return blogTypelist;
        }
示例#3
0
        public Core.Business.BlogType Select(Int64 id)
        {
            SqlServerUtility sql = new SqlServerUtility(SqlConnection);

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

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

                if (!reader.IsDBNull(0)) blogType.Id = reader.GetInt64(0);
                if (!reader.IsDBNull(1)) blogType.DateCreated = reader.GetDateTime(1);
                if (!reader.IsDBNull(2)) blogType.AccountId = reader.GetInt64(2);
                if (!reader.IsDBNull(3)) blogType.Name = reader.GetString(3);

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

                return null;
            }
        }