Exemplo n.º 1
0
		void uiSaveChanges_Click(object sender, EventArgs e)
		{

			foreach (GridViewRow row in uiResults.Rows)
			{
				int k = Convert.ToInt32(row.Cells[0].Text);
				Tag tag = new Tag(k);
				
				bool showInTagCloud = ((CheckBox)row.FindControl("uiShowInTagCloudCheckBox")).Checked;
				if (tag.ShowInTagCloud != showInTagCloud)
				{
					tag.ShowInTagCloud = showInTagCloud;
					tag.Update();
					(new Caching.CacheKeys.NamespaceCacheKey(CacheKeyPrefix.TagCloudVersion)).Invalidate();
				}
				bool blocked = ((CheckBox)row.FindControl("uiBlockedCheckBox")).Checked;
				if (tag.Blocked != blocked)
				{
					tag.SetBlockedAndUpdate(blocked);
				}
				
			}
			GetResults();
			
		}
Exemplo n.º 2
0
		public void TestInsertsFireInvalidationTriggers()
		{
			Tag tag = new Tag();
			tag.Update();
			Photo photo = new Photo();
			photo.Update();
			Caching.Instances.Main.FlushAll();
			string version = Guid.NewGuid().ToString();
			Caching.Instances.Main.Set(Caching.CacheKeys.Tag.TagPhotos(tag.K), version);
			TagPhoto tagPhoto = new TagPhoto() { TagK = tag.K, PhotoK = photo.K};
			Assert.AreEqual(version, Caching.Instances.Main.Get(Caching.CacheKeys.Tag.TagPhotos(tag.K)));
			tagPhoto.Update();
			Assert.AreNotEqual(version, Caching.Instances.Main.Get(Caching.CacheKeys.Tag.TagPhotos(tag.K)));

		}
Exemplo n.º 3
0
		public void TestDeletesFireInvalidationTriggers()
		{
			Tag tag = new Tag();
			tag.Update();
			Photo photo2 = new Photo();
			photo2.Update();
			Photo photo = new Photo();
			photo.Update();
			Caching.Instances.Main.FlushAll();
			TagPhoto tagPhoto = new TagPhoto() { TagK = tag.K, PhotoK = photo.K};
			tagPhoto.Update();
			string version = Caching.Instances.Main.Get(Caching.CacheKeys.Tag.TagPhotos(tag.K)) as string;
			tagPhoto.Delete();
			Assert.AreNotEqual(version, Caching.Instances.Main.Get(Caching.CacheKeys.Tag.TagPhotos(tag.K)));

		}
Exemplo n.º 4
0
		public static Tag GetTag(string tagText)
		{
			tagText = RemoveAnyInvalidCharactersAndStuff(tagText);
			Query query = new Query(new Q(Tag.Columns.TagText, tagText));
			TagSet tagSet = new TagSet(query);
			if (tagSet.Count == 1)
			{
				return tagSet[0];
			}
			else
			{
				Tag tag = new Tag() { TagText = tagText };
				tag.Update();
				return tag;
			}
		}