コード例 #1
0
        public Core.Business.UserPostRank Select(Guid id)
        {
            SqlServerUtility sql = new SqlServerUtility();

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

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

                if (!reader.IsDBNull(0)) userPostRank.Id = reader.GetGuid(0);
                if (!reader.IsDBNull(1)) userPostRank.PostRankName = reader.GetString(1);

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

                return null;
            }
        }
コード例 #2
0
        public IList<Core.Business.UserPostRank> GetAllUserPostRank()
        {
            IList<Core.Business.UserPostRank> userPostRanklist = new List<Core.Business.UserPostRank>();
            SqlServerUtility sql = new SqlServerUtility();

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

            if(reader != null)
            {
                while(reader.Read())
                {
                    Core.Business.UserPostRank userPostRank = new Core.Business.UserPostRank();

                    if (!reader.IsDBNull(0)) userPostRank.Id = reader.GetGuid(0);
                    if (!reader.IsDBNull(1)) userPostRank.PostRankName = reader.GetString(1);

                    userPostRank.MarkOld();
                    userPostRanklist.Add(userPostRank);
                }
                reader.Close();
            }
            return userPostRanklist;
        }