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


C# IDnaDataReader.GetGuidAsStringOrEmpty方法代码示例

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


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

示例1: GenerateMemberListXml

        /// <summary>
        /// 
        /// </summary>
        /// <param name="dataReader"></param>
        /// <param name="userSearchType"></param>
        /// <param name="searchText"></param>
        /// <param name="checkAllSites"></param>
        /// <param name="twitterAPIException"></param>
        public void GenerateMemberListXml(
            IDnaDataReader dataReader,
            int userSearchType,
            string searchText,
            bool checkAllSites,
            string twitterAPIException)
        {
            int count = 0;

            XmlNode memberList = AddElementTag(RootElement, "MEMBERLIST");
            AddAttribute(memberList, "USERSEARCHTYPE", userSearchType.ToString());
            AddAttribute(memberList, "SEARCHTEXT", searchText);
            AddAttribute(memberList, "CHECKALLSITES", checkAllSites.ToString());
            

            if (dataReader.HasRows)
            {
                if (dataReader.Read())
                {
                    XmlNode userAccounts = AddElementTag(memberList, "USERACCOUNTS");

                    //int previousUserID = 0;
                    XmlNode userAccount = null;
                    do
                    {
                        int userID = dataReader.GetInt32NullAsZero("USERID");
                        /*if (userID != previousUserID)
                        {
                            if (userAccount != null)
                            {
                                userAccounts.AppendChild(userAccount);
                            }
                            userAccount = CreateElementNode("USERACCOUNT");
                            previousUserID = userID;
                        }*/
                        userAccount = CreateElementNode("USERACCOUNT");

                        //Start filling new user xml
                        AddAttribute(userAccount, "USERID", userID);
                        AddTextTag(userAccount, "SITEID", dataReader.GetInt32NullAsZero("SITEID"));

                        AddTextTag(userAccount, "USERNAME", dataReader.GetStringNullAsEmpty("USERNAME"));
                        AddTextTag(userAccount, "LOGINNAME", dataReader.GetStringNullAsEmpty("LOGINNAME"));
                        AddTextTag(userAccount, "EMAIL", dataReader.GetStringNullAsEmpty("EMAIL"));
                        AddTextTag(userAccount, "PREFSTATUS", dataReader.GetInt32NullAsZero("PREFSTATUS"));
                        AddTextTag(userAccount, "PREFSTATUSDURATION", dataReader.GetInt32NullAsZero("PREFSTATUSDURATION"));
                        AddTextTag(userAccount, "USERSTATUSDESCRIPTION", ((ModerationStatus.UserStatus)dataReader.GetInt32NullAsZero("PREFSTATUS")).ToString());
                        if (!dataReader.IsDBNull("DATEJOINED"))
                        {
                            AddDateXml(dataReader.GetDateTime("DATEJOINED"), userAccount, "DATEJOINED");
                        }
                        if (!dataReader.IsDBNull("PREFSTATUSCHANGEDDATE"))
                        {
                            DateTime prefStatusChangedDate = dataReader.GetDateTime("PREFSTATUSCHANGEDDATE");
                            AddDateXml(prefStatusChangedDate, userAccount, "PREFSTATUSCHANGEDDATE");
                        }
                        else
                        {
                            AddTextTag(userAccount, "PREFSTATUSCHANGEDDATE", "");
                        }

                        AddTextTag(userAccount, "SHORTNAME", dataReader.GetStringNullAsEmpty("SHORTNAME"));
                        AddTextTag(userAccount, "URLNAME", dataReader.GetStringNullAsEmpty("URLNAME"));

                        if (dataReader.DoesFieldExist("IPADDRESS") && dataReader.GetStringNullAsEmpty("IPADDRESS") != String.Empty)
                        {
                            AddTextTag(userAccount, "IPADDRESS", dataReader.GetStringNullAsEmpty("IPADDRESS"));
                        }
                        if (dataReader.DoesFieldExist("BBCUID") && dataReader.GetGuidAsStringOrEmpty("BBCUID") != String.Empty)
                        {
                            AddTextTag(userAccount, "BBCUID", dataReader.GetGuidAsStringOrEmpty("BBCUID"));
                        }

                        if (userSearchType == 6)
                        {
                            AddTextTag(userAccount, "TWITTERUSERID", dataReader.GetStringNullAsEmpty("TwitterUserID"));
                        }
                        else
                        {
                            AddIntElement(userAccount, "SSOUSERID", dataReader.GetInt32NullAsZero("SSOUserID"));
                        }
                        AddTextTag(userAccount, "IDENTITYUSERID", dataReader.GetStringNullAsEmpty("IdentityUserID"));
                        AddIntElement(userAccount, "ACTIVE", dataReader.GetInt32NullAsZero("STATUS") != 0 ? 1:0);
                        userAccounts.AppendChild(userAccount);

                        count++;
                        
                    } while (dataReader.Read());

                    memberList.AppendChild(userAccounts);
                }
            }
//.........这里部分代码省略.........
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:101,代码来源:MemberList.cs

示例2: CheckRiskModThreadEntryQueue

        void CheckRiskModThreadEntryQueue(IDnaDataReader reader, int? ThreadEntryId, char PublishMethod, bool? IsRisky, TestDate DateAssessed, int SiteId, int ForumId, int? ThreadId, int UserId, string UserName, int? InReplyTo, string Subject, string Text, byte PostStyle, string IPAddress, string BBCUID, DateTime EventDate, byte AllowEventEntries, int NodeId, int? QueueId, int ClubId, byte IsNotable, byte IsComment, string ModNotes, byte IsThreadedComment)
        {
            reader.ExecuteWithinATransaction(@"SELECT rm.*
                                        FROM RiskModThreadEntryQueue rm
                                        WHERE RiskModThreadEntryQueueId=" + GetLatestRiskModThreadEntryQueueId(reader));
            reader.Read();

            // Nasty tweak.  The RiskModThreadEntryQueue table always stores undefined ThreadId and ThreadEntryId values
            // as NULL.  We treat zero values as NULL for comparision purposes 
            ThreadId = NullIf(ThreadId, 0);
            ThreadEntryId = NullIf(ThreadEntryId, 0);
            
            TestNullableIntField(reader, "ThreadEntryId", ThreadEntryId);

            TestPublishMethod(reader, PublishMethod);

            TestNullableBoolField(reader, "IsRisky", IsRisky);

            TestNullableDateField(reader, "DateAssessed", DateAssessed);

            Assert.AreEqual(SiteId,reader.GetInt32("SiteId"));
            Assert.AreEqual(ForumId,reader.GetInt32("ForumId"));

            TestNullableIntField(reader, "ThreadId", ThreadId);

            Assert.AreEqual(UserId,reader.GetInt32("UserId"));

            Assert.AreEqual(UserName, reader.GetString("UserName"));

            TestNullableIntField(reader, "InReplyTo", InReplyTo);

            Assert.AreEqual(Subject,reader.GetString("Subject"));
            Assert.AreEqual(Text,reader.GetString("Text"));
            Assert.AreEqual(PostStyle, reader.GetByte("PostStyle"));
            Assert.AreEqual(IPAddress,reader.GetString("IPAddress"));
            Assert.AreEqual(BBCUID,reader.GetGuidAsStringOrEmpty("BBCUID"));

            //Assert.AreEqual(EventDate,reader.GetInt32("EventDate"));
            Assert.AreEqual(AllowEventEntries,reader.GetByte("AllowEventEntries"));
            //Assert.AreEqual(NodeId,reader.GetInt32("NodeId"));
            TestNullableIntField(reader, "QueueId", QueueId);
            Assert.AreEqual(ClubId,reader.GetInt32("ClubId"));
            Assert.AreEqual(IsNotable, reader.GetByte("IsNotable"));
            Assert.AreEqual(IsComment, reader.GetByte("IsComment"));
            TestNullableStringField(reader, "ModNotes", ModNotes);
            Assert.AreEqual(IsThreadedComment, reader.GetByte("IsThreadedComment"));

            reader.Close();
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:49,代码来源:RiskModTests.cs

示例3: GenerateXml

        private void GenerateXml(IDnaDataReader reader, int h2g2Id, int postId, string exLinkUrl)
        {
            XmlElement modHistory = AddElementTag(RootElement, "MODERATION-HISTORY");
            reader.Read();

            if (h2g2Id > 0)
                AddAttribute(modHistory, "H2G2ID", h2g2Id);
            else if (postId > 0)
            {
                AddAttribute(modHistory, "POSTID", postId);
                if ( reader.HasRows )
                {
                    AddAttribute(modHistory, "FORUMID", reader.GetInt32NullAsZero("forumid") );
                    AddAttribute(modHistory, "THREADID", reader.GetInt32NullAsZero("threadid") );
                }
            }
            else if (exLinkUrl != String.Empty)
                AddAttribute(modHistory, "EXLINKURL", exLinkUrl );

            if (reader.HasRows)
            {
                int rowCount = 0;
                do
                {
                    if (rowCount == 0)
                    {
                        AddXmlTextTag(modHistory, "SUBJECT", reader.GetStringNullAsEmpty("subject"));

                        if (reader.DoesFieldExist("authoruserid") && !reader.IsDBNull("authoruserid"))
                        {
                            XmlElement editorNode = AddElementTag(modHistory, "EDITOR");
                            User editor = new User(InputContext);
                            editor.AddPrefixedUserXMLBlock(reader, reader.GetInt32NullAsZero("authoruserid"), "Author", editorNode);
                        }
                    }

                    XmlElement moderation = AddElementTag(modHistory, "MODERATION");
                    AddAttribute(moderation, "MODID", reader.GetInt32NullAsZero("modid"));
                    AddIntElement(moderation, "STATUS", reader.GetInt32NullAsZero("status"));
                    AddTextElement(moderation, "URLNAME", InputContext.TheSiteList.GetSite(reader.GetInt32NullAsZero("siteid")).SiteName);
                    if (reader.DoesFieldExist("reasonid") && reader.GetInt32NullAsZero("reasonid") > 0)
                    {
                        AddIntElement(moderation, "REASONID", reader.GetInt32NullAsZero("reasonid"));
                    }

                    User user = new User(InputContext);

                    if ( !reader.IsDBNull("lockedbyuserid") )
                    {
                        XmlElement locked = AddElementTag(moderation, "LOCKED-BY");
                        user.AddPrefixedUserXMLBlock(reader, reader.GetInt32NullAsZero("LockedBy"), "lockedby", locked);
                    }

                    if (!reader.IsDBNull("referredbyuserid"))
                    {
                        XmlElement referred = AddElementTag(moderation, "REFERRED-BY");
                        user.AddPrefixedUserXMLBlock(reader, reader.GetInt32NullAsZero("referredbyuserid"), "referredby", referred);
                    }

                    XmlElement complaint = AddElementTag(moderation, "COMPLAINT");
                    AddTextElement(complaint, "COMPLAINT-TEXT", reader.GetStringNullAsEmpty("complainttext"));

                    if (reader.DoesFieldExist("complainantuserid") && !reader.IsDBNull("complainantuserid"))
                    {
                        user.AddPrefixedUserXMLBlock(reader, reader.GetInt32NullAsZero("complainantuserid"), "complainant", complaint);
                    }

                    AddTextElement(complaint, "IPADDRESS", reader.GetStringNullAsEmpty("ipaddress"));
                    AddTextElement(complaint, "BBCUID", reader.GetGuidAsStringOrEmpty("bbcuid").ToString());
                    AddTextElement(complaint, "EMAIL-ADDRESS", reader.GetStringNullAsEmpty("correspondenceemail"));
                    AddTextElement(moderation, "NOTES", HtmlUtils.ReplaceCRsWithBRs(reader.GetStringNullAsEmpty("notes")));

                    AddDateXml(reader.GetDateTime("datequeued"), moderation, "DATE-QUEUED");
                    if (!reader.IsDBNull("datelocked"))
                    {
                        AddDateXml(reader.GetDateTime("datelocked"), moderation, "DATE-LOCKED");
                    }

                    if (!reader.IsDBNull("datereferred"))
                    {
                        AddDateXml(reader.GetDateTime("datereferred"), moderation, "DATE-REFERRED");
                    }

                    if (!reader.IsDBNull("datecompleted"))
                    {
                        AddDateXml(reader.GetDateTime("datecompleted"), moderation, "DATE-COMPLETED");
                    }

                    ++rowCount;
                }
                while (reader.Read());
            }
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:93,代码来源:ModerationHistory.cs


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