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


C# Usr.Update方法代码示例

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


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

示例1: TestThatNamespaceCacheKeysAreInvalidatedBySqlCommands

		public void TestThatNamespaceCacheKeysAreInvalidatedBySqlCommands()
		{
			Caching.Instances.Main.FlushAll();
			Usr u1 = new Usr()
			{
				NickName= Guid.NewGuid().ToString(),
				Email = Guid.NewGuid().ToString()
			};
			u1.Update();
			Usr u2 = new Usr()
			{
				NickName = Guid.NewGuid().ToString(),
				Email = Guid.NewGuid().ToString()
			};
			u1.Update();
			u2.Update();
			Assert.IsNull(Caching.Instances.Main.Get(Caching.CacheKeys.Usr.Banners(u1.K)));
			Assert.IsNull(Caching.Instances.Main.Get(Caching.CacheKeys.Usr.Banners(u2.K)));
			Banner b = new Banner() { UsrK = u1.K };
			b.Update();
			Assert.IsNotNull(Caching.Instances.Main.Get(Caching.CacheKeys.Usr.Banners(u1.K)));
			Assert.IsNull(Caching.Instances.Main.Get(Caching.CacheKeys.Usr.Banners(u2.K)));
			
			b.UsrK= u2.K;
			b.Update();
			Assert.IsNotNull(Caching.Instances.Main.Get(Caching.CacheKeys.Usr.Banners(u1.K)));
			Assert.IsNotNull(Caching.Instances.Main.Get(Caching.CacheKeys.Usr.Banners(u2.K)));
			
			
		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:30,代码来源:NamespacedCacheKeyTests.cs

示例2: TestDeletesRemoveBobsFromCache

		public void TestDeletesRemoveBobsFromCache()
		{
			Usr usr = new Usr();
			usr.Update();
			UsrTableDef def = new UsrTableDef();
			Caching.Instances.Main.Set(new Caching.CacheKeys.BobCacheKey("Usr", usr.K, def.TableCacheKey), Guid.NewGuid().ToString());
			Assert.IsNotNull(Caching.Instances.Main.Get(new Caching.CacheKeys.BobCacheKey("Usr", usr.K, def.TableCacheKey)));
			usr.Delete();
			Assert.IsNull(Caching.Instances.Main.Get(new Caching.CacheKeys.BobCacheKey("Usr", usr.K, def.TableCacheKey)));
		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:10,代码来源:TriggerTests.cs

示例3: Delete_RemoveUsr1ThenLoadUsr1_BobNotFoundThrown

		public void Delete_RemoveUsr1ThenLoadUsr1_BobNotFoundThrown()
		{
			SetupCacheForTesting();

			Usr usr = new Usr();
			usr.Update();
			int k = usr.K;
			usr.Delete();

			usr = new Usr(k);
		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:11,代码来源:UsrTests.cs

示例4: CountUsrs_PlaceConditions_NotIncludingIfUsrHasBeenToEventInTown

		public void CountUsrs_PlaceConditions_NotIncludingIfUsrHasBeenToEventInTown()
		{
			new Delete(TablesEnum.Usr, new Q(true)).Run();

			Random r = new Random();
			List<int> placeKs = new List<int>() { 1, 2, 3, 4 };
			List<int> notPlaceKs = new List<int>() { 5, 6, 7, 8, 9, 10, 11 };

			int usrsToCreate = 15;
			int usrs = 0;
			usrsToCreate.Times(() =>
			{
				Usr u = new Usr()
				{
					Email = Guid.NewGuid().ToString(),
					IsSkeleton = false,
					IsEmailVerified = true,
					SendFlyers = true
				};
				u.Update();

				int i = r.Next(placeKs.Count + notPlaceKs.Count);
				int placeK;
				if (i < placeKs.Count)
				{
					usrs++;
					placeK = placeKs[i];
				}
				else
				{
					placeK = notPlaceKs[i - placeKs.Count];
				}
				UsrPlaceVisit up = new UsrPlaceVisit()
				{
					UsrK = u.K,
					PlaceK = placeK
				};
				up.Update();
			});

			Assert.AreEqual(usrs, Flyer.CountUsrs(placeKs, new List<int>(), false));
		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:42,代码来源:Flyer_Tests.cs

示例5: BobsCachingIsWorking

		public void BobsCachingIsWorking()
		{
			SetupCacheForTesting();
			
			UnitTestUtilities.Sql.SqlTrace trace = new UnitTestUtilities.Sql.SqlTrace(Common.Properties.ConnectionString);
			trace.Start();
			Usr usr = new Usr();
			usr.Update();
			trace.Stop();
			Assert.AreNotEqual(0, trace.TotalReads, "First read was zero");
			trace.ClearData();
			trace.Start();
			Usr selectedUsr = new Usr(usr.K);
			trace.Stop();
			Assert.AreNotEqual(0, trace.TotalReads, "Second read was zero");

			trace.ClearData();
			trace.Start();
			Usr cachedUsr = new Usr(usr.K);
			trace.Stop();
			Assert.AreEqual(0, trace.TotalReads, "Third read was not zero");
		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:22,代码来源:UsrTests.cs

示例6: CountUsrs_NoConditions

		public void CountUsrs_NoConditions()
		{
			new Delete(TablesEnum.Usr, new Q(true)).Run();
			int usrsToCreate = 15;
			usrsToCreate.Times(() =>
			{
				Usr u = new Usr()
				{
					Email = Guid.NewGuid().ToString(),
					IsSkeleton = false,
					IsEmailVerified = true,
					SendFlyers = true
				};
				u.Update();
			});

			Query q = new Query();
			q.QueryCondition = new And(new Q(Usr.Columns.IsSkeleton, false), new Q(Usr.Columns.SendFlyers, true));
			q.ReturnCountOnly = true;

			int totalUsrs = new UsrSet(q).Count;
			Assert.AreEqual(usrsToCreate, totalUsrs);
			Assert.AreEqual(totalUsrs, Flyer.CountUsrs(new List<int>(), new List<int>(), false));
		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:24,代码来源:Flyer_Tests.cs

示例7: Test

		public void Test()
		{
			BuddyImporterService service = new BuddyImporterService();
			string email = "[email protected]";

			Usr u = new Usr();
			u.Update();

			Usr u2 = new Usr()
			{
				Email = email
			};
			u2.Update();

			Buddy b = new Buddy()
			{
				UsrK = u.K,
				BuddyUsrK = u2.K
			};
			b.Update();

			List<Contact> cList;
			List<Usr> uList;

			List<Contact> list = new List<Contact>()
			{
				new Contact("Bob", email)
			};

			int alreadyBuddies;
			service.SplitOutEmailContacts(list, u.K, out alreadyBuddies, out uList, out cList);

			Assert.AreEqual(1, uList.Count);
			Assert.IsTrue((bool)uList[0].ExtraSelectElements["BuddyRequested"]);
			Assert.AreEqual(0, cList.Count);
		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:36,代码来源:Tests.cs

示例8: ProcessLoginPart

		public bool ProcessLoginPart(ref int currentIndex, string[] urlParts)
		{
			if (urlParts[currentIndex].StartsWith("login") || urlParts[currentIndex].StartsWith("logout"))
			{
				try
				{
					LoginPartLogOutFirst = urlParts[currentIndex].StartsWith("logout"); // logout is used when forcing a log out (e.g. when admin or mod is needed)

					if (urlParts[currentIndex].Contains('-'))
					{
						string[] loginArr = urlParts[currentIndex].Split('-');
						LoginPartUsrK = loginArr.Length >= 2 ? int.Parse(loginArr[1]) : 0;
						LoginPartLoginString = loginArr.Length >= 3 ? loginArr[2] : "";
					}

					currentIndex++;

					#region construct LoggedInPlainUrl
					string redirectUrl = "";
					for (int part = currentIndex; part < urlParts.Length; part++)
						redirectUrl += "/" + urlParts[part];

					if (redirectUrl.Length == 0)
						LoggedInPlainUrl = "/";
					else
						LoggedInPlainUrl = redirectUrl;

					if (HttpContext.Current.Request.QueryString.ToString().Length > 0)
						LoggedInPlainUrl += "?" + HttpContext.Current.Request.QueryString.ToString();
					#endregion

					Usr u = null;
					try
					{
						u = new Usr(LoginPartUsrK);
						if (u.LoginString.ToLower().Equals(LoginPartLoginString.ToLower()))
						{
							if (!u.IsEmailVerified)
							{
								u.IsEmailVerified = true;
								u.Update();
							}
						}
					}
					catch { }

					if (Usr.Current == null || (LoginPartUsrK > 0 && Usr.Current.K != LoginPartUsrK))
					{
						if (u.LoginString.ToLower().Equals(LoginPartLoginString.ToLower()))
						{
							LoginPartUsrEmail = u.Email;
							LoginPartUsrIsSkeleton = u.IsSkeleton;
							LoginPartUsrIsFacebookNotConfirmed = !u.FacebookStory.HasValue;
							LoginPartUsrIsEnhancedSecurity = u.EnhancedSecurity && (Usr.Current == null || !Usr.Current.IsAdmin);
							LoginPartUsrNeedsCaptcha = u.NeedsCaptcha.HasValue && u.NeedsCaptcha.Value && Settings.CaptchaEnabledStatus == Settings.CaptchaEnabledStatusOption.On;
							LoginPartUsrHomePlaceK = u.HomePlaceK;
							LoginPartUsrFavouriteMusicK = u.FavouriteMusicTypeK;
							LoginPartUsrSendSpottedEmails = u.SendSpottedEmails;
							LoginPartUsrSendEflyers = u.SendFlyers;

							if (LoginPartUsrNeedsCaptcha)
							{
								string text = Cambro.Misc.Utility.GenRandomChars(5).ToUpper() + "|" + HttpUtility.UrlEncode(u.Email.ToLower());
								LoginPartUsrCaptchaEncrypted = Cambro.Misc.Utility.Encrypt(text, DateTime.Now.AddHours(1));
							}

							if (LoginPartUsrIsSkeleton || LoginPartUsrIsEnhancedSecurity || LoginPartUsrNeedsCaptcha)
							{
								PageType = PageTypes.Pages;
								PageName = "AutoLogin";
								return true;
							}
							else
							{
								u.LogInAsThisUserNew();
								if (!DisableAllActions)
								{
									if (u.EmailHold)
										HttpContext.Current.Response.Redirect("/popup/unsubscribe");
									else
										HttpContext.Current.Response.Redirect(LoggedInPlainUrl);
								}
							}
						}
						else
						{
							LoginFailed = true;

							PageType = PageTypes.Pages;
							PageName = "AutoLogin";
							return true;
						}

					}
					else if (LoginPartLogOutFirst)
					{
						PageType = PageTypes.Pages;
						PageName = "AutoLogin";
						return true;
					}
//.........这里部分代码省略.........
开发者ID:davelondon,项目名称:dontstayin,代码行数:101,代码来源:UrlInfo.cs

示例9: CountUsrs_MusicConditions_QueryIncludingAllMusic_GetsAllUsrs

		public void CountUsrs_MusicConditions_QueryIncludingAllMusic_GetsAllUsrs()
		{
			new Delete(TablesEnum.Usr, new Q(true)).Run();

			Random r = new Random();
			List<int> musicTypeKs = new List<int>() { 1, 2, 3, 4 };

			int usrsToCreate = 15;
			usrsToCreate.Times(() =>
			{
				Usr u = new Usr()
				{
					Email = Guid.NewGuid().ToString(),
					IsSkeleton = false,
					IsEmailVerified = true,
					SendFlyers = true
				};
				u.Update();

				int i = r.Next(musicTypeKs.Count * 2);
				if (i < musicTypeKs.Count)
				{
					UsrMusicTypeFavourite um = new UsrMusicTypeFavourite()
					{
						UsrK = u.K,
						MusicTypeK = musicTypeKs[i]
					};
					um.Update();
				}
			});

			Assert.AreEqual(usrsToCreate, Flyer.CountUsrs(new List<int>(), musicTypeKs, false));
		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:33,代码来源:Flyer_Tests.cs

示例10: ProcessDonation

		private void ProcessDonation()
		{
			if (!this.Enabled)
			{
				this.Enabled = true;
				this.BuyDateTime = DateTime.Now;
				this.Update();
			}

			var u = new Usr(this.UsrK);
			u.RolloverDonationIconK = this.DonationIconK;
			u.Update();
		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:13,代码来源:UsrDonationIcon.cs

示例11: CreateUsr

		private void CreateUsr(int musicTypeK, int homePlaceK, int eventPlaceK, int visitPlaceK, bool isPromoter)
		{
			Usr u = new Usr()
			{
				Email = Guid.NewGuid().ToString(),
				IsSkeleton = false,
				IsEmailVerified = true,
				SendFlyers = true,
				HomePlaceK = homePlaceK,
				IsPromoter = isPromoter
			};
			u.Update();

			UsrMusicTypeFavourite um = new UsrMusicTypeFavourite()
			{
				UsrK = u.K,
				MusicTypeK = musicTypeK
			};
			um.Update();



			Venue v = new Venue()
			{
				PlaceK = eventPlaceK
			};
			v.Update();

			Event e = new Event()
			{
				VenueK = v.K
			};
			e.Update();

			UsrEventAttended ue = new UsrEventAttended()
			{
				UsrK = u.K,
				EventK = e.K
			};
			ue.Update();


			UsrPlaceVisit up = new UsrPlaceVisit()
			{
				UsrK = u.K,
				PlaceK = visitPlaceK
			};
			up.Update();
		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:49,代码来源:Flyer_Tests.cs

示例12: CreateSkeletonUserAndSendWelcomeEmail

		private static Usr CreateSkeletonUserAndSendWelcomeEmail(Usr invitingUsr, string email, string nickName, Group invitingGroup, string inviteMessage, bool invitedViaContactImporter)
		{
			Usr u = new Usr();
			Random r = new Random();

			u.DateTimeSignUp = DateTime.Now;
			u.DateTimeLastAccess = DateTime.Now;
			u.DateTimeLastPageRequest = DateTime.Now;

			u.IsSkeleton = true;
			u.Email = Cambro.Web.Helpers.StripHtml(email);
			u.EmailDateTime = DateTime.Now;
			if (HttpContext.Current != null)
				u.EmailIp = Utilities.TruncateIp(HttpContext.Current.Request.ServerVariables["REMOTE_HOST"]);
			u.LoginString = Cambro.Misc.Utility.GenRandomText(6, r);
			u.RandomNumber = r.NextDouble();
			u.IsAdmin = false;
			u.LoginCount = 0;
			u.FirstName = "";
			u.LastName = "";

			u.NickName = Cambro.Web.Helpers.StripHtml(nickName);
			u.Mobile = "";
			u.AddressPostcode = "";

			u.SendSpottedEmails = true;
			u.UpdateLargeEvents = 5000;
			u.UpdateSendBuddies = false;
			u.UpdateSendGenericMusic = false;
			u.SendSpottedTexts = true;
			u.SendFlyers = true;
			u.SendInvites = true;
			u.SendPartnerEmails = false;
			u.SendPartnerTexts = false;
			u.IsEmailVerified = true;

			if (invitingUsr != null)
				u.AddedByUsrK = invitingUsr.K;

			if (invitingGroup != null)
				u.AddedByGroupK = invitingGroup.K;

			u.InvitedViaContactImporter = invitedViaContactImporter;

			u.Update();
			
			u.SendWelcomeEmail(invitingUsr, invitingGroup, inviteMessage);

			u = new Usr(u.K);
			return u;

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

示例13: CreateNewUsrMaster

		//public static bool GetCompliantUniqueNickName(string inNickName, out string outNickName)
		//{
		//    outNickName = inNickName;

		//    int index;
		//    // if it's an email address, remove domain
		//    if (index = outNickName.IndexOf("@") > 0)
		//    {
		//        outNickName = outNickName.Substring(0, outNickName.IndexOf(index));
		//    }

		//    outNickName = Usr.GetCompliantNickName(outNickName);
		//    if (!Usr.NickNameRegex.IsMatch(outNickName))
		//        return false;

		//    else
		//    {
		//        Query q = new Query();
		//        q.QueryCondition = new Q(Usr.Columns.NickName, outNickName);
		//        q.ReturnCountOnly = true;
		//        UsrSet us = new UsrSet(q);
		//        us.Count == 0;
		//    }
		//}
		#endregion

		#region CreateNewUsr
		//public static Usr CreateNewUsr(string email, string password)
		//{
		//    return CreateNewUsr(email, password, "", "");
		//}
		//public static Usr CreateNewUsr(string email, string password, string firstName, string lastName)
		//{
		//    return CreateNewUsr(email, password, firstName, lastName, "");
		//}
		//public static Usr CreateNewUsr(string email, string password, string firstName, string lastName, string emailIp)
		//{
		//    return CreateNewUsr(email, password, firstName, lastName, emailIp, true);
		//}
		public static Usr CreateNewUsrMaster(string email, string password, string firstName, string lastName, string emailIp, bool runUpdate)
		{
			Usr u = new Usr();
			Random r = new Random();

			#region Add data from form

			u.DateTimeSignUp = Time.Now;
			u.DateTimeLastAccess = Time.Now;
			u.DateTimeLastPageRequest = Time.Now;

			u.Email = email.Trim();
			u.EmailDateTime = Time.Now;
			u.EmailIp = emailIp;
			if (password.Trim().Length > 0)
				u.SetPassword(password.Trim(), false);
			u.LoginString = Cambro.Misc.Utility.GenRandomText(6, r);
			u.RandomNumber = r.NextDouble();
			u.IsEmailVerified = false;
			u.IsAdmin = false;
			u.LoginCount = 0;
			u.FirstName = firstName;
			u.LastName = lastName;
			u.NickName = "";
			u.IsSkeleton = true;

			u.SendSpottedEmails = true;
			u.UpdateLargeEvents = 5000;
			u.UpdateSendBuddies = false;
			u.UpdateSendGenericMusic = true;
			u.SendSpottedTexts = true;
			u.SendFlyers = true;
			u.SendInvites = true;
			u.SendPartnerEmails = false;
			u.SendPartnerTexts = false;

			#endregion

			if (runUpdate)
				u.Update();

			return u;
		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:82,代码来源:Usr.cs

示例14: CountUsrs_PlaceConditions_IncludingIfUsrHasBeenToEventInTown

		public void CountUsrs_PlaceConditions_IncludingIfUsrHasBeenToEventInTown()
		{
			new Delete(TablesEnum.Usr, new Q(true)).Run();

			Random r = new Random();
			List<int> placeKs = new List<int>() { 1, 2, 3, 4 };

			Venue v = new Venue()
			{
				PlaceK = placeKs[0]
			};
			v.Update();

			Event e = new Event()
			{
				VenueK = v.K
			};
			e.Update();

			int usrsToCreate = 15;
			int usrs = 0;
			usrsToCreate.Times(() =>
			{
				Usr u = new Usr()
				{
					Email = Guid.NewGuid().ToString(),
					IsSkeleton = false,
					IsEmailVerified = true,
					SendFlyers = true
				};
				u.Update();

				int i = r.Next(placeKs.Count * 2);
				if (i < placeKs.Count)
				{
					UsrEventAttended ue = new UsrEventAttended()
					{
						UsrK = u.K,
						EventK = e.K
					};
					ue.Update();
					usrs++;
				}
			});

			Assert.AreEqual(usrs, Flyer.CountUsrs(placeKs, new List<int>(), false));
		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:47,代码来源:Flyer_Tests.cs

示例15: CreateLol

		public static void CreateLol(Comment comment)
		{
			LolSet ls = new LolSet(
				new Query(
					new And(
						new Q(Lol.Columns.CommentK,comment.K),
						new Q(Lol.Columns.UsrK,Usr.Current.K)
					)
				)
			);
			if (ls.Count==0)
			{
				Usr usr = new Usr(comment.UsrK);
				LolSet lolUniqueSet = new LolSet(new Query(new And(
					new Q(Lol.Columns.CommentUsrK,usr.K),
					new Q(Lol.Columns.UsrK,Usr.Current.K))));
				if (lolUniqueSet.Count==0)
					usr.UniqueMadeLol++;
				usr.TotalMadeLol++;
				usr.Update();

				comment.LolCount++;
				comment.Update();

				Lol l = new Lol();
				l.DateTime=DateTime.Now;
				l.CommentK=comment.K;
				l.UsrK=Usr.Current.K;
				l.CommentUsrK=comment.UsrK;
				l.Update();
				l = new Lol(l.K);
				
				//DateTime lastLolDateTime = Usr.Current.LastLol;
						
				Usr.Current.TotalLol++;
				Usr.Current.LastLol = l.DateTime;
				Usr.Current.Update();

				Comment fullComment = new Comment(comment.K);

				if (!fullComment.Thread.Private && !fullComment.Thread.GroupPrivate && !fullComment.Thread.PrivateGroup)
				{

					if (Usr.Current.FacebookConnected && Usr.Current.FacebookStoryLaugh)
					{
						FacebookPost.CreateLaugh(Usr.Current, comment);
					}

					////LaughStub randomChatLaughStub = getLaughStub(ItemType.LaughAlert, new Chat.RoomSpec(RoomType.Laughs).Guid, fullComment);
					//LaughStub randomChatLaughStub = getLaughStub(ItemType.LaughAlert, new Chat.RoomSpec(RoomType.PublicStream).Guid, fullComment);
					//Chat.SendJsonChatItem(randomChatLaughStub);

					LaughStub randomChatLaughStub1 = getLaughStub(ItemType.LaughAlert, new Chat.RoomSpec(RoomType.PublicStream).Guid, fullComment);
					Chat.SendJsonChatItem(randomChatLaughStub1);
				}
				else
				{
					//LaughStub laughStub = getLaughStub(ItemType.LaughAlert, new Chat.RoomSpec(RoomType.Normal, Model.Entities.ObjectType.Thread, fullComment.ThreadK).Guid, fullComment);
					//UsrSet us = Thread.GetAllLoggedInParticipants(fullComment.Thread);
					//Chat.SendJsonChatItem(laughStub, us);
				}

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


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