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


C# Usr.LoginAndTransfer方法代码示例

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


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

示例1: GetFullBody

		string GetFullBody()
		{
			if (TemplateType.Equals(TemplateTypes.SpecialMail))
			{
				string body = "";

				Assembly ass = Assembly.GetExecutingAssembly();
				StreamReader sr = new StreamReader(ass.GetManifestResourceStream("Bobs.Emails.DsiEmailTemplateSpecial.htm"));
				string siteUserTemplate = sr.ReadToEnd();

				string logInUrl = "http://" + Vars.DomainName + "/";
				if (UsrRecipient != null)
				{
					logInUrl = UsrRecipient.LoginUrl;
				}
				if (RedirectUrl.Length > 0 && UsrRecipient != null)
				{
					logInUrl = UsrRecipient.LoginAndTransfer(RedirectUrl);
				}
				if (OverrideLoginLink.Length > 0)
				{
					logInUrl = OverrideLoginLink;
				}
				body = siteUserTemplate.Replace("[SUBJECT]", Subject);
				body = body.Replace("[BODY]", Body);
				body = body.Replace("[LOGIN]", logInUrl);

				body = AolCompliance(body);
				body = GenericReplacements(body);
				return body;
			}
			else if (TemplateType.Equals(TemplateTypes.AnotherSiteUser))
			{
				string body = "";

				Assembly ass = Assembly.GetExecutingAssembly();
				StreamReader sr = new StreamReader(ass.GetManifestResourceStream("Bobs.Emails.DsiEmailTemplateSiteUser.htm"));
				string siteUserTemplate = sr.ReadToEnd();
				
				RelevanceHolder rel = new RelevanceHolder();
				UsrRecipient.AddRelevant(rel);

				BannerServer.Rules.RequestRules rules = new Bobs.BannerServer.Rules.RequestRules();

				foreach (int musicTypeK in rel.RelevantMusic)
				{
					rules.MusicTypes.Add(musicTypeK);
				}
				foreach (int placeK in rel.RelevantPlaces)
				{
					rules.PlacesVisited.Add(placeK);
				}
				Bobs.BannerServer.Server server = new Bobs.BannerServer.Server();
				BannerDataHolder bdh = server.GetBanner(Banner.Positions.EmailBanner, false, new UsrIdentity(UsrRecipient), rules);
				//Banner b = null;
				string bannerHtml = "";
				if (bdh != null)
				{
					Banner b = new Banner(bdh.K);
					bannerHtml = @"<table cellpadding=""0"" cellspacing=""0"" border=""0""><tr><td rowspan=""3""><img src=""[WEB-ROOT]gfx/1pix.gif"" width=""23"" height=""90""></td><td rowspan=""3""><a href=""[LOGIN]""><img src=""[WEB-ROOT]gfx/logo-200-90.jpg"" border=""0"" width=""200"" height=""90""></a></td><td rowspan=""3""><img src=""[WEB-ROOT]gfx/1pix.gif"" width=""23"" height=""90""></td><td><img src=""[WEB-ROOT]gfx/1pix.gif"" width=""331"" height=""20""></td><td rowspan=""3""><img src=""[WEB-ROOT]gfx/1pix.gif"" width=""23"" height=""90""></td></tr><tr><td><a href=""[LOGIN(" + b.LinkUrlLive + @")]""><img src=""" + b.Misc.Url() + @""" border=""0"" width=""331"" height=""51""></a></td></tr><tr><td><img src=""[WEB-ROOT]gfx/1pix.gif"" width=""331"" height=""19""></td></tr></table>";
					b.RegisterHit(new UsrIdentity(UsrRecipient));
				}
				else
				{
					bannerHtml = @"<table cellpadding=""0"" cellspacing=""0"" border=""0""><tr><td><img src=""[WEB-ROOT]gfx/1pix.gif"" width=""23"" height=""90""></td><td><a href=""[LOGIN]""><img src=""[WEB-ROOT]gfx/logo-200-90.jpg"" border=""0"" width=""200"" height=""90""></a></td><td><img src=""[WEB-ROOT]gfx/1pix.gif"" width=""377"" height=""90""></td></tr></table>";
				}
			
				siteUserTemplate = siteUserTemplate.Replace("[BANNER]", bannerHtml);
			 
				
				
				
				#region AnotherSiteUser
				string salutation = "Hi, ";
				string logInUrl = "http://" + Vars.DomainName + "/";
				if (UsrRecipient != null)
				{
					if (UsrRecipient.NickName.Length > 0)
						salutation = "Dear " + HttpUtility.HtmlEncode(UsrRecipient.NickName) + ", ";
					logInUrl = UsrRecipient.LoginUrl;
				}
				if (RedirectUrl.Length > 0 && UsrRecipient != null)
				{
					logInUrl = UsrRecipient.LoginAndTransfer(RedirectUrl);
				}
				if (OverrideLoginLink.Length > 0)
				{
					logInUrl = OverrideLoginLink;
				}
				body = siteUserTemplate.Replace("[SUBJECT]", Subject);
				#region [QUICKLINK]
				if (ShowQuickLink)
				{
					body = body.Replace("[QUICKLINK]", @"[h1]
		Quick link
	[/h1]
	[div]
		<p align=""center"" style=""margin:8px 0px 4px 0px;""><a href=""[LOGIN]"" style=""font-size:18px;font-weight:bold;"">Click here for DontStayIn</a></p>
	[/div]");
				}
//.........这里部分代码省略.........
开发者ID:davelondon,项目名称:dontstayin,代码行数:101,代码来源:Mailer.cs

示例2: AddBuddy

		public void AddBuddy(Usr buddyUsr, bool canBuddyInvite, bool sendNotificationEmailIfNewBuddyRequest, AddBuddySource source, Buddy.BuddyFindingMethod foundByMethod, string skeletonName)
		{
			ValidateBuddyUsr(buddyUsr, true);

			Buddy b;
			try
			{
				b = new Buddy(this.K, buddyUsr.K);
			}
			catch (BobNotFound)
			{
				b = new Buddy();
				b.UsrK = this.K;
				b.BuddyUsrK = buddyUsr.K;
				b.CanBuddyInvite = canBuddyInvite;
				b.BuddyFoundByMethod = foundByMethod;
				b.SkeletonName = skeletonName;
				try
				{
					Buddy reverseBuddy = new Buddy(buddyUsr.K, this.K);
					reverseBuddy.FullBuddy = true;
					reverseBuddy.Denied = false;
					reverseBuddy.CanInvite = canBuddyInvite;
					b.CanInvite = reverseBuddy.CanBuddyInvite;
					b.FullBuddy = true;
					b.Denied = false;
					reverseBuddy.Update();

					if (this.FacebookConnected && this.FacebookStoryNewBuddy)
					{
						try
						{
							FacebookPost.CreateNewBuddy(this, buddyUsr, true);
						}
						catch { }
					}

					if (buddyUsr.FacebookConnected && buddyUsr.FacebookStoryNewBuddy)
					{
						try
						{
							FacebookPost.CreateNewBuddy(buddyUsr, this, false);
						}
						catch { }
					}
				}
				catch (BobNotFound)
				{
					if (source == AddBuddySource.BuddyButtonClick ||
						source == AddBuddySource.UsrPageSendPrivateMessage)
					{
						Usr.IncrementSpamBotDefeaterCounter(SpamBotDefeaterCounter.BuddyRequests, this.K);
					}

					b.CanInvite = false;
					b.FullBuddy = false;

					if (sendNotificationEmailIfNewBuddyRequest)
					{
						Mailer m = new Mailer();
						m.TemplateType = Mailer.TemplateTypes.AnotherSiteUser;
						m.Subject = this.NickName + " has invited you to " + this.HisString(false) + " buddy list";
						
						if (this.HasPic)
						{
							m.Body += "<a href=\"[LOGIN(" + this.Url() + ")]\"><img src=\"" + this.PicPath + "\" style=\"margin-left:5px;\" class=\"BorderBlack All\" width=\"100\" height=\"100\" align=\"right\" vspace=\"6\" border=\"0\"></a>";
						}
						m.Body += "<h1>" + HttpUtility.HtmlEncode(this.NickName) + " has invited you to " + this.HisString(false) + " buddy list</h1>";
						m.Body += "<p>Name: <a href=\"[LOGIN(" + this.Url() + ")]\">" + HttpUtility.HtmlEncode(this.FirstName) + " " + HttpUtility.HtmlEncode(this.LastName) + "</a>.</p>";
						m.Body += "<p>To add " + HttpUtility.HtmlEncode(this.NickName) + " to your buddy list, view " + this.HisString(false) + " <a href=\"[LOGIN(" + this.Url() + ")]\">profile</a> and click the \"Add " + HttpUtility.HtmlEncode(this.NickName) + " to my buddy list\" button.</p>";
						m.OverrideLoginLink = buddyUsr.LoginAndTransfer(this.Url());
						m.UsrRecipient = buddyUsr;
						m.To = buddyUsr.Email;
						m.Send();
					}
				}
				b.Update();
				b.Usr.UpdateBuddyCount(null);
				b.BuddyUsr.UpdateBuddyCount(null);
			}
		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:81,代码来源:Usr.cs


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