当前位置: 首页>>代码示例>>C#>>正文


C# IDnaDataReader.GetBoolean方法代码示例

本文整理汇总了C#中IDnaDataReader.GetBoolean方法的典型用法代码示例。如果您正苦于以下问题:C# IDnaDataReader.GetBoolean方法的具体用法?C# IDnaDataReader.GetBoolean怎么用?C# IDnaDataReader.GetBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDnaDataReader的用法示例。


在下文中一共展示了IDnaDataReader.GetBoolean方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddPrefixedUserXMLBlock

        /// <summary>
        /// Creates and adds the returned User Xml block to a given parent post node from the passed user parameters with a prefix
        /// ie the field name of OwnerUserName, OwnerFirstNames
        /// </summary>
        /// <param name="dataReader">Data reader object</param>
        /// <param name="userID">The users id</param>
        /// <param name="prefix">The prefix of the field names for a different user in the same result set</param>
        /// <param name="parent">The parent Node to add the user xml to</param>
        /// <returns>XmlNode Containing user XML from the stored procedure</returns>
        public void AddPrefixedUserXMLBlock(IDnaDataReader dataReader, int userID, string prefix, XmlNode parent)
        {
            string userName = "";
            if (dataReader.Exists(prefix + "UserName"))
            {
                userName = dataReader.GetStringNullAsEmpty(prefix + "UserName");
            }
            else if (dataReader.Exists(prefix + "Name"))
            {
                userName = dataReader.GetStringNullAsEmpty(prefix + "Name");
            }

            if (userName == String.Empty)
            {
                userName = "Member " + userID.ToString();
            }

            string identityUserId = "";
            if (dataReader.Exists(prefix + "identityUserId"))
            {
                identityUserId = dataReader.GetStringNullAsEmpty(prefix + "identityUserId");
            }

            string emailAddress = "";
            if (dataReader.Exists(prefix + "Email"))
            {
                emailAddress = dataReader.GetStringNullAsEmpty(prefix + "Email");
            }

            double zeigeistScore = 0.0;
            if (dataReader.DoesFieldExist(prefix + "ZeitgeistScore"))
            {
                zeigeistScore = dataReader.GetDoubleNullAsZero(prefix + "ZeitgeistScore");
            }

            string siteSuffix = "";
            if (dataReader.Exists(prefix + "SiteSuffix"))
            {
                siteSuffix = dataReader.GetStringNullAsEmpty(prefix + "SiteSuffix");
            }

            string area = "";
            if (dataReader.Exists(prefix + "Area"))
            {
                area = dataReader.GetStringNullAsEmpty(prefix + "Area");
            }

            string title = "";
            if (dataReader.Exists(prefix + "Title"))
            {
                title = dataReader.GetStringNullAsEmpty(prefix + "Title");
            }

            int subQuota = 0;
            if (dataReader.Exists(prefix + "SubQuota"))
            {
                subQuota = dataReader.GetInt32NullAsZero(prefix + "SubQuota");
            }

            int allocations = 0;
            if (dataReader.Exists(prefix + "Allocations"))
            {
                allocations = dataReader.GetInt32NullAsZero(prefix + "Allocations");
            }
            

            int journal = 0;
            if (dataReader.Exists(prefix + "Journal"))
            {
                journal = dataReader.GetInt32NullAsZero(prefix + "Journal");
            }

            bool isActive = false;
            if (dataReader.Exists(prefix + "Active") && !dataReader.IsDBNull(prefix + "Active"))
            {
                isActive = dataReader.GetBoolean(prefix + "Active");
            }

            DateTime dateLastNotified = DateTime.MinValue;
            if (dataReader.Exists(prefix + "DateLastNotified") && dataReader.GetValue(prefix + "DateLastNotified") != DBNull.Value)
            {
                dateLastNotified = dataReader.GetDateTime(prefix + "DateLastNotified");
            }

            DateTime dateJoined = DateTime.MinValue;
            if (dataReader.Exists(prefix + "DateJoined") && dataReader.GetValue(prefix + "DateJoined") != DBNull.Value)
            {
                dateJoined = dataReader.GetDateTime(prefix + "DateJoined");
            }
            int forumPostedTo = -1;
            if (dataReader.Exists(prefix + "ForumPostedTo"))
//.........这里部分代码省略.........
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:101,代码来源:User.cs

示例2: CommentCreateFromReader

        /// <summary>
        /// Creates a commentinfo object
        /// </summary>
        /// <param name="reader">A reader with all information</param>
        /// <param name="site">site information</param>
        /// <returns>Comment info object</returns>
        private CommentInfo CommentCreateFromReader(IDnaDataReader reader, ISite site)
        {
            var commentInfo = new CommentInfo
                                  {
                                      Created =
                                          new DateTimeHelper(DateTime.Parse(reader.GetDateTime("Created").ToString())),
                                      User = UserReadById(reader, site),
                                      ID = reader.GetInt32NullAsZero("id")
                                  };

            commentInfo.hidden = (CommentStatus.Hidden) reader.GetInt32NullAsZero("hidden");
            if (reader.IsDBNull("poststyle"))
            {
                commentInfo.PostStyle = PostStyle.Style.richtext;
            }
            else
            {
                commentInfo.PostStyle = (PostStyle.Style) reader.GetTinyIntAsInt("poststyle");
            }

            commentInfo.IsEditorPick = reader.GetBoolean("IsEditorPick");
            commentInfo.Index = reader.GetInt32NullAsZero("PostIndex");

            //get complainant
            var replacement = new Dictionary<string, string>();
            replacement.Add("sitename", site.SiteName);
            replacement.Add("postid", commentInfo.ID.ToString());
            commentInfo.ComplaintUri = UriDiscoverability.GetUriWithReplacments(BasePath,
                                                                                SiteList.GetSiteOptionValueString(site.SiteID, "General", "ComplaintUrl"),
                                                                                replacement);

            replacement = new Dictionary<string, string>();
            replacement.Add("commentforumid", reader.GetString("forumuid"));
            replacement.Add("sitename", site.SiteName);
            commentInfo.ForumUri = UriDiscoverability.GetUriWithReplacments(BasePath,
                                                                            UriDiscoverability.UriType.CommentForumById,
                                                                            replacement);

            replacement = new Dictionary<string, string>();
            replacement.Add("parentUri", reader.GetString("parentUri"));
            replacement.Add("postid", commentInfo.ID.ToString());
            commentInfo.Uri = UriDiscoverability.GetUriWithReplacments(BasePath, UriDiscoverability.UriType.Comment,
                                                                       replacement);

            if(reader.DoesFieldExist("nerovalue"))
            {
                commentInfo.NeroRatingValue = reader.GetInt32NullAsZero("nerovalue");
            }

            if (reader.DoesFieldExist("neropositivevalue"))
            {
                commentInfo.NeroPositiveRatingValue = reader.GetInt32NullAsZero("neropositivevalue");
            }

            if (reader.DoesFieldExist("neronegativevalue"))
            {
                commentInfo.NeroNegativeRatingValue = reader.GetInt32NullAsZero("neronegativevalue");
            }
            
            if (reader.DoesFieldExist("tweetid"))
            {
                commentInfo.TweetId = reader.GetLongNullAsZero("tweetid");
            }

            commentInfo.text = CommentInfo.FormatComment(reader.GetStringNullAsEmpty("text"), commentInfo.PostStyle, commentInfo.hidden, commentInfo.User.Editor);

            if (reader.DoesFieldExist("twitterscreenname"))
            {
                commentInfo.TwitterScreenName = reader.GetStringNullAsEmpty("twitterscreenname");
            }

            if (reader.DoesFieldExist("retweetid"))
            {
                commentInfo.RetweetId = reader.GetLongNullAsZero("retweetid");
            }

            if (reader.DoesFieldExist("retweetedby"))
            {
                commentInfo.RetweetedBy = reader.GetStringNullAsEmpty("retweetedby");
            }

            if (reader.DoesFieldExist("DmID"))
            {
                if (reader.IsDBNull("DmID") == false)
                {
                    commentInfo.DistressMessage = IncludeDistressMessage(reader, site);
                }
            }

            return commentInfo;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:97,代码来源:Comments.cs

示例3: FillUserDataDictionary

        /// <summary>
        /// Fills the userData Dictionary with User DB data
        /// </summary>
        /// <param name="sp">Stored Procedure Data Reader object</param>
        /// <returns>True if sucessful or false</returns>
        private bool FillUserDataDictionary(IDnaDataReader sp)
        {
			// Set member variables that are useful as values
            _userID = sp.GetInt32NullAsZero("userid");
            _identityUserId = sp.GetStringNullAsEmpty("identityuserid");
            _status = (UserStatus)sp.GetInt32NullAsZero("Status");
			_userName = sp.GetStringNullAsEmpty("UserName");
			_firstNames = sp.GetStringNullAsEmpty("FirstNames");
            _lastName = sp.GetStringNullAsEmpty("LastName");
            _userEmail = sp.GetStringNullAsEmpty("Email");
			_password = sp.GetStringNullAsEmpty("Password");
         
			if (_loginName.Length == 0)
			{
				_loginName = sp.GetStringNullAsEmpty("LoginName");
			}
            _preferredSkin = sp.GetStringNullAsEmpty("PrefSkin");
			_masthead = sp.GetInt32NullAsZero("Masthead");
			_journalID = sp.GetInt32NullAsZero("Journal");
			_title = sp.GetStringNullAsEmpty("Title");
			_siteSuffix = sp.GetStringNullAsEmpty("SiteSuffix");
            _acceptSubscriptions = sp.GetBoolean("AcceptSubscriptions");
            _prefStatus = sp.GetInt32NullAsZero("PrefStatus");
            _teamID = sp.GetInt32NullAsZero("TeamID");
            _lastUpdated = DateTime.Now;
            _lastUpdated = sp.GetDateTime("LastUpdatedDate");

            bool success = false;
            if (_gotUserData)
            {
                //AddUserDataObject("UserID", sp);
                //AddUserDataObject("UserName", sp);
                AddUserDataObject("Postcode", sp);
                AddUserDataObject("Region", sp);
                AddUserDataObject("PrefUserMode", sp);
                //AddUserDataObject("Status", sp);
                AddUserDataObject("Area", sp);
                AddUserDataObject("Title", sp);
                //AddUserDataObject("FirstNames", sp);
                //AddUserDataObject("LastName", sp);
                AddUserDataObject("SiteSuffix", sp);
                AddUserDataObject("TeamID", sp);
                AddUserDataObject("UnreadPublicMessageCount", sp);
                AddUserDataObject("UnreadPrivateMessageCount", sp);
                AddUserDataObject("TaxonomyNode", sp);
                AddUserDataObject("HideLocation", sp);
                AddUserDataObject("HideUserName", sp);
                //AddUserDataObject("AcceptSubscriptions", sp);

                if (ShowFullDetails)
                {
                    AddUserDataObject("PrefXML", sp);
                    //AddUserDataObject("Email", sp);

                    //AddUserDataObject("LoginName", sp);
                    AddUserDataObject("BBCUID", sp);
                    AddUserDataObject("Cookie", sp);
                    //AddUserDataObject("Password", sp);
                    AddUserDataObject("Masthead", sp);
                    AddUserDataObject("Journal", sp);
                    AddUserDataObject("PrivateForum", sp);
                    AddUserDataObject("DateJoined", sp);
                    AddUserDataObject("DateReleased", sp);
                    AddUserDataObject("Active", sp);
                    AddUserDataObject("Anonymous", sp);

                    AddUserDataObject("SinBin", sp);
                    AddUserDataObject("Latitude", sp);
                    AddUserDataObject("Longitude", sp);
                    AddUserDataObject("PrefSkin", sp);

                    AddUserDataObject("IsModClassMember", sp);
                    AddUserDataObject("PrefForumStyle", sp);
                    AddUserDataObject("AgreedTerms", sp);
                    AddUserDataObject("PrefStatus", sp); 
                    AddUserDataObject("AutoSinBin", sp);
                }

                success = true;
            }
            return success;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:87,代码来源:User.cs

示例4: LoadFieldFromDatabase

        /// <summary>
        /// Loads the field from the database
        /// </summary>
        /// <param name="dataReader">dataReader with the field info</param>
        public void LoadFieldFromDatabase(IDnaDataReader dataReader)
        {
            _UIFieldID = dataReader.GetInt32NullAsZero("UIFieldID");
            _name = dataReader.GetStringNullAsEmpty("Name");
            _label = dataReader.GetStringNullAsEmpty("Label");

            _type = (UIFieldType)Enum.Parse(typeof(UIFieldType), dataReader.GetStringNullAsEmpty("Type"));

            _description = dataReader.GetStringNullAsEmpty("Description");
            _isKeyPhrase = dataReader.GetBoolean("IsKeyPhrase");
            _keyPhraseNamespace = dataReader.GetStringNullAsEmpty("KeyPhraseNamespace");
            _required = dataReader.GetBoolean("Required");
            _defaultValue = dataReader.GetStringNullAsEmpty("DefaultValue");
            _escape = dataReader.GetBoolean("Escape");
            _rawInput = dataReader.GetBoolean("RawInput");
            _includeInGuideEntry = dataReader.GetBoolean("IncludeInGuideEntry");
            _validateEmpty = dataReader.GetBoolean("ValidateEmpty");
            _validateNotEqualTo = dataReader.GetBoolean("ValidateNotEqualTo");
            _validateParsesOK = dataReader.GetBoolean("ValidateParsesOK");
            _notEqualToValue = dataReader.GetStringNullAsEmpty("NotEqualToValue");
            _validateCustom = dataReader.GetBoolean("ValidateCustom");
            _step = dataReader.GetInt32NullAsZero("Step");

            _permissions = (UIFieldPermissions)Enum.Parse(typeof(UIFieldPermissions), dataReader.GetStringNullAsEmpty("Permissions"));
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:29,代码来源:UIField.cs

示例5: CreateUserFromReader


//.........这里部分代码省略.........
                
                user.TaxonomyNode= reader.GetInt32NullAsZero(prefix + "TaxonomyNode");
            }
            if (reader.Exists(prefix + "UserName"))
            {
                user.UserName = reader.GetStringNullAsEmpty(prefix + "UserName") ?? "";
            }
            else if (reader.Exists(prefix + "Name"))
            {
                user.UserName = reader.GetStringNullAsEmpty(prefix + "Name") ?? "";
            }

            if (user.UserName == String.Empty)
            {
                user.UserName = "Member " + user.UserId.ToString();
            }
            /* NO NO not emails
             * if (reader.Exists(prefix + "Email"))
            {
                user.Email = reader.GetStringNullAsEmpty(prefix + "Email") ?? "";
            }
             */
            
            if (reader.Exists(prefix + "SiteSuffix"))
            {
                user.SiteSuffix = reader.GetStringNullAsEmpty(prefix + "SiteSuffix") ?? "";
            }
            if (reader.Exists(prefix + "Area"))
            {
                user.Area = reader.GetStringNullAsEmpty(prefix + "Area") ?? "";
            }
            if (reader.Exists(prefix + "Title"))
            {
                user.Title = reader.GetStringNullAsEmpty(prefix + "Title") ?? "";
            }
            if (reader.Exists(prefix + "SubQuota"))
            {
                user.SubQuota = reader.GetInt32NullAsZero(prefix + "SubQuota");
            }
            if (reader.Exists(prefix + "Allocations"))
            {
                user.Allocations = reader.GetInt32NullAsZero(prefix + "Allocations");
            }
            if (reader.Exists(prefix + "Journal"))
            {
                user.Journal = reader.GetInt32NullAsZero(prefix + "Journal");
            }
            if (reader.Exists(prefix + "Active") && !reader.IsDBNull(prefix + "Active"))
            {
                user.Active = reader.GetBoolean(prefix + "Active");
            }
            if (reader.Exists(prefix + "DateLastNotified") && reader.GetValue(prefix + "DateLastNotified") != DBNull.Value)
            {
                user.DateLastNotified = new DateElement(reader.GetDateTime(prefix + "DateLastNotified"));
            }
            if (reader.Exists(prefix + "DateJoined") && reader.GetValue(prefix + "DateJoined") != DBNull.Value)
            {
                user.DateJoined = new DateElement(reader.GetDateTime(prefix + "DateJoined"));
            }
            if (reader.Exists(prefix + "ForumPostedTo"))
            {
                user.ForumPostedTo = reader.GetInt32NullAsZero(prefix + "ForumPostedTo");
            }
            if (reader.Exists(prefix + "Masthead"))
            {
                user.MastHead = reader.GetInt32NullAsZero(prefix + "Masthead");
            }
            if (reader.Exists(prefix + "SinBin"))
            {
                user.SinBin = reader.GetInt32NullAsZero(prefix + "SinBin");
            }
            if (reader.Exists(prefix + "ForumID"))
            {
                user.ForumId = reader.GetInt32NullAsZero(prefix + "ForumID");
            }
            var siteId = 0;
            if (reader.Exists("SiteID"))
            {
                siteId = reader.GetInt32NullAsZero("SiteID");
            }
            
            
            if (siteId != 0 && user.UserId != 0)
            {
                var userGroups = (UserGroups)SignalHelper.GetObject(typeof(UserGroups));
                var groupList = userGroups.GetUsersGroupsForSite(user.UserId, siteId);
                foreach (var group in groupList)
                {
                    user.Groups.Add(new Group(){Name = group.Name.ToUpper()});
                }
            }
            else
            {

            }
             

            return (User)user;
        
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:101,代码来源:User.cs

示例6: GenerateAltIdentitiesXml

        private void GenerateAltIdentitiesXml(IDnaDataReader dataReader, XmlNode parentXml)
        {
            int postPassedCount = 0;
            int postFailedCount = 0;
            int postTotalCount = 0;
            int articlePassedCount = 0;
            int articleFailedCount = 0;
            int articleTotalCount = 0;

             // Add Result Data .
            while (dataReader.Read())
            {
                XmlNode memberXml = AddElementTag(parentXml,"MEMBERDETAILS");

                //AddUser XML
                XmlNode userXml = AddElementTag(memberXml, "USER");
                AddIntElement(userXml,"USERID", dataReader.GetInt32NullAsZero("userid"));
                AddTextTag(userXml, "USERNAME", dataReader.GetStringNullAsEmpty("username"));
                AddTextTag(userXml, "LOGINNAME", dataReader.GetStringNullAsEmpty("loginname"));
                AddTextTag(userXml, "EMAIL", dataReader.GetStringNullAsEmpty("email"));
                XmlNode statusXml = AddElementTag(userXml, "STATUS");
                AddAttribute(statusXml, "STATUSID", dataReader.GetInt32NullAsZero("prefstatus"));
                AddIntElement(userXml, "ACTIVE", Convert.ToInt32(dataReader.GetBoolean("active")));

                //Add Site XML.
                int siteId = dataReader.GetInt32NullAsZero("siteid");
                ISite site = InputContext.TheSiteList.GetSite(siteId);
                SiteXmlBuilder siteXmlBuilder = new SiteXmlBuilder(InputContext);
                XmlNode siteXML = siteXmlBuilder.GenerateXml(null, site);
                siteXML = ImportNode(siteXML);
                memberXml.AppendChild(siteXML);

                if (!dataReader.IsDBNull("datejoined"))
                {
                    AddDateXml(dataReader.GetDateTime("datejoined"), memberXml, "DATEJOINED");
                }
                
                //Add Stats XML
                AddIntElement(memberXml, "POSTPASSEDCOUNT", dataReader.GetInt32NullAsZero("postpassedcount"));
                AddIntElement(memberXml, "POSTFAILEDCOUNT", dataReader.GetInt32NullAsZero("postfailedcount"));
                AddIntElement(memberXml, "POSTTOTALCOUNT", dataReader.GetInt32NullAsZero("totalpostcount"));
                AddIntElement(memberXml, "ARTICLEPASSEDCOUNT", dataReader.GetInt32NullAsZero("articlepassedcount"));
                AddIntElement(memberXml, "ARTICLEFAILEDCOUNT", dataReader.GetInt32NullAsZero("articlefailedcount"));
                AddIntElement(memberXml, "ARTICLETOTALCOUNT", dataReader.GetInt32NullAsZero("totalarticlecount"));

                postPassedCount += dataReader.GetInt32NullAsZero("postpassedcount");
                postFailedCount += dataReader.GetInt32NullAsZero("postfailedcount");
                postTotalCount += dataReader.GetInt32NullAsZero("totalpostcount");
                articlePassedCount += dataReader.GetInt32NullAsZero("articlepassedcount");
                articleFailedCount += dataReader.GetInt32NullAsZero("articlefailedcount");
                articleTotalCount += dataReader.GetInt32NullAsZero("totalarticlecount");
            }

            //Add Member Details Summary XML
            XmlNode summaryXml = AddElementTag(parentXml, "SUMMARY");
            AddIntElement(summaryXml, "POSTPASSEDCOUNT", postPassedCount);
            AddIntElement(summaryXml, "POSTFAILEDCOUNT", postFailedCount);
            AddIntElement(summaryXml, "POSTTOTALCOUNT", postTotalCount);
            AddIntElement(summaryXml, "ARTICLEPASSEDCOUNT", articlePassedCount);
            AddIntElement(summaryXml,"ARTICLEFAILEDCOUNT",articleFailedCount);
            AddIntElement(summaryXml, "ARTICLETOTALCOUNT", articleTotalCount);
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:62,代码来源:ModerationMemberDetails.cs

示例7: CreateList

        /// <summary>
        /// Helper method to create the list after a specific stored procedure
		///		has been called to return an appropriate results set.
        /// </summary>
        /// <param name="articleList"></param>
        /// <param name="dataReader"></param>
        /// <param name="skip">Number of Articles to skip</param>
        /// <param name="show">Number of Articles to show</param>
        /// <returns></returns>
        public int CreateList(XmlElement articleList, IDnaDataReader dataReader, int skip, int show)
        {
            int count = show;
            bool records = true;

            //Read/skip over the skip number of rows so that the row that the first row that in the do below is 
            //the one required
            for (int i = 0; i < skip; i++)
            {
                records = dataReader.Read();
                if (!records)
                {
                    break;
                }
            }

            if (records)
            {
                do
                {
                    // Setup the article
                    XmlElement article = AddElementTag(articleList, "ARTICLE");

                    if (dataReader.DoesFieldExist("EntryID"))
                    {
                        AddIntElement(article, "ENTRY-ID", dataReader.GetInt32NullAsZero("EntryID"));
                    }
                    if (dataReader.DoesFieldExist("h2g2ID"))
                    {
                        AddAttribute(article, "H2G2ID", dataReader.GetInt32NullAsZero("h2g2ID"));
                        //TODO: remove the H2G2-ID from all schemas and skins...
                        AddIntElement(article, "H2G2-ID", dataReader.GetInt32NullAsZero("h2g2ID"));
                    }
                    if (dataReader.DoesFieldExist("SiteID"))
                    {
                        AddIntElement(article, "SITEID", dataReader.GetInt32NullAsZero("SiteID"));
                    }
                    if (dataReader.DoesFieldExist("RecommendationID"))
                    {
                        AddIntElement(article, "RECOMMENDATION-ID", dataReader.GetInt32NullAsZero("RecommendationID"));
                    }
                    if (dataReader.DoesFieldExist("NotificationSent"))
                    {
                        AddIntElement(article, "NOTIFIED", dataReader.GetBoolean("NotificationSent") ? 1 : 0);
                    }

                    User user = new User(InputContext);
                    if (dataReader.DoesFieldExist("Editor"))
                    {
                        // place all user details within a USER tag and structure them appropriately
                        // editor info
                        int editorID = dataReader.GetInt32NullAsZero("Editor");
                        XmlElement editorTag = AddElementTag(article, "EDITOR");
                        user.AddPrefixedUserXMLBlock(dataReader, editorID, "Editor", editorTag);
                    }

                    if (dataReader.DoesFieldExist("AuthorID"))
                    {
                        // author info
                        int authorID = dataReader.GetInt32NullAsZero("AuthorID");
                        XmlElement authorTag = AddElementTag(article, "AUTHOR");
                        user.AddPrefixedUserXMLBlock(dataReader, authorID, "Author", authorTag);
                    }

                    if (dataReader.DoesFieldExist("AcceptorID"))
                    {
                        // acceptor info (user that accepted a recommendation)
                        int acceptorID = dataReader.GetInt32NullAsZero("AcceptorID");
                        XmlElement acceptorTag = AddElementTag(article, "ACCEPTOR");
                        user.AddPrefixedUserXMLBlock(dataReader, acceptorID, "Acceptor", acceptorTag);
                    }

                    if (dataReader.DoesFieldExist("AllocatorID"))
                    {
                        // allocator info (user that allocated a recommendation to a sub)
                        int allocatorID = dataReader.GetInt32NullAsZero("AllocatorID");
                        XmlElement allocatorTag = AddElementTag(article, "ALLOCATOR");
                        user.AddPrefixedUserXMLBlock(dataReader, allocatorID, "Allocator", allocatorTag);
                    }

                    if (dataReader.DoesFieldExist("ScoutID"))
                    {
                        // scout info
                        int scoutID = dataReader.GetInt32NullAsZero("ScoutID");
                        XmlElement scoutTag = AddElementTag(article, "SCOUT");
                        user.AddPrefixedUserXMLBlock(dataReader, scoutID, "Scout", scoutTag);
                    }

                    if (dataReader.DoesFieldExist("SubEditorID"))
                    {
                        // sub editor info
//.........这里部分代码省略.........
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:101,代码来源:ArticleList.cs

示例8: CreateThreadSummaryFromReader

        /// <summary>
        /// 
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="forumId"></param>
        /// <param name="index"></param>
        /// <param name="applySkin">whether we need to apply the transform to the post</param>
        /// <returns></returns>
        public static ThreadSummary CreateThreadSummaryFromReader(IDnaDataReader reader, int forumId, int index, bool applySkin)
        {
            var thread = new ThreadSummary();
            thread.ForumId = forumId;
            thread.Index = index;
            thread.Type = string.Empty; //TODO: remove as this is a legacy ripley element


            if (reader.DoesFieldExist("ThisCanRead"))
            {
                thread.CanRead = (byte)(reader.GetBoolean("ThisCanRead") ? 1 : 0);
            }

            if (reader.DoesFieldExist("ThisCanWrite"))
            {
                thread.CanWrite = (byte)(reader.GetBoolean("ThisCanWrite") ? 1 : 0);

            }

           
            thread.ThreadId = reader.GetInt32NullAsZero("ThreadID");            
            thread.DateLastPosted = new DateElement(reader.GetDateTime("LastPosted"));
            if (reader.DoesFieldExist("cnt"))
            {
                thread.TotalPosts = reader.GetInt32NullAsZero("cnt");
            }
            
            if (reader.DoesFieldExist("firstpostentryid"))
            {
                thread.FirstPost = ThreadPostSummary.CreateThreadPostFromReader(reader, "FirstPost", reader.GetInt32NullAsZero("firstpostentryid"), applySkin);
            }

            if (reader.DoesFieldExist("lastpostentryid"))
            {
                thread.LastPost = ThreadPostSummary.CreateThreadPostFromReader(reader, "LastPost", reader.GetInt32NullAsZero("lastpostentryid"), applySkin);
            }

            if (reader.DoesFieldExist("FirstSubject"))
            {
                if (thread.FirstPost != null)
                {
                    thread.Subject = ThreadPost.FormatSubject(reader.GetString("FirstSubject"), (CommentStatus.Hidden)thread.FirstPost.Hidden);
                }
                else
                {
                    thread.Subject = ThreadPost.FormatSubject(reader.GetString("FirstSubject"), CommentStatus.Hidden.NotHidden );
                }
            }


            if(reader.DoesFieldExist("IsSticky"))
            {//conditionally check if field exists..
                thread.IsSticky = (reader.GetInt32NullAsZero("IsSticky")==1);
            }
            return thread;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:64,代码来源:ThreadSummary.cs

示例9: RatingCreateFromReader

        /// <summary>
        /// Creates a ratinginfo object
        /// </summary>
        /// <param name="reader">A reader with all information</param>
        /// <returns>Rating Info object</returns>
        public RatingInfo RatingCreateFromReader(IDnaDataReader reader, ISite site)
        {
            RatingInfo ratingInfo = new RatingInfo
            {
                Created = new DateTimeHelper(DateTime.Parse(reader.GetDateTime("Created").ToString())),
                User = base.UserReadById(reader, site),
                ID = reader.GetInt32NullAsZero("id"),
                rating = reader.GetByte("rating")
            };

            ratingInfo.hidden = (CommentStatus.Hidden)reader.GetInt32NullAsZero("hidden");
            if (reader.IsDBNull("poststyle"))
            {
                ratingInfo.PostStyle = PostStyle.Style.richtext;
            }
            else
            {
                ratingInfo.PostStyle = (PostStyle.Style)reader.GetTinyIntAsInt("poststyle");
            }

            ratingInfo.IsEditorPick = reader.GetBoolean("IsEditorPick");
            ratingInfo.Index = reader.GetInt32NullAsZero("PostIndex");

            //get complainant
            Dictionary<string, string> replacement = new Dictionary<string, string>();
            replacement.Add("sitename", site.SiteName);
            replacement.Add("postid", ratingInfo.ID.ToString());
            ratingInfo.ComplaintUri = UriDiscoverability.GetUriWithReplacments(BasePath, SiteList.GetSiteOptionValueString(site.SiteID, "General", "ComplaintUrl"), replacement);
            
            replacement = new Dictionary<string, string>();
            replacement.Add("RatingForumid", reader.GetString("forumuid"));
            replacement.Add("sitename", site.SiteName);
            ratingInfo.ForumUri = UriDiscoverability.GetUriWithReplacments(BasePath, UriDiscoverability.UriType.RatingsByRatingForumId, replacement);
            
            replacement = new Dictionary<string, string>();
            replacement.Add("parentUri", reader.GetString("parentUri"));
            replacement.Add("postid", ratingInfo.ID.ToString());
            ratingInfo.Uri = UriDiscoverability.GetUriWithReplacments(BasePath, UriDiscoverability.UriType.Comment, replacement);
            
            //Get Editors Pick ( this should be expanded to include any kind of poll )
            /*EditorsPick editorsPick = new EditorsPick(_dnaDiagnostics, _connection, _caching);
            if (editorsPick.LoadPollResultsForItem(commentInfo.ID) && editorsPick.Id > 0)
            {
                commentInfo.EditorsPick = new EditorsPickInfo
                {
                    Id = editorsPick.Id,
                    Response = editorsPick.Result
                };
            }*/
            ratingInfo.text = CommentInfo.FormatComment(reader.GetString("text"), ratingInfo.PostStyle, ratingInfo.hidden, ratingInfo.User.Editor);
            return ratingInfo;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:57,代码来源:Reviews.cs

示例10: ReadUserDetails

        /// <summary>
        /// Method for reading user data from user procedure calls
        /// </summary>
        /// <param name="reader">The StoredProcedure reader that contains the data</param>
        private void ReadUserDetails(IDnaDataReader reader)
        {
            UserID = reader.GetInt32("userid");
            UserName = reader.GetString("username");

            IdentityUserID = reader.GetStringNullAsEmpty("IdentityUserID");
            IdentityUserName = reader.GetStringNullAsEmpty("IdentityUserName");

            _status = reader.GetInt32("status");
            _prefStatus = reader.GetInt32("PrefStatus");
            
            if (_status == 1)//normal global status
            {
                if (reader.GetInt32("PrefStatus") == 4)//banned
                {
                    _status = 0;
                }
            }
            //NO NO emails
            Email = reader.GetString("email");
            SiteSuffix = reader.GetStringNullAsEmpty("SiteSuffix");
            LastSynchronisedDate = reader.GetDateTime("LastUpdatedDate");
            if (reader.Exists("AcceptSubscriptions"))
            {
                AcceptSubscriptions = reader.GetBoolean("AcceptSubscriptions");
            }

            if (reader.Exists("SinBin"))
            {
                IsAutoSinBin = reader.GetInt32NullAsZero("SinBin");
            }

            //PrimarySiteId = reader.GetInt32NullAsZero("PrimarySiteId");
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:38,代码来源:User.cs


注:本文中的IDnaDataReader.GetBoolean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。