Example #1
0
		internal static TagPhoto Get(int tagK, int photoK)
		{
			Query q = new Query(new And(new Q(TagPhoto.Columns.TagK, tagK), new Q(TagPhoto.Columns.PhotoK, photoK)));
			TagPhotoSet set = new TagPhotoSet(q);
			switch (set.Count)
			{
				case 0: return null;
				case 1: return set[0];
				default: throw new Exception("Should not happen as should be unique");
			}
		}
		void view_RemoveTagClick(object sender, EventArgs<string> e)
		{
			Tag tag = Tag.GetTag(e.Value);
			Query query = new Query(new Q(Bobs.TagPhoto.Columns.TagK, tag.K), new Q(Bobs.TagPhoto.Columns.PhotoK, view.Taggable.K));
			TagPhotoSet set = new TagPhotoSet(query);
			if (set.Count > 0)
			{
				set[0].SetDisabledAndUpdate(true);
			}
			view_TaggableChanged(this, null);
		}
		private void Bind()
		{

			uiPhotoImg.Src = Photo.WebPath;
			uiPhotoImg.Width = Photo.WebWidth;
			uiPhotoImg.Height = Photo.WebHeight;

			TagPhotoSet tagPhotoSet = new TagPhotoSet(new Query(new Q(Bobs.TagPhoto.Columns.PhotoK, Photo.K)));


			if (tagPhotoSet.Count == 0)
			{
				uiNoTags.Visible = true;
				uiPhotoTags.Visible = false;
			}
			else
			{
				uiNoTags.Visible = false;
				uiPhotoTags.Visible = true;
				uiPhotoTags.DataSource = tagPhotoSet;
				uiPhotoTags.DataBind();
			}
		}
Example #4
0
		public static TagPhoto GetTagPhoto(int tagK, int photoK)
		{
			Query q = new Query(new And(new Q(TagPhoto.Columns.PhotoK, photoK), new Q(TagPhoto.Columns.TagK, tagK)));
			TagPhotoSet set = new TagPhotoSet(q);
			if (set.Count == 0)
			{
				return null;
			}
			else
			{
				return set[0];
			}

		}