Пример #1
0
		void updateDate(DateStub newDate)
		{
			int year = new DateTime().GetFullYear();
			DateStub previousMonday = newDate.PreviousMonday();
			DateStub nextSunday = newDate.NextSunday();
			if (newDate.NextSunday().Month == newDate.PreviousMonday().Month)
			{
				view.MonthLabel.InnerHTML = previousMonday.Day + " - " + nextSunday.Day + " " + nextSunday.MonthNameFull + (nextSunday.Year != year ? (" " + nextSunday.Year.ToString()) : "");
			}
			else
			{
				view.MonthLabel.InnerHTML = previousMonday.Day + " " + previousMonday.MonthNameFull + " - " + nextSunday.Day + " " + nextSunday.MonthNameFull + (nextSunday.Year != year ? (" " + nextSunday.Year.ToString()) : "");
			}
		}
Пример #2
0
		public DateArgs(DateStub d)
		{
			this.Date = d;
		}
Пример #3
0
		public DateStub Modify(int modifier, string unit)
		{
			DateStub newDate = new DateStub(this.Year, this.Month, this.Day);
			if (unit == "y")
			{
				newDate.Year = this.Year + modifier;
			}
			else if (unit == "m")
			{
				#region month
				if (modifier > 0)
				{
					if (this.Month + modifier > 12)
					{
						newDate.Month = this.Month + modifier - 12;
						newDate.Year++;
					}
					else
						newDate.Month = this.Month + modifier;
				}
				else
				{
					if (this.Month + modifier < 1)
					{
						newDate.Month = 12 - (this.Month + modifier);
						newDate.Year--;
					}
					else
						newDate.Month = this.Month + modifier;
				}
				#endregion
			}
			else if (unit == "d")
			{
				#region day
				int daysInOldMonth = DaysInMonth(this.Year, this.Month);
				if (modifier > 0)
				{
					if (this.Day + modifier > daysInOldMonth)
					{
						if (this.Month == 12)
						{
							newDate.Year++;
							newDate.Month = 1;
							newDate.Day = this.Day + modifier - daysInOldMonth;
						}
						else
						{
							newDate.Month++;
							newDate.Day = this.Day + modifier - daysInOldMonth;
						}
					}
					else
						newDate.Day = this.Day + modifier;
				}
				else
				{
					if (this.Day + modifier < 1)
					{
						if (this.Month == 1)
						{
							newDate.Year--;
							newDate.Month = 12;
							newDate.Day = DaysInMonth(newDate.Year, newDate.Month) + this.Day + modifier;
						}
						else
						{
							newDate.Month--;
							newDate.Day = DaysInMonth(newDate.Year, newDate.Month) + this.Day + modifier;
						}
					}
					else
						newDate.Day = this.Day + modifier;
				}
				#endregion
			}
			return newDate;
		}
Пример #4
0
		public EventSelectionSpecification(ObjectStub brand, ObjectStub place, ObjectStub venue, ObjectStub music, DateStub date, bool me)
		{
			Brand = brand;
			Place = place;
			Venue = venue;
			Music = music;
			Date = date;
			Me = me;
		}
Пример #5
0
		public void DateChange(DateStub newDate)
		{
			dateChangePrivate(newDate);
		}
Пример #6
0
		void initialiseEventDropDown()
		{
			if (!OptionEvent)
				return;

			if (!eventDropDownIsInitialised ||
				((SearchType == SearchTypes.Venue || SearchType == SearchTypes.Music) && Venue != null && eventDropDownVenueK != Venue.K) ||
				(SearchType == SearchTypes.Brand && Brand != null && eventDropDownBrandK != Brand.K) ||
				(SearchType == SearchTypes.Key && Key != null && eventDropDownKey != Key) ||
				eventDropDownDate.Year != Date.Year ||
				eventDropDownDate.Month != Date.Month)
			{
				if ((SearchType == SearchTypes.Venue || SearchType == SearchTypes.Music) && Venue != null && Venue.K == 1)
					return; //Specific case for "all venues" option.

				eventDropDownDate = Date;
				eventDropDownVenueK = Venue != null && (SearchType == SearchTypes.Venue || SearchType == SearchTypes.Music) ? Venue.K : 0;
				eventDropDownBrandK = Brand != null && SearchType == SearchTypes.Brand ? Brand.K : 0;
				eventDropDownKey = Key != null && SearchType == SearchTypes.Key ? Key : "0";

				if (eventDropDownVenueK == 0 && eventDropDownBrandK == 0 && eventDropDownKey == "0")
					return;

				requestId++;

				int currentRequestId = requestId;
				int currentLoadId = loadId;

				EventListBoxJ.ajaxAddOption1("/support/getcached.aspx?type=event&key=" + eventDropDownKey + "&venuek=" + eventDropDownVenueK + "&brandk=" + eventDropDownBrandK + "&date=" + eventDropDownDate.ToString(), null, false, new ActionAjaxOption(eventDropDownInitialised), new object[] { currentRequestId });

				Window.SetTimeout(
					delegate
					{
						if (loadId == currentLoadId)
						{
							EventListBoxJ.removeAll();
							addOption(view.EventListBox, "0", "Loading...");
						}
					},
					100);
			}
			else
				eventDropDownConfigure();
		}
Пример #7
0
		DateStub datePlusMinus(int modifier, string unit)
		{
			DateStub newDate = new DateStub(Date.Year, Date.Month, Date.Day).Modify(modifier, unit);

			dateChangePrivate(newDate);
			
			return newDate;
		}
Пример #8
0
		void dateChangePrivate(DateStub newDate)
		{
			DateStub oldDate = new DateStub(Date.Year, Date.Month, Date.Day);
			if (newDate.Year != oldDate.Year || newDate.Month != oldDate.Month)
			{
				dateRefreshDays(newDate.Year, newDate.Month);
				//newDate.Day = getValueInt(view.DateDayDropDown);
			}

			if (newDate.Day != oldDate.Day)
				setValue(view.DateDayDropDown, newDate.Day.ToString());

			if (newDate.Month != oldDate.Month)
				setValue(view.DateMonthDropDown, newDate.Month.ToString());

			if (newDate.Year != oldDate.Year)
				view.DateYearTextBox.Value = newDate.Year.ToString();

			if (!OptionDateDay && newDate.Day > 0)
				newDate.Day = 0;

			addHistory("Date", newDate.ToString());
			initialiseEventDropDown();
		}
Пример #9
0
		void dateYearTextBoxKeyUpChange(bool change)
		{
			try
			{
				RegularExpression regex = new RegularExpression("[^0-9]", "g");
				if (!regex.Test(view.DateYearTextBox.Value))
				{
					int newYear = int.ParseInvariant(view.DateYearTextBox.Value);
					if (newYear > 1900 && newYear < 2100)
					{
						if (newYear != Date.Year)
						{
							dateRefreshDays(newYear, Date.Month);
							int newDay = OptionDateDay ? getValueInt(view.DateDayDropDown) : 0;
							DateStub newDate = new DateStub(newYear, Date.Month, newDay);
							addHistory("Date", newDate.ToString());
							initialiseEventDropDown();
						}
					}
					else
					{
						if (change)
							view.DateYearTextBox.Value = Date.Year.ToString();
					}
				}
				else
				{
					if (change)
						view.DateYearTextBox.Value = Date.Year.ToString();
				}
			}
			catch
			{
				if (change)
					view.DateYearTextBox.Value = Date.Year.ToString();
			}
		}
Пример #10
0
		void dateMonthDropDownChange(DomEvent e)
		{
			int newMonth = getValueInt(view.DateMonthDropDown);
			dateRefreshDays(Date.Year, newMonth);
			int newDay = OptionDateDay ? getValueInt(view.DateDayDropDown) : 0;
			DateStub newDate = new DateStub(Date.Year, newMonth, newDay);
			addHistory("Date", newDate.ToString());
			initialiseEventDropDown();
		}
Пример #11
0
		void dateDayDropDownChange(DomEvent e)
		{
			int newDay = getValueInt(view.DateDayDropDown);
			DateStub newDate = new DateStub(Date.Year, Date.Month, newDay);
			addHistory("Date", newDate.ToString());
			initialiseEventDropDown();
		}