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


C# User.CreateUser方法代码示例

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


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

示例1: TryCreateMorePagesXML

        /// <summary>
        /// Implements generating the XML for the More Pages page
        /// </summary>
        /// <param name="skip">Number of articles to skip</param>
        /// <param name="show">Number of articles to show</param>
        /// <param name="userID">User ID of the page to return</param>
        /// <param name="type">type is either 1 (approved) 2 (normal) 3 (cancelled) or 4 (normal and approved)</param>
        /// <param name="guideType">See if we've been given a specified article type to search for</param>
        private void TryCreateMorePagesXML(int skip, int show, int userID, int type, int guideType)
        {
            //Clean any existing XML.
            RootElement.RemoveAll();

            if ((type == (int) ArticleList.ArticleListType.ARTICLELISTTYPE_CANCELLED) && ((InputContext.ViewingUser.UserLoggedIn == false) || (InputContext.ViewingUser.UserID != userID)))
	        {
		        throw new DnaException("MorePages - TryCreateMorePagesXML - You cannot view the cancelled entries of another user");
	        }

            _pageOwnerElement = AddElementTag(RootElement, "PAGE-OWNER");
            User pageOwner = new User(InputContext);
            pageOwner.CreateUser(userID);
            AddInside(_pageOwnerElement, pageOwner);

            XmlElement articles = AddElementTag(RootElement, "ARTICLES");
            AddAttribute(articles, "USERID", userID);
            AddAttribute(articles, "WHICHSET", type);

            ArticleList articleList = new ArticleList(InputContext);

            if (type == (int) ArticleList.ArticleListType.ARTICLELISTTYPE_APPROVED)
		    {
			    articleList.CreateRecentApprovedArticlesList(userID, 0, skip, show, guideType);
		    }
            else if (type == (int) ArticleList.ArticleListType.ARTICLELISTTYPE_NORMAL)
		    {
                articleList.CreateRecentArticleList(userID, 0, skip, show, guideType);
		    }
		    else if (type == (int) ArticleList.ArticleListType.ARTICLELISTTYPE_NORMALANDAPPROVED)
		    {
                articleList.CreateRecentNormalAndApprovedArticlesList(userID, 0, skip, show, guideType);
		    }
		    else
		    {
                articleList.CreateCancelledArticlesList(userID, 0, skip, show, guideType);
		    }
            AddInside(articles, articleList);

            AddInside(articles, pageOwner);

        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:50,代码来源:MorePages.cs

示例2: CreatePageOwner

 private bool CreatePageOwner(int userID, ref User owner)
 {
     owner.CreateUser(userID);
     return owner.UserID > 0;
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:5,代码来源:UserPage.cs

示例3: TryGetPageParams

        /// <summary>
        /// Gets the params for the page
        /// </summary>
        /// <param name="H2G2ID">H2G2 ID of the article to diagnose</param>
        private void TryGetPageParams(ref int H2G2ID)
        {
            H2G2ID = InputContext.GetParamIntOrZero("h2g2ID", _docDnaH2G2ID);
	        if (H2G2ID == 0)
	        {
                int userID = InputContext.GetParamIntOrZero("userid", _docDnaUserID);
		        User user = new User(InputContext);
		        user.CreateUser(userID);
                H2G2ID = user.Masthead;
	        }
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:15,代码来源:ArticleDiagnostic.cs

示例4: GenerateModerateHomePageXml

        /// <summary>
        /// Calls the correct stored procedure given the inputs selected
        /// </summary>
        /// <param name="modHomeParams">Parameters</param>
        private void GenerateModerateHomePageXml(ModHomeParameters modHomeParams)
        {
            //if not an editor then return an error
            if (InputContext.ViewingUser == null || !(InputContext.ViewingUser.IsEditor || InputContext.ViewingUser.IsModerator || InputContext.ViewingUser.IsHost))
            {
                AddErrorXml("NOT-EDITOR", "You cannot perform moderation unless you are logged in as an Editor or a Moderator.", RootElement);
                return;
            }
            if (modHomeParams.OwnerID != 0 && InputContext.ViewingUser.UserID != modHomeParams.OwnerID && InputContext.ViewingUser.IsEditor)
            {
		        // only editors can view other peoples moderation home page
                AddErrorXml("NOT-EDITOR", "You cannot view someone elses Moderation Home Page unless you are logged in as an Editor.", RootElement);
                return;
            }

            // if no user ID specified then we wish to see the viewers own page
            if (modHomeParams.OwnerID == 0)
            {
                modHomeParams.OwnerID = InputContext.ViewingUser.UserID;
            }
            // try to create the page owner object from this user ID
            // TODO: give a useful error message if this fails

            _pageOwnerElement = AddElementTag(RootElement, "PAGE-OWNER");
            User pageOwner = new User(InputContext);
            pageOwner.CreateUser(modHomeParams.OwnerID);
            AddInside(_pageOwnerElement, pageOwner);

            ProcessSubmission(modHomeParams);
            bool isRefereeForAnySite = false;
            isRefereeForAnySite = CheckRefereeForAnySite();

            var moderatorInfo = ModeratorInfo.GetModeratorInfo(AppContext.ReaderCreator, modHomeParams.OwnerID, InputContext.TheSiteList);

            bool referrals = InputContext.ViewingUser.IsSuperUser;
            if (!referrals)
            {
                referrals = isRefereeForAnySite;
            }
            ModStats modStats = ModStats.FetchModStatsByModClass(AppContext.ReaderCreator, modHomeParams.OwnerID, moderatorInfo, referrals, modHomeParams.FastMod != 0);
            SerialiseAndAppend(modStats, "");
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:46,代码来源:ModerateHome.cs

示例5: NotifyAuthorOnPersonalSpace

        /// <summary>
        /// Posts a message to the editor of an article that it has been submitted to a review forum
        /// </summary>
        /// <param name="submitterID"></param>
        /// <param name="editorID"></param>
        /// <param name="userName"></param>
        /// <param name="H2G2ID"></param>
        /// <param name="siteID"></param>
        /// <param name="reviewForumID"></param>
        /// <param name="forumID"></param>
        /// <param name="threadID"></param>
        /// <param name="postID"></param>
        /// <param name="subject"></param>
        /// <param name="comments"></param>
        public void NotifyAuthorOnPersonalSpace(int submitterID, int editorID, string userName, int H2G2ID,
                                            int siteID, int reviewForumID, int forumID, int threadID, int postID, 
                                            string subject, string comments)
        {	        
            XmlElement submitReviewForum = AddElementTag(RootElement, "SUBMIT-REVIEW-FORUM");
	        int userForumID = 0;

            using (IDnaDataReader dataReader = InputContext.CreateDnaDataReader("fetchpersonalspaceforum"))
            {
                dataReader.AddParameter("userid", editorID);
                dataReader.AddParameter("siteid", siteID);

                dataReader.Execute();
                // Check to see if we found anything
                if (dataReader.HasRows && dataReader.Read())
                {
                    userForumID = dataReader.GetInt32NullAsZero("ForumID");
                }
            }
            if (userForumID == 0)
            {
                throw new DnaException("No Personal Space Forum - Failed to send message to Personal Space");
            }

            if (submitterID == 0)
            {
                AddErrorXml("NO-USER","Failed to get User details", submitReviewForum);
            }
            
            User submitter = new User(InputContext);
            submitter.CreateUser(submitterID);                 

	        string submitterName = submitter.UserName; 

	        ReviewForum reviewForum = new ReviewForum(InputContext);
	        reviewForum.InitialiseViaReviewForumID(reviewForumID, false);

	        string generatedSubject = "Your entry has been submitted to '" +  reviewForum.ReviewForumName + "'";

	        string generatedBody = "Entry: " + subject + " - A" + H2G2ID + " \n";
	        generatedBody += "Author: " + userName + " - U" + editorID + " \n";
	        generatedBody += "Submitter: " + submitterName + " - U" + submitterID + "\n\n";

	        generatedBody += "This is an automated message.\n\n";

	        generatedBody += "Your entry above has been submitted to the Review Forum '" +  reviewForum.ReviewForumName + "'" 
				           + " by the Researcher named above. For more information about what happens next check out <./>ReviewForums-Next</.>.\n\n";
        	
	        generatedBody += "You can see the discussion about your entry at " + "F" + forumID + "?thread=" + threadID + "\n\n";

	        generatedBody += "If you'd rather your entry wasn't in this Review Forum then you can remove it by visiting "
				           + "<./>" + reviewForum.UrlFriendlyName + "</.> and clicking on the relevant 'Remove' link."
				           + " To prevent it being put into a Review Forum in the future, please click on the 'Edit Entry' button and tick the 'Not for Review' box.\n\n";

	        if (forumID > 0)
	        {
		        // Check the user input for profanities!
		        //ProfanityFilter profanityFilter = new ProfanityFilter(InputContext);
                string matchingProfanity = String.Empty;
                List<Term> terms = null;
		        ProfanityFilter.FilterState filterState = ProfanityFilter.CheckForProfanities(InputContext.CurrentSite.ModClassID, generatedSubject + " " + generatedBody, out matchingProfanity, out terms, forumID);

		        bool forceModeration = false;
		        if (filterState == ProfanityFilter.FilterState.FailBlock)
		        {
					AddErrorXml("profanityblocked", matchingProfanity, submitReviewForum);
			        return;
		        }
		        else if (filterState == ProfanityFilter.FilterState.FailRefer)
		        {
			        forceModeration = true;
		        }

                if(InputContext.GetSiteOptionValueBool("General", "IsURLFiltered") && !(InputContext.ViewingUser.IsEditor || InputContext.ViewingUser.IsNotable))
	            {
		            URLFilter URLFilter = new URLFilter(InputContext);
                    List<string> nonAllowedURLs = new List<string>();
		            URLFilter.FilterState URLFilterState = URLFilter.CheckForURLs(generatedSubject + " " + generatedBody, nonAllowedURLs);
		            if (URLFilterState == URLFilter.FilterState.Fail)
		            {
			            //return immediately - these don't get submitted
					    AddErrorXml("nonAllowedURLsFound", "For example " + nonAllowedURLs[0], submitReviewForum);
			            return;
		            }
		        }
                //Filter for email addresses.
//.........这里部分代码省略.........
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:101,代码来源:ReviewSubmissionForum.cs

示例6: SubmitArticle

        /// <summary>
        /// Submits an article to a review forum
        /// </summary>
        /// <param name="user"></param>
        /// <param name="H2G2ID"></param>
        /// <param name="siteID"></param>
        /// <param name="response"></param>
        /// <param name="reviewForumID"></param>
        public void SubmitArticle(IUser user, int H2G2ID, int siteID, string response, int reviewForumID)
        {
            XmlElement submitReviewForum = AddElementTag(RootElement, "SUBMIT-REVIEW-FORUM");
            if (user.UserID == 0)
            {
                AddGracefulErrorXml("NO_USERID", "You have not logged in!", "Login", "Login", submitReviewForum);
            }

            if (response == String.Empty)
            {
                AddErrorXml("NO_COMMENT", "There should be comments with this click back to back", submitReviewForum);
            }

            GuideEntrySetup guideSetup = new GuideEntrySetup(H2G2ID);
            guideSetup.ShowEntryData = true;
            guideSetup.ShowPageAuthors = true;
            guideSetup.ShowReferences = false;

            GuideEntry guideEntry = new GuideEntry(InputContext, guideSetup);
            guideEntry.Initialise();

            if (guideEntry.IsSubmittable && !user.IsEditor)
            {
                AddGracefulErrorXml("NO_SUBMIT", "This article is not for review", "FRONTPAGE", "Back to frontpage", submitReviewForum);
            }

            string subjectName = String.Empty;
            XmlElement subjectNameElement = (XmlElement) guideEntry.RootElement.SelectSingleNode("ARTICLE/SUBJECT");
            if (subjectNameElement != null)
            {
                subjectName = subjectNameElement.InnerText;
            }
            int editorID = 0;
            XmlElement editorIDElement = (XmlElement)guideEntry.RootElement.SelectSingleNode("PAGEAUTHOR/EDITOR/USERID");
            if (editorIDElement != null)
            {
                Int32.TryParse(editorIDElement.InnerText, out editorID);
            }

            string subject = "A" + H2G2ID.ToString() + " - " + subjectName;
            string aNumber = "A" + H2G2ID.ToString();

            User editor = new User(InputContext);
            editor.CreateUser(editorID);

            string editedComments = "Entry: " + subjectName + " - A" + H2G2ID + "\n";
            editedComments += "Author: " + editor.UserName + " - U" + editorID + "\n\n";
            editedComments += response;

            string hash = String.Empty;
            string hashString = subject + "<:>" + editedComments + "<:>" + user.UserID + "<:>0<:>0<:>0<:>ToReviewForum";

            using (IDnaDataReader dataReader = InputContext.CreateDnaDataReader("addarticletoreviewforummembers"))
            {
                dataReader.AddParameter("h2g2id", H2G2ID);
                dataReader.AddParameter("reviewforumid", reviewForumID);
                dataReader.AddParameter("submitterid", user.UserID);
                dataReader.AddParameter("subject", subject);
                dataReader.AddParameter("content", editedComments);
                dataReader.AddParameter("Hash", DnaHasher.GenerateHash(hashString));

                dataReader.Execute();
                // Check to see if we found anything
                if (dataReader.HasRows && dataReader.Read())
                {
                    XmlElement article = AddTextTag(submitReviewForum, "ARTICLE", subjectName);
                    AddAttribute(article, "H2G2ID", H2G2ID);
                    XmlElement newThread = AddElementTag(submitReviewForum, "NEW-THREAD");
                    AddAttribute(newThread, "postid", dataReader.GetInt32NullAsZero("PostID"));
                    AddAttribute(newThread, "threadid", dataReader.GetInt32NullAsZero("ThreadID"));
                    AddAttribute(newThread, "forumid", dataReader.GetInt32NullAsZero("ForumID"));

                    ReviewForum reviewForum = new ReviewForum(InputContext);
                    reviewForum.InitialiseViaReviewForumID(reviewForumID, false);
                    AddInside(newThread, reviewForum);
                }
            }
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:86,代码来源:ReviewSubmissionForum.cs

示例7: SubmitNameReg_Click1

    //if the username entered returns a record in the db and the password matches
    //log the user into the system and redirect to the user home page
    protected void SubmitNameReg_Click1(object sender, EventArgs e)
    {
        if (!userExists(emailRegTB.Text))
        {
            User newUser = new User(emailRegTB.Text, firstnameRegTB.Text, lastnameRegTB.Text, PasswordRegTB.Text);
            newUser.CreateUser();
            userView.SetActiveView(loginView);
            newUserCB.Checked = false;
            EmailLogTB.Text = newUser.Email;

            Label SignInLabel = new Label();
            SignInLabel.Text = "<br> Registration Successful, please enter password above to sign in.";
            loginView.Controls.Add(SignInLabel);
        }
        else
        {
            NewEmailValidatior.IsValid = false;
        }
    }
开发者ID:movies28423,项目名称:Conference-Register,代码行数:21,代码来源:UserLogin.aspx.cs


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