Ejemplo n.º 1
0
		protected string EditHtml(Event e)
		{
			if (Usr.Current.CanEdit(e))
				return "<a href=\"" + e.UrlApp("edit") + "\">Edit</a>&nbsp;or&nbsp;<a href=\"" + e.UrlApp("edit","page","pic") + "\">" + (e.HasPic ? "edit" : "add") + "&nbsp;pic</a>";
			else
				return "<small>n/a</small>";
		}
Ejemplo n.º 2
0
		protected string ReviewHtml(Event e)
		{
			if (e.DateTime <= DateTime.Today)
				return "<a href=\"" + e.UrlApp("review") + "\">Review</a>";
			else
				return "<small>n/a</small>";
		}
Ejemplo n.º 3
0
		public static Event AddEvent(
			string name, 
			int venueK, 
			StartTimes? startTime, 
			DateTime date, 
			string shortDetails, 
			string safeLongDetails, 
			Guid? duplicateGuid, 
			int? capacity, 
			Usr usr, 
			int[] musicTypeKs, 
			int[] brandKs,
			bool spotterRequest,
			string spotterRequestName,
			string spotterRequestNumber)
		{
			Event ev = new Event();

			Venue venue = new Venue(venueK);
			Transaction t = null;//new Transaction();
			try
			{
				ev.AddedDateTime = DateTime.Now;
				ev.VenueK = venue.K;
				ev.Name = Cambro.Web.Helpers.StripHtml(name).Trim();
				ev.StartTime = startTime ?? StartTimes.Evening;;
				ev.DateTime = date;
				ev.ShortDetailsHtml = Cambro.Misc.Utility.Snip(Cambro.Web.Helpers.StripHtml(shortDetails ?? ""), 500);

				ev.LongDetailsHtml = safeLongDetails;

				ev.DuplicateGuid = duplicateGuid ?? Guid.NewGuid();

				ev.Capacity = capacity ?? venue.Capacity;

				ev.AdminNote += "Event added by owner " + DateTime.Now.ToString();

				ev.OwnerUsrK = Usr.Current.K;

				ev.SpotterRequest = spotterRequest;
				ev.SpotterRequestName = spotterRequestName;
				ev.SpotterRequestNumber = spotterRequestNumber;

				if (!usr.IsSuper)
				{
					ev.IsNew = true;
					ev.ModeratorUsrK = Usr.GetEventModeratorUsrK();
				}
				ev.InitUrlFragment();
				ev.Update(t);

				foreach (int musicTypeK in musicTypeKs ?? new int[]{})
				{
					MusicType mt = new MusicType(musicTypeK);
					EventMusicType emt = new EventMusicType();
					emt.EventK = ev.K;
					emt.MusicTypeK = mt.K;
					emt.Update(t);
				}
				foreach (int brandK in brandKs ?? new int[] { })
				{
					EventBrand eb = new EventBrand();
					eb.BrandK = brandK;
					eb.EventK = ev.K;
					eb.Update(t);
				}

				ev.UpdateMusicTypesString(t);

				ev.Venue.UpdateTotalEvents(t);
				ev.Owner.UpdateEventCount(t);

				//t.Commit();
				

			}
			catch (Exception ex)
			{
				//t.Rollback();
				ev.DeleteAll(null);
				throw ex;
			}
			finally
			{
				//t.Close();
			}

			Mailer sm = new Mailer();
			sm.TemplateType = Mailer.TemplateTypes.AnotherSiteUser;
			sm.UsrRecipient = Usr.Current;
			sm.To = Usr.Current.Email;
			sm.Subject = "You've added an event!";
			sm.Body += "<p>You've added an event to the DontStayIn events database.</p>";
			sm.Body += "<p>Click the link below to view the event:</p>";
			sm.Body += "<p><a href=\"[LOGIN(" + ev.Url() + ")]\">" + HttpUtility.HtmlEncode(ev.FriendlyName) + "</a></p>";
			sm.Body += "<h2>Make changes</h2>";
			sm.Body += "<p>You can make changes or corrections to the event details by clicking the link below:</p>";
			sm.Body += "<p><a href=\"[LOGIN(/event-" + ev.K.ToString() + "/edit)]\">Edit your event</a></p>";
			sm.Body += "<h2>How about a banner advert?</h2>";
			sm.Body += "<p>You can add a banner advert to your event by using the link below:</p>";
			sm.Body += "<p><a href=\"[LOGIN(/pages/bannerpreview/eventk-" + ev.K.ToString() + ")]\">Add a banner</a></p>";
			sm.Body += "<h2>Add photos or a review</h2>";
			sm.Body += "<p>After the event you can upload photos or add a review with the links below:</p>";
			sm.Body += "<p><a href=\"[LOGIN(/pages/galleries/add/eventk-" + ev.K.ToString() + ")]\">Add photos</a> or <a href=\"[LOGIN(" + ev.UrlApp("review") + ")]\">add a review</a></p>";
			sm.Body += "<h2>Are you the event promoter?</h2>";
			sm.Body += "<p>If you organise this event, you can sign up for a FREE promoter account by using the link below:</p>";
			sm.Body += "<p><a href=\"[LOGIN(/pages/promoters/edit)]\">Apply for a promoter account</a></p>";
			sm.RedirectUrl = ev.Url();
			sm.Send();
			return ev;

		}
Ejemplo n.º 4
0
		public void BindPanelReview(int NewEventK)
		{
			Event NewEvent = new Event(NewEventK);
			ReviewVenue.Text = NewEvent.Venue.Name + " in " + NewEvent.Venue.Place.Name;
			ReviewDate.Text = NewEvent.DateTime.ToShortDateString();
			ReviewName.Text = NewEvent.Name;
			ReviewStartTime.Text = NewEvent.StartTime.ToString();
			ReviewShortDetailsHtml.Text = NewEvent.ShortDetailsHtmlRender;
			ReviewLongDetailsHtml.Text = NewEvent.LongDetailsHtmlRender;
			ReviewCapacity.Text = (NewEvent.Capacity == 0 ? "(not specified)" : NewEvent.Capacity.ToString());

			//TODO: Show brands

			if (NewEvent.MusicTypesString.Length != 0)
			{
				ReviewMusicTypes.Text = NewEvent.MusicTypesString;
			}
			else
			{
				ReviewMusicTypes.Text = "None selected";
			}

			ReviewPicTd.Visible = NewEvent.HasPic;
			ReviewNoPicTd.Visible = !NewEvent.HasPic;
			if (NewEvent.HasPic)
				ReviewPicImg.Src = NewEvent.PicPath;

			ReviewEditAnchor.HRef = NewEvent.UrlApp("edit", "page", "details");


		}