示例#1
0
		void BindVenues()
		{
			Query q = new Query();
			q.QueryCondition = new Q(Venue.Columns.OwnerUsrK, Usr.Current.K);
			q.TableElement = new Join(Venue.Columns.PlaceK, Place.Columns.K);
			q.OrderBy = new OrderBy(new OrderBy(Place.Columns.Name), new OrderBy(Venue.Columns.Name));
			VenueSet vs = new VenueSet(q);
			if (vs.Count > 0)
			{
				VenuesDataGrid.AllowPaging = (vs.Count > VenuesDataGrid.PageSize);
				VenuesDataGrid.DataSource = vs;
				VenuesDataGrid.DataBind();
			}
			else
				VenuesPanel.Visible = false;

		}
示例#2
0
		static void Main(string[] args)
		{
			VenueSet vs = new VenueSet(new Query(new Q(Venue.Columns.Postcode, QueryOperator.NotEqualTo, "")));
			foreach (Venue v in vs)
			{
				try
				{
					KeyValuePair<double, double> latLng = GoogleGeoCoder.GeoCodeAddress(v.Postcode + ", " + v.Place.Country.Code2Letter);
					if (latLng.Key != 0 || latLng.Value != 0)
					{
						Console.WriteLine("{0},{1},{2},UPDATE VENUE WITH (ROWLOCK) SET Lat = {0}, Lon = {1} WHERE K = {2}", latLng.Key, latLng.Value, v.K);
					}
				}
				catch { }
			}

			Console.ReadLine();
		}
示例#3
0
		public void DeleteAll(Transaction transaction)
		{
			if (!this.Bob.DbRecordExists)
				return;


			Query qUsrEventGuestlist = new Query();
			qUsrEventGuestlist.QueryCondition = new Q(UsrEventGuestlist.Columns.UsrK, this.K);
			UsrEventGuestlistSet uegs = new UsrEventGuestlistSet(qUsrEventGuestlist);
			foreach (UsrEventGuestlist ueg in uegs)
			{
				ueg.Delete(transaction);
				ueg.Event.UpdateGuestlistCount(transaction);
			}

			//Promoters
			Query PromoterQ = new Query();
			PromoterQ.TableElement = Promoter.UsrJoin;
			PromoterQ.QueryCondition = new Q(Usr.Columns.K, this.K);
			PromoterSet promoters = new PromoterSet(PromoterQ);

			Delete PromoterUsrDelete = new Delete(
				TablesEnum.PromoterUsr,
				new Q(PromoterUsr.Columns.UsrK, this.K)
			);
			PromoterUsrDelete.CommandTimeout = 3600;
			PromoterUsrDelete.Run(transaction);

			foreach (Promoter p in promoters)
			{
				p.AdminUsrs = null;
				if (p.AdminUsrs.Count == 0)
				{
					p.DeleteAll(transaction);
				}
				else if (p.PrimaryUsrK == this.K)
				{
					p.PrimaryUsrK = p.AdminUsrs[0].K;
					p.Update(transaction);
				}
			}

			//UsrPlaceVisit
			Delete UsrPlaceVisitDelete = new Delete(
				TablesEnum.UsrPlaceVisit,
				new Q(UsrPlaceVisit.Columns.UsrK, this.K)
				);
			UsrPlaceVisitDelete.CommandTimeout = 3600;
			UsrPlaceVisitDelete.Run(transaction);

			//UsrEventAttended
			Delete UsrEventAttendedDelete = new Delete(
				TablesEnum.UsrEventAttended,
				new Q(UsrEventAttended.Columns.UsrK, this.K)
				);
			UsrEventAttendedDelete.CommandTimeout = 3600;
			UsrEventAttendedDelete.Run(transaction);

			//UsrPhotoFavourite
			Delete UsrPhotoFavouriteDelete = new Delete(
				TablesEnum.UsrPhotoFavourite,
				new Q(UsrPhotoFavourite.Columns.UsrK, this.K)
				);
			UsrPhotoFavouriteDelete.CommandTimeout = 3600;
			UsrPhotoFavouriteDelete.Run(transaction);

			//UsrPhotoMe
			PhotoSet psMe = this.PhotosMe(new ColumnSet(Photo.Columns.K, Photo.Columns.EventK, Photo.Columns.FirstUsrK, Photo.Columns.UsrCount), 0);
			foreach (Photo p in psMe)
			{
				this.PhotoMe(p, false, transaction);
			}

			//UsrMusicTypeFavourite
			Delete UsrMusicTypeFavouriteDelete = new Delete(
				TablesEnum.UsrMusicTypeFavourite,
				new Q(UsrMusicTypeFavourite.Columns.UsrK, this.K)
				);
			UsrMusicTypeFavouriteDelete.CommandTimeout = 3600;
			UsrMusicTypeFavouriteDelete.Run(transaction);

			//Buddy / Buddy reverse;
			BuddySet bs = new BuddySet(new Query(new Or(new Q(Buddy.Columns.UsrK, this.K), new Q(Buddy.Columns.BuddyUsrK, this.K))));
			foreach (Buddy b in bs)
				b.DeleteAll(transaction);

			//ChatMessageFrom
			//	Delete ChatMessageFromDelete = new Delete(
			//		TablesEnum.ChatMessage,
			//		new Q(ChatMessage.Columns.FromUsrK,this.K)
			//	);
			//	ChatMessageFromDelete.Run(transaction);

			//ChatMessageTo
			//	Delete ChatMessageToDelete = new Delete(
			//		TablesEnum.ChatMessage,
			//		new Q(ChatMessage.Columns.ToUsrK, this.K)
			//	);
			//	ChatMessageToDelete.Run(transaction);

			//UsrDate
			Delete UsrDateDelete = new Delete(
				TablesEnum.UsrDate,
				new Or(new Q(UsrDate.Columns.UsrK, this.K), new Q(UsrDate.Columns.DateUsrK, this.K))
				);
			UsrDateDelete.CommandTimeout = 3600;
			UsrDateDelete.Run(transaction);

			//Owners - Event
			EventSet esOwner = new EventSet(new Query(new Q(Event.Columns.OwnerUsrK, this.K)));
			foreach (Event e in esOwner)
			{
				e.OwnerUsrK = 8;
				e.Update(transaction);
			}

			BrandSet bsOwner = new BrandSet(new Query(new Q(Brand.Columns.OwnerUsrK, this.K)));
			foreach (Brand b in bsOwner)
			{
				b.OwnerUsrK = 8;
				b.Update(transaction);
			}

			//Owners - Venue
			VenueSet vsOwner = new VenueSet(new Query(new Q(Venue.Columns.OwnerUsrK, this.K)));
			foreach (Venue v in vsOwner)
			{
				v.OwnerUsrK = 8;
				v.Update(transaction);
			}

			//Remove EnabledByUsrK in Photos that this usr has enabled
			PhotoSet pEnableds = new PhotoSet(new Query(new Q(Photo.Columns.EnabledByUsrK, this.K)));
			foreach (Photo p in pEnableds)
			{
				p.EnabledByUsrK = 0;
				p.Update(transaction);
			}

			//ThreadUsr
			Delete ThreadUsrDelete = new Delete(
				TablesEnum.ThreadUsr,
				new Or(new Q(ThreadUsr.Columns.UsrK, this.K), new Q(ThreadUsr.Columns.InvitingUsrK, this.K))
				);
			ThreadUsrDelete.CommandTimeout = 3600;
			ThreadUsrDelete.Run(transaction);

			//CommentAlert
			Delete CommentAlertDelete = new Delete(
				TablesEnum.CommentAlert,
				new Q(CommentAlert.Columns.UsrK, this.K)
			);
			CommentAlertDelete.CommandTimeout = 3600;
			CommentAlertDelete.Run(transaction);


			//GroupUsr
			Delete GroupUsrDelete = new Delete(
				TablesEnum.GroupUsr,
				new Q(GroupUsr.Columns.UsrK, this.K)
				);
			GroupUsrDelete.CommandTimeout = 3600;
			GroupUsrDelete.Run(transaction);


			//Threads?
			ThreadSet ts = new ThreadSet(new Query(new Q(Thread.Columns.UsrK, this.K)));
			foreach (Thread t in ts)
				t.DeleteAll(transaction);

			Bobs.Update uLastPostUsrK = new Bobs.Update();
			uLastPostUsrK.Changes.Add(new Assign(Thread.Columns.LastPostUsrK, 0));
			uLastPostUsrK.Table = TablesEnum.Thread;
			uLastPostUsrK.Where = new Q(Thread.Columns.LastPostUsrK, this.K);
			uLastPostUsrK.CommandTimeout = 3600;
			uLastPostUsrK.Run(transaction);

			Bobs.Update uFirstParticipantUsrK = new Bobs.Update();
			uFirstParticipantUsrK.Changes.Add(new Assign(Thread.Columns.FirstParticipantUsrK, 0));
			uFirstParticipantUsrK.Table = TablesEnum.Thread;
			uFirstParticipantUsrK.Where = new Q(Thread.Columns.FirstParticipantUsrK, this.K);
			uFirstParticipantUsrK.CommandTimeout = 3600;
			uFirstParticipantUsrK.Run();

			//Comments?
			CommentSet cs = new CommentSet(new Query(new Q(Comment.Columns.UsrK, this.K)));
			foreach (Comment c in cs)
				c.DeleteAll(transaction);

			//PhotoReview ???
			PhotoReviewSet prs = new PhotoReviewSet(new Query(new Q(PhotoReview.Columns.UsrK, this.K)));
			foreach (PhotoReview pr in prs)
			{
				pr.Delete(transaction);
				pr.Photo.UpdateStats(transaction);
			}

			//Galleries
			GallerySet gs = new GallerySet(new Query(new Q(Gallery.Columns.OwnerUsrK, this.K)));
			foreach (Gallery g in gs)
				g.DeleteAll(transaction);

			//Photos
			PhotoSet ps = new PhotoSet(new Query(new Q(Photo.Columns.UsrK, this.K)));
			foreach (Photo p in ps)
				p.DeleteAll(transaction);

			//Aticles
			ArticleSet ars = new ArticleSet(new Query(new Q(Article.Columns.OwnerUsrK, this.K)));
			foreach (Article a in ars)
				a.DeleteAll(transaction);

			int k = this.K;

			//Usr-AddedByUsrK
			UsrSet usrsAddedByUsr = new UsrSet(new Query(new Q(Usr.Columns.AddedByUsrK, this.K)));
			foreach (Usr u in usrsAddedByUsr)
			{
				u.AddedByUsrK = 0;
				u.Update(transaction);
			}

			Guid oldPic = this.Pic;

			//Usr
			this.Delete(transaction);

			if (oldPic != Guid.Empty)
				Storage.RemoveFromStore(Storage.Stores.Pix, oldPic, "jpg");

		}
示例#4
0
		public void StripAll()
		{
			Query qUsrEventGuestlist = new Query();
			qUsrEventGuestlist.QueryCondition = new Q(UsrEventGuestlist.Columns.UsrK, this.K);
			UsrEventGuestlistSet uegs = new UsrEventGuestlistSet(qUsrEventGuestlist);
			foreach (UsrEventGuestlist ueg in uegs)
			{
				ueg.Delete();
				ueg.Update();
				ueg.Event.UpdateGuestlistCount();
			}

			//UsrPlaceVisit
			Delete UsrPlaceVisitDelete = new Delete(
				TablesEnum.UsrPlaceVisit,
				new Q(UsrPlaceVisit.Columns.UsrK, this.K)
				);
			UsrPlaceVisitDelete.Run();

			//UsrEventAttended
			Delete UsrEventAttendedDelete = new Delete(
				TablesEnum.UsrEventAttended,
				new Q(UsrEventAttended.Columns.UsrK, this.K)
				);
			UsrEventAttendedDelete.Run();

			//UsrPhotoFavourite
			Delete UsrPhotoFavouriteDelete = new Delete(
				TablesEnum.UsrPhotoFavourite,
				new Q(UsrPhotoFavourite.Columns.UsrK, this.K)
				);
			UsrPhotoFavouriteDelete.Run();

			//UsrPhotoMe
			Delete UsrPhotoMeDelete = new Delete(
				TablesEnum.UsrPhotoMe,
				new Q(UsrPhotoMe.Columns.UsrK, this.K)
				);
			UsrPhotoMeDelete.Run();

			//UsrMusicTypeFavourite
			Delete UsrMusicTypeFavouriteDelete = new Delete(
				TablesEnum.UsrMusicTypeFavourite,
				new Q(UsrMusicTypeFavourite.Columns.UsrK, this.K)
				);
			UsrMusicTypeFavouriteDelete.Run();

			//Buddy / Buddy reverse;
			BuddySet bs = new BuddySet(new Query(new Or(new Q(Buddy.Columns.UsrK, this.K), new Q(Buddy.Columns.BuddyUsrK, this.K))));
			foreach (Buddy b in bs)
				b.DeleteAll(null);

			//UsrDate
			Delete UsrDateDelete = new Delete(
				TablesEnum.UsrDate,
				new Or(new Q(UsrDate.Columns.UsrK, this.K), new Q(UsrDate.Columns.DateUsrK, this.K))
				);
			UsrDateDelete.Run();

			//Owners - Event
			EventSet esOwner = new EventSet(new Query(new Q(Event.Columns.OwnerUsrK, this.K)));
			foreach (Event e in esOwner)
			{
				e.DeleteAllUsr(Usr.Current);
				//e.OwnerUsrK=4;
				//e.Update();
			}

			BrandSet bsOwner = new BrandSet(new Query(new Q(Brand.Columns.OwnerUsrK, this.K)));
			foreach (Brand b in bsOwner)
			{
				b.DeleteAll(null);
				//b.OwnerUsrK=4;
				//b.Update();
			}

			//Owners - Venue
			VenueSet vsOwner = new VenueSet(new Query(new Q(Venue.Columns.OwnerUsrK, this.K)));
			foreach (Venue v in vsOwner)
			{
				v.DeleteAllUsr(Usr.Current);
				//v.OwnerUsrK=4;
				//v.Update();
			}

			//PhotoReview ???
			PhotoReviewSet prs = new PhotoReviewSet(new Query(new Q(PhotoReview.Columns.UsrK, this.K)));
			foreach (PhotoReview pr in prs)
			{
				pr.Delete();
				pr.Update();
				pr.Photo.UpdateStats(null);
			}

			//Galleries
			GallerySet gs = new GallerySet(new Query(new Q(Gallery.Columns.OwnerUsrK, this.K)));
			foreach (Gallery g in gs)
				g.DeleteAll(null);

			//Photos
			PhotoSet ps = new PhotoSet(new Query(new Q(Photo.Columns.UsrK, this.K)));
			foreach (Photo p in ps)
				p.DeleteAll(null);

			//Aticles
			ArticleSet ars = new ArticleSet(new Query(new Q(Article.Columns.OwnerUsrK, this.K)));
			foreach (Article a in ars)
				a.DeleteAll(null);

			Guid oldPic = Pic;

			this.PicPhotoK = 0;
			this.PicState = "";
			this.Pic = Guid.Empty;
			this.PicOriginal = Guid.Empty;
			//this.NickName=Usr.GetCompliantNickName("user-"+this.K.ToString());
			this.PersonalStatement = "";
			this.IsSingle = false;
			this.EnhancedSecurity = true;
			this.IsSpotter = false;
			Random r = new Random();
			this.LoginString = Cambro.Misc.Utility.GenRandomText(6, r);
			this.SetPassword(Cambro.Misc.Utility.GenRandomText(10, r), false);

			int k = this.K;

			//Usr
			this.Update();

			if (oldPic != Guid.Empty)
				Storage.RemoveFromStore(Storage.Stores.Pix, oldPic, "jpg");

		}
示例#5
0
		private void VenuesPanel_Load(object sender, System.EventArgs e)
		{
			PlaceNameLabel1.Text = CurrentPlace.Name;
			PlaceNameLabel2.Text = CurrentPlace.Name;
			PlaceNameLabel3.Text = CurrentPlace.Name;

			SuggestVenueLink.HRef = CurrentPlace.UrlAddVenue();
			SuggestVenueLink1.HRef = CurrentPlace.UrlAddVenue();

			Query q = new Query();
			q.QueryCondition = new And(
				new Q(Venue.Columns.PlaceK, CurrentPlace.K),
				new Q(Venue.Columns.RegularEvents, true));
			q.OrderBy = new OrderBy(Venue.Columns.TotalEvents, OrderBy.OrderDirection.Descending);

			q.TopRecords = 18;
			q.Columns = Templates.Venues.PlaceVenuesListSmall.Columns;
			VenueSet vs = new VenueSet(q);

			if (vs.Count == 0)
			{
				VenueDataListDiv.Visible = false;
				VenuesMorePanel.Visible = false;
				NoVenuesDiv.Visible = true;
			}
			else
			{
				NoVenuesDiv.Visible = false;
				VenueDataListDiv.Visible = true;
				VenueDataList.ItemTemplate = this.LoadTemplate("/Templates/Venues/PlaceVenuesListSmall.ascx");

				if (vs.Count == 18)
				{
					VenuesMorePanel.Visible = true;
					VenuesMoreLink.HRef = CurrentPlace.UrlApp("venues");
					VenueDataList.DataSource = vs;
				}
				else
				{
					VenuesMorePanel.Visible = false;
					VenueDataList.DataSource = vs;
				}
				VenueDataList.DataBind();

			}
		}
示例#6
0
		public static VenueSet SimilarVenuesStatic(string name, Place place, int excludeVenueK, string postCode)
		{
			//split name into words and get all > 3 chars...
			ArrayList al = new ArrayList();
			ArrayList commonWords = new ArrayList(Q.CommonWords);
			commonWords.Add("bar");
			commonWords.Add("club");
			string[] words = name.Split(' ');
			int wordsCount = 0;
			foreach (string word in words)
			{
				if (!commonWords.Contains(word.ToLower()) && word.Length>1)
				{
					al.Add(new Q(Columns.Name,QueryOperator.TextContains,word));
					wordsCount++;
				}
			}
			Q wordsOr = new Q(true);
			if (wordsCount>0)
				wordsOr = new Or((Q[])al.ToArray(typeof(Q)));
			else
				wordsOr = new Q(false);

			//10 nearest places also
			Query qPlaces = new Query();
			qPlaces.TopRecords=10;
			qPlaces.OrderBy=place.NearestPlacesOrderBy;
			PlaceSet ps = new PlaceSet(qPlaces);
			ArrayList al1 = new ArrayList();
			foreach (Place p in ps)
			{
				al1.Add(new Q(Columns.PlaceK,p.K));
			}
			Or placesOr = new Or((Q[])al1.ToArray(typeof(Q)));

			Q thisVenue = new Q(true);
			if (excludeVenueK>0)
				thisVenue = new Q(Columns.K,QueryOperator.NotEqualTo,excludeVenueK);

			Q postCodeQ = null;
			if (postCode.Length>0)
				postCodeQ = new Q(Columns.Postcode,postCode);
			else
				postCodeQ = new Q(false);

			Query qSimilar = new Query();
			qSimilar.QueryCondition = new And(new Or(new And(wordsOr, placesOr), postCodeQ), thisVenue);
			VenueSet vsSimilar = new VenueSet(qSimilar);
			return vsSimilar;



		
		}
示例#7
0
		public void CreateUniqueUrlName(bool UpdateChildUrlFragments)
		{
			string urlName = UrlInfo.GetUrlName(this.Name);
			if (urlName.Length==0)
				urlName = "venue-"+this.K.ToString();
			if (UrlInfo.IsReservedString(urlName))
				urlName = "venue-"+urlName;

			VenueSet vs = null;
			int namePost = 0;
			string newName = urlName;
			while (vs==null || vs.Count>0)
			{
				if (namePost>0)
					newName = urlName+"-"+namePost.ToString();
				Query q = new Query();
				q.NoLock=true;
				q.ReturnCountOnly=true;
				q.QueryCondition=new And(
					new Q(Columns.PlaceK,this.PlaceK),
					new Q(Columns.K,QueryOperator.NotEqualTo,this.K),
					new Q(Columns.UrlName,newName));
				vs = new VenueSet(q);
				namePost++;
			}
			if (!this.UrlName.Equals(newName))
			{
				this.UrlName = newName;
				this.Update();
				if (UpdateChildUrlFragments)
				{
					Utilities.UpdateChildUrlFragmentsJob job = new Utilities.UpdateChildUrlFragmentsJob(Model.Entities.ObjectType.Venue, this.K, true);
					job.ExecuteAsynchronously();
				}
			}
		}
示例#8
0
		public void UpdateChildUrlFragments(bool Cascade)
		{
			Update uVenues = new Update();
			uVenues.Table=TablesEnum.Venue;
			uVenues.Changes.Add(new Assign(Venue.Columns.UrlFragment,UrlFilterPart));
			uVenues.Where=new Q(Venue.Columns.PlaceK,this.K);
			uVenues.Run();

			if (Cascade)
			{
				Query q = new Query();
				q.NoLock=true;
				q.QueryCondition=new Q(Venue.Columns.PlaceK,this.K);
				q.Columns=new ColumnSet(
					Venue.Columns.K, 
					Venue.Columns.UrlFragment, 
					Venue.Columns.PlaceK,
					Venue.Columns.UrlName);
				VenueSet vs = new VenueSet(q);
				foreach (Venue v in vs)
				{
					try
					{
						Utilities.UpdateChildUrlFragmentsJob job = new Utilities.UpdateChildUrlFragmentsJob(Model.Entities.ObjectType.Venue, v.K, true);
						job.ExecuteAsynchronously();
					}
					catch(Exception ex)
					{
						if (Vars.DevEnv)
							throw ex;
					}
				}
			}

			Update uThreads = new Update();
			uThreads.Table=TablesEnum.Thread;
			uThreads.Changes.Add(new Assign(Thread.Columns.UrlFragment,UrlFilterPart));
			uThreads.Where=new And(
				new Q(Thread.Columns.ParentObjectType,Model.Entities.ObjectType.Place),
				new Q(Thread.Columns.ParentObjectK,this.K));
			uThreads.Run();

			Update uArticles = new Update();
			uArticles.Table=TablesEnum.Article;
			uArticles.Changes.Add(new Assign(Article.Columns.UrlFragment,UrlFilterPart));
			uArticles.Where=new And(
				new Q(Article.Columns.ParentObjectType,Model.Entities.ObjectType.Place),
				new Q(Article.Columns.ParentObjectK,this.K));
			uArticles.Run();

			if (Cascade)
			{
				Query q = new Query();
				q.NoLock=true;
				q.QueryCondition=new And(
					new Q(Article.Columns.ParentObjectType,Model.Entities.ObjectType.Place),
					new Q(Article.Columns.ParentObjectK,this.K));
				q.Columns=new ColumnSet(
					Article.Columns.K,
					Article.Columns.UrlFragment,
					Article.Columns.ParentObjectK,
					Article.Columns.ParentObjectType);
				ArticleSet aSet = new ArticleSet(q);
				foreach (Article a in aSet)
				{
					try
					{
						Utilities.UpdateChildUrlFragmentsJob job = new Utilities.UpdateChildUrlFragmentsJob(Model.Entities.ObjectType.Article, a.K, true);
						job.ExecuteAsynchronously();
					}
					catch(Exception ex)
					{
						if (Vars.DevEnv)
							throw ex;
					}
				}
			}
		}
		protected void PromoterSelected(object o, EventArgs e)
		{
			DisplayDomainsPromoterK = PromoterK;
			Brands = new BrandSet(new Query(new Q(Brand.Columns.PromoterK, PromoterK)));
			Venues = new VenueSet(new Query(new Q(Venue.Columns.PromoterK, PromoterK)));
			SetStage(Stage.SetNewDomainDetails);
		}
示例#10
0
		private void Page_Load(object sender, System.EventArgs e)
		{
			Response.ContentType = "text/xml";
			Response.Clear();
			Response.Buffer = false;

			XmlTextWriter x = new XmlTextWriter(Response.OutputStream, Encoding.UTF8);
			x.Formatting = Formatting.Indented;
			x.WriteRaw("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");

			string dateFormat = "yyyy-MM-ddTHH:mm:sszzz";

			if (Request.QueryString[0].Equals("index"))
			{
				#region sitemapindex
				x.WriteStartElement("sitemapindex");
				x.WriteAttributeString("xmlns", "http://www.google.com/schemas/sitemap/0.84");

				if (true)
				{
					#region sitemap - countries
					x.WriteStartElement("sitemap");
					x.WriteElementString("loc", "http://www.dontstayin.com/sitemapxml?country");
					Query q = new Query();
					q.QueryCondition = new And(
						new Q(Thread.Columns.Private, false),
						new Q(Thread.Columns.PrivateGroup, false),
						new Q(Thread.Columns.GroupPrivate, false)
						);
					q.OrderBy = new OrderBy(Thread.Columns.LastPost, OrderBy.OrderDirection.Descending);
					q.TopRecords = 1;
					ThreadSet bobset = new ThreadSet(q);
					if (bobset.Count > 0)
						x.WriteElementString("lastmod", bobset[0].LastPost.ToString(dateFormat));
					x.WriteEndElement();	//sitemap
					#endregion
				}

				if (true)
				{
					#region sitemap - place
					x.WriteStartElement("sitemap");
					x.WriteElementString("loc", "http://www.dontstayin.com/sitemapxml?place");

					Query q = new Query();
					q.OrderBy = new OrderBy(Place.Columns.LastPost, OrderBy.OrderDirection.Descending);
					q.TopRecords = 1;
					PlaceSet bobset = new PlaceSet(q);
					if (bobset.Count > 0)
						x.WriteElementString("lastmod", bobset[0].LastPost.ToString(dateFormat));

					x.WriteEndElement();	//sitemap
					#endregion
				}

				if (true)
				{
					#region sitemap - venue
					x.WriteStartElement("sitemap");
					x.WriteElementString("loc", "http://www.dontstayin.com/sitemapxml?venue");

					Query q = new Query();
					q.OrderBy = new OrderBy(Venue.Columns.LastPost, OrderBy.OrderDirection.Descending);
					q.TopRecords = 1;
					VenueSet bobset = new VenueSet(q);
					if (bobset.Count > 0)
						x.WriteElementString("lastmod", bobset[0].LastPost.ToString(dateFormat));

					x.WriteEndElement();	//sitemap
					#endregion
				}

				if (true)
				{
					#region sitemap - event
					x.WriteStartElement("sitemap");
					x.WriteElementString("loc", "http://www.dontstayin.com/sitemapxml?event");

					Query q = new Query();
					q.OrderBy = new OrderBy(Event.Columns.LastPost, OrderBy.OrderDirection.Descending);
					q.TopRecords = 1;
					EventSet bobset = new EventSet(q);
					if (bobset.Count > 0)
						x.WriteElementString("lastmod", bobset[0].LastPost.ToString(dateFormat));

					x.WriteEndElement();	//sitemap
					#endregion
				}

				if (true)
				{
					#region sitemap - thread
					x.WriteStartElement("sitemap");
					x.WriteElementString("loc", "http://www.dontstayin.com/sitemapxml?thread");

					Query q = new Query();
					q.QueryCondition = new And(
						new Q(Thread.Columns.Private, false),
						new Q(Thread.Columns.PrivateGroup, false),
						new Q(Thread.Columns.GroupPrivate, false)
						);
					q.OrderBy = new OrderBy(Thread.Columns.LastPost, OrderBy.OrderDirection.Descending);
					q.TopRecords = 1;
					ThreadSet bobset = new ThreadSet(q);
					if (bobset.Count > 0)
						x.WriteElementString("lastmod", bobset[0].LastPost.ToString(dateFormat));

					x.WriteEndElement();	//sitemap
					#endregion
				}

				if (true)
				{
					#region sitemap - photo
					x.WriteStartElement("sitemap");
					x.WriteElementString("loc", "http://www.dontstayin.com/sitemapxml?photo");

					Query q = new Query();
					q.QueryCondition = Photo.EnabledQueryCondition;
					q.OrderBy = new OrderBy(Photo.Columns.EnabledDateTime, OrderBy.OrderDirection.Descending);
					q.TopRecords = 1;
					PhotoSet bobset = new PhotoSet(q);
					if (bobset.Count > 0)
						x.WriteElementString("lastmod", bobset[0].EnabledDateTime.ToString(dateFormat));

					x.WriteEndElement();	//sitemap
					#endregion
				}

				if (true)
				{
					#region sitemap - usr
					x.WriteStartElement("sitemap");
					x.WriteElementString("loc", "http://www.dontstayin.com/sitemapxml?usr");
					x.WriteEndElement();	//sitemap
					#endregion
				}

				if (true)
				{
					#region sitemap - article
					x.WriteStartElement("sitemap");
					x.WriteElementString("loc", "http://www.dontstayin.com/sitemapxml?article");

					Query q = new Query();
					q.QueryCondition = Article.EnabledQueryCondition;
					q.OrderBy = new OrderBy(Article.Columns.EnabledDateTime, OrderBy.OrderDirection.Descending);
					q.TopRecords = 1;
					ArticleSet bobset = new ArticleSet(q);
					if (bobset.Count > 0)
						x.WriteElementString("lastmod", bobset[0].EnabledDateTime.ToString(dateFormat));

					x.WriteEndElement();	//sitemap
					#endregion
				}

				if (true)
				{
					#region sitemap - comp
					x.WriteStartElement("sitemap");
					x.WriteElementString("loc", "http://www.dontstayin.com/sitemapxml?comp");
					x.WriteEndElement();	//sitemap
					#endregion
				}

				if (true)
				{
					#region sitemap - brand
					x.WriteStartElement("sitemap");
					x.WriteElementString("loc", "http://www.dontstayin.com/sitemapxml?brand");

					Query q = new Query();
					q.OrderBy = new OrderBy(Brand.Columns.LastPost, OrderBy.OrderDirection.Descending);
					q.TopRecords = 1;
					BrandSet bobset = new BrandSet(q);
					if (bobset.Count > 0)
						x.WriteElementString("lastmod", bobset[0].LastPost.ToString(dateFormat));

					x.WriteEndElement();	//sitemap
					#endregion
				}


				if (true)
				{
					#region sitemap - group
					x.WriteStartElement("sitemap");
					x.WriteElementString("loc", "http://www.dontstayin.com/sitemapxml?group");

					Query q = new Query();
					q.QueryCondition = new And(
						new Q(Group.Columns.BrandK, 0),
						new Q(Group.Columns.PrivateGroupPage, false));
					q.OrderBy = new OrderBy(Group.Columns.LastPost, OrderBy.OrderDirection.Descending);
					q.TopRecords = 1;
					GroupSet bobset = new GroupSet(q);
					if (bobset.Count > 0)
						x.WriteElementString("lastmod", bobset[0].LastPost.Value.ToString(dateFormat));

					x.WriteEndElement();	//sitemap
					#endregion
				}

				x.WriteEndElement();	//sitemapindex
				#endregion
			}
			else
			{
				#region urlset
				x.WriteStartElement("urlset");
				x.WriteAttributeString("xmlns", "http://www.google.com/schemas/sitemap/0.84");

				#region Countries
				if (Request.QueryString[0].Equals("country"))
				{
					if (true)
					{
						#region url
						x.WriteStartElement("url");
						x.WriteElementString("loc", "http://www.dontstayin.com/");
						Query q = new Query();
						q.QueryCondition = new And(
							new Q(Thread.Columns.Private, false),
							new Q(Thread.Columns.PrivateGroup, false),
							new Q(Thread.Columns.GroupPrivate, false)
							);
						q.OrderBy = new OrderBy(Thread.Columns.LastPost, OrderBy.OrderDirection.Descending);
						q.TopRecords = 1;
						ThreadSet bobset = new ThreadSet(q);
						if (bobset.Count > 0)
							x.WriteElementString("lastmod", bobset[0].LastPost.ToString(dateFormat));
						x.WriteElementString("changefreq", "hourly");
						x.WriteEndElement();	//url
						#endregion
					}

					if (true)
					{
						Query q = new Query();
						q.QueryCondition = new Q(Country.Columns.TotalEvents, QueryOperator.GreaterThan, 0);
						q.OrderBy = new OrderBy(Country.Columns.TotalEvents, OrderBy.OrderDirection.Descending);
						q.Columns = new ColumnSet(Country.LinkColumns, Country.Columns.TotalEvents);
						if (Vars.DevEnv)
							q.TopRecords = 10;
						CountrySet bobset = new CountrySet(q);
						for (int i = 0; i < bobset.Count; i++)
						{
							Country p = bobset[i];
							#region url
							x.WriteStartElement("url");
							x.WriteElementString("loc", "http://www.dontstayin.com" + p.Url());
							if (p.TotalEvents > 100)
								x.WriteElementString("changefreq", "hourly");
							else if (p.TotalEvents > 20)
								x.WriteElementString("changefreq", "daily");
							else if (p.TotalEvents > 10)
								x.WriteElementString("changefreq", "weekly");
							else
								x.WriteElementString("changefreq", "monthly");
							x.WriteEndElement();	//url
							#endregion
							bobset.Kill(i);
						}
					}
				}
				#endregion

				#region Places
				if (Request.QueryString[0].Equals("place"))
				{
					Query q = new Query();
					q.QueryCondition = new Or(
						new Q(Place.Columns.TotalComments, QueryOperator.GreaterThan, 0),
						new Q(Place.Columns.TotalEvents, QueryOperator.GreaterThan, 0));
					q.OrderBy = new OrderBy(Place.Columns.TotalComments, OrderBy.OrderDirection.Descending);
					q.Columns = new ColumnSet(Place.LinkColumns, Place.Columns.LastPost);
					if (Vars.DevEnv)
						q.TopRecords = 10;
					else
						q.TopRecords = 40000;
					PlaceSet bobset = new PlaceSet(q);
					for (int i = 0; i < bobset.Count; i++)
					{
						Place p = bobset[i];
						#region url
						x.WriteStartElement("url");
						x.WriteElementString("loc", "http://www.dontstayin.com" + p.Url());
						if (p.LastPost != DateTime.MinValue)
						{
							x.WriteElementString("lastmod", p.LastPost.ToString(dateFormat));
							TimeSpan ts = DateTime.Now.Subtract(p.LastPost);
							if (ts.TotalHours < 24)
								x.WriteElementString("changefreq", "hourly");
							else if (ts.TotalDays < 7)
								x.WriteElementString("changefreq", "daily");
							else if (ts.TotalDays < 30)
								x.WriteElementString("changefreq", "weekly");
							else
								x.WriteElementString("changefreq", "monthly");
						}
						else
							x.WriteElementString("changefreq", "monthly");
						x.WriteEndElement();	//url
						#endregion
						bobset.Kill(i);
					}
				}
				#endregion

				#region Venues
				if (Request.QueryString[0].Equals("venue"))
				{
					Query q = new Query();
					q.OrderBy = new OrderBy(Venue.Columns.TotalEvents, OrderBy.OrderDirection.Descending);
					q.Columns = new ColumnSet(Venue.LinkColumns, Venue.Columns.LastPost, Venue.Columns.TotalEvents);
					if (Vars.DevEnv)
						q.TopRecords = 10;
					else
						q.TopRecords = 40000;
					VenueSet bobset = new VenueSet(q);
					for (int i = 0; i < bobset.Count; i++)
					{
						Venue v = bobset[i];
						#region url
						x.WriteStartElement("url");
						x.WriteElementString("loc", "http://www.dontstayin.com" + v.Url());
						if (v.LastPost != DateTime.MinValue)
						{
							x.WriteElementString("lastmod", v.LastPost.ToString(dateFormat));
							TimeSpan ts = DateTime.Now.Subtract(v.LastPost);
							if (ts.TotalHours < 24)
								x.WriteElementString("changefreq", "hourly");
							else if (ts.TotalDays < 7)
								x.WriteElementString("changefreq", "daily");
							else if (ts.TotalDays < 30)
								x.WriteElementString("changefreq", "weekly");
							else
								x.WriteElementString("changefreq", "monthly");
						}
						else if (v.TotalEvents > 10)
							x.WriteElementString("changefreq", "weekly");
						else
							x.WriteElementString("changefreq", "monthly");

						x.WriteEndElement();	//url
						#endregion
						bobset.Kill(i);
					}
				}
				#endregion

				#region Events
				if (Request.QueryString[0].Equals("event"))
				{
					Query q = new Query();
					q.OrderBy = new OrderBy(Event.Columns.LastPost, OrderBy.OrderDirection.Descending);
					q.Columns = new ColumnSet(Event.LinkColumns, Event.Columns.LastPost, Event.Columns.DateTime);
					if (Vars.DevEnv)
						q.TopRecords = 10;
					else
						q.TopRecords = 40000;
					EventSet bobset = new EventSet(q);
					for (int i = 0; i < bobset.Count; i++)
					{
						Event ev = bobset[i];
						#region url
						x.WriteStartElement("url");
						x.WriteElementString("loc", "http://www.dontstayin.com" + ev.Url());
						if (ev.LastPost != DateTime.MinValue)
						{
							x.WriteElementString("lastmod", ev.LastPost.ToString(dateFormat));
							TimeSpan ts = DateTime.Now.Subtract(ev.LastPost);
							if (ts.TotalHours < 24)
								x.WriteElementString("changefreq", "hourly");
							else if (ts.TotalDays < 7)
								x.WriteElementString("changefreq", "daily");
							else if (ts.TotalDays < 30)
								x.WriteElementString("changefreq", "weekly");
							else
								x.WriteElementString("changefreq", "monthly");
						}
						else
							x.WriteElementString("changefreq", "monthly");
						x.WriteEndElement();	//url
						#endregion
						bobset.Kill(i);
					}
				}
				#endregion

				#region Threads
				if (Request.QueryString[0].Equals("thread"))
				{
					Query q = new Query();
					q.QueryCondition = new And(
						new Q(Thread.Columns.Private, false),
						new Q(Thread.Columns.PrivateGroup, false),
						new Q(Thread.Columns.GroupPrivate, false)
					);
					q.Columns = new ColumnSet(Thread.Columns.K, Thread.Columns.UrlFragment, Thread.Columns.TotalComments, Thread.Columns.LastPost);
					q.OrderBy = new OrderBy(Thread.Columns.LastPost, OrderBy.OrderDirection.Descending);
					if (Vars.DevEnv)
						q.TopRecords = 10;
					else
						q.TopRecords = 40000;
					ThreadSet bobset = new ThreadSet(q);
					for (int i = 0; i < bobset.Count; i++)
					{
						Thread t = bobset[i];
						#region url
						x.WriteStartElement("url");
						if (t.LastPage == 1)
							x.WriteElementString("loc", "http://www.dontstayin.com" + t.Url());
						else
							x.WriteElementString("loc", "http://www.dontstayin.com" + t.Url("c", t.LastPage.ToString()));
						x.WriteElementString("lastmod", t.LastPost.ToString(dateFormat));
						TimeSpan ts = DateTime.Now.Subtract(t.LastPost);
						if (ts.TotalHours < 24)
							x.WriteElementString("changefreq", "hourly");
						else if (ts.TotalDays < 7)
							x.WriteElementString("changefreq", "daily");
						else if (ts.TotalDays < 30)
							x.WriteElementString("changefreq", "weekly");
						else
							x.WriteElementString("changefreq", "monthly");
						x.WriteEndElement();	//url
						#endregion
						bobset.Kill(i);
					}
				}
				#endregion

				#region Photos
				if (Request.QueryString[0].Equals("photo"))
				{
					Query q = new Query();
					q.QueryCondition = Photo.EnabledQueryCondition;
					q.Columns = new ColumnSet(Photo.Columns.K, Photo.Columns.UrlFragment, Photo.Columns.EventK, Photo.Columns.ArticleK);
					q.OrderBy = new OrderBy(Photo.Columns.EnabledDateTime, OrderBy.OrderDirection.Descending);
					if (Vars.DevEnv)
						q.TopRecords = 10;
					else
						q.TopRecords = 50000;
					PhotoSet bobset = new PhotoSet(q);
					for (int i = 0; i < bobset.Count; i++)
					{
						Photo p = bobset[i];
						#region url
						x.WriteStartElement("url");
						x.WriteElementString("loc", "http://www.dontstayin.com" + p.Url());
						x.WriteEndElement();	//url
						#endregion
						bobset.Kill(i);
					}
				}
				#endregion

				#region Usrs
				if (Request.QueryString[0].Equals("usr"))
				{
					Query q = new Query();
					q.QueryCondition = new And(
						new Q(Usr.Columns.IsSkeleton, false),
						new Q(Usr.Columns.IsEmailVerified, true),
						new Or(
						new Q(Usr.Columns.Pic, QueryOperator.NotEqualTo, Guid.Empty),
						new Q(Usr.Columns.CommentCount, QueryOperator.NotEqualTo, 0)
						)
					);
					q.Columns = new ColumnSet(Usr.Columns.NickName);
					q.OrderBy = new OrderBy(Usr.Columns.DateTimeLastPageRequest, OrderBy.OrderDirection.Descending);
					if (Vars.DevEnv)
						q.TopRecords = 10;
					else
						q.TopRecords = 50000;
					UsrSet bobset = new UsrSet(q);
					for (int i = 0; i < bobset.Count; i++)
					{
						Usr u = bobset[i];
						#region url
						x.WriteStartElement("url");
						x.WriteElementString("loc", "http://www.dontstayin.com" + u.Url());
						x.WriteEndElement();	//url
						#endregion
						bobset.Kill(i);
					}
				}
				#endregion

				#region Articles
				if (Request.QueryString[0].Equals("article"))
				{
					Query q = new Query();
					q.QueryCondition = Article.EnabledQueryCondition;
					q.Columns = new ColumnSet(Article.Columns.UrlFragment,
					Article.Columns.ParentObjectK,
					Article.Columns.ParentObjectType, Article.Columns.K);
					q.OrderBy = new OrderBy(Article.Columns.EnabledDateTime, OrderBy.OrderDirection.Descending);
					if (Vars.DevEnv)
						q.TopRecords = 10;
					else
						q.TopRecords = 50000;
					ArticleSet bobset = new ArticleSet(q);
					for (int i = 0; i < bobset.Count; i++)
					{
						Article a = bobset[i];
						#region url
						x.WriteStartElement("url");
						x.WriteElementString("loc", "http://www.dontstayin.com" + a.Url());
						x.WriteEndElement();	//url
						#endregion
						bobset.Kill(i);
					}
				}
				#endregion

				#region Competitions
				if (Request.QueryString[0].Equals("comp"))
				{
					Query q = new Query();
					q.QueryCondition = new Q(Comp.Columns.Status, Comp.StatusEnum.Enabled);
					q.Columns = new ColumnSet(Comp.Columns.K);
					q.OrderBy = new OrderBy(Comp.Columns.DateTimeClose, OrderBy.OrderDirection.Descending);
					if (Vars.DevEnv)
						q.TopRecords = 10;
					else
						q.TopRecords = 50000;
					CompSet bobset = new CompSet(q);
					for (int i = 0; i < bobset.Count; i++)
					{
						Comp c = bobset[i];
						#region url
						x.WriteStartElement("url");
						x.WriteElementString("loc", "http://www.dontstayin.com" + c.Url());
						x.WriteEndElement();	//url
						#endregion
						bobset.Kill(i);
					}
				}
				#endregion

				#region Brands
				if (Request.QueryString[0].Equals("brand"))
				{
					Query q = new Query();
					q.OrderBy = new OrderBy(Brand.Columns.LastPost, OrderBy.OrderDirection.Descending);
					q.Columns = new ColumnSet(Brand.LinkColumns, Brand.Columns.LastPost);
					if (Vars.DevEnv)
						q.TopRecords = 10;
					else
						q.TopRecords = 40000;
					BrandSet bobset = new BrandSet(q);
					for (int i = 0; i < bobset.Count; i++)
					{
						Brand b = bobset[i];
						#region url
						x.WriteStartElement("url");
						x.WriteElementString("loc", "http://www.dontstayin.com" + b.Url());
						if (b.LastPost > DateTime.MinValue)
						{
							x.WriteElementString("lastmod", b.LastPost.ToString(dateFormat));
							TimeSpan ts = DateTime.Now.Subtract(b.LastPost);
							if (ts.TotalHours < 24)
								x.WriteElementString("changefreq", "hourly");
							else if (ts.TotalDays < 7)
								x.WriteElementString("changefreq", "daily");
							else if (ts.TotalDays < 30)
								x.WriteElementString("changefreq", "weekly");
							else
								x.WriteElementString("changefreq", "monthly");
						}
						else
							x.WriteElementString("changefreq", "monthly");
						x.WriteEndElement();	//url
						#endregion
						bobset.Kill(i);
					}
				}
				#endregion

				#region Groups
				if (Request.QueryString[0].Equals("group"))
				{
					Query q = new Query();
					q.QueryCondition = new And(
						new Q(Group.Columns.BrandK, 0),
						new Q(Group.Columns.PrivateGroupPage, false));
					q.OrderBy = new OrderBy(Group.Columns.LastPost, OrderBy.OrderDirection.Descending);
					q.Columns = new ColumnSet(Group.Columns.BrandK, Group.Columns.UrlName, Group.Columns.LastPost);
					if (Vars.DevEnv)
						q.TopRecords = 10;
					else
						q.TopRecords = 40000;
					GroupSet bobset = new GroupSet(q);
					for (int i = 0; i < bobset.Count; i++)
					{
						Group g = bobset[i];
						#region url
						x.WriteStartElement("url");
						x.WriteElementString("loc", "http://www.dontstayin.com" + g.Url());
						if (g.LastPost.HasValue && g.LastPost > DateTime.MinValue)
						{
							x.WriteElementString("lastmod", g.LastPost.Value.ToString(dateFormat));
							TimeSpan ts = DateTime.Now.Subtract(g.LastPost.Value);
							if (ts.TotalHours < 24)
								x.WriteElementString("changefreq", "hourly");
							else if (ts.TotalDays < 7)
								x.WriteElementString("changefreq", "daily");
							else if (ts.TotalDays < 30)
								x.WriteElementString("changefreq", "weekly");
							else
								x.WriteElementString("changefreq", "monthly");
						}
						else
							x.WriteElementString("changefreq", "monthly");
						x.WriteEndElement();	//url
						#endregion
						bobset.Kill(i);
					}
				}
				#endregion

				x.WriteEndElement();	//urlset
				#endregion
			}
			x.Flush();
			x.Close();
			Response.End();

		}
示例#11
0
		protected void Page_Load(object sender, EventArgs e)
		{
			AllVenuesPlaceLink.InnerText = CurrentPlace.Name;
			AllVenuesPlaceLink.HRef = CurrentPlace.Url();
			SetPageTitle("Venues in " + CurrentPlace.Name);
			PageHeadingAllVenues.InnerText = "Venues in " + CurrentPlace.Name;

			if (CurrentPlace.Venues.Count > 0)
			{
				Query LargeVenuesQ = new Query();
				LargeVenuesQ.QueryCondition = new And(
					new Q(Venue.Columns.PlaceK, CurrentPlace.K),
					new Q(Venue.Columns.RegularEvents, true),
					new Q(Venue.Columns.Capacity, QueryOperator.GreaterThanOrEqualTo, 800)
				);
				LargeVenuesQ.OrderBy = new OrderBy(Venue.Columns.Name);
				VenueSet LargeVenueSet = new VenueSet(LargeVenuesQ);
				if (LargeVenueSet.Count > 0)
				{
					if (LargeVenueSet.Count <= 18)
						LargeRegularVenueDataList.ItemTemplate = this.LoadTemplate("/Templates/Venues/PlaceVenuesList.ascx");
					else
					{
						LargeRegularVenueDataList.ItemTemplate = this.LoadTemplate("/Templates/Venues/PlaceVenuesListSmall.ascx");
						LargeRegularVenueDataList.RepeatColumns = 5;
						LargeRegularVenueDataList.CellPadding = 3;
						LargeRegularVenueDataList.ItemStyle.VerticalAlign = VerticalAlign.Top;
						LargeRegularVenueDataList.ItemStyle.Width = Unit.Percentage(20.0);
					}
					LargeRegularVenueDataList.DataSource = LargeVenueSet;
					LargeRegularVenueDataList.DataBind();
				}
				else
					LargeRegularVenuePanel.Visible = false;

				Query MediumVenuesQ = new Query();
				MediumVenuesQ.QueryCondition = new And(
					new Q(Venue.Columns.PlaceK, CurrentPlace.K),
					new Q(Venue.Columns.RegularEvents, true),
					new Q(Venue.Columns.Capacity, QueryOperator.GreaterThanOrEqualTo, 300),
					new Q(Venue.Columns.Capacity, QueryOperator.LessThan, 800)
					);
				MediumVenuesQ.OrderBy = new OrderBy(Venue.Columns.Name);
				VenueSet MediumVenueSet = new VenueSet(MediumVenuesQ);
				if (MediumVenueSet.Count > 0)
				{
					if (MediumVenueSet.Count <= 18)
						MediumRegularVenueDataList.ItemTemplate = this.LoadTemplate("/Templates/Venues/PlaceVenuesList.ascx");
					else
					{
						MediumRegularVenueDataList.ItemTemplate = this.LoadTemplate("/Templates/Venues/PlaceVenuesListSmall.ascx");
						MediumRegularVenueDataList.RepeatColumns = 5;
						MediumRegularVenueDataList.CellPadding = 3;
						MediumRegularVenueDataList.ItemStyle.VerticalAlign = VerticalAlign.Top;
						MediumRegularVenueDataList.ItemStyle.Width = Unit.Percentage(20.0);
					}
					MediumRegularVenueDataList.DataSource = MediumVenueSet;
					MediumRegularVenueDataList.DataBind();
				}
				else
					MediumRegularVenuePanel.Visible = false;

				Query SmallVenuesQ = new Query();
				SmallVenuesQ.QueryCondition = new And(
					new Q(Venue.Columns.PlaceK, CurrentPlace.K),
					new Q(Venue.Columns.RegularEvents, true),
					new Q(Venue.Columns.Capacity, QueryOperator.LessThan, 300)
					);
				SmallVenuesQ.OrderBy = new OrderBy(Venue.Columns.Name);
				VenueSet SmallVenueSet = new VenueSet(SmallVenuesQ);
				if (SmallVenueSet.Count > 0)
				{
					if (SmallVenueSet.Count <= 18)
						SmallRegularVenueDataList.ItemTemplate = this.LoadTemplate("/Templates/Venues/PlaceVenuesList.ascx");
					else
					{
						SmallRegularVenueDataList.ItemTemplate = this.LoadTemplate("/Templates/Venues/PlaceVenuesListSmall.ascx");
						SmallRegularVenueDataList.RepeatColumns = 5;
						SmallRegularVenueDataList.CellPadding = 3;
						SmallRegularVenueDataList.ItemStyle.VerticalAlign = VerticalAlign.Top;
						SmallRegularVenueDataList.ItemStyle.Width = Unit.Percentage(20.0);
					}
					SmallRegularVenueDataList.DataSource = SmallVenueSet;
					SmallRegularVenueDataList.DataBind();
				}
				else
					SmallRegularVenuePanel.Visible = false;

				Query NotRegularVenuesQ = new Query();
				NotRegularVenuesQ.QueryCondition = new And(
					new Q(Venue.Columns.PlaceK, CurrentPlace.K),
					new Q(Venue.Columns.RegularEvents, false)
				);
				NotRegularVenuesQ.OrderBy = new OrderBy(Venue.Columns.Name);
				VenueSet NotRegularVenueSet = new VenueSet(NotRegularVenuesQ);
				if (NotRegularVenueSet.Count > 0)
				{
					NotRegularVenueDataList.ItemTemplate = this.LoadTemplate("/Templates/Venues/PlaceVenuesListSmall.ascx");
					NotRegularVenueDataList.RepeatColumns = 5;
					NotRegularVenueDataList.CellPadding = 3;
					NotRegularVenueDataList.ItemStyle.VerticalAlign = VerticalAlign.Top;
					NotRegularVenueDataList.ItemStyle.Width = Unit.Percentage(20.0);
					NotRegularVenueDataList.DataSource = NotRegularVenueSet;
					NotRegularVenueDataList.DataBind();
				}
				else
					NotRegularVenuePanel.Visible = false;
			}
			else
				AllVenuesPanelNoVenues.Visible = true;

		}
示例#12
0
		public UrlPartTypes ProcessFilterPart(ref int currentIndex, string[] urlParts)
		{
			if (HasYearFilter && urlParts[currentIndex].Equals("tickets"))
			{
				#region tickets calendar
				PageType = PageTypes.Pages;
				PageName = "CalendarTickets";
				CurrentApplication = "tickets";
				currentIndex++;
				return UrlPartTypes.Application;
				#endregion
			}
			else if (HasYearFilter && urlParts[currentIndex].Equals("free"))
			{
				#region Free Guestlist calendar
				PageType = PageTypes.Pages;
				PageName = "CalendarFreeGuestlist";
				CurrentApplication = "free";
				currentIndex++;
				return UrlPartTypes.Application;
				#endregion
			}
			else if (urlParts[currentIndex].Equals("tags"))
			{
				#region tags
				PageType = PageTypes.Pages;
				PageName = "TagSearch";
				CurrentApplication = "tags";
				HasTagFilter = true;

				currentIndex++;
				if (urlParts.Length > currentIndex)
				{

					CurrentApplication = "tags/" + urlParts[currentIndex];

					foreach (string s in urlParts[currentIndex].Split('-'))
					{
						if (!s.Equals("all"))
							TagFilter.Add(Cambro.Web.Helpers.UrlTextDeSerialize(s));
					}

					currentIndex++;
				}
				return UrlPartTypes.Application;
				#endregion
			}
			else if ((HasBrandObjectFilter || HasVenueObjectFilter) && (urlParts[currentIndex].Equals("tickets") || urlParts[currentIndex].Equals("photos")))
			{
				#region Styled page
				currentIndex++;
				PageType = PageTypes.Styled;
				PageName = "Home";
				if (urlParts.Length > currentIndex &&
					YearRegex.IsMatch(urlParts[currentIndex]))
				{
					#region //year and month
					int year = int.Parse(urlParts[currentIndex]);
					if (year > 1990 && year < 2030)
					{
						HasYearFilter = true;
						DateFilter = new DateTime(year, 1, 1);
						PageName = "Calendar";
						currentIndex++;
						if (urlParts.Length > currentIndex &&
							MonthRegex.IsMatch(urlParts[currentIndex]))
						{
							int month = MonthNumber(urlParts[currentIndex]);
							HasMonthFilter = true;
							DateFilter = new DateTime(year, month, 1);
							currentIndex++;
						}
						return UrlPartTypes.Application;
					}
					#endregion
				}
				else if (urlParts.Length > currentIndex &&
					MonthRegex.IsMatch(urlParts[currentIndex]))
				{
					#region //month only - infer the year
					int requestedMonth = MonthNumber(urlParts[currentIndex]);
					HasYearFilter = true;
					HasMonthFilter = true;
					int requestedMonthIndex = (DateTime.Today.Year * 12) + requestedMonth;
					int currentMonthIndex = (DateTime.Today.Year * 12) + DateTime.Today.Month;
					DateTime d = new DateTime(DateTime.Today.Year, requestedMonth, 1);

					if (currentMonthIndex - requestedMonthIndex > 4)
					{
						d = new DateTime(DateTime.Today.Year + 1, requestedMonth, 1);
					}
					else if (currentMonthIndex - requestedMonthIndex < -7)
					{
						d = new DateTime(DateTime.Today.Year - 1, requestedMonth, 1);
					}

					DateFilter = d;
					PageName = "Calendar";
					currentIndex++;
					return UrlPartTypes.Application;
					#endregion
				}
				else if (urlParts.Length > currentIndex &&
					urlParts[currentIndex].ToLower().Equals("calendar"))
				{
					#region //todays month
					DateFilter = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
					PageName = "Calendar";
					currentIndex++;
					return UrlPartTypes.Application;
					#endregion
				}
				else if (urlParts.Length > currentIndex &&
					NumericRegex.IsMatch(urlParts[currentIndex]))
				{
					#region //event id
					PageName = "EventDetail";
					return UrlPartTypes.Application;
					#endregion
				}
				return UrlPartTypes.ObjectFilter;
				#endregion
			}
			else if (urlParts[currentIndex].Equals("parties"))
			{
				#region brand
				currentIndex++;
				Query brandQuery = new Query();
				brandQuery.NoLock = true;
				brandQuery.Columns = new ColumnSet(Brand.Columns.K);
				brandQuery.QueryCondition = new Q(Brand.Columns.UrlName, urlParts[currentIndex]);
				BrandSet bs = new BrandSet(brandQuery);
				if (bs.Count > 0)
				{
					HasObjectFilter = true;
					ObjectFilterType = Model.Entities.ObjectType.Brand;
					ObjectFilterK = bs[0].K;
					PageType = PageTypes.Application;
					PageName = "Home";
					CurrentFilter += "/parties/" + urlParts[currentIndex];
					currentIndex++;
					return UrlPartTypes.ObjectFilter;
				}
				return UrlPartTypes.Null;
				#endregion
			}
			else if (urlParts[currentIndex].Equals("groups"))
			{
				#region group
				currentIndex++;
				if (urlParts.Length > currentIndex)
				{
					string groupUrlName = urlParts[currentIndex];
					if (urlParts[currentIndex].Equals("parties"))
					{
						currentIndex++;
						groupUrlName = "parties/" + urlParts[currentIndex];
					}
					Query groupQuery = new Query();
					groupQuery.NoLock = true;
					groupQuery.Columns = new ColumnSet(Bobs.Group.Columns.K);
					groupQuery.QueryCondition = new Q(Bobs.Group.Columns.UrlName, groupUrlName);
					GroupSet gs = new GroupSet(groupQuery);
					if (gs.Count > 0)
					{
						HasObjectFilter = true;
						ObjectFilterType = Model.Entities.ObjectType.Group;
						ObjectFilterK = gs[0].K;
						PageType = PageTypes.Application;
						PageName = "Home";
						CurrentFilter += "/groups/" + groupUrlName;
						currentIndex++;
						return UrlPartTypes.ObjectFilter;
					}
				}
				PageType = PageTypes.Pages;
				PageName = "GroupBrowser";
				CurrentApplication = "groups";
				return UrlPartTypes.Application;
				#endregion
			}
			else if (!HasObjectFilter && urlParts[currentIndex].Equals("promoters"))
			{
				#region promoter
				currentIndex++;
				Query promoterQuery = new Query();
				promoterQuery.NoLock = true;
				promoterQuery.Columns = new ColumnSet(Promoter.Columns.K);
				promoterQuery.QueryCondition = new Q(Promoter.Columns.UrlName, urlParts[currentIndex]);
				PromoterSet ps = new PromoterSet(promoterQuery);
				if (ps.Count > 0)
				{
					HasObjectFilter = true;
					ObjectFilterType = Model.Entities.ObjectType.Promoter;
					ObjectFilterK = ps[0].K;
					PageType = PageTypes.Application;
					PageName = "Home";
					CurrentFilter += "/promoters/" + urlParts[currentIndex];
					currentIndex++;
					return UrlPartTypes.ObjectFilter;
				}
				return UrlPartTypes.Null;
				#endregion
			}
			else if (!HasObjectFilter && urlParts[currentIndex].Equals("members"))
			{
				#region members - usr
				currentIndex++;
				if (urlParts[currentIndex].Length > 0)
				{
					Usr usr = Usr.GetFromNickName(urlParts[currentIndex]);
					if (usr != null)
					{
						HasObjectFilter = true;
						ObjectFilterType = Model.Entities.ObjectType.Usr;
						ObjectFilterK = usr.K;
						PageType = PageTypes.Application;
						PageName = "Home";
						CurrentFilter += "/members/" + urlParts[currentIndex];
						currentIndex++;
						return UrlPartTypes.ObjectFilter;
					}
					//Query usrQuery = new Query();
					//usrQuery.NoLock = true;
					//usrQuery.Columns = new ColumnSet(Usr.Columns.K);
					//usrQuery.QueryCondition = new Q(Usr.Columns.NickName, urlParts[currentIndex]);
					//UsrSet us = new UsrSet(usrQuery);
					//if (us.Count > 0)
					//{
					//    HasObjectFilter = true;
					//    ObjectFilterType = Model.Entities.ObjectType.Usr;
					//    ObjectFilterK = us[0].K;
					//    PageType = PageTypes.Application;
					//    PageName = "Home";
					//    CurrentFilter += "/members/" + urlParts[currentIndex];
					//    currentIndex++;
					//    return UrlPartTypes.ObjectFilter;
					//}
				}
				return UrlPartTypes.Null;
				#endregion
			}
			else if (urlParts[currentIndex].StartsWith("event-"))
			{
				#region event
				try
				{
					Event ev = new Event(int.Parse(urlParts[currentIndex].Split('-')[1]));
					HasObjectFilter = true;
					ObjectFilterType = Model.Entities.ObjectType.Event;
					ObjectFilterK = ev.K;
					PageType = PageTypes.Application;
					PageName = "Home";
					CurrentFilter += "/" + urlParts[currentIndex];
					currentIndex++;
					return UrlPartTypes.ObjectFilter;
				}
				catch
				{
					currentIndex++;
				}
				return UrlPartTypes.Null;
				#endregion
			}
			else if (urlParts[currentIndex].StartsWith("gallery-"))
			{
				#region gallery
				try
				{
					Gallery g = new Gallery(int.Parse(urlParts[currentIndex].Split('-')[1]));
					HasObjectFilter = true;
					PageType = PageTypes.Application;
					PageName = "Home";
					ObjectFilterType = Model.Entities.ObjectType.Gallery;
					ObjectFilterK = g.K;
					CurrentFilter += "/" + urlParts[currentIndex];
					currentIndex++;
					return UrlPartTypes.ObjectFilter;
				}
				catch
				{
					currentIndex++;
				}
				return UrlPartTypes.Null;
				#endregion
			}
			else if (urlParts[currentIndex].StartsWith("photo-"))
			{
				#region photo
				try
				{
					Photo p = new Photo(int.Parse(urlParts[currentIndex].Split('-')[1]));
					HasObjectFilter = true;
					PageType = PageTypes.Application;
					PageName = "Home";
					ObjectFilterType = Model.Entities.ObjectType.Photo;
					ObjectFilterK = p.K;
					CurrentFilter += "/" + urlParts[currentIndex];
					currentIndex++;
					return UrlPartTypes.ObjectFilter;
				}
				catch
				{
					currentIndex++;
				}
				return UrlPartTypes.Null;
				#endregion
			}
			else if (urlParts[currentIndex].StartsWith("article-"))
			{
				#region article
				try
				{
					Article a = new Article(int.Parse(urlParts[currentIndex].Split('-')[1]));
					HasObjectFilter = true;
					PageType = PageTypes.Application;
					PageName = "Home";
					ObjectFilterType = Model.Entities.ObjectType.Article;
					ObjectFilterK = a.K;
					CurrentFilter += "/" + urlParts[currentIndex];
					currentIndex++;
					return UrlPartTypes.ObjectFilter;
				}
				catch
				{
					currentIndex++;
				}
				return UrlPartTypes.Null;
				#endregion
			}
			else if (GetMusicTypeK(urlParts[currentIndex].ToLower()) > 0)
			{
				#region music filter
				this.HasMusicFilter = true;
				this.MusicFilterK = GetMusicTypeK(urlParts[currentIndex].ToLower());
				CurrentFilter += "/" + urlParts[currentIndex].ToLower();
				currentIndex++;
				return UrlPartTypes.MusicFilter;
				#endregion
			}
			else if (GetThemeK(urlParts[currentIndex].ToLower()) > 0)
			{
				#region theme filter
				this.HasThemeFilter = true;
				this.ThemeFilterK = GetThemeK(urlParts[currentIndex].ToLower());
				CurrentFilter += "/" + urlParts[currentIndex].ToLower();
				currentIndex++;
				return UrlPartTypes.ThemeFilter;
				#endregion
			}
			else if (GetCountryK(urlParts[currentIndex].ToLower()) > 0)
			{
				#region Lookup country / place / venue
				HasObjectFilter = true;
				ObjectFilterType = Model.Entities.ObjectType.Country;
				ObjectFilterK = GetCountryK(urlParts[currentIndex].ToLower());
				PageType = PageTypes.Application;
				PageName = "Home";
				CurrentFilter += "/" + urlParts[currentIndex].ToLower();
				currentIndex++;
				int countryK = this.ObjectFilterK;

				if (urlParts.Length > currentIndex)
				{
					Country country = new Country(countryK);
					Q regionQ = new Q(true);
					if (country.UseRegion)
					{
						Query qRegion = new Query();
						qRegion.NoLock = true;
						qRegion.Columns = new ColumnSet(Region.Columns.K);
						qRegion.TopRecords = 1;
						qRegion.QueryCondition = new And(
							new Q(Region.Columns.CountryK, countryK),
							new Q(Region.Columns.Abbreviation, urlParts[currentIndex]));
						RegionSet rs = new RegionSet(qRegion);
						if (rs.Count > 0)
						{
							HasObjectFilter = true;
							ObjectFilterType = Model.Entities.ObjectType.Region;
							ObjectFilterK = rs[0].K;
							PageType = PageTypes.Application;
							PageName = "Home";
							int regionK = ObjectFilterK;
							regionQ = new Q(Place.Columns.RegionK, regionK);
							CurrentFilter += "/" + urlParts[currentIndex].ToLower();

							currentIndex++;

							if (!(urlParts.Length > currentIndex))
								return UrlPartTypes.ObjectFilter;
						}


					}
					#region Lookup place
					Query placeQuery = new Query();
					placeQuery.NoLock = true;
					placeQuery.Columns = new ColumnSet(Place.Columns.K);
					placeQuery.QueryCondition = new And(
						new Q(Place.Columns.Enabled, true),
						new Q(Place.Columns.CountryK, countryK),
						new Q(Place.Columns.UrlName, urlParts[currentIndex].ToLower()),
						regionQ
					);
					PlaceSet ps = new PlaceSet(placeQuery);
					if (ps.Count > 0)
					{
						HasObjectFilter = true;
						ObjectFilterType = Model.Entities.ObjectType.Place;
						ObjectFilterK = ps[0].K;
						PageType = PageTypes.Application;
						PageName = "Home";
						CurrentFilter += "/" + urlParts[currentIndex].ToLower();
						currentIndex++;
						int placeK = this.ObjectFilterK;

						if (urlParts.Length > currentIndex)
						{
							#region Lookup venue
							Query venueQuery = new Query();
							venueQuery.NoLock = true;
							venueQuery.Columns = new ColumnSet(Venue.Columns.K);
							venueQuery.QueryCondition = new And(
								new Q(Venue.Columns.PlaceK, placeK),
								new Q(Venue.Columns.UrlName, urlParts[currentIndex].ToLower())
								);
							VenueSet vs = new VenueSet(venueQuery);
							if (vs.Count > 0)
							{
								HasObjectFilter = true;
								ObjectFilterType = Model.Entities.ObjectType.Venue;
								ObjectFilterK = vs[0].K;
								PageType = PageTypes.Application;
								PageName = "Home";
								CurrentFilter += "/" + urlParts[currentIndex].ToLower();
								currentIndex++;
								int venueK = this.ObjectFilterK;
							}
							#endregion
						}
					}
					#endregion
				}
				return UrlPartTypes.ObjectFilter;
				#endregion
			}
			else if (YearRegex.IsMatch(urlParts[currentIndex]))
			{
				#region year / month / day
				int year = int.Parse(urlParts[currentIndex]);
				if (year > 1990 && year < 2030)
				{
					HasYearFilter = true;
					DateFilter = new DateTime(year, 1, 1);
					PageType = PageTypes.Pages;
					PageName = "Calendar";
					CurrentFilter += "/" + urlParts[currentIndex];
					currentIndex++;
					if (urlParts.Length > currentIndex && MonthRegex.IsMatch(urlParts[currentIndex]))
					{
						int month = MonthNumber(urlParts[currentIndex]);
						HasMonthFilter = true;
						DateFilter = new DateTime(year, month, 1);
						PageType = PageTypes.Pages;
						PageName = "Calendar";
						CurrentFilter += "/" + urlParts[currentIndex];
						currentIndex++;
						if (urlParts.Length > currentIndex && DayRegex.IsMatch(urlParts[currentIndex]))
						{
							int day = int.Parse(urlParts[currentIndex]);
							try
							{
								DateFilter = new DateTime(year, month, day);
								HasDayFilter = true;
								PageType = PageTypes.Pages;
								PageName = "Calendar";
								CurrentFilter += "/" + urlParts[currentIndex];
								currentIndex++;
							}
							catch
							{
								currentIndex++;
							}
						}
					}
					return UrlPartTypes.DateFilter;
				}
				else
					return UrlPartTypes.Null;
				#endregion
			}
			else if (urlParts[currentIndex].Equals("chat") || urlParts[currentIndex].Equals("messages"))
			{
				#region chat application
				PageType = PageTypes.Pages;
				PageName = "Chat";
				CurrentApplication = "chat";
				currentIndex++;
				if (ObjectFilterType.Equals(Model.Entities.ObjectType.Usr))
				{
					PageType = PageTypes.PagesFolder;
					PageFolder = "Usrs";
					PageName = "MyComments";
					CurrentApplication = "chat";
				}
				return UrlPartTypes.Application;
				#endregion
			}
			else if (urlParts[currentIndex].Equals("archive"))
			{
				#region archive application
				PageType = PageTypes.Pages;
				PageName = "Archive";
				CurrentApplication = "archive";
				currentIndex++;
				return UrlPartTypes.Application;
				#endregion
			}
			else if (urlParts[currentIndex].Equals("hottickets"))
			{
				#region hot tickets application
				PageType = PageTypes.Pages;
				PageName = "HotTickets";
				CurrentApplication = "hottickets";
				currentIndex++;
				return UrlPartTypes.Application;
				#endregion
			}
			else if (urlParts[currentIndex].Equals("home"))
			{
				#region home application
				CurrentApplication = "home";
				currentIndex++;
				return UrlPartTypes.Application;
				#endregion
			}
			else if (HasUsrObjectFilter && urlParts[currentIndex].Equals("photosof"))
			{
				#region photosof page
				currentIndex++;
				PageType = PageTypes.Application;
				PageName = "photosof";
				CurrentApplication = "photosof/" + urlParts[currentIndex].ToLower();
				currentIndex++;
				return UrlPartTypes.Application;
				#endregion
			}
			else
			{
				if (urlParts.Length > currentIndex)
				{
					if (!PageType.Equals(PageTypes.Styled))
						PageType = PageTypes.Application;
					PageName = urlParts[currentIndex].ToLower();
					CurrentApplication = urlParts[currentIndex].ToLower();
					currentIndex++;
					return UrlPartTypes.Application;
				}
				else
				{
					currentIndex++;
					return UrlPartTypes.Null;
				}
			}
		}
示例#13
0
		void appendVenues(StringBuilder sb, VenueSet vs)
		{
			Dictionary<string, int> counter = new Dictionary<string, int>();
			foreach (Venue v in vs)
			{
				string key = venueString(v);
				if (counter.ContainsKey(key.ToLower()))
					counter[key.ToLower()]++;
				else
					counter[key.ToLower()] = 1;
			}


			foreach (Venue v in vs)
			{
				string key = venueString(v);
				if (counter[key.ToLower()] > 1)
					key = key + " #" + v.K.ToString();

				append(sb, key, v.K.ToString());
			}
		}
示例#14
0
		protected void Page_Load(object sender, EventArgs e)
		{
			StringBuilder sb = new StringBuilder();
		//	if (Vars.DevEnv)
		//		System.Threading.Thread.Sleep(new Random().Next(2000));

			if (Request.QueryString["type"] == "calendar")
			{
				bool freeGuestlist = Request.QueryString["freeGuestlist"] == null || Request.QueryString["freeGuestlist"].Length == 0 || Request.QueryString["freeGuestlist"] == "0" ? false : true;
				Brand brand = Request.QueryString["brandk"] == null || Request.QueryString["brandk"].Length == 0 || Request.QueryString["brandk"] == "0" ? null : new Brand(int.Parse(Request.QueryString["brandk"]));
				Place place = Request.QueryString["placek"] == null || Request.QueryString["placek"].Length == 0 || Request.QueryString["placek"] == "0" ? null : new Place(int.Parse(Request.QueryString["placek"]));
				Venue venue = Request.QueryString["venuek"] == null || Request.QueryString["venuek"].Length == 0 || Request.QueryString["venuek"] == "0" || Request.QueryString["venuek"] == "1" ? null : new Venue(int.Parse(Request.QueryString["venuek"]));
				int key = Request.QueryString["key"] == null || Request.QueryString["key"].Length == 0 || Request.QueryString["key"] == "0" ? 0 : int.Parse(Request.QueryString["key"]);
				MusicType music = Request.QueryString["musictypek"] == null || Request.QueryString["musictypek"].Length == 0 || Request.QueryString["musictypek"] == "0" ? null : new MusicType(int.Parse(Request.QueryString["musictypek"]));
				bool me = Request.QueryString["me"] != null && Request.QueryString["me"] == "1";
				bool addGalleryButton = Request.QueryString["addgallery"] != null && Request.QueryString["addgallery"] == "1";
				bool allVenues = Request.QueryString["venuek"] != null && Request.QueryString["venuek"] == "1";
				DateTime date = new DateTime(
					int.Parse(Request.QueryString["date"].Substring(0, 4)),
					int.Parse(Request.QueryString["date"].Substring(4, 2)),
					int.Parse(Request.QueryString["date"].Substring(6, 2)) > 0 ? int.Parse(Request.QueryString["date"].Substring(6, 2)) : 1 );
				//if (date == DateTime.Today)
				//	System.Threading.Thread.Sleep(1000);
				DateTime from = date.Previous(DayOfWeek.Monday, true);
				DateTime to = date.Next(DayOfWeek.Sunday, true);
				Event.EventsForDisplay events = new Event.EventsForDisplay();
				events.IgnoreMusicType = true;

				if (me)
				{
					events.AttendedUsrK = Usr.Current.K;
				}
				else if (brand != null)
				{
					events.BrandK = brand.K;
				}
				else if (venue != null)
				{
					events.VenueK = venue.K;
				}
				else if (place != null && music != null)
				{
					events.PlaceK = place.K;
					events.MusicTypeK = music.K;
				}
				else if (place != null && freeGuestlist)
				{
					events.PlaceK = place.K;
					events.FreeGuestlist = freeGuestlist;
				}
				else if (key > 0)
				{

				}
				else
					throw new Exception();

				

				EventSet es;
				if (key == 0)
					es = events.GetEventsBetweenDates(from, to);
				else
					es = new EventSet(new Query(new Q(Event.Columns.K, key)));

				CustomControls.DsiCalendar calendar = new Spotted.CustomControls.DsiCalendar();

				calendar.AllEvents = es;
				calendar.Month = date.Month;
				
				calendar.ShowCountryFriendlyName = !(events.FilterByCountry || events.FilterByPlace || events.FilterByVenue);
				calendar.ShowPlace = !(events.FilterByPlace || events.FilterByVenue);
				calendar.ShowVenue = !events.FilterByVenue;
				calendar.ShowAddGalleryButton = addGalleryButton;

				calendar.Tickets = true;
				calendar.StartDate = from;
				calendar.EndDate = to;

				Out.Controls.Add(calendar);
				
			}
			else
			{
				sb.AppendLine("{");
				if (Request.QueryString["type"] == "music")
				{
					#region Music types

					Query q = new Query();
					q.QueryCondition = new Q(MusicType.Columns.K, QueryOperator.NotEqualTo, 1);
					q.Columns = new ColumnSet(MusicType.Columns.Name, MusicType.Columns.ParentK, MusicType.Columns.K);
					q.OrderBy = new OrderBy(MusicType.Columns.Order, OrderBy.OrderDirection.Ascending);
					q.CacheDuration = TimeSpan.FromDays(1);
					MusicTypeSet mts = new MusicTypeSet(q);
					append(sb, "Select your music...", "0");
					append(sb, "", "");
					foreach (MusicType mt in mts)
					{
						append(sb, (mt.ParentK == 1 ? "" : "... ") + mt.Name, mt.K.ToString());
					}

					#endregion
				}
				else if (Request.QueryString["type"] == "country")
				{
					#region Countries

					append(sb, "Select a country...", "0");
					Query qTop = new Query();
					qTop.Columns = new ColumnSet(Country.Columns.FriendlyName, Country.Columns.K);
					qTop.OrderBy = new OrderBy(Country.Columns.TotalEvents, OrderBy.OrderDirection.Descending);
					qTop.QueryCondition = new Q(Country.Columns.Enabled, true);
					qTop.TopRecords = 10;
					qTop.CacheDuration = TimeSpan.FromDays(1);
					CountrySet csTop = new CountrySet(qTop);
					append(sb, "", "");
					append(sb, "--- TOP COUNTRIES ---", "0");
					foreach (Country c in csTop)
					{
						append(sb, c.FriendlyName.TruncateWithDots(maxLength), c.K.ToString());
					}
					Query qAll = new Query();
					qAll.Columns = new ColumnSet(Country.Columns.FriendlyName, Country.Columns.K);
					qAll.OrderBy = new OrderBy(Country.Columns.FriendlyName);
					qAll.QueryCondition = new And(new Q(Country.Columns.Enabled, true), new StringQueryCondition("(SELECT COUNT(*) FROM [Place] WHERE [Place].[Enabled] = 1 AND [Place].[CountryK] = [Country].[K]) > 0"));
					qAll.CacheDuration = TimeSpan.FromDays(1);
					CountrySet csAll = new CountrySet(qAll);
					append(sb, "", "");
					append(sb, "--- ALL COUNTRIES ---", "0");
					foreach (Country c in csAll)
					{
						append(sb, c.FriendlyName.TruncateWithDots(maxLength), c.K.ToString());
					}

					#endregion
				}
				else if (Request.QueryString["type"] == "place")
				{
					#region Places

					int countryK = int.Parse(Request.QueryString["countryk"]);
					Country country = new Country(countryK);

					Query qTop = new Query();
					qTop.Columns = new ColumnSet(Place.Columns.Name, Place.Columns.K, Place.LinkColumns);
					qTop.TopRecords = 10;
					qTop.QueryCondition = new And(new Q(Place.Columns.CountryK, country.K), new Q(Place.Columns.Enabled, true));
					qTop.OrderBy = new OrderBy(Place.Columns.TotalEvents, OrderBy.OrderDirection.Descending);
					PlaceSet psTop = new PlaceSet(qTop);
					if (psTop.Count == 0)
					{
						append(sb, "No towns in our database for this country", "");
					}
					else
					{
						append(sb, "Towns in " + country.FriendlyName.Truncate(maxLength) + "...", "");
						append(sb, "", "");
						if (psTop.Count < 10)
						{
							foreach (Place p in psTop)
								append(sb, p.NamePlainRegion.TruncateWithDots(maxLength), Request.QueryString["return"] == "k" ? p.K.ToString() : p.Url());
						}
						else
						{
							append(sb, "--- TOP TOWNS ---", "");

							foreach (Place p in psTop)
								append(sb, p.NamePlainRegion.TruncateWithDots(maxLength), Request.QueryString["return"] == "k" ? p.K.ToString() : p.Url());

							Query qAll = new Query();
							qAll.Columns = new ColumnSet(Place.Columns.Name, Place.Columns.K, Place.LinkColumns);
							qAll.OrderBy = new OrderBy(Place.Columns.UrlName);
							qAll.QueryCondition = new And(new Q(Place.Columns.CountryK, countryK), new Q(Place.Columns.Enabled, true));
							PlaceSet psAll = new PlaceSet(qAll);
							append(sb, "", "");
							append(sb, "--- ALL TOWNS ---", "");

							foreach (Place p in psAll)
								append(sb, p.NamePlainRegion.TruncateWithDots(maxLength), Request.QueryString["return"] == "k" ? p.K.ToString() : p.Url());

						}
					}
					#endregion
				}
				else if (Request.QueryString["type"] == "venue")
				{
					#region Venues

					int placeK = int.Parse(Request.QueryString["placek"]);
					Place place = new Place(placeK);

					Query qTop = new Query();
					qTop.Columns = new ColumnSet(Venue.Columns.Name, Venue.Columns.K, Venue.LinkColumns);
					qTop.TopRecords = 10;
					qTop.QueryCondition = new Q(Venue.Columns.PlaceK, place.K);
					qTop.OrderBy = new OrderBy(Venue.Columns.TotalEvents, OrderBy.OrderDirection.Descending);
					VenueSet vsTop = new VenueSet(qTop);
					if (vsTop.Count == 0)
					{
						append(sb, "No venues in our database for this town", "");
					}
					else
					{
						append(sb, "Venues in " + place.NamePlainRegion.Truncate(maxLength) + "...", "");
						append(sb, "", "");
						if (Request.QueryString["all"] == "1")
						{
							append(sb, "All venues", "1");
							append(sb, "", "");
						}
						if (vsTop.Count < 10)
						{
							appendVenues(sb, vsTop);
						}
						else
						{
							append(sb, "--- TOP VENUES ---", "");

							appendVenues(sb, vsTop);

							Query qAll = new Query();
							qAll.Columns = new ColumnSet(Venue.Columns.Name, Venue.Columns.K, Venue.LinkColumns);
							qAll.OrderBy = new OrderBy("( CASE WHEN [Venue].[UrlName] LIKE 'the-%' THEN SUBSTRING([Venue].[UrlName], 4, LEN([Venue].[UrlName]) - 4) ELSE [Venue].[UrlName] END )");
							qAll.QueryCondition = new Q(Venue.Columns.PlaceK, placeK);
							VenueSet vsAll = new VenueSet(qAll);
							append(sb, "", "");
							append(sb, "--- ALL VENUES ---", "");

							if (vsAll.Count <= 300)
							{
								appendVenues(sb, vsAll);

							}
							else
							{
								append(sb, "Select the first letter:", "");
								append(sb, "", "");
								append(sb, "0-9", "*0");

								string ch;
								for (int i = 65; i <= 90; i++)
								{
									ch = char.ConvertFromUtf32(i);
									append(sb, ch.ToUpper() + "...", "*" + ch.ToLower());

								}
							}
						}
					}
					#endregion
				}
				else if (Request.QueryString["type"] == "venuebyletter")
				{
					#region Venues

					int placeK = int.Parse(Request.QueryString["placek"]);
					string letter = Request.QueryString["letter"];
					if (letter.Length > 1)
						throw new Exception();
					Place place = new Place(placeK);

					string qu = "";
					if (letter.ToLower() == "0")
					{
						qu = "([Venue].[UrlName] LIKE '[0-9]%' OR [Venue].[UrlName] LIKE 'the-[0-9]%')";
					}
					else if (letter.ToLower() == "t")
					{
						qu = "(([Venue].[UrlName] LIKE 't%' AND [Venue].[UrlName] NOT LIKE 'the-%' ) OR [Venue].[UrlName] LIKE 'the-t%')";
					}
					else
					{
						qu = "([Venue].[UrlName] LIKE '" + letter.ToLower() + "%' OR [Venue].[UrlName] LIKE 'the-" + letter.ToLower() + "%')";
					}
					Query q = new Query();
					q.Columns = new ColumnSet(Venue.Columns.Name, Venue.Columns.K, Venue.LinkColumns);
					//q.OrderBy = new OrderBy(Venue.Columns.UrlName);
					q.OrderBy = new OrderBy("( CASE WHEN [Venue].[UrlName] LIKE 'the-%' THEN SUBSTRING([Venue].[UrlName], 4, LEN([Venue].[UrlName]) - 4) ELSE [Venue].[UrlName] END )");
					q.QueryCondition = new And(
						new Q(Venue.Columns.PlaceK, placeK),
						new StringQueryCondition(qu));
					VenueSet vs = new VenueSet(q);


					if (vs.Count == 0)
					{
						append(sb, "No venues starting with " + letter.ToUpper(), "");
					}
					else
					{
						append(sb, "Venues starting with " + letter.ToUpper() + "...", "");
						append(sb, "", "");

						appendVenues(sb, vs);
					}
					#endregion
				}
				else if (Request.QueryString["type"] == "event")
				{
					#region Events

					int venueK = int.Parse(Request.QueryString["venuek"]);
					int brandK = int.Parse(Request.QueryString["brandk"]);
					int key = int.Parse(Request.QueryString["key"]);
					int year = int.Parse(Request.QueryString["date"].Substring(0, 4));
					int month = int.Parse(Request.QueryString["date"].Substring(4, 2));
					DateTime dateFrom = new DateTime(year, month, 1);
					DateTime dateTo = dateFrom.AddMonths(1);
					Venue venue = venueK > 1 ? new Venue(venueK) : null;
					Brand brand = brandK > 0 ? new Brand(brandK) : null;

					EventSet es;
					if (key == 0)
					{
						Query q = new Query();
						if (brand == null)
							q.Columns = new ColumnSet(Event.Columns.DateTime, Event.Columns.Name, Event.Columns.K);
						else
							q.Columns = new ColumnSet(Event.Columns.DateTime, Event.Columns.Name, Event.Columns.K, Event.FriendlyLinkColumns);
						q.QueryCondition = new And(
							new Q(Event.Columns.DateTime, QueryOperator.GreaterThanOrEqualTo, dateFrom),
							new Q(Event.Columns.DateTime, QueryOperator.LessThan, dateTo),
							venue != null ? new Q(Event.Columns.VenueK, venue.K) : new Q(true),
							brand != null ? new Q(EventBrand.Columns.BrandK, brand.K) : new Q(true));
						q.OrderBy = Event.FutureEventOrder;
						if (brandK > 0)
						{
							q.TableElement = new Join(
							Event.CountryAllJoin,
							new TableElement(TablesEnum.EventBrand),
							QueryJoinType.Inner,
							Event.Columns.K,
							EventBrand.Columns.EventK);
						}
						es = new EventSet(q);
					}
					else
						es = new EventSet(new Query(new Q(Event.Columns.K, key)));

					if (es.Count == 0)
					{
						append(sb, "No events in our database for this selection", "");
					}
					else
					{
						//append(sb, "Events at " + venue.FriendlyName.Truncate(maxLength) + ", " + dateFrom.ToString("MMM yyyy") + "...", "");
						//append(sb, "", "");
						Dictionary<string, int> counter = new Dictionary<string, int>();
						foreach (Event ev in es)
						{
							string key1 = eventString(ev, brand != null);
							if (counter.ContainsKey(key1.ToLower()))
								counter[key1.ToLower()]++;
							else
								counter[key1.ToLower()] = 1;
						}


						foreach (Event ev in es)
						{
							string key1 = eventString(ev, brand != null);
							if (counter[key1.ToLower()] > 1)
								key1 = key1.Substring(0, 8) + " - #" + ev.K.ToString() + key1.Substring(8);

							append(sb, key1, ev.K.ToString());
						}

					}
					#endregion
				}
				sb.AppendLine("");
				sb.Append("}");
			}

			Out.Controls.Add(new LiteralControl(sb.ToString()));
		}
示例#15
0
		public void SaveNow()
		{
			if (Page.IsValid)
			{
				if (IsEdit)
				{
					if (!Usr.Current.CanEdit(CurrentVenue))
						throw new Exception("You can't edit this venue!");
					else
					{
						bool changedName = false;
						bool changedPlace = false;
						string newName = Cambro.Web.Helpers.StripHtml(PanelDetailsVenueName.Text.Trim());
						if (!CurrentVenue.Name.Equals(newName))
						{
							changedName = true;
							CurrentVenue.Name = newName;
						}
						CurrentVenue.Postcode = Cambro.Web.Helpers.StripHtml(PanelDetailsPostcodeTextBox.Text);
						CurrentVenue.Capacity = int.Parse(PanelDetailsVenueCapacity.Text);
						CurrentVenue.RegularEvents = PanelDetailsVenueRegularEventsYes.Checked;
						CurrentVenue.DetailsHtml = PanelDetailsVenueDetailsHtml.GetHtml();
						if (CurrentVenue.AdminNote.Length > 0)
							CurrentVenue.AdminNote += "\n";
						CurrentVenue.AdminNote += "Venue modified by " + Usr.Current.NickName + " (K=" + Usr.Current.K.ToString() + ") " + DateTime.Now.ToString();

						if (Usr.Current.IsSuper)
						{
							CurrentVenue.IsNew = false;
							CurrentVenue.IsEdited = false;
						}
						else
						{
							CurrentVenue.IsEdited = true;
							CurrentVenue.ModeratorUsrK = Usr.GetEventModeratorUsrK();
						}


						CurrentVenue.Update();

						if (changedName)
							CurrentVenue.CreateUniqueUrlName(false);

						if (CanEditPlace)
						{
							Place p = PanelDetailsPlacePicker.Place;
							if (p.K != CurrentVenue.PlaceK)
							{
								changedPlace = true;
								CurrentVenue.ChangePlace(p.K, false);
							}
						}
						if (changedName || changedPlace)
						{
							CurrentVenue.UpdateUrlFragment(false);

							Utilities.UpdateChildUrlFragmentsJob job = new Utilities.UpdateChildUrlFragmentsJob(Model.Entities.ObjectType.Venue, CurrentVenue.K, true);
							job.ExecuteAsynchronously();


						}
						Response.Redirect(CurrentVenue.UrlApp("edit", "page", "pic"));
					}
				}
				else if (IsNew)
				{
					//Duplicate?
					VenueSet vsDup = new VenueSet(new Query(new Q(Venue.Columns.DuplicateGuid, (Guid)ContainerPage.ViewStatePublic["VenueDuplicateGuid"])));
					if (vsDup.Count == 0)
					{
						Venue v = Venue.Add(
							Usr.Current,
							Cambro.Web.Helpers.StripHtml(PanelDetailsVenueName.Text.Trim()),
							int.Parse(PanelDetailsVenueCapacity.Text),
							PanelDetailsPlacePicker.Place.K,
							Cambro.Web.Helpers.StripHtml(PanelDetailsPostcodeTextBox.Text),
							PanelDetailsVenueRegularEventsYes.Checked,
							(Guid)ContainerPage.ViewStatePublic["VenueDuplicateGuid"],
							PanelDetailsVenueDetailsHtml.GetHtml()
						);
						Response.Redirect(v.UrlApp("edit", "page", "pic"));

					}
					else
					{
						Response.Redirect(vsDup[0].UrlApp("edit", "page", "pic"));
					}
				}

			}
		}
示例#16
0
		private void Page_Load(object sender, System.EventArgs e)
		{

			AdminPanel.Visible = (Usr.Current != null && Usr.Current.IsAdmin);

			#region Sales People
			SalesPanel.Visible = (Usr.Current != null && (Usr.Current.IsSalesPerson || Usr.Current.IsSuperAdmin));

			if (SalesPanel.Visible)
			{
				List<UsrDataHolder> salesUsrList = new List<UsrDataHolder>();
				if (ViewState["SalesUsrList"] == null)
				{
					UsrSet salesUsrs = Usr.GetCurrentSalesUsrsNameAndK(new int[] {(int)Usr.SalesTeams.PromoterSalesTeam, (int)Usr.SalesTeams.SmallBusinessSalesTeam});
					foreach (Usr salesUsr in salesUsrs)
						salesUsrList.Add(new UsrDataHolder(salesUsr));
					ViewState["SalesUsrList"] = salesUsrList;
				}
				else
				{
					salesUsrList = (List<UsrDataHolder>)ViewState["SalesUsrList"];
				}
				GenerateSalesTodayTable(salesUsrList);
				GenerateSalesMonthTable(salesUsrList);


				//LastWeekDivHeader.InnerHtml = "<a href=\"\" onclick=\"document.getElementById('" + TeamBonusLastWeekDiv.ClientID + "').style.display='';return false;\">Last week</a>";
				//LastWeekDivHeader.Attributes["style"] = "cursor:pointer";

				TeamBonusLastWeekDiv.Controls.Clear();
				TeamBonusThisWeekDiv.Controls.Clear();
				try
				{
					GenerateTeamBonusTargetWeek(Time.Today.AddDays(-7), TeamBonusLastWeekDiv, salesUsrList);
					GenerateTeamBonusTargetWeek(Time.Today, TeamBonusThisWeekDiv, salesUsrList);
				}
				catch { }
			}
			#endregion

			#region IsSuper
			if (Usr.Current != null && Usr.Current.IsSuper)
			{

				Query vq = new Query();
				vq.NoLock = true;
				vq.QueryCondition = new Q(Venue.Columns.IsNew, true);
				vq.ReturnCountOnly = true;
				VenueSet vs = new VenueSet(vq);

				if (vs.Count != 0)
				{
					if (Usr.Current.AdminLevel.Equals(Usr.AdminLevels.Super))
					{
						SuperAdmin.Controls.Add(new LiteralControl("<p>You have to moderate:</p>"));
						SuperAdmin.Controls.Add(new LiteralControl("<p>" + Usr.Current.NewVenuesToModerateHtml + " new venues</p>"));
						SuperAdmin.Controls.Add(new LiteralControl("<p>Total to moderate:</p>"));
					}
					SuperAdmin.Controls.Add(new LiteralControl("<p>" + vs.Count.ToString() + " new venue(s)</p><p><a href=\"/pages/venues/moderate\">Moderate now!</a></p>"));
				}

				Query qMisc = new Query();
				qMisc.QueryCondition = new Q(Bobs.Misc.Columns.NeedsAuth, true);
				qMisc.ReturnCountOnly = true;
				qMisc.NoLock = true;
				MiscSet ms = new MiscSet(qMisc);
				if (ms.Count > 0)
					SuperAdmin.Controls.Add(new LiteralControl("<p><a href=\"/pages/bannercheck/mode-list\">Check new banners</a></p>"));

			}
			else
				SuperPanel.Visible = false;
			#endregion

			#region IsSenior
			if (Usr.Current != null && Usr.Current.IsSenior)
			{
				//GallerySet gs = new GallerySet(new Q(Gallery.Columns.TotalPhotos,QueryOperator.NotEqualTo,Gallery.Columns.LivePhotos,true));
				//if (gs.Count>0)
				SeniorPanel.Visible = true;

				if (ContainerPage.Url.HasPhotoObjectFilter)
				{
					SeniorAdmin.Controls.Add(new LiteralControl("<p><a href=\"" + ContainerPage.Url.ObjectFilterPhoto.Gallery.UrlApp("edit") + "\">Edit gallery</a></p>"));
				}
				if (ContainerPage.Url.HasGalleryObjectFilter)
				{
					SeniorAdmin.Controls.Add(new LiteralControl("<p><a href=\"" + ContainerPage.Url.ObjectFilterGallery.UrlApp("edit") + "\">Edit gallery</a></p>"));
				}

			}
			else
				SeniorPanel.Visible = false;
			#endregion

			if (Usr.Current != null && Usr.Current.IsAdmin && ((Spotted.Master.DsiPage)Page).Url.HasPromoterObjectFilter)
			{
				Promoter CurrentPromoter = ((Spotted.Master.DsiPage)Page).Url.ObjectFilterPromoter;
				AdminPanelContents.Controls.Add(new LiteralControl("<p><b>PromoterK: " + CurrentPromoter.K + "</b></p>"));
				AdminPanelContents.Controls.Add(new LiteralControl("<p><a href=\"http://old.dontstayin.com/login-" + Usr.Current.K + "- "+ Usr.Current.LoginString +"/admin/promoter?ID=" + CurrentPromoter.K + "\">Edit this promoter (admin)</a></p>"));
				AdminPanelContents.Controls.Add(new LiteralControl("<p><a href=\"" + CurrentPromoter.UrlApp("edit") + "\">Edit this promoter (public)</a></p>"));

				AdminPanelContents.Controls.Add(new LiteralControl("<p>Promoter:<br>"));
				AdminPanelContents.Controls.Add(new LiteralControl("&nbsp;-&nbsp;<a href=\"/chat/k-" + CurrentPromoter.QuestionsThreadK + "\">Questions</a><br>"));
				AdminPanelContents.Controls.Add(new LiteralControl("&nbsp;-&nbsp;<a href=\"" + CurrentPromoter.UrlApp("banners") + "\">Banners</a><br>"));
				AdminPanelContents.Controls.Add(new LiteralControl("&nbsp;-&nbsp;<a href=\"" + CurrentPromoter.UrlApp("files") + "\">Files</a><br>"));
				AdminPanelContents.Controls.Add(new LiteralControl("&nbsp;-&nbsp;<a href=\"" + CurrentPromoter.UrlApp("events") + "\">Events</a><br>"));
				AdminPanelContents.Controls.Add(new LiteralControl("&nbsp;-&nbsp;<a href=\"" + CurrentPromoter.UrlApp("guestlists") + "\">Guestlists</a><br>"));
				AdminPanelContents.Controls.Add(new LiteralControl("&nbsp;-&nbsp;<a href=\"" + CurrentPromoter.UrlApp("competitions") + "\">Competitions</a>"));
				AdminPanelContents.Controls.Add(new LiteralControl("</p>"));

				if (CurrentPromoter.AllBrands.Count > 0)
					AdminPanelContents.Controls.Add(new LiteralControl("<p>Brands:<br>"));
				foreach (Brand b in CurrentPromoter.AllBrands)
					AdminPanelContents.Controls.Add(new LiteralControl("&nbsp;-&nbsp;<a href=\"" + b.Url() + "\">" + b.Name + "</a>" + (b.PromoterStatus.Equals(Brand.PromoterStatusEnum.Unconfirmed) ? " <font color=0000ff><b>unconfirmed</b></font>" : "") + "<br>"));
				if (CurrentPromoter.AllBrands.Count > 0)
					AdminPanelContents.Controls.Add(new LiteralControl("</p>"));

				if (CurrentPromoter.AllVenues.Count > 0)
					AdminPanelContents.Controls.Add(new LiteralControl("<p>Venues:<br>"));
				foreach (Venue v in CurrentPromoter.AllVenues)
					AdminPanelContents.Controls.Add(new LiteralControl("&nbsp;-&nbsp;<a href=\"" + v.Url() + "\">" + v.Name + " in " + v.Place.Name + "</a>" + (v.PromoterStatus.Equals(Venue.PromoterStatusEnum.Unconfirmed) ? " <font color=0000ff><b>unconfirmed</b></font>" : "") + "<br>"));
				if (CurrentPromoter.AllVenues.Count > 0)
					AdminPanelContents.Controls.Add(new LiteralControl("</p>"));

				AdminPanelContents.Controls.Add(new LiteralControl("<p>Users:<br>"));
				foreach (Usr u in CurrentPromoter.AdminUsrs)
					AdminPanelContents.Controls.Add(new LiteralControl("&nbsp;-&nbsp;<a href=\"" + u.Url() + "\">" + u.NickNameSafe + "</a>" + (CurrentPromoter.PrimaryUsrK == u.K ? "&nbsp;(PRIMARY)" : "") + "<br>"));
				AdminPanelContents.Controls.Add(new LiteralControl("</p>"));
			}


			//if (Usr.Current != null && Usr.Current.IsJunior)
			//{
			//    if (ContainerPage.Url.HasUsrObjectFilter)
			//    {
			//        uiModerateTagsAnchor.Text = "Moderate this user's tags";
			//        uiModerateTagsAnchor.NavigateUrl = "/pages/moderateusrtags/usr-" + ContainerPage.Url.ObjectFilterUsr.K;
			//    }
			//    else if (ContainerPage.Url.HasPhotoObjectFilter)
			//    {
			//        uiModerateTagsAnchor.Text = "Moderate this photo's tags";
			//        uiModerateTagsAnchor.NavigateUrl = "/pages/moderatephototags/photo-" + ContainerPage.Url.ObjectFilterPhoto.K;

			//        Photo photo = ContainerPage.Url.ObjectFilterPhoto;
			//        if (photo.ThreadK > 0)
			//        {
			//            uiAdministrateChatAnchor.Text = "Administrate this photo's thread";
			//            uiAdministrateChatAnchor.NavigateUrl = "/pages/chatadmin/k-" + photo.ThreadK;
			//            uiAdministrateChatAnchor.Style["display"] = "";
			//        }
			//        else
			//        {
			//            uiAdministrateChatAnchor.Style["display"] = "none";
			//        }
			//    }
			//    else if (ContainerPage.Url["photo"].Exists)
			//    {
			//        uiModerateTagsAnchor.Text = "Moderate this photo's tags";
			//        uiModerateTagsAnchor.NavigateUrl = "/pages/moderatephototags/photo-" + ContainerPage.Url["photo"].ValueInt;
			//        Photo photo= new Photo(ContainerPage.Url["Photo"].ValueInt);
			//        if (photo.ThreadK > 0)
			//        {
			//            uiAdministrateChatAnchor.Text = "Administrate this photo's thread";
			//            uiAdministrateChatAnchor.NavigateUrl = "/pages/chatadmin/k-" + photo.ThreadK;
			//            uiAdministrateChatAnchor.Style["display"] = "";
			//        }
			//        else
			//        {
			//            uiAdministrateChatAnchor.Style["display"] = "none";
			//        }
			//    }
			//    else
			//    {
			//        ChatPanel.Visible = false;
			//    }
			//}
			//else
			//{
			//    ChatPanel.Visible = false;
			//}

		}
示例#17
0
		void Bind()
		{
			Query q = new Query();
			q.NoLock = true;
			q.QueryCondition = new Q(Usr.Columns.AdminLevel, Usr.AdminLevels.Super);
			q.OrderBy = new OrderBy(Usr.Columns.NickName);
			q.Columns = new ColumnSet(Usr.LinkColumns, Usr.Columns.DateTimeLastPageRequest, Usr.Columns.IsLoggedOn, Usr.Columns.FirstName, Usr.Columns.LastName, Usr.Columns.IsSkeleton);
			UsrSet us = new UsrSet(q);
			ModeratorsDataGrid.DataSource = us;
			ModeratorsDataGrid.DataBind();

			if (ContainerPage.Url["usrk"].IsInt)
			{
				int UsrK = ContainerPage.Url["usrk"];
				if (ContainerPage.Url["type"] == 1)
				{
					Query vsq = new Query();
					vsq.QueryCondition = new And(new Q(Venue.Columns.IsNew, true),
						new Q(Venue.Columns.ModeratorUsrK, UsrK));
					vsq.TopRecords = 10;
					vsq.NoLock = true;
					VenueSet vs = new VenueSet(vsq);
					if (vs.Count == 0)
						ItemsPanel.Visible = false;
					else
					{
						ItemsRepeater.DataSource = vs;
						ItemsRepeater.ItemTemplate = this.LoadTemplate("/Templates/Venues/Admin.ascx");
						ItemsRepeater.DataBind();
					}
				}
				else
				{
					ItemsPanel.Visible = false;
				}
			}
			else
			{
				ItemsPanel.Visible = false;
			}
		}