Пример #1
0
		public static TableElement PerformJoins(TableElement tIn)
		{
			if (tIn == null)
				tIn = new TableElement(TablesEnum.Thread);
			TableElement t = tIn;
			return t;
		}
Пример #2
0
		public static TableElement PerformJoins(TableElement tIn, bool skipEventJoin)
		{
			if (tIn == null)
				tIn = new TableElement(TablesEnum.Gallery);
			TableElement t = tIn;
			if (skipEventJoin)
			{
				t = new Join(
					tIn,
					Venue.CountryJoin,
					QueryJoinType.Inner,
					Event.Columns.VenueK,
					Venue.Columns.K);
			}
			else
			{
				t = new Join(
					tIn,
					Event.CountryAllJoin,
					QueryJoinType.Inner,
					Gallery.Columns.EventK,
					Event.Columns.K);
			}
			return t;
		}
Пример #3
0
		public static TableElement PerformJoins(TableElement tIn)
		{
			TableElement t = new Join(tIn,
				new TableElement(new Column(Photo.Columns.FirstUsrK, Usr.Columns.K)),
				QueryJoinType.Left,
				Photo.Columns.FirstUsrK,
				new Column(Photo.Columns.FirstUsrK, Usr.Columns.K));
			return t;
		}
Пример #4
0
		public void Cal_Load(object o, System.EventArgs e)
		{

			int usrK = 0;
			if (Usr.Current != null)
				usrK = Usr.Current.K;

			TableElement te = new TableElement(TablesEnum.Comment);

			te = new Join(
				te,
				Thread.Columns.K,
				Comment.Columns.ThreadK);

			te = new Join(
				te,
				new TableElement(TablesEnum.ThreadUsr),
				QueryJoinType.Left,
				new And(
				new Q(Thread.Columns.K, ThreadUsr.Columns.ThreadK, true),
				new Q(ThreadUsr.Columns.UsrK, usrK),
				new Q(ThreadUsr.Columns.Status, QueryOperator.NotEqualTo, ThreadUsr.StatusEnum.Deleted)));

			te = new Join(
				te,
				new TableElement(TablesEnum.GroupUsr),
				QueryJoinType.Left,
				new And(
				new Q(Thread.Columns.GroupK, GroupUsr.Columns.GroupK, true),
				new Q(GroupUsr.Columns.UsrK, usrK),
				new Q(GroupUsr.Columns.Status, GroupUsr.StatusEnum.Member)));

			Q q = new And(
				new Q(Comment.Columns.UsrK, ThisUsr.K),
				new Or(
					new Q(Thread.Columns.Private, false),
					new Q(ThreadUsr.Columns.UsrK, usrK)
				),
				new Or(
					new Q(Thread.Columns.GroupPrivate, false),
					new Q(GroupUsr.Columns.UsrK, usrK)
				),
				new Or(
					new Q(Thread.Columns.PrivateGroup, false),
					new Q(GroupUsr.Columns.UsrK, usrK)
				)
			);

			Cal.MonthUrlGetter = new Controls.Cal.MonthUrlDelegate(GetMonthUrl);
			Cal.DayUrlGetter = new Controls.Cal.DayUrlDelegate(GetDayUrl);
			Cal.DateTimeColumn = new Column(Comment.Columns.DateTime);
			Cal.TableElement = te;
			Cal.QueryCondition = q;
		}
Пример #5
0
		public static TableElement PerformJoins(TableElement tIn)
		{
			if (tIn == null)
				tIn = new TableElement(TablesEnum.Gallery);
			TableElement t = tIn;
			t = new Join(t, new TableElement(new Column(Gallery.Columns.MainPhotoK, Photo.Columns.K)), QueryJoinType.Left, Gallery.Columns.MainPhotoK, new Column(Gallery.Columns.MainPhotoK, Photo.Columns.K));
			t = new Join(t, new TableElement(new Column(Gallery.Columns.OwnerUsrK, Usr.Columns.K)), QueryJoinType.Inner, Gallery.Columns.OwnerUsrK, new Column(Gallery.Columns.OwnerUsrK, Usr.Columns.K));

			int usrK = 0;
			if (Usr.Current != null)
				usrK = Usr.Current.K;

			t = new Join(
				t,
				new TableElement(TablesEnum.GalleryUsr),
				QueryJoinType.Left,
				new And(
				new Q(Gallery.Columns.K, GalleryUsr.Columns.GalleryK, true),
				new Q(GalleryUsr.Columns.UsrK, usrK)));

			return t;
		}
		public static TableElement PerformJoins(TableElement tIn)
		{
			return Usr.UsrPageAttendedListPerformJoins(tIn);
		}
Пример #7
0
			TableElement GetTableElement(bool outputOnly)
			{
				if (BuddyDisplay)
				{
					TableElement t;
					if (outputOnly)
					{
						t = new Join(Event.PlaceAndMusicTypeLeftJoin, Country.Columns.K, Place.Columns.CountryK);
					}
					else
					{
						t = new TableElement(TablesEnum.Event);
					}

					t = new Join(t,
						new TableElement(TablesEnum.UsrEventAttended),
						QueryJoinType.Left,
						new Q(Event.Columns.K, UsrEventAttended.Columns.EventK, true));

					t = new Join(t,
						new TableElement(TablesEnum.Buddy),
						QueryJoinType.Inner,
						new And(new Q(Buddy.Columns.FullBuddy, true), new Q(Buddy.Columns.UsrK, Usr.Current.K), new Q(UsrEventAttended.Columns.UsrK, Buddy.Columns.BuddyUsrK, true))
					);

					t = new Join(t,
						new TableElement(TablesEnum.Usr),
						QueryJoinType.Left,
						new Q(Buddy.Columns.BuddyUsrK, Usr.Columns.K, true)
					);

					t = new Join(t,
						new TableElement(new Column(Event.Columns.K, UsrEventAttended.Columns.EventK)),
						QueryJoinType.Left,
						new And(
							new Q(new Column(Event.Columns.K, UsrEventAttended.Columns.EventK), Event.Columns.K, true),
							new Q(new Column(Event.Columns.K, UsrEventAttended.Columns.UsrK), Usr.Current.K)
							)
					);

					return t;// Event.EventCountryJoin(t);
				}
				else if (FilterByUsrAttended)
				{
					return new Join(
						Event.CountryAllJoin,
						UsrEventAttended.Columns.EventK,
						Event.Columns.K);

				}
				else if (FilterByBrand)
					return new Join(
						new Join(Event.PlaceAndMusicTypeLeftJoin, Country.Columns.K, Place.Columns.CountryK),
						new TableElement(TablesEnum.EventBrand),
						QueryJoinType.Inner,
						Event.Columns.K,
						EventBrand.Columns.EventK
						);
				else if (FilterByGroup)
					return new Join(
						new Join(Event.PlaceAndMusicTypeLeftJoin, Country.Columns.K, Place.Columns.CountryK),
						new TableElement(TablesEnum.GroupEvent),
						QueryJoinType.Inner,
						Event.Columns.K,
						GroupEvent.Columns.EventK
						);
				else
					return new Join(Event.PlaceAndMusicTypeLeftJoin, Country.Columns.K, Place.Columns.CountryK);
			}
Пример #8
0
		/// <summary>
		/// Complex join, joining two table elements on a complex join condition.
		/// </summary>
		public Join(object Element1, object Element2, QueryJoinType JoinType, Q JoinCondition)
		{
			TableElement TableElement1, TableElement2;

			if (Element1 is TableElement)
				TableElement1 = (TableElement)Element1;
			else
				TableElement1 = new TableElement(Element1);

			if (Element2 is TableElement)
				TableElement2 = (TableElement)Element2;
			else
				TableElement2 = new TableElement(Element2);

			Init(TableElement1);
			this.TableElement1 = TableElement1;
			this.TableElement2 = TableElement2;
			if (Element1 is TableElement || Element2 is TableElement)
				this.JoinCondition = JoinCondition;
			else
				this.JoinCondition = new And(new Q(Element1, Element2, true), JoinCondition);

			this.JoinType = JoinType;
		}
Пример #9
0
		public Update(TablesEnum table, TableElement from, List<Assign> changes, Q where)
		{
			Table = table;
			From = from;
			Changes = changes;
			Where = where;
		}
Пример #10
0
		public void Bind()
		{
			//Header.InnerText = Future ? "Next events" : "Past events";

			OnlyPhotosP.Visible = OnlyPhotos;

			#region Get weekCount
			Query qWeek = new Query();
			qWeek.QueryCondition = new And(
				Filter,
				dateQ,
				new Q(Event.Columns.DateTime, dateOpNotNow, dateWeek),
				MusicFilterQ
			);
			if (FilterByMusic)
			{
				qWeek.TableElement = new Join(
					Join,
					new TableElement(TablesEnum.EventMusicType),
					QueryJoinType.Left,
					Event.Columns.K,
					EventMusicType.Columns.EventK);
				qWeek.Distinct = true;
				qWeek.DistinctColumn = Event.Columns.K;
			}
			else
				qWeek.TableElement = Join;
			qWeek.ReturnCountOnly = true;
			EventSet esWeek = new EventSet(qWeek);
			int weekCount = esWeek.Count;
			#endregion

			int maxSize1 = Size;
			int maxSize2 = Size * 2;
			int maxSize3 = Size * 4;

			#region Determine template type and toprecords
			int type = 1;
			int top = maxSize1;

			if (weekCount > maxSize1)
			{
				type = 2;
				top = maxSize2;
			}

			if (weekCount > maxSize2)
			{
				type = 3;
				top = maxSize3;
			}
			#endregion

			#region Get EventSet
			Query eventsShowQuery = new Query();
			eventsShowQuery.QueryCondition = new And(
				Filter,
				dateQ,
				MusicFilterQ
			);
			if (Join == null)
				Join = new TableElement(TablesEnum.Event);
			if (FilterByMusic)
			{
				eventsShowQuery.TableElement = new Join(
					Join,
					new TableElement(TablesEnum.EventMusicType),
					QueryJoinType.Left,
					Event.Columns.K,
					EventMusicType.Columns.EventK);
				eventsShowQuery.Distinct = true;
				eventsShowQuery.DistinctColumn = Event.Columns.K;
			}
			else
				eventsShowQuery.TableElement = Join;

			if (eventsShowQuery.Distinct)
			{
				eventsShowQuery.DataTableElement = Join;
			}
			eventsShowQuery.Columns = Event.EventsForDisplay.EventListColumnSet;
			eventsShowQuery.TopRecords = top;
			eventsShowQuery.OrderBy = Future ? Event.FutureEventOrder : Event.PastEventOrder;
			EventSet esShow = new EventSet(eventsShowQuery);
			#endregion

			if (esShow.Count > 0)
			{

				if (AddEventUrl != null)
					AddEventLink1.HRef = AddEventUrl;

				MoreEventsP.Visible = (esShow.Count == top) && !OnlyPhotos;

				DateTime dtLast = esShow[esShow.Count - 1].DateTime;
				CalendarLinkBottomDateLabel.Text = Cambro.Misc.Utility.FriendlyDate(dtLast, false, true);

				if (Calendar != null)
				{
					CalendarLink.HRef = Calendar.UrlCalendar();
					CalendarLink1.HRef = Calendar.UrlCalendar();

					CalendarLinkBottom.HRef = Calendar.UrlCalendarDay(dtLast.Year, dtLast.Month, dtLast.Day);
				}
				else
				{
					CalendarLink.HRef = Calendar.UrlCalendar();
					CalendarLink1.HRef = Calendar.UrlCalendar();

					CalendarLinkBottom.HRef = Calendar.UrlCalendarDay(dtLast.Year, dtLast.Month, dtLast.Day);
				}

				EventsPanel.Visible = true;
				NoEventsPanel.Visible = false;
				EventsDataList.DataSource = esShow;
				if (type == 1)
					EventsDataList.ItemTemplate = this.LoadTemplate("/Templates/Events/EventList1.ascx");
				else if (type == 2)
					EventsDataList.ItemTemplate = this.LoadTemplate("/Templates/Events/EventList2.ascx");
				else
					EventsDataList.ItemTemplate = this.LoadTemplate("/Templates/Events/EventList3.ascx");


				//EventsDataList.DataBinding
				EventsDataList.ItemDataBound += new DataListItemEventHandler(EventsDataList_ItemDataBound);
				EventsDataList.PreRender += new EventHandler(EventsDataList_PreRender);
				EventsDataList.DataBind();

			}
			else
			{
				if (AddEventUrl != null)
					AddEventLink.HRef = AddEventUrl;

				EventsPanel.Visible = false;
				NoEventsPanel.Visible = true;
			}
		}
Пример #11
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 = "";
		}
Пример #12
0
		public Query(TableElement TableElement, Q QueryCondition, OrderBy OrderBy, int TopRecords):
			this(null, TableElement, QueryCondition, OrderBy, TopRecords, false, 0, -1) { }
Пример #13
0
		/// <summary>
		/// Very simple join, joining a TableElement (a join) to a table with an inner join.
		/// </summary>
		public Join(TableElement t1, object ColumnEnum2, object ColumnEnum1ForCondition)
		{
			Init(t1);
			this.TableElement1 = t1;
			this.TableElement2 = new TableElement(ColumnEnum2);
			this.JoinCondition = new Q(ColumnEnum1ForCondition, ColumnEnum2, true);
			this.JoinType = QueryJoinType.Inner;
		}
Пример #14
0
		/// <summary>
		/// Complex join, joining two table elements on a complex join condition.
		/// </summary>
		public Join(TableElement TableElement1, TableElement TableElement2, QueryJoinType JoinType, Q JoinCondition)
		{
			Init(TableElement1);
			this.TableElement1 = TableElement1;
			this.TableElement2 = TableElement2;
			this.JoinCondition = JoinCondition;
			this.JoinType = JoinType;
		}
Пример #15
0
		/// <summary>
		/// Simple join with two table elements:
		/// TableElement1 JoinType JOIN TableElement2 ON ColumnEnum1 = ColumnEnum2
		/// </summary>
		public Join(TableElement TableElement1, TableElement TableElement2, QueryJoinType JoinType, object ColumnEnum1, object ColumnEnum2)
		{
			Init(TableElement1);
			this.TableElement1 = TableElement1;
			this.TableElement2 = TableElement2;
			this.JoinCondition = new Q(ColumnEnum1, ColumnEnum2, true);
			this.JoinType = JoinType;
		}
Пример #16
0
		public static TableElement PerformUsrBuddyLink(TableElement tableElement)
		{
			return new Bobs.Join(
					tableElement,
					new TableElement(TablesEnum.Buddy),
					QueryJoinType.Left,
					new And(
						new Q(Usr.Columns.K, Buddy.Columns.BuddyUsrK, true),
						new Q(Buddy.Columns.FullBuddy, true),
						new Q(Buddy.Columns.UsrK, (Usr.Current == null ? 0 : Usr.Current.K))
					)
				);
		}
Пример #17
0
		public static TableElement UsrPageAttendedListPerformJoins(TableElement tIn)
		{
			TableElement t = new Join(tIn, Venue.Columns.K, Event.Columns.VenueK);
			t = new Join(t, Place.Columns.K, Venue.Columns.PlaceK);
			t = new Join(t, Country.Columns.K, Place.Columns.CountryK);
			return t;
		}
Пример #18
0
		public static TableElement JoinTo(TableElement joinWhat, Group g)
		{
			if (g.BrandK > 0)
			{
				return new Join(
					joinWhat,
					new TableElement(TablesEnum.EventBrand),
					QueryJoinType.Inner,
					new And(
					new Q(Event.Columns.K, EventBrand.Columns.EventK, true),
					new Q(EventBrand.Columns.BrandK, g.BrandK))
				);
			}
			else
			{
				return new Join(
					joinWhat,
					new TableElement(TablesEnum.GroupEvent),
					QueryJoinType.Inner,
					new And(
					new Q(Event.Columns.K, GroupEvent.Columns.EventK, true),
					new Q(GroupEvent.Columns.GroupK, g.K))
				);
			}
		}
Пример #19
0
		public static TableElement EventCountryJoin(TableElement tIn)
		{
			TableElement t = tIn;
			t = new Join(t, Venue.Columns.K, Event.Columns.VenueK);
			t = new Join(t, Place.Columns.K, Venue.Columns.PlaceK);
			t = new Join(t, Country.Columns.K, Place.Columns.CountryK);
			return t;
		}
Пример #20
0
		public static EventSet GetEventSetFromEventBoxKey(string key)
		{
			EventPageStub data = EventPageDetails.GetStubFromKey(key);

			Query q = new Query();

			Q dateQ = new Q(true);
			Q ticketsQ = new Q(true);
			if (data.tabType == TabType.Tickets)
			{
				q.OrderBy = new OrderBy(@"
1.0 * (LOG(2) / LOG((DATEDIFF(wk, GETDATE(), [Event].[DateTime]) * 0.25) + 2)) +
1.0 * (1 - (LOG((1.0 / (([TicketHeat] / 10.0) + 1)) + 1) / LOG(2))) +
1.0 * (1 - (LOG((1.0 / (([Event].[UsrAttendCount] / 30.0) + 1)) + 1) / LOG(2))) --+ 
--1.0 * (1 - (LOG((1.0 / (([Event].[TotalComments] / 100.0) + 1)) + 1) / LOG(2)))
DESC, [Event].[K]", Event.Columns.DateTime, Event.Columns.UsrAttendCount, Event.Columns.TotalComments);

				dateQ = Event.FutureEventsQueryCondition;
				ticketsQ = new Q(Event.Columns.IsTicketsAvailable, true);

			}
			else if (data.tabType == TabType.Future)
			{
				q.OrderBy = new OrderBy(@"
1.0 * (LOG(2) / LOG((DATEDIFF(wk, GETDATE(), [Event].[DateTime]) * 0.25) + 2)) +
1.0 * (1 - (LOG((1.0 / (([Event].[UsrAttendCount] / 30.0) + 1)) + 1) / LOG(2))) --+ 
--1.0 * (1 - (LOG((1.0 / (([Event].[TotalComments] / 100.0) + 1)) + 1) / LOG(2)))
DESC, [Event].[K]", Event.Columns.DateTime, Event.Columns.UsrAttendCount, Event.Columns.TotalComments);

				dateQ = Event.FutureEventsQueryCondition;

			}
			else
			{
				q.OrderBy = new OrderBy(@"
1.0 * (LOG(2) / LOG(0 - (DATEDIFF(wk, GETDATE(), [Event].[DateTime]) * 0.25) + 2)) +
1.0 * (1 - (LOG((1.0 / (([Event].[UsrAttendCount] / 30.0) + 1)) + 1) / LOG(2))) --+ 
--0.5 * (1 - (LOG((1.0 / (([Event].[TotalComments] / 100.0) + 1)) + 1) / LOG(2))) +
--0.5 * (1 - (LOG((1.0 / (([Event].[LivePhotos] / 75.0) + 1)) + 1) / LOG(2))) + 
DESC, [Event].[K]", Event.Columns.DateTime, Event.Columns.UsrAttendCount, Event.Columns.TotalComments, Event.Columns.LivePhotos);

				//q.OrderBy = Event.PastEventOrder;

				dateQ = new And(Event.PreviousEventsQueryCondition, new Q(Event.Columns.DateTime, QueryOperator.GreaterThan, DateTime.Today.AddDays(-60)));
			}

			//supported object types: None, Brand, Country, Place
			Q parentObjectQ;
			TableElement parentObjectTableElement;
			if (data.parentObjectType == Model.Entities.ObjectType.None)
			{
				parentObjectTableElement = new TableElement(TablesEnum.Event);
				parentObjectQ = new Q(true);
			}
			else if (data.parentObjectType == Model.Entities.ObjectType.Country)
			{
				parentObjectTableElement = Event.PlaceAllJoin;
				parentObjectQ = new Q(Place.Columns.CountryK, data.parentObjectK);
			}
			else if (data.parentObjectType == Model.Entities.ObjectType.Place)
			{
				parentObjectTableElement = Event.VenueAllJoin;
				parentObjectQ = new Q(Venue.Columns.PlaceK, data.parentObjectK);
			}
			else if (data.parentObjectType == Model.Entities.ObjectType.Brand)
			{
				parentObjectTableElement = Event.EventBrandJoin;
				parentObjectQ = new Q(EventBrand.Columns.BrandK, data.parentObjectK);
			}
			else
				throw new Exception("Unsupported object type");

			q.TableElement = parentObjectTableElement;

			Q musicTypeQ = new Q(true);
			if (data.musicTypeK > 1)
			{
				List<int> al = new List<int>();
				MusicType mt = new MusicType(data.musicTypeK);
				al.Add(mt.K);
				if (mt.ParentK == 1)
				{
					foreach (MusicType mtChild in mt.Children)
					{
						al.Add(mtChild.K);
					}
				}
				musicTypeQ = new InListQ(EventMusicType.Columns.MusicTypeK, al);

				q.TableElement = new Join(
					parentObjectTableElement,
					new TableElement(TablesEnum.EventMusicType),
					QueryJoinType.Left,
					Event.Columns.K,
					EventMusicType.Columns.EventK);
				q.Distinct = true;
				q.DistinctColumn = Event.Columns.K;

			}

			q.QueryCondition = new And(
				dateQ,
				parentObjectQ,
				musicTypeQ,
				ticketsQ);

			q.CacheDuration = TimeSpan.FromDays(1);

			q.Paging.RecordsPerPage = 8;
			q.Paging.RequestedPageIndex = data.pageIndex;

			EventSet es = new EventSet(q);
			return es;
		}
Пример #21
0
		public void CompPanel_Load(object o, System.EventArgs e)
		{
			if (OnlyShowThreads)
			{
				CompPanel.Visible = false;
				return;
			}

			Q RelevanceQ = null;
			if (Discussable == null)
				RelevanceQ = new Q(true);
			else if (Discussable.UsedDiscussable is Event)
				RelevanceQ = new Q(Comp.Columns.EventK, Discussable.UsedDiscussable.K);
			else if (Discussable.UsedDiscussable is Venue)
				RelevanceQ = new Q(Event.Columns.VenueK, Discussable.UsedDiscussable.K);
			else if (Discussable.UsedDiscussable is Place)
				RelevanceQ = new Q(Venue.Columns.PlaceK, Discussable.UsedDiscussable.K);
			else if (Discussable.UsedDiscussable is Country)
				RelevanceQ = new Q(Place.Columns.CountryK, Discussable.UsedDiscussable.K);
			else if (Discussable.UsedDiscussable is Brand)
				RelevanceQ = new Or(
					new Q(Brand.Columns.K, Discussable.UsedDiscussable.K),
					new Q(Comp.Columns.BrandK, Discussable.UsedDiscussable.K));
			else if (Discussable.UsedDiscussable is Group)
				RelevanceQ = new Q(Group.Columns.K, Discussable.UsedDiscussable.K);

			TableElement t = new TableElement(TablesEnum.Comp);
			if (Discussable != null && Discussable.UsedDiscussable is Venue)
				t = new Join(Comp.Columns.EventK, Event.Columns.K);
			else if (Discussable != null && Discussable != null && Discussable.UsedDiscussable is Place)
				t = new Join(new Join(Comp.Columns.EventK, Event.Columns.K), new TableElement(TablesEnum.Venue), QueryJoinType.Inner, Event.Columns.VenueK, Venue.Columns.K);
			else if (Discussable != null && Discussable.UsedDiscussable is Country)
				t = new Join(
						new Join(
							new JoinLeft(Comp.Columns.EventK, Event.Columns.K),
							new TableElement(TablesEnum.Venue),
							QueryJoinType.Left,
							Event.Columns.VenueK,
							Venue.Columns.K),
						new TableElement(TablesEnum.Place),
						QueryJoinType.Left,
						Venue.Columns.PlaceK,
						Place.Columns.K);
			else if (Discussable != null && Discussable.UsedDiscussable is Brand)
				t = new Join(new TableElement(TablesEnum.Comp), Event.BrandJoin, QueryJoinType.Left, Comp.Columns.EventK, Event.Columns.K);
			else if (Discussable != null && Discussable.UsedDiscussable is Group)
				t = new Join(new TableElement(TablesEnum.Comp), Event.GroupJoin, QueryJoinType.Inner, Comp.Columns.EventK, Event.Columns.K);

			t = Templates.Comps.Latest.PerformJoins(t);

			Query q = new Query();
			q.Columns = Templates.Comps.Latest.Columns;

			q.QueryCondition = new And(
				new Q(Comp.Columns.Status, Comp.StatusEnum.Enabled),
				new Q(Comp.Columns.DateTimeClose, QueryOperator.GreaterThan, DateTime.Now),
				new Q(Comp.Columns.DateTimeStart, QueryOperator.LessThan, DateTime.Now),
				RelevanceQ
				);
			q.OrderBy = new OrderBy(new OrderBy(Comp.Columns.PrizeValueRange, OrderBy.OrderDirection.Descending), new OrderBy(OrderBy.OrderDirection.Random));
			q.TopRecords = Items;
			q.TableElement = t;
			CompSet cs = new CompSet(q);

			if (cs.Count == 0)
				CompPanel.Visible = false;
			else
			{
				CompPanel.Visible = true;
				CompDataList.DataSource = cs;
				CompDataList.ItemTemplate = this.LoadTemplate("/Templates/Comps/Latest.ascx");
				CompDataList.DataBind();

				if (Discussable == null)
					CompArchiveAnchor.HRef = Archive.GetUrl(DateTime.Now.Year, DateTime.Now.Month, 0, ArchiveObjectType.Comp, new string[] { }, "");
				else if (Discussable.UsedDiscussable is IHasArchive && cs.Count == Items)
					CompArchiveAnchor.HRef = ((IHasArchive)Discussable.UsedDiscussable).UrlArchiveDate(DateTime.Now.Year, DateTime.Now.Month, 0, ArchiveObjectType.Comp);
				else
				{
					CompArchiveDiv.Visible = false;
					CompPanelInner.Attributes["class"] = "LatestPanel Big CleanLinks";
				}
			}
		}
Пример #22
0
			public Series(params object[] columns)
			{
				InitialTableElement = new TableElement(columns[0]);

				for (int i = 1; i < columns.Length; i++)
				{
					TableElement t = new TableElement(columns[i]);

					if (TableElements.Count>0 && t.ExternalSqlTableName.Equals(TableElements[TableElements.Count - 1].ExternalSqlTableName))
						continue;

					TableElements.Add(t);
					JoinConditions.Add(new Q(columns[i - 1], columns[i], true));

				}
			}