Пример #1
0
		void BindPlacesList(string order)
		{

			OrderBy o = new OrderBy(Bobs.Place.Columns.Name, OrderBy.OrderDirection.Ascending);
			if (order.Equals("Size"))
				o = new OrderBy(Bobs.Place.Columns.Population, OrderBy.OrderDirection.Descending);
			else if (order.Equals("Latitude"))
				o = new OrderBy(Bobs.Place.Columns.LatitudeDegreesNorth, OrderBy.OrderDirection.Descending);
			else if (order.Equals("Longitude"))
				o = new OrderBy(Bobs.Place.Columns.LongitudeDegreesWest, OrderBy.OrderDirection.Descending);
			else if (order.Equals("Region"))
				o = Bobs.Region.RegionOrder;
			else if (order.Equals("Event"))
				o = new OrderBy(Bobs.Place.Columns.TotalEvents, OrderBy.OrderDirection.Descending);

			NoPlaceSelectedFlagImg.Src = CurrentCountry.FlagUrl();

			PageHeadingNoPlace.InnerText = PageHeadingNoPlace.InnerText.Replace("???", CurrentCountry.FriendlyName);
			ContainerPage.SetPageTitle("Places in " + CurrentCountry.FriendlyName);

			NoPlaceSelectedHomeCountryPanel.Visible = (!ContainerPage.Url.HasCountryObjectFilter);
			NoPlaceSelectedCountryPanel.Visible = (ContainerPage.Url.HasCountryObjectFilter);

			NoPlaceSelectedFlagAnchor.HRef = CurrentCountry.Url();

			if (ContainerPage.Url.HasCountryObjectFilter)
			{
				NoPlaceSelectedCountryLink.InnerText = CurrentCountry.FriendlyName;
				NoPlaceSelectedCountryLink.HRef = CurrentCountry.Url();
			}

			PlaceSet ts = new PlaceSet(
				new Query(
					new And(
					new Q(Place.Columns.Enabled, true),
					new Q(Place.Columns.CountryK, CurrentCountry.K)
					),
					o
				)
			);
			PlacesDataList.DataSource = ts;
			PlacesDataList.DataBind();

			//	PlaceSet tsVisit = Usr.Current.PlacesVisit;
			//	foreach (Place t in tsVisit)
			//	{
			//		Cob c = this.CurrentCob;
			//		HtmlAnchor a = new HtmlAnchor();
			//		a.HRef=t.Url();
			//		a.InnerText=t.Name;
			//	}
		}
Пример #2
0
		void BindPlacesList(string order)
		{
			OrderBy o = new OrderBy(Bobs.Place.Columns.Name, OrderBy.OrderDirection.Ascending);

			if (order.Equals("Size"))
				o = new OrderBy(Bobs.Place.Columns.Population, OrderBy.OrderDirection.Descending);
			else if (order.Equals("Latitude"))
				o = new OrderBy(Bobs.Place.Columns.LatitudeDegreesNorth, OrderBy.OrderDirection.Descending);
			else if (order.Equals("Longitude"))
				o = new OrderBy(Bobs.Place.Columns.LongitudeDegreesWest, OrderBy.OrderDirection.Descending);
			else if (order.Equals("Event"))
				o = new OrderBy(Bobs.Place.Columns.TotalEvents, OrderBy.OrderDirection.Descending);

			NoPlaceSelectedFlagImg.Src = CurrentRegion.Country.FlagUrl();

			PageHeadingNoPlace.InnerText = PageHeadingNoPlace.InnerText.Replace("???", CurrentRegion.Name);
			ContainerPage.SetPageTitle("Places in " + CurrentRegion.Name);

			RegionNameLabel.Text = CurrentRegion.Name;

			NoPlaceSelectedFlagAnchor.HRef = CurrentRegion.Country.Url();

			NoPlaceSelectedCountryLink.InnerText = CurrentRegion.Country.FriendlyName;
			NoPlaceSelectedCountryLink.HRef = CurrentRegion.Country.Url();

			PlaceSet ts = new PlaceSet(
				new Query(
					new And(
					new Q(Place.Columns.Enabled, true),
					new Q(Place.Columns.RegionK, CurrentRegion.K)
					),
					o
				)
			);
			PlacesDataList.DataSource = ts;
			PlacesDataList.DataBind();
		}
Пример #3
0
		public static OrderBy DateTimeOrder(OrderBy.OrderDirection direction)
		{
			return new OrderBy(
				new OrderBy(Photo.Columns.ParentDateTime, direction),
				new OrderBy(Photo.Columns.DateTime, direction),
				new OrderBy(Photo.Columns.K, direction)
			);
		}
Пример #4
0
		public GallerySet GalleriesWithJoinedGalleryUsr(OrderBy orderBy, int currentUsrK)
		{
			if (galleries == null)
			{
				Query q = new Query();
				q.QueryCondition = new And(
					new Q(Gallery.Columns.EventK, K), 
					//new Or(
						new Q(Gallery.Columns.LivePhotos, QueryOperator.GreaterThan, 0)//,
						//new Q(Gallery.Columns.OwnerUsrK, currentUsrK)
					//)
				);
				//q.TableElement = Gallery.OwnerJoin;
				//q.OrderBy = new OrderBy(" (CASE WHEN [Usr].[SpotterK]>0 THEN 1 ELSE 0 END) DESC, [Usr].[LoginCount] DESC ");
				q.OrderBy = orderBy;
				if (currentUsrK > 0)
				{
					q.TableElement = new Join(
						new TableElement(TablesEnum.Gallery),
						new TableElement(TablesEnum.GalleryUsr),
						QueryJoinType.Left,
						new And(
							new Q(Gallery.Columns.K, GalleryUsr.Columns.GalleryK, true),
							new Q(GalleryUsr.Columns.UsrK, currentUsrK)
						)
					);
				}
				galleries = new GallerySet(q);


			}
			return galleries;
		}
Пример #5
0
		public Query(object QueryColumnRemoved, TableElement TableElement, Q QueryCondition, OrderBy OrderBy, int TopRecords, bool ReturnCountOnly, int FillStartingAt, int FillMaxRecords)
		{
			this.TableElement = TableElement;
			this.QueryCondition = QueryCondition;
			this.OrderBy = OrderBy;
			this.TopRecords = TopRecords;
			this.ReturnCountOnly = ReturnCountOnly;
			this.FillStartingAt = FillStartingAt;
			if (FillMaxRecords == -1)
				this.FillMaxRecords = 0;
			else
				this.FillMaxRecords = FillMaxRecords;
			this.OverideSql = "";
		}
Пример #6
0
		public Query(TableElement TableElement, Q QueryCondition, OrderBy OrderBy, int TopRecords):
			this(null, TableElement, QueryCondition, OrderBy, TopRecords, false, 0, -1) { }
Пример #7
0
		public Query(Q QueryCondition, OrderBy OrderBy, int TopRecords):
			this(null, null, QueryCondition, OrderBy, TopRecords, false, 0, -1) { }
Пример #8
0
		public Query(Q QueryCondition, OrderBy OrderBy):
			this(null, null, QueryCondition, OrderBy, -1, false, 0, -1) { }