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


C# Thread.Update方法代码示例

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


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

示例1: SendMatchNotification

		public void SendMatchNotification()
		{
			#region Init thread
			Thread t = new Thread();
			t.DateTime = DateTime.Now;
			t.Enabled = true;
			t.ParentObjectK = 0;
			t.ParentObjectType = Model.Entities.ObjectType.None;
			t.Subject = "DSI Date introduction - " + this.Usr.NickName + " and " + this.DateUsr.NickName;
			t.UsrK = this.UsrK;
			t.Private = true;
			t.IsNews = false;
			t.IsSticky = false;
			t.Update();
			t.UpdateAncestorLinks(null);

			ThreadUsr tu = new ThreadUsr();
			tu.DateTime = DateTime.Now;
			tu.InvitingUsrK = this.UsrK;
			tu.UsrK = this.DateUsrK;
			tu.ThreadK = t.K;
			tu.ChangeStatus(ThreadUsr.StatusEnum.NewInvite);
			tu.StatusChangeObjectK = this.UsrK;
			tu.StatusChangeObjectType = Model.Entities.ObjectType.Usr;
			tu.PrivateChatType = ThreadUsr.PrivateChatTypes.Popup;
			tu.Update();

			ThreadUsr tu1 = new ThreadUsr();
			tu1.DateTime = DateTime.Now;
			tu1.InvitingUsrK = this.DateUsrK;
			tu1.UsrK = this.UsrK;
			tu1.ThreadK = t.K;
			tu1.ChangeStatus(ThreadUsr.StatusEnum.NewInvite);
			tu1.PrivateChatType = ThreadUsr.PrivateChatTypes.Popup;
			tu1.StatusChangeObjectK = this.UsrK;
			tu1.StatusChangeObjectType = Model.Entities.ObjectType.Usr;
			tu1.Update();

			Comment c = new Comment();
			c.DateTime = DateTime.Now;
			if (HttpContext.Current != null)
				c.Ip = Utilities.TruncateIp(HttpContext.Current.Request.ServerVariables["REMOTE_HOST"]);
			c.Enabled = true;
			string rel = "";
			if (this.Usr.Relationship1 && this.DateUsr.Relationship1)
				rel += " <b>just friends</b>";
			if (this.Usr.Relationship2 && this.DateUsr.Relationship2)
				rel += (rel.Length > 0 ? " or " : "") + " <b>a bit of a fling</b>";
			if (this.Usr.Relationship3 && this.DateUsr.Relationship3)
				rel += (rel.Length > 0 ? " or " : "") + " <b>love</b>";
			c.Text = "<b>You've both been matched by DSI Date.</b>\n\nYou've selected Yes to each others profiles on the DSI Date page. You're both looking for: " + rel + ".\n\nGet to know each other better in this private conversation.";
			c.ThreadK = t.K;
			c.UsrK = 3526;
			c.DuplicateGuid = Guid.NewGuid();
			c.Update();
			c = new Comment(c.K);

			CommentAlert.Enable(this.Usr, t.K, Model.Entities.ObjectType.Thread);
			CommentAlert.Enable(this.DateUsr, t.K, Model.Entities.ObjectType.Thread);

			t.LastPost = c.DateTime;
			t.LastPostUsrK = c.UsrK;
			t.Update();
			t.UpdateTotalComments(null);
			//t.UpdateTotalParticipants();
			UpdateTotalParticipantsJob job = new UpdateTotalParticipantsJob();
			job.ExecuteSynchronously();

			#endregion

			this.MatchThreadK = t.K;
			this.Update();
			UsrDate udRev = new UsrDate(this.DateUsrK, this.UsrK);
			udRev.MatchThreadK = t.K;
			udRev.Update();

			//Email
			Mailer sm = new Mailer();
			sm.RedirectUrl = t.Url();
			sm.Subject = "DSI Date has matched you to " + this.DateUsr.NickName;
			sm.Body = "<p>DSI Date has matched you to " + this.DateUsr.NickNameSafe + ". We've invited you both to a private conversation, where you can get to know each other better.</p>";
			sm.Body += "<p><a href=\"[LOGIN(" + t.Url() + ")]\">Click here to send " + this.DateUsr.NickNameSafe + " a message</a></p>";
			sm.TemplateType = Mailer.TemplateTypes.AnotherSiteUser;
			sm.UsrRecipient = this.Usr;
			sm.To = this.Usr.Email;
			sm.Send();

			Mailer sm1 = new Mailer();
			sm1.RedirectUrl = t.Url();
			sm1.Subject = "DSI Date has matched you to " + this.Usr.NickName;
			sm1.Body = "<p>DSI Date has matched you to " + this.Usr.NickNameSafe + ". We've invited you both to a private conversation, where you can get to know each other better.</p>";
			sm1.Body += "<p><a href=\"[LOGIN(" + t.Url() + ")]\">Click here to send " + this.Usr.NickNameSafe + " a message</a></p>";
			sm1.TemplateType = Mailer.TemplateTypes.AnotherSiteUser;
			sm1.UsrRecipient = this.DateUsr;
			sm1.To = this.DateUsr.Email;
			sm1.Send();

		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:98,代码来源:UsrDate.cs

示例2: Post


//.........这里部分代码省略.........
				try
				{
					#region Create thread
					NewThread.DateTime = DateTime.Now;
					NewThread.Enabled = true;
					NewThread.UsrK = PostingUsr.K;
					NewThread.LastPostUsrK = PostingUsr.K;
					NewThread.Subject = Helpers.Strip(Subject, true, true, true, true);

					NewThread.ParentObjectType = ParentType;
					NewThread.ParentObjectK = ParentK;
					if (GroupK > 0)
						NewThread.GroupK = ParentGroup.K;
					else
						NewThread.GroupK = 0;

					NewThread.Private = tPrivate;
					NewThread.GroupPrivate = gPrivate;
					if (GroupK > 0)
						NewThread.PrivateGroup = ParentGroup.PrivateChat;
					else
						NewThread.PrivateGroup = false;

					NewThread.IsNews = tNews;
					NewThread.NewsStatus = tNewsStatus;
					NewThread.NewsLevel = tNewsLevel;
					NewThread.NewsModeratorUsrK = tNewsModeratorUsrK;
					NewThread.NewsUsrK = tNewsUsrK;

					NewThread.Sealed = tSealed;
					NewThread.Closed = tClosed;
					NewThread.IsReview = tReview;

					NewThread.UpdateAncestorLinksNoUpdate();
					NewThread.Update(trans);

					#endregion

					#region Add PostingUsr ThreadUsr
					CurrentThreadUsr = new ThreadUsr();
					CurrentThreadUsr.DateTime = DateTime.Now;
					CurrentThreadUsr.InvitingUsrK = PostingUsr.K;
					CurrentThreadUsr.UsrK = PostingUsr.K;
					CurrentThreadUsr.ThreadK = NewThread.K;
					CurrentThreadUsr.ChangeStatus(ThreadUsr.StatusEnum.Archived, NewThread.DateTime);
					CurrentThreadUsr.StatusChangeObjectK = PostingUsr.K;
					CurrentThreadUsr.StatusChangeObjectType = Model.Entities.ObjectType.Usr;
					CurrentThreadUsr.Update(trans);
					#endregion

					#region Make the comment
					Comment.Maker cMaker = new Comment.Maker();
					cMaker.Body = Body;
					cMaker.ParentThread = NewThread;
					cMaker.DuplicateGuid = DuplicateGuid;
					cMaker.PostingUsr = PostingUsr;
					cMaker.InviteKs = InviteKs;
					cMaker.AlertedUsrs = AlertedUsrs;
					cMaker.NewThread = true;
					cMaker.CurrentThreadUsr = CurrentThreadUsr;
					cMaker.CurrentGroupUsr = CurrentGroupUsr;
					cMaker.RunAsync = RunAsync;
					cMaker.DisableLiveChatMessage = DisableLiveChatMessage;
					Comment.MakerReturn cReturn = null;
					try
					{
开发者ID:davelondon,项目名称:dontstayin,代码行数:67,代码来源:Thread.cs

示例3: FixPromoterQuestions

		public void FixPromoterQuestions(object o, System.EventArgs e)
		{
			Cambro.Web.Helpers.WriteAlertHeader();

			Cambro.Web.Helpers.WriteAlert("Selecting promoters...", 1);
			Query q = new Query();
			//q.QueryCondition=???
			PromoterSet bs = new PromoterSet(q);
			for (int count = 0; count < bs.Count; count++)
			{
				Promoter c = bs[count];

				try
				{
					Thread t = new Thread(c.QuestionsThreadK);
					t.Subject = c.Name + " promoter questions";
					t.Update();
					// Do work here!
					//c.Update();

					if (count % 10 == 0)
						Cambro.Web.Helpers.WriteAlert("Done " + count + "/" + bs.Count, 2);

				}
				catch(Exception ex)
				{
					Cambro.Web.Helpers.WriteAlert("Exception " + count + "/" + bs.Count + " - " + ex.ToString(), 3);
				}

				bs.Kill(count);

			}
			Cambro.Web.Helpers.WriteAlert("Done!", 3);
			Cambro.Web.Helpers.WriteAlertFooter();
		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:35,代码来源:Utility.ascx.cs

示例4: CheckToPutThreadInCaptionCompetition

		private static void CheckToPutThreadInCaptionCompetition(IDiscussable discussable, Thread thread)
		{
			if (Vars.IsCompetitionActive && discussable.ObjectType == Model.Entities.ObjectType.Photo)
			{
				Photo photo = (Photo)discussable;
				if (photo.IsInCaptionCompetition && (!photo.ThreadK.HasValue || !photo.Thread.IsInCaptionCompetition))
				{
					thread.GroupK = Vars.CompetitionGroupK;
					thread.IsInCaptionCompetition = true;
					thread.Update();

					photo.ThreadK = thread.K;
					photo.Update();
				}
			}
		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:16,代码来源:Thread.cs


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