Пример #1
0
        public WikiFile(int id)
        {
            umbraco.DataLayer.IRecordsReader dr = Data.SqlHelper.ExecuteReader("SELECT * FROM wikiFiles WHERE id = " + id.ToString());

            if (dr.Read())
            {
                Id          = dr.GetInt("id");
                Path        = dr.GetString("path");
                Name        = dr.GetString("name");
                FileType    = dr.GetString("type");
                RemovedBy   = dr.GetInt("removedBy");
                CreatedBy   = dr.GetInt("createdBy");
                NodeVersion = dr.GetGuid("version");
                NodeId      = dr.GetInt("nodeId");
                CreateDate  = dr.GetDateTime("createDate");
                Current     = dr.GetBoolean("current");
                Downloads   = dr.GetInt("downloads");
                Archived    = dr.GetBoolean("archived");
                Verified    = dr.GetBoolean("verified");
                Versions    = GetVersionsFromString(dr.GetString("umbracoVersion"));
                Version     = Versions.Any() ? GetVersionsFromString(dr.GetString("umbracoVersion"))[0] : UmbracoVersion.DefaultVersion();
            }
            else
            {
                throw new ArgumentException(string.Format("No node exists with id '{0}'", Id));
            }

            dr.Close();
        }
Пример #2
0
        public static Topic GetFromReader(umbraco.DataLayer.IRecordsReader reader)
        {
            var topic = new Topic
            {
                Id                = reader.GetInt("id"),
                ParentId          = reader.GetInt("parentId"),
                MemberId          = reader.GetInt("memberId"),
                Replies           = reader.GetInt("replies"),
                Title             = CleanInvalidXmlChars(reader.GetString("title")),
                Body              = CleanInvalidXmlChars(reader.GetString("body")),
                LatestReplyAuthor = reader.GetInt("latestReplyAuthor"),
                Created           = reader.GetDateTime("created"),
                Updated           = reader.GetDateTime("updated"),
                UrlName           = reader.GetString("urlName"),
                Locked            = reader.GetBoolean("locked")
            };

            return(topic);
        }