public void DeleteNow(object o, System.EventArgs e) { if (ObjectTypeDropDown.SelectedValue.Equals("Photo")) { Photo c = new Photo(int.Parse(ObjectKTextBox.Text)); SendEmail(c); Delete.DeleteAll(c); } else if (ObjectTypeDropDown.SelectedValue.Equals("Gallery")) { Gallery c = new Gallery(int.Parse(ObjectKTextBox.Text)); SendEmail(c); Delete.DeleteAll(c); } else if (ObjectTypeDropDown.SelectedValue.Equals("Venue")) { Venue c = new Venue(int.Parse(ObjectKTextBox.Text)); SendEmail(c); Delete.DeleteAll(c); } else if (ObjectTypeDropDown.SelectedValue.Equals("Event")) { Event c = new Event(int.Parse(ObjectKTextBox.Text)); SendEmail(c); Delete.DeleteAll(c); } else if (ObjectTypeDropDown.SelectedValue.Equals("Comment")) { Comment c = new Comment(int.Parse(ObjectKTextBox.Text)); SendEmail(c); Delete.DeleteAll(c); } else if (ObjectTypeDropDown.SelectedValue.Equals("Thread")) { Thread c = new Thread(int.Parse(ObjectKTextBox.Text)); SendEmail(c); Delete.DeleteAll(c); } else if (ObjectTypeDropDown.SelectedValue.Equals("Usr")) { Usr c = new Usr(int.Parse(ObjectKTextBox.Text)); SendEmail(c); Delete.DeleteAll(c); } else if (ObjectTypeDropDown.SelectedValue.Equals("Article")) { Article c = new Article(int.Parse(ObjectKTextBox.Text)); SendEmail(c); Delete.DeleteAll(c); } DoneLabel.Visible = true; }
protected string EditHtml(Venue v) { if (Usr.Current.CanEdit(v)) { string part = "<a href=\"" + v.UrlApp("edit") + "\">Edit details</a>"; if (v.HasPic) return part; else return part + " or <a href=\"" + v.UrlApp("edit","page","pic") + "\">add a picture</a>"; } else return "<small>n/a</small>"; }
public void EnableSelected(object o, System.EventArgs e) { OutputP.InnerHtml = ""; foreach (string str in Request.Form.Keys) { if (str.StartsWith("ucAdminEventSelectedK") && Request.Form[str].Equals("1")) { string str1 = str.Substring(21); OutputP.InnerHtml += "Enabling event " + str1 + "..."; try { int eventK = int.Parse(str1); Event ev = new Event(eventK); ev.IsNew = false; ev.IsEdited = false; ev.Update(); OutputP.InnerHtml += " Done."; } catch { OutputP.InnerHtml += " <b>FAILED</b> - exception while enabling event. Please contact admin with details."; } OutputP.InnerHtml += "<br>"; } if (str.StartsWith("ucAdminVenueSelectedK") && Request.Form[str].Equals("1")) { string str1 = str.Substring(21); OutputP.InnerHtml += "Enabling venue " + str1 + "..."; try { int venueK = int.Parse(str1); Venue ven = new Venue(venueK); ven.IsNew = false; ven.IsEdited = false; ven.Update(); OutputP.InnerHtml += " Done."; } catch { OutputP.InnerHtml += " <b>FAILED</b> - exception while enabling venue. Please contact admin with details."; } OutputP.InnerHtml += "<br>"; } } OutputP.Visible = true; Bind(); }
public void ProcessRequest(HttpContext context) { string[] splitPath = context.Request.Path.Split('/'); if (splitPath.Length == 4 && splitPath[1].ToLower() == "images" && splitPath[2].ToLower() == "flyer") { string fileName = splitPath[3]; int flyerK = int.Parse(fileName.Substring(0, fileName.IndexOf("."))); Flyer f = new Flyer(flyerK); if (f.MiscK == 0) Storage.WriteFileToHttpResponse(context, Storage.Stores.Pix, new Guid("5a106560-1989-4ecb-86bd-e52ba8689352"), "gif"); else Storage.WriteFileToHttpResponse(context, Storage.Stores.Pix, f.Misc.Guid, f.Misc.Extention); Utilities.GetSafeThread(() => f.LogView()).Start(); } else if ((splitPath.Length == 4 || splitPath.Length == 6) && splitPath[1].ToLower() == "images" && (splitPath[2].ToLower() == "pix" || splitPath[2].ToLower() == "master")) { string fileName = splitPath[splitPath.Length - 1]; Guid guid = new Guid(fileName.Substring(0, fileName.IndexOf("."))); string extention = fileName.Substring(fileName.IndexOf(".") + 1); Storage.WriteFileToHttpResponse(context, splitPath[2].ToLower() == "pix" ? Storage.Stores.Pix : Storage.Stores.Master, guid, extention); } else if ((splitPath.Length == 4 || splitPath.Length == 6) && splitPath[1].ToLower() == "images" && (splitPath[2].ToLower() == "pixredirect" || splitPath[2].ToLower() == "masterredirect")) { string fileName = splitPath[splitPath.Length - 1]; Guid guid = new Guid(fileName.Substring(0, fileName.IndexOf("."))); string extention = fileName.Substring(fileName.IndexOf(".") + 1); HttpContext.Current.Response.Redirect(Storage.Path(guid, extention, splitPath[2].ToLower() == "pixredirect" ? Storage.Stores.Pix : Storage.Stores.Master)); //Storage.WriteFileToHttpResponse(context, splitPath[2].ToLower() == "pix" ? Storage.Stores.Pix : Storage.Stores.Master, guid, extention); } else if (splitPath.Length == 4 && splitPath[1].ToLower() == "files" && splitPath[2].ToLower() == "styledcss" && splitPath[3].ToLower().EndsWith(".css")) { string[] filename = splitPath[3].ToLower().Split('-'); string objectType = filename[0]; int K = int.Parse(filename[1].Substring(0, filename[1].Length - 4)); if (objectType == "brand") { Brand b = new Brand(K); context.Response.Write(b.StyledCss); } else if (objectType == "venue") { Venue v = new Venue(K); context.Response.Write(v.StyledCss); } } }
public void TestThatGeneratedCacheKeysAreInvalidatedWhenAForeignKeyIsChangedInAChildTable() { Caching.Instances.Main.FlushAll(); Venue venue = new Venue(); venue.Update(); Venue venue2 = new Venue(); venue2.Update(); Event ev = new Event() { VenueK = venue.K }; ev.Update(); string value = Guid.NewGuid().ToString(); Caching.Instances.Main.Store(new NamespacedCacheKey(CacheKeyPrefix.BobCacheItem, Caching.CacheKeys.Venue.Events(venue.K)), value); Caching.Instances.Main.Store(new NamespacedCacheKey(CacheKeyPrefix.BobCacheItem, Caching.CacheKeys.Venue.Events(venue2.K)), value); ev.VenueK = venue2.K; ev.Update(); Assert.IsNull(Caching.Instances.Main.Get(new NamespacedCacheKey(CacheKeyPrefix.BobCacheItem, Caching.CacheKeys.Venue.Events(venue.K)))); Assert.IsNull(Caching.Instances.Main.Get(new NamespacedCacheKey(CacheKeyPrefix.BobCacheItem, Caching.CacheKeys.Venue.Events(venue2.K)))); }
private void Page_Load(object sender, System.EventArgs e) { Response.CacheControl = "no-cache"; Response.AddHeader("Pragma", "no-cache"); Response.Expires = -1; if (Mode.Equals(Modes.None)) { if (Usr.Current.IsPromoter) ChangePanel(PanelAlreadyPromoter); else ChangePanel(PanelSignUpForm); } else if (Mode.Equals(Modes.Add) || Mode.Equals(Modes.Edit)) ChangePanel(PanelSignUpForm); else if (Mode.Equals(Modes.ConfirmBrand)) { if (!Usr.Current.IsAdmin) throw new Exception("Only admin!"); Brand b = new Brand(ContainerPage.Url["k"]); b.PromoterStatus = Brand.PromoterStatusEnum.Confirmed; b.Update(); Response.Redirect(b.Promoter.Url()); } else if (Mode.Equals(Modes.ConfirmVenue)) { if (!Usr.Current.IsAdmin) throw new Exception("Only admin!"); Venue v = new Venue(ContainerPage.Url["k"]); v.PromoterStatus = Venue.PromoterStatusEnum.Confirmed; v.Update(); Response.Redirect(v.Promoter.Url()); } this.SignUpForm_Load(sender, e); this.Pic_Load(sender, e); if (Usr.Current.IsAdmin) { this.uiAccessUsersMultiSelector.WebServiceMethod = "GetUsrsPublic"; } }
public static Dictionary<string, string> GetDataItem(Venue v) { var nextEvents = v.ChildEvents(new Q(Event.Columns.DateTime, QueryOperator.GreaterThanOrEqualTo, DateTime.Now.Day), new KeyValuePair<object, OrderBy.OrderDirection>(Event.Columns.DateTime, OrderBy.OrderDirection.Descending)).Page(1, 10); var lastChat = v.ChildThreads(new Q(Thread.Columns.Enabled, true), new KeyValuePair<object, OrderBy.OrderDirection>(Thread.Columns.LastPost, OrderBy.OrderDirection.Descending)); return new Dictionary<string, string>() { {Columns.AnyPicPath.ToString(), v.AnyPicPath}, {Columns.Url.ToString(), v.Url()}, {Columns.Name.ToString(), v.Name}, {Columns.NextEventDate.ToString(), nextEvents.Any() ? Cambro.Misc.Utility.FriendlyDate(nextEvents[0].DateTime) : ""}, {Columns.NextEventName.ToString(), nextEvents.Any() ? nextEvents[0].Name : ""}, {Columns.NextEventUrl.ToString(), nextEvents.Any() ? nextEvents[0].Url() : ""}, {Columns.LastChatDate.ToString(), lastChat.Any() ? Cambro.Misc.Utility.FriendlyDate(lastChat[0].DateTime) : ""}, {Columns.LastChatName.ToString(), lastChat.Any() ? lastChat[0].Name : ""}, {Columns.LastChatUrl.ToString(), lastChat.Any() ? lastChat[0].Url() : ""}, }; }
public static IBob Get(Model.Entities.ObjectType type, int k) { IBob b = null; bool wrongType = false; try { switch (type) { case Model.Entities.ObjectType.Photo: b = new Photo(k); break; case Model.Entities.ObjectType.Event: b = new Event(k); break; case Model.Entities.ObjectType.Venue: b = new Venue(k); break; case Model.Entities.ObjectType.Place: b = new Place(k); break; case Model.Entities.ObjectType.Thread: b = new Thread(k); break; case Model.Entities.ObjectType.Country: b = new Country(k); break; case Model.Entities.ObjectType.Article: b = new Article(k); break; case Model.Entities.ObjectType.Para: b = new Para(k); break; case Model.Entities.ObjectType.Brand: b = new Brand(k); break; case Model.Entities.ObjectType.Promoter: b = new Promoter(k); break; case Model.Entities.ObjectType.Usr: b = new Usr(k); break; case Model.Entities.ObjectType.Region: b = new Region(k); break; case Model.Entities.ObjectType.Gallery: b = new Gallery(k); break; case Model.Entities.ObjectType.Group: b = new Group(k); break; case Model.Entities.ObjectType.Banner: b = new Banner(k); break; case Model.Entities.ObjectType.GuestlistCredit: b = new GuestlistCredit(k); break; case Model.Entities.ObjectType.Ticket: b = new Ticket(k); break; case Model.Entities.ObjectType.Invoice: b = new Invoice(k); break; case Model.Entities.ObjectType.InsertionOrder: b = new InsertionOrder(k); break; case Model.Entities.ObjectType.CampaignCredit: b = new CampaignCredit(k); break; case Model.Entities.ObjectType.UsrDonationIcon: b = new UsrDonationIcon(k); break; default: wrongType = true; b = null; break; } } catch { } if (wrongType) throw new Exception("Bob.Get attempted to get " + type.ToString() + " - can't do it!!! DUH!"); return b; }
public void MergeAndDelete(Venue merge) { if (this.K == merge.K) throw new DsiUserFriendlyException("Can't merge a venue into itself!"); Cambro.Web.Helpers.WriteAlertHeader(); //throw new Exception("This function isn't finished yet!"); Cambro.Web.Helpers.WriteAlert("Starting merge...", true); #region Promoter Cambro.Web.Helpers.WriteAlert("Merging promoter...", true); if (merge.PromoterK > 0 && merge.PromoterStatus.Equals(Venue.PromoterStatusEnum.Confirmed) && merge.Promoter.IsEnabled) { this.PromoterK = merge.PromoterK; this.PromoterStatus = Venue.PromoterStatusEnum.Confirmed; } else if (this.PromoterK == 0 && merge.PromoterK > 0) { this.PromoterK = merge.PromoterK; this.PromoterStatus = merge.PromoterStatus; } Cambro.Web.Helpers.WriteAlert("Done merging promoter..."); #endregion #region Articles if (true) { Cambro.Web.Helpers.WriteAlert("Moving articles...", true); Query q = new Query(); q.QueryCondition = new And(new Q(Article.Columns.ParentObjectType, Model.Entities.ObjectType.Venue),new Q(Article.Columns.ParentObjectK, merge.K)); ArticleSet ars = new ArticleSet(q); foreach (Article a in ars) { Cambro.Web.Helpers.WriteAlert("Moving article " + a.K + "..."); a.ParentObjectK = this.K; a.VenueK = this.K; if (a.Relevance <= Model.Entities.Article.RelevanceEnum.Place) a.PlaceK = this.PlaceK; else a.PlaceK = 0; if (a.Relevance <= Model.Entities.Article.RelevanceEnum.Country) a.CountryK = this.Place.CountryK; else a.CountryK = 0; a.UrlFragment = this.UrlFilterPart; a.Update(); #region Threads if (true) { Update u = new Update(); u.Table = TablesEnum.Thread; u.Where = new Q(Thread.Columns.ArticleK, a.K); u.Changes.Add(new Assign(Thread.Columns.UrlFragment, a.UrlFilterPart)); u.Changes.Add(new Assign(Thread.Columns.VenueK, this.K)); u.Changes.Add(new Assign(Thread.Columns.PlaceK, this.PlaceK)); u.Changes.Add(new Assign(Thread.Columns.CountryK, this.Place.CountryK)); u.Run(); } #endregion #region Galleries if (true) { Update u = new Update(); u.Table = TablesEnum.Gallery; u.Where = new Q(Gallery.Columns.ArticleK, a.K); u.Changes.Add(new Assign(Gallery.Columns.UrlFragment, a.UrlFilterPart)); u.Run(); } #endregion #region Photos if (true) { Update u = new Update(); u.Table = TablesEnum.Photo; u.Where = new Q(Photo.Columns.ArticleK, a.K); u.Changes.Add(new Assign(Photo.Columns.UrlFragment, a.UrlFilterPart)); u.Run(); } #endregion } Cambro.Web.Helpers.WriteAlert("Done moving articles...", true); } #endregion #region Events if (true) { Cambro.Web.Helpers.WriteAlert("Moving events...", true); EventSet es = new EventSet(new Query(new Q(Event.Columns.VenueK, merge.K))); int count = 0; foreach (Event ev in es) { count++; Cambro.Web.Helpers.WriteAlert("Moving event "+ev.K+" ("+count+" / "+es.Count+")..."); ev.ChangeVenue(this.K, true); } Cambro.Web.Helpers.WriteAlert("Done moving events..."); } #endregion #region Thread ParentObjects if (true) { Cambro.Web.Helpers.WriteAlert("Merging topics (1/2)...", true); Update u = new Update(); u.Table = TablesEnum.Thread; u.Where = new And( new Q(Thread.Columns.ParentObjectType, Model.Entities.ObjectType.Venue), new Q(Thread.Columns.ParentObjectK, merge.K)); u.Changes.Add(new Assign(Thread.Columns.ParentObjectK, this.K)); u.Run(); Cambro.Web.Helpers.WriteAlert("Done merging topics (1/2)..."); } #endregion #region Thread if (true) { Cambro.Web.Helpers.WriteAlert("Merging topics (2/2)...", true); Update u = new Update(); u.Table = TablesEnum.Thread; u.Where = new And( new Q(Thread.Columns.VenueK, merge.K), new Q(Thread.Columns.EventK, 0), new Q(Thread.Columns.ArticleK, 0)); u.Changes.Add(new Assign(Thread.Columns.VenueK, this.K)); u.Changes.Add(new Assign(Thread.Columns.UrlFragment, this.UrlFilterPart)); u.Run(); Cambro.Web.Helpers.WriteAlert("Done merging topics (2/2)..."); } #endregion #region Pic if (!this.HasPic) { Cambro.Web.Helpers.WriteAlert("Merging picture...", true); this.Pic = merge.Pic; this.PicMiscK = merge.PicMiscK; this.PicPhotoK = merge.PicPhotoK; this.PicState = merge.PicState; merge.Pic = Guid.Empty; merge.PicMiscK = 0; merge.PicPhotoK = 0; merge.PicState = ""; merge.Update(); Cambro.Web.Helpers.WriteAlert("Done merging picture..."); } #endregion this.AdminNote += "Venue " + merge.K + " was merged with this one " + DateTime.Now.ToString() + ". The admin note from venue " + merge.K + " is:\n********************\n" + merge.AdminNote + "\n********************\n"; this.Update(); int mergePlaceK = merge.PlaceK; Cambro.Web.Helpers.WriteAlert("Deleting old venue...", true); merge.DeleteAll(null); Cambro.Web.Helpers.WriteAlert("Done deleting old venue..."); if (mergePlaceK != this.PlaceK) { Place mergePlace = new Place(mergePlaceK); Cambro.Web.Helpers.WriteAlert("Updating stats for old place...", true); mergePlace.UpdateTotalComments(null); mergePlace.UpdateTotalEvents(null); Cambro.Web.Helpers.WriteAlert("Done updating stats for old place..."); } Cambro.Web.Helpers.WriteAlert("Updating stats for new venue...", true); this.UpdateTotalComments(null); this.UpdateTotalEvents(null); Cambro.Web.Helpers.WriteAlert("Done updating stats for new venue..."); this.Update(); Cambro.Web.Helpers.WriteAlert("Done merging venues!", true); }
public static Venue Add(Usr currentUsr, string name, int? capacity, int placeK, string postcode, bool? regularEvents, Guid? duplicateGuid, string safeDetailsString) { Venue v = new Venue(); v.AddedDateTime = DateTime.Now; v.Name = Cambro.Web.Helpers.StripHtml(name); v.Postcode = Cambro.Web.Helpers.StripHtml(postcode); Place selectedPlace = new Place(placeK); v.PlaceK = selectedPlace.K; v.Capacity = capacity ?? 0; v.RegularEvents = regularEvents ?? false; v.DetailsHtml = safeDetailsString; v.DuplicateGuid = duplicateGuid ?? Guid.NewGuid(); v.AdminNote += "Venue added by owner " + DateTime.Now.ToString(); v.OwnerUsrK = currentUsr.K; if (!currentUsr.IsSuper) { v.IsNew = true; v.ModeratorUsrK = Usr.GetEventModeratorUsrK(); } v.Update(); v.CreateUniqueUrlName(false); v.UpdateUrlFragment(false); v.Update(); return v; }
public string dsiTagReplacement(Match m) { string tagName = "dsi"; try { //string[] arrParts = m.Groups[1].Value.Split[" "]; //Dictionary<string, string> parts = new Dictionary<string, string>(); SgmlReader sgml = new SgmlReader(); string inStr = m.Groups[0].Value; if (inStr.StartsWith("<dsi:link")) inStr += "</dsi:link>"; sgml.InputStream = new StringReader(inStr); sgml.DocType = "HTML"; sgml.Read(); tagName = sgml.Name; string uniqueId = Guid.NewGuid().ToString("N"); #region Parse attributes Dictionary<string, string> attributes = new Dictionary<string, string>(); while (sgml.MoveToNextAttribute()) { attributes.Add(sgml.Name.ToLower(), sgml.Value); } #endregion string typeAtt = attributes.ContainsKey("type") ? attributes["type"] : null; string refAtt = attributes.ContainsKey("ref") ? attributes["ref"] : null; #region Parse styles Dictionary<string, string> style = new Dictionary<string, string>(); if (attributes.ContainsKey("style")) { foreach (string s in attributes["style"].Split(';')) { try { if (s.Contains(":")) style[s.Split(':')[0].Trim()] = s.Split(':')[1].Trim(); } catch { } } } #endregion #region Parse class List<string> classes = new List<string>(); if (attributes.ContainsKey("class")) { foreach (string s in attributes["class"].Split(' ')) { try { classes.Add(s); } catch { } } } #endregion if (tagName == "dsi:video") { #region dsi:video /* <dsi:video type = [dsi | flv | youtube | google | metacafe | myspace | break | collegehumor | redtube | ebaumsworld | dailymotion] ref = [dsi-photo-k | site-ref] src = [flv-url] width = [width] (optional) height = [height] (optional) nsfw = [true | false] (optional) /> */ bool nsfw = attributes.ContainsKey("nsfw") ? bool.Parse(attributes["nsfw"].ToLower()) : false; string draw = attributes.ContainsKey("draw") ? attributes["draw"].ToLower() : "auto"; if (typeAtt == "youtube") { #region youtube int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 425; int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 355; //<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/8VtWo8tFdPQ&rel=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/8VtWo8tFdPQ&rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object> return GetFlash(uniqueId, height, width, nsfw, draw, "http://www.youtube.com/v/" + refAtt + "&rel=1"); #endregion } else if (typeAtt == "metacafe") { #region metacafe int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 400; int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 345; //<embed src="http://www.metacafe.com/fplayer/1029494/how_to_make_fire_balls.swf" width="400" height="345" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"> </embed><br><font size = 1><a href="http://www.metacafe.com/watch/1029494/how_to_make_fire_balls/">How To Make Fire Balls</a> - <a href="http://www.metacafe.com/">The funniest videos clips are here</a></font> return GetFlash(uniqueId, height, width, nsfw, draw, "http://www.metacafe.com/fplayer/" + refAtt + ".swf"); #endregion } else if (typeAtt == "google") { #region google int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 400; int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 326; //<embed style="width:400px; height:326px;" id="VideoPlayback" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId=-7477616603879486362&hl=en-GB" flashvars=""> </embed> return GetFlash(uniqueId, height, width, nsfw, draw, "http://video.google.com/googleplayer.swf?docId=" + refAtt + "&hl=en-GB"); #endregion } else if (typeAtt == "flv") { #region flv string flvUrl = attributes.ContainsKey("src") ? attributes["src"] : null; int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 450; int height = attributes.ContainsKey("height") ? (int.Parse(attributes["height"]) + 20) : 357; return GetFlash(uniqueId, height, width, nsfw, draw, "/misc/flvplayer.swf", "file", flvUrl, "autoStart", "0"); #endregion } else if (typeAtt == "dsi") { #region dsi try { Photo p = new Photo(int.Parse(refAtt)); if (p.MediaType != Photo.MediaTypes.Video) { return "[Invalid ref " + refAtt + " - this is not a video]"; } else { if (p.ContentDisabled) { return "[Invalid ref " + refAtt + " - video disabled]"; } else { if (p.Status == Photo.StatusEnum.Enabled) { //int width = p.VideoMedWidth; //int height = p.VideoMedHeight + 20; int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : p.VideoMedWidth; int height = attributes.ContainsKey("height") ? (int.Parse(attributes["height"]) + 20) : (p.VideoMedHeight + 20); return GetFlash(uniqueId, height, width, nsfw, draw, "/misc/flvplayer.swf", "file", p.VideoMedPath, "autoStart", "0", "jpg", p.WebPath); } else if (p.Status == Photo.StatusEnum.Moderate) { return "[Invalid ref " + refAtt + " - video waiting for moderation]"; } else if (p.Status == Photo.StatusEnum.Processing) { return "[Invalid ref " + refAtt + " - video still processing]"; } } } } catch { return "[Invalid ref " + refAtt + " - video not found]"; } return "[Invalid ref " + refAtt + " - error]"; #endregion } else if (typeAtt == "collegehumor") { #region collegehumor int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 450; int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 337; //<object type="application/x-shockwave-flash" data="http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=1754304&fullscreen=1" width="480" height="360" ><param name="allowfullscreen" value="true" /><param name="movie" quality="best" value="http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=1754304&fullscreen=1" /></object> return GetFlash(uniqueId, height, width, nsfw, draw, "http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=" + refAtt + "&fullscreen=1"); #endregion } else if (typeAtt == "myspace") { #region myspace int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 430; int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 346; //<embed src="http://lads.myspace.com/videos/vplayer.swf" flashvars="m=25330587&v=2&type=video" type="application/x-shockwave-flash" width="430" height="346"></embed> return GetFlash(uniqueId, height, width, nsfw, draw, "http://lads.myspace.com/videos/vplayer.swf", "m", refAtt, "v", "2", "type", "video"); #endregion } else if (typeAtt == "break") { #region break int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 464; int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 392; //<object width="464" height="392"><param name="movie" value="http://embed.break.com/NDMyNjg3"></param><embed src="http://embed.break.com/NDMyNjg3" type="application/x-shockwave-flash" width="464" height="392"></embed></object> return GetFlash(uniqueId, height, width, nsfw, draw, "http://embed.break.com/" + refAtt); #endregion } else if (typeAtt == "redtube") { #region redtube int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 434; int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 344; //<object height="344" width="434"><param name="movie" value="http://embed.redtube.com/player/"><param name="FlashVars" value="id=2394&style=redtube"><embed src="http://embed.redtube.com/player/?id=2394&style=redtube" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" height="344" width="434"></object> return GetFlash(uniqueId, height, width, true, draw, "http://embed.redtube.com/player/?id=" + refAtt + "&style=redtube", "id", refAtt, "style", "redtube"); #endregion } else if (typeAtt == "ebaumsworld") { #region ebaumsworld int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 425; int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 345; //<embed src="http://www.ebaumsworld.com/mediaplayer.swf" flashvars="file=http://media.ebaumsworld.com/2008/01/trouble-leaving-parking-lot.flv&displayheight=321&image=http://media.ebaumsworld.com/2008/01/trouble-leaving-parking-lot.jpg" loop="false" menu="false" quality="high" bgcolor="#ffffff" width="425" height="345" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> return GetFlash(uniqueId, height, width, nsfw, draw, "http://www.ebaumsworld.com/mediaplayer.swf", "file", "http://media.ebaumsworld.com/" + refAtt + ".flv", "displayheight", (height - 24).ToString(), "image", "http://media.ebaumsworld.com/" + refAtt + ".jpg"); #endregion } else if (typeAtt == "dailymotion") { #region dailymotion int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 420; int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 331; //<div><object width="420" height="331"><param name="movie" value="http://www.dailymotion.com/swf/x3xmzx"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.dailymotion.com/swf/x3xmzx" type="application/x-shockwave-flash" width="420" height="331" allowFullScreen="true" allowScriptAccess="always"></embed></object><br /><b><a href="http://www.dailymotion.com/video/x3xmzx_time-attack-evo-crash-knockhill-200_auto">TIME ATTACK EVO CRASH KNOCKHILL 2007</a></b><br /><i>Uploaded by <a href="http://www.dailymotion.com/TIMEATTACKTV">TIMEATTACKTV</a></i></div> return GetFlash(uniqueId, height, width, nsfw, draw, "http://www.dailymotion.com/swf/" + refAtt); #endregion } else if (typeAtt == "veoh") { return "[Veoh videos disabled]"; #region veoh int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 450; int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 365; //<embed src="http://www.veoh.com/videodetails2.swf?player=videodetailsembedded&type=v&permalinkId=v1644215kQ3H8PG2&id=anonymous" allowFullScreen="true" width="540" height="438" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed><br/><a href="http://www.veoh.com/">Online Videos by Veoh.com</a> return GetFlash(uniqueId, height, width, nsfw, draw, "http://www.veoh.com/videodetails2.swf?player=videodetailsembedded&type=v&permalinkId=" + refAtt + "&id=anonymous"); #endregion } else { return "[Invalid type attribute]"; } #endregion } else if (tagName == "dsi:audio") { #region dsi:audio /* <dsi:audio type = [mp3] src = [mp3-url] nsfw = [true | false] (optional) /> */ if (typeAtt == "mp3") { #region mp3 string mp3Url = attributes.ContainsKey("src") ? attributes["src"] : null; int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 290; int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 24; string audioPlayerSwfPath = Storage.Path(new Guid("7abb3119-f8ad-43ff-be01-764b2ae111fc"), "swf", Storage.Stores.Pix); return GetFlash(uniqueId, height, width, false, "load", audioPlayerSwfPath, "soundFile", mp3Url, "autoStart", "no") + @"<a href=""" + mp3Url + @"""><img src=""/gfx/download-button2.png"" width=""73"" height=""16"" border=""0"" /></a>"; #endregion } else { return "[Invalid type attribute]"; } #endregion } else if (tagName == "dsi:flash") { #region dsi:flash /* <dsi:flash src = [swf-url] width = [width] height = [height] nsfw = [true | false] (optional) play = [true | false] (optional) loop = [true | false] (optional) menu = [true | false] (optional) quality = [low | autolow | autohigh | medium | high | best] (optional) scale = [default | noorder | exactfit] (optional) align = [l | t | r | b] (optional) salign = [l | t | r | b | tl | tr | bl | br] (optional) wmode = [window | opaque | transparent] (optional) bgcolor = [colour] (optional) base = [base-url] (optional) flashvars = [flashvars] (optional) /> */ string swfUrl = attributes.ContainsKey("src") ? attributes["src"] : null; return getFlashAttributesFromSgml(uniqueId, swfUrl, attributes); #endregion } else if (tagName == "dsi:quote") { #region dsi:quote Usr u = null; try { u = new Usr(int.Parse(refAtt)); } catch { } if (u != null) { StringBuilder sb = new StringBuilder(); sb.Append("<div class=\"QuoteName\">"); sb.Append(u.Link()); sb.Append(" said:"); sb.Append("</div>"); sb.Append("<div class=\"QuoteBody\">"); return sb.ToString(); } else { return "<div class=\"QuoteBody\">"; } #endregion } else if (tagName == "dsi:object" || tagName == "dsi:link") { #region dsi:object, dsi:link /* <dsi:object type = [usr | event | venue | place | group | brand | photo | misc] ref = [object-k] style = [ content: {text* | icon | text-under-icon}; // for type=usr, event, venue, place, group, brand details: {none* | venue | place | country}; // for type=event, venue, place date: {false* | true}; // for type=event snip: {number}; // for type=event rollover: {true* | false} // for type=usr, photo photo: {icon* | thumb | web} // for type=photo link: {true* | false} ] /> */ string app = attributes.ContainsKey("app") ? (attributes["app"] == "home" ? null : attributes["app"]) : null; string date = attributes.ContainsKey("date") ? attributes["date"].Replace('-', '/') : null; string jump = attributes.ContainsKey("jump") ? "#" + attributes["jump"] : ""; string parStr = attributes.ContainsKey("par") ? attributes["par"] : null; #region Decode par array string[] par = null; if (parStr != null) { List<string> parList = new List<string>(); foreach (string s in parStr.Split('&')) { if (s.Contains("=")) { parList.Add(System.Web.HttpUtility.UrlDecode(s.Split('=')[0])); parList.Add(System.Web.HttpUtility.UrlDecode(s.Split('=')[1])); } else { parList.Add(System.Web.HttpUtility.UrlDecode(s)); parList.Add(""); } } par = parList.ToArray(); } #endregion string styleContent = style.ContainsKey("content") ? style["content"] : "text"; string styleDetails = style.ContainsKey("details") ? style["details"] : "none"; bool styleDate = style.ContainsKey("date") ? bool.Parse(style["date"]) : false; int styleSnip = style.ContainsKey("snip") ? int.Parse(style["snip"]) : 0; bool styleRollover = style.ContainsKey("rollover") ? bool.Parse(style["rollover"]) : true; string stylePhoto = style.ContainsKey("photo") ? style["photo"] : "icon"; bool styleLink = style.ContainsKey("link") ? bool.Parse(style["link"]) : true; string extraHtmlAttributes = ""; string extraStyleAttribute = ""; string extraStyleElements = ""; string extraClassAttribute = ""; string extraClassElements = ""; foreach (string k in attributes.Keys) { if (k != "href" && k != "src" && k != "type" && k != "ref" && k != "style" && k != "app" && k != "date" && k != "par" && k != "class") { extraHtmlAttributes += " " + k + "=\"" + attributes[k] + "\""; } } foreach (string s in style.Keys) { if (s != "content" && s != "details" && s != "date" && s != "snip" && s != "rollover" && s != "photo" && s != "link") { extraStyleElements += s + ":" + style[s] + ";"; } } if (extraStyleElements.Length > 0) { extraStyleAttribute = " style=\"" + extraStyleElements + "\""; } foreach (string s in classes) { extraClassElements += " " + s; } if (extraClassElements.Length > 0) { extraClassAttribute = " class=\"" + extraClassElements + "\""; } if (typeAtt == "usr") { #region Usr Usr u = new Usr(int.Parse(refAtt)); string url = getObectPageUrl(u, app, date, par) + jump; if (tagName == "dsi:link") return "<a href=\"" + url + "\"" + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">"; StringBuilder sb = new StringBuilder(); string rolloverHtml = styleRollover ? ((styleContent == "icon" || styleContent == "text-under-icon") ? u.RolloverNoPic : u.Rollover) : ""; if (styleContent == "icon" || styleContent == "text-under-icon") { #region Pic if (styleLink) { sb.Append("<a href=\""); sb.Append(url); sb.Append("\""); sb.Append(rolloverHtml); sb.Append(extraHtmlAttributes); sb.Append(extraStyleAttribute); sb.Append(extraClassAttribute); sb.Append(">"); } sb.Append("<img src=\""); sb.Append(u.AnyPicPath); sb.Append("\""); if (styleContent == "icon" && !styleLink) { //Just image with no link around the image... lets apply any extra html to the image tag. if (!attributes.ContainsKey("width")) sb.Append(" width=\"100\""); if (!attributes.ContainsKey("height")) sb.Append(" height=\"100\""); sb.Append(extraHtmlAttributes); sb.Append(extraStyleAttribute); sb.Append(" class=\"BorderBlack All" + extraClassElements + "\""); sb.Append(" />"); } else sb.Append(" width=\"100\" height=\"100\" class=\"BorderBlack All\" />"); if (styleLink) sb.Append("</a>"); if (styleContent == "text-under-icon") sb.Append("<br />"); #endregion } if (styleContent == "text" || styleContent == "text-under-icon") { #region Nickname if (styleLink) { sb.Append("<a href=\""); sb.Append(url); sb.Append("\""); sb.Append(rolloverHtml); sb.Append(extraHtmlAttributes); sb.Append(extraStyleAttribute); sb.Append(extraClassAttribute); sb.Append(">"); } sb.Append(getObjectName(u.NickNameDisplay, app, styleSnip)); if (styleLink) sb.Append("</a>"); #endregion } return sb.ToString(); #endregion } else if (typeAtt == "event") { #region Event Event e = new Event(int.Parse(refAtt)); string url = getObectPageUrl(e, app, date, par) + jump; if (tagName == "dsi:link") return "<a href=\"" + url + "\"" + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">"; StringBuilder sb = new StringBuilder(); #region Container span if ((styleContent == "text" || styleContent == "text-under-icon") && !styleLink && (extraHtmlAttributes.Length > 0 || extraStyleAttribute.Length > 0 || extraClassAttribute.Length > 0) && (styleDate || styleDetails == "venue" || styleDetails == "place" || styleDetails == "country")) { sb.Append("<span"); sb.Append(extraHtmlAttributes); sb.Append(extraStyleAttribute); sb.Append(extraClassAttribute); sb.Append(">"); } #endregion if (styleContent == "icon" || styleContent == "text-under-icon") { #region Pic if (styleLink) { sb.Append("<a href=\""); sb.Append(url); sb.Append("\""); sb.Append(extraHtmlAttributes); sb.Append(extraStyleAttribute); sb.Append(extraClassAttribute); sb.Append(">"); } sb.Append("<img src=\""); sb.Append(e.AnyPicPath); sb.Append("\""); if (styleContent == "icon" && !styleLink) { //Just image with no link around the image... lets apply any extra html to the image tag. if (!attributes.ContainsKey("width")) sb.Append(" width=\"100\""); if (!attributes.ContainsKey("height")) sb.Append(" height=\"100\""); sb.Append(extraHtmlAttributes); sb.Append(extraStyleAttribute); sb.Append(" class=\"BorderBlack All" + extraClassElements + "\""); sb.Append(" />"); } else sb.Append(" width=\"100\" height=\"100\" class=\"BorderBlack All\" />"); if (styleLink) sb.Append("</a>"); if (styleContent == "text-under-icon") sb.Append("<br />"); #endregion } if (styleContent == "text" || styleContent == "text-under-icon") { #region Event link if (styleLink) { sb.Append("<a href=\""); sb.Append(url); sb.Append("\""); sb.Append(extraHtmlAttributes); sb.Append(extraStyleAttribute); sb.Append(extraClassAttribute); sb.Append(">"); } sb.Append(getObjectName(e.Name, app, styleSnip)); if (styleLink) sb.Append("</a>"); #endregion #region Venue link if (styleDetails == "venue" || styleDetails == "place" || styleDetails == "country") { sb.Append(" @ "); if (styleLink) { sb.Append("<a href=\""); sb.Append(e.Venue.Url()); sb.Append("\""); sb.Append(extraHtmlAttributes); sb.Append(extraStyleAttribute); sb.Append(extraClassAttribute); sb.Append(">"); } sb.Append(Cambro.Misc.Utility.Snip(e.Venue.Name, styleSnip)); if (styleLink) sb.Append("</a>"); } #endregion #region Place link if (styleDetails == "place" || styleDetails == "country") { sb.Append(" in "); if (styleLink) { sb.Append("<a href=\""); sb.Append(e.Venue.Place.Url()); sb.Append("\""); sb.Append(extraHtmlAttributes); sb.Append(extraStyleAttribute); sb.Append(extraClassAttribute); sb.Append(">"); } if (styleDetails == "country") { sb.Append(Cambro.Misc.Utility.Snip(e.Venue.Place.Name, styleSnip)); } else { sb.Append(Cambro.Misc.Utility.Snip(e.Venue.Place.NamePlain, styleSnip)); } if (styleLink) sb.Append("</a>"); } #endregion #region Date if (styleDate) { sb.Append(", "); sb.Append(e.FriendlyDate(false)); } #endregion } #region End container span if ((styleContent == "text" || styleContent == "text-under-icon") && !styleLink && (extraHtmlAttributes.Length > 0 || extraStyleAttribute.Length > 0 || extraClassAttribute.Length > 0) && (styleDetails == "venue" || styleDetails == "place" || styleDetails == "country")) { sb.Append("</span>"); } #endregion return sb.ToString(); #endregion } else if (typeAtt == "venue") { #region Venue Venue v = new Venue(int.Parse(refAtt)); string url = getObectPageUrl(v, app, date, par) + jump; if (tagName == "dsi:link") return "<a href=\"" + url + "\"" + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">"; StringBuilder sb = new StringBuilder(); #region Container span if ((styleContent == "text" || styleContent == "text-under-icon") && !styleLink && (extraHtmlAttributes.Length > 0 || extraStyleAttribute.Length > 0 || extraClassAttribute.Length > 0) && (styleDetails == "place" || styleDetails == "country")) { sb.Append("<span"); sb.Append(extraHtmlAttributes); sb.Append(extraStyleAttribute); sb.Append(extraClassAttribute); sb.Append(">"); } #endregion if (styleContent == "icon" || styleContent == "text-under-icon") { #region Pic if (styleLink) { sb.Append("<a href=\""); sb.Append(url); sb.Append("\""); sb.Append(extraHtmlAttributes); sb.Append(extraStyleAttribute); sb.Append(extraClassAttribute); sb.Append(">"); } sb.Append("<img src=\""); sb.Append(v.AnyPicPath); sb.Append("\""); if (styleContent == "icon" && !styleLink) { //Just image with no link around the image... lets apply any extra html to the image tag. if (!attributes.ContainsKey("width")) sb.Append(" width=\"100\""); if (!attributes.ContainsKey("height")) sb.Append(" height=\"100\""); sb.Append(extraHtmlAttributes); sb.Append(extraStyleAttribute); sb.Append(" class=\"BorderBlack All" + extraClassElements + "\""); sb.Append(" />"); } else sb.Append(" width=\"100\" height=\"100\" class=\"BorderBlack All\" />"); if (styleLink) sb.Append("</a>"); if (styleContent == "text-under-icon") sb.Append("<br />"); #endregion } if (styleContent == "text" || styleContent == "text-under-icon") { #region Venue link if (styleLink) { sb.Append("<a href=\""); sb.Append(url); sb.Append("\""); sb.Append(extraHtmlAttributes); sb.Append(extraStyleAttribute); sb.Append(extraClassAttribute); sb.Append(">"); } sb.Append(getObjectName(v.Name, app, styleSnip)); if (styleLink) sb.Append("</a>"); #endregion #region Place link if (styleDetails == "place" || styleDetails == "country") { sb.Append(" in "); if (styleLink) { sb.Append("<a href=\""); sb.Append(v.Place.Url()); sb.Append("\""); sb.Append(extraHtmlAttributes); sb.Append(extraStyleAttribute); sb.Append(extraClassAttribute); sb.Append(">"); } if (styleDetails == "country") { sb.Append(Cambro.Misc.Utility.Snip(v.Place.Name, styleSnip)); } else { sb.Append(Cambro.Misc.Utility.Snip(v.Place.NamePlain, styleSnip)); } if (styleLink) sb.Append("</a>"); } #endregion } #region End container span if ((styleContent == "text" || styleContent == "text-under-icon") && !styleLink && (extraHtmlAttributes.Length > 0 || extraStyleAttribute.Length > 0 || extraClassAttribute.Length > 0) && (styleDetails == "place" || styleDetails == "country")) { sb.Append("</span>"); } #endregion return sb.ToString(); #endregion } else if (typeAtt == "place") { #region Place Place p = new Place(int.Parse(refAtt)); string url = getObectPageUrl(p, app, date, par) + jump; if (tagName == "dsi:link") return "<a href=\"" + url + "\"" + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">"; StringBuilder sb = new StringBuilder(); #region Container span if ((styleContent == "text" || styleContent == "text-under-icon") && !styleLink && (extraHtmlAttributes.Length > 0 || extraStyleAttribute.Length > 0 || extraClassAttribute.Length > 0)) { sb.Append("<span"); sb.Append(extraHtmlAttributes); sb.Append(extraStyleAttribute); sb.Append(extraClassAttribute); sb.Append(">"); } #endregion if (styleContent == "icon" || styleContent == "text-under-icon") { #region Pic if (styleLink) { sb.Append("<a href=\""); sb.Append(url); sb.Append("\""); sb.Append(extraHtmlAttributes); sb.Append(extraStyleAttribute); sb.Append(extraClassAttribute); sb.Append(">"); } sb.Append("<img src=\""); sb.Append(p.AnyPicPath); sb.Append("\""); if (styleContent == "icon" && !styleLink) { //Just image with no link around the image... lets apply any extra html to the image tag. if (!attributes.ContainsKey("width")) sb.Append(" width=\"100\""); if (!attributes.ContainsKey("height")) sb.Append(" height=\"100\""); sb.Append(extraHtmlAttributes); sb.Append(extraStyleAttribute); if (style.ContainsKey("border")) { sb.Append(extraClassAttribute); } else { sb.Append(" class=\"BorderBlack All" + extraClassElements + "\""); } sb.Append(" />"); } else sb.Append(" width=\"100\" height=\"100\" class=\"BorderBlack All\" />"); if (styleLink) sb.Append("</a>"); if (styleContent == "text-under-icon") sb.Append("<br />"); #endregion } if (styleContent == "text" || styleContent == "text-under-icon") { #region Place link if (styleLink) { sb.Append("<a href=\""); sb.Append(url); sb.Append("\""); sb.Append(extraHtmlAttributes); sb.Append(extraStyleAttribute); sb.Append(extraClassAttribute); sb.Append(">"); } if (styleDetails == "country") { sb.Append(getObjectName(p.Name, app, styleSnip)); } else { sb.Append(getObjectName(p.NamePlain, app, styleSnip)); } if (styleLink) sb.Append("</a>"); #endregion } #region End container span if ((styleContent == "text" || styleContent == "text-under-icon") && !styleLink && (extraHtmlAttributes.Length > 0 || extraStyleAttribute.Length > 0 || extraClassAttribute.Length > 0)) { sb.Append("</span>"); } #endregion return sb.ToString(); #endregion } else if (typeAtt == "group") { #region Group Group g = new Group(int.Parse(refAtt)); string url = getObectPageUrl(g, app, date, par) + jump; if (tagName == "dsi:link") return "<a href=\"" + url + "\"" + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">"; StringBuilder sb = new StringBuilder(); #region Group link if (styleLink) { sb.Append("<a href=\""); sb.Append(url); sb.Append("\""); sb.Append(extraHtmlAttributes); sb.Append(extraStyleAttribute); sb.Append(extraClassAttribute); sb.Append(">"); } sb.Append(getObjectName(g.FriendlyName, app, styleSnip)); if (styleLink) sb.Append("</a>"); #endregion return sb.ToString(); #endregion } else if (typeAtt == "brand") { #region Brand Brand b = new Brand(int.Parse(refAtt)); string url = getObectPageUrl(b, app, date, par) + jump; if (tagName == "dsi:link") return "<a href=\"" + url + "\"" + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">"; StringBuilder sb = new StringBuilder(); #region Brand link if (styleLink) { sb.Append("<a href=\""); sb.Append(url); sb.Append("\""); sb.Append(extraHtmlAttributes); sb.Append(extraStyleAttribute); sb.Append(extraClassAttribute); sb.Append(">"); } sb.Append(getObjectName(b.FriendlyName, app, styleSnip)); if (styleLink) sb.Append("</a>"); #endregion return sb.ToString(); #endregion } else if (typeAtt == "photo") { #region Photo Photo p = new Photo(int.Parse(refAtt)); string url = getObectPageUrl(p, app, date, par) + jump; if (tagName == "dsi:link") return "<a href=\"" + url + "\"" + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">"; StringBuilder sb = new StringBuilder(); #region Link if (styleLink) { sb.Append("<a href=\""); sb.Append(url); sb.Append("\""); sb.Append(extraHtmlAttributes); sb.Append(extraStyleAttribute); sb.Append(extraClassAttribute); sb.Append(">"); } #endregion if (app != null && app == "chat") { #region For chat app, just show the name of the parent... sb.Append(Cambro.Misc.Utility.Snip(((IName)p.ParentObject).Name, styleSnip) + " (chat)"); #endregion } else { #region Image tag sb.Append("<img"); #region Src attribute sb.Append(" src=\""); if (stylePhoto == "thumb") sb.Append(p.ThumbPath); else if (stylePhoto == "icon") sb.Append(p.IconPath); else if (stylePhoto == "web") sb.Append(p.WebPath); sb.Append("\""); #endregion #region Width attribute if (styleLink || !attributes.ContainsKey("width")) { sb.Append(" width=\""); if (stylePhoto == "thumb") sb.Append(p.ThumbWidth); else if (stylePhoto == "icon") sb.Append("100"); else if (stylePhoto == "web") sb.Append(p.WebWidth); sb.Append("\""); } #endregion #region Height attribute if (styleLink || !attributes.ContainsKey("height")) { sb.Append(" height=\""); if (stylePhoto == "thumb") sb.Append(p.ThumbHeight); else if (stylePhoto == "icon") sb.Append("100"); else if (stylePhoto == "web") sb.Append(p.WebHeight); sb.Append("\""); } #endregion #region Extra html attributes if (!styleLink) { sb.Append(extraHtmlAttributes); sb.Append(extraStyleAttribute); } #endregion #region Style attribute if (styleLink) { sb.Append(" class=\"BorderBlack All\""); } else if (style.ContainsKey("border")) { sb.Append(extraClassAttribute); } else { sb.Append(" class=\"BorderBlack All" + extraClassElements + "\""); } #endregion #region Rollover if (styleRollover && stylePhoto != "web") { sb.Append(" onmouseover=\"stm('<img src=" + p.WebPath + " width=" + p.WebWidth + " height=" + p.WebHeight + " class=Block />');\" onmouseout=\"htm();\""); } #endregion sb.Append(" />"); #endregion } #region End link if (styleLink) sb.Append("</a>"); #endregion return sb.ToString(); #endregion } else if (typeAtt == "misc") { #region Misc Misc mi = new Misc(int.Parse(refAtt)); if (tagName == "dsi:link") return "<a href=\"" + mi.Url() + "\"" + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">"; if (mi.Extention.ToLower() == "jpg" || mi.Extention.ToLower() == "jpeg" || mi.Extention.ToLower() == "gif" || mi.Extention.ToLower() == "png") { StringBuilder sb = new StringBuilder(); #region Width and height int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : mi.Width; int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : mi.Height; #endregion #region Image tag sb.Append("<img src=\""); sb.Append(mi.Url()); sb.Append("\" width=\""); sb.Append(width); sb.Append("\" height=\""); sb.Append(height); sb.Append("\" border=\"0\""); sb.Append(extraHtmlAttributes); sb.Append(extraStyleAttribute); sb.Append(extraClassAttribute); sb.Append(" />"); #endregion return sb.ToString(); } else if (mi.Extention.ToLower() == "swf") { #region Swf return getFlashAttributesFromSgml(uniqueId, mi.Url(), attributes); #endregion } #endregion } else if (typeAtt == "article") { #region Article Article a = new Article(int.Parse(refAtt)); string url = getObectPageUrl(a, app, date, par) + jump; if (tagName == "dsi:link") return "<a href=\"" + url + "\"" + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">"; StringBuilder sb = new StringBuilder(); #region Article link if (styleLink) { sb.Append("<a href=\""); sb.Append(url); sb.Append("\""); sb.Append(extraHtmlAttributes); sb.Append(extraStyleAttribute); sb.Append(extraClassAttribute); sb.Append(">"); } sb.Append(getObjectName(a.FriendlyName, app, styleSnip)); if (styleLink) sb.Append("</a>"); #endregion return sb.ToString(); #endregion } else if (typeAtt == "url") //if (attributes.ContainsKey("href")) { #region Url string url = attributes.ContainsKey("href") ? attributes["href"] : ""; #region Get name string name = url; string path = url; string domain = url; string targetAttribute = ""; try { if (UrlRegex.IsMatch(url)) { Match urlMatch = UrlRegex.Match(url); if (urlMatch.Groups[3].Value.StartsWith("www.")) name = urlMatch.Groups[3].Value.Substring(4); else name = urlMatch.Groups[3].Value; domain = urlMatch.Groups[3].Value; path = urlMatch.Groups[4].Value; if (!domain.ToLower().EndsWith(".dontstayin.com") && !attributes.ContainsKey("target")) targetAttribute = " target=\"_blank\""; } } catch { } #endregion if (tagName == "dsi:link") return "<a href=\"" + url + "\"" + targetAttribute + extraHtmlAttributes + extraStyleAttribute + extraClassAttribute + ">"; StringBuilder sb = new StringBuilder(); if (path.ToLower().EndsWith(".jpg") || path.ToLower().EndsWith(".jpeg") || path.ToLower().EndsWith(".gif") || path.ToLower().EndsWith(".png")) { #region Image tag sb.Append("<img"); #region Src attribute sb.Append(" src=\""); sb.Append(url); sb.Append("\""); #endregion sb.Append(extraHtmlAttributes); #region Style attribute if (domain.EndsWith(".dontstayin.com") && !style.ContainsKey("border")) { sb.Append(" class=\"BorderBlack All" + extraClassElements + "\""); } else { sb.Append(extraClassAttribute); } #endregion sb.Append(extraStyleAttribute); sb.Append(" />"); #endregion } else if (path.ToLower().EndsWith(".mp3") || path.ToLower().EndsWith(".wav")) { #region Audio int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 290; int height = attributes.ContainsKey("height") ? int.Parse(attributes["height"]) : 24; string audioPlayerSwfPath = Storage.Path(new Guid("7abb3119-f8ad-43ff-be01-764b2ae111fc"), "swf", Storage.Stores.Pix); return GetFlash(uniqueId, height, width, false, "load", audioPlayerSwfPath, "soundFile", url, "autoStart", "no") + @"<a href=""" + url + @"""><img src=""/gfx/download-button2.png"" width=""73"" height=""16"" border=""0"" /></a>"; #endregion } else if (path.ToLower().EndsWith(".swf")) { #region Swf return getFlashAttributesFromSgml(uniqueId, path, attributes); #endregion } else if (path.ToLower().EndsWith(".flv")) { #region Flv int width = attributes.ContainsKey("width") ? int.Parse(attributes["width"]) : 450; int height = attributes.ContainsKey("height") ? (int.Parse(attributes["height"]) + 20) : 357; bool nsfw = attributes.ContainsKey("nsfw") ? bool.Parse(attributes["nsfw"].ToLower()) : false; string draw = attributes.ContainsKey("draw") ? attributes["draw"].ToLower() : "auto"; return GetFlash(uniqueId, height, width, nsfw, draw, "/misc/flvplayer.swf", "file", url, "autoStart", "0"); #endregion } else { #region Link if (styleLink) { sb.Append("<a href=\""); sb.Append(url); sb.Append("\""); sb.Append(targetAttribute); sb.Append(extraHtmlAttributes); sb.Append(extraStyleAttribute); sb.Append(extraClassAttribute); sb.Append(">"); } #endregion #region Name sb.Append(name); #endregion #region End link if (styleLink) sb.Append("</a>"); #endregion } return sb.ToString(); #endregion } else if (typeAtt == "room") { #region Chat room Guid guid = refAtt.UnPackGuid(); Chat.RoomSpec room = Chat.RoomSpec.FromGuid(guid); if (room == null) return "[Room not found]"; StringBuilder sb = new StringBuilder(); if (tagName == "dsi:link") room.LinkHtmlAppendJustStartOfAnchorTag(sb, "selected-onyellow", extraHtmlAttributes, extraStyleAttribute, extraClassAttribute); else room.LinkHtmlAppend(sb, "selected-onyellow", extraHtmlAttributes, extraStyleAttribute, extraClassAttribute); return sb.ToString(); #endregion } #endregion } return "[Invalid tag " + tagName + "]"; } catch (Exception ex) { if (Vars.DevEnv) throw ex; return "[Error in " + tagName + " tag]"; } }
public static EventSet GetUpcomingEvents(Venue venue) { Query upcomingEventsQuery = Event.GetUpcomingEventsQuery(); upcomingEventsQuery.QueryCondition = new And(upcomingEventsQuery.QueryCondition, new Q(Event.Columns.VenueK, venue.K)); return new EventSet(upcomingEventsQuery); }
public bool IsEnabledPromoterOfConfirmedVenue(Venue v) { if (!this.IsPromoter) return false; if (v.PromoterK > 0 && v.Promoter != null && v.PromoterStatus.Equals(Venue.PromoterStatusEnum.Confirmed) && this.IsPromoterK(v.PromoterK)) return true; return false; }
private void Page_Load(object sender, System.EventArgs e) { if (this.Visible) { if (Personalise) Usr.KickUserIfNotLoggedIn("You must be logged in to use the My Calendar or Buddy Calendar pages."); if (BuddyDisplay) selectTab(BuddyCalendarTab); else if (Personalise) selectTab(MyCalendarTab); //else //CalendarTab.Visible=true; HotTicketsIntroPanel.Visible = HotTickets; NotHotTicketsIntroPanel.Visible = !HotTickets; if (Personalise && !BuddyDisplay) { if (Usr.Current.MusicTypesFavouriteCount == 0) Response.Redirect("/pages/mymusic"); if (Usr.Current.PlacesVisitCount == 0) Response.Redirect("/pages/placesivisit"); } MusicTypeDropDownPanel.Visible = !Personalise && !(eventsForDisplay.FilterByVenue || eventsForDisplay.FilterByBrand || eventsForDisplay.FilterByGroup); MusicFilterLabel1.Visible = MusicTypeDropDownPanel.Visible; MusicFilterLabel2.Visible = MusicTypeDropDownPanel.Visible; if (eventsForDisplay.FilterByVenue || eventsForDisplay.FilterByBrand || eventsForDisplay.FilterByGroup) eventsForDisplay.IgnoreMusicType = true; #region //Set up intro panel if (HotTickets) { TopIcon.Src = "/gfx/icon-hottickets.png"; EventFinderTab.InnerText = "Hot tickets"; HotTicketsIntroPanelWorldwideP.Visible = eventsForDisplay.FilterWorldwide; HotTicketsIntroPanelBrandP.Visible = eventsForDisplay.FilterByBrand; HotTicketsIntroPanelNonBrandP.Visible = eventsForDisplay.FilterByVenue || eventsForDisplay.FilterByPlace || eventsForDisplay.FilterByCountry || eventsForDisplay.FilterByGroup; if (eventsForDisplay.FilterWorldwide) { HotTicketsIntroPanelWorldwideHomeCountryLink.InnerText = HotTicketsIntroPanelWorldwideHomeCountryLink.InnerText.Replace("???", Country.Current.FriendlyName); HotTicketsIntroPanelWorldwideHomeCountryLink.HRef = Country.Current.UrlApp("hottickets"); } } else { AllEventsIntroPanel.Visible = eventsForDisplay.FilterWorldwide; ObjectCalendarIntroPanel.Visible = eventsForDisplay.FilterByVenue || eventsForDisplay.FilterByPlace || eventsForDisplay.FilterByCountry || eventsForDisplay.FilterByBrand || eventsForDisplay.FilterByGroup; MyCalendarIntroPanel.Visible = Personalise && !Tickets && !BuddyDisplay; BuddyCalendarIntroPanel.Visible = BuddyDisplay; TicketsCalendarIntroPanel.Visible = Personalise && Tickets; if (Tickets) TopIcon.Src = "/gfx/icon-tickets.png"; else if (FreeGuestlist) TopIcon.Src = "/gfx/icon-freeguestlist.png"; if (Tickets) EventFinderTab.InnerText = "Tickets"; else if (FreeGuestlist) EventFinderTab.InnerText = "Free Guestlist"; if (Tickets) { AllEventsIntroPanelEventsLabel1.Text = "events with tickets available"; AllEventsIntroPanelEventsLabel2.Text = "events with tickets available"; AllEventsIntroPanelEventsLabel3.Text = "events with tickets available"; } else if (FreeGuestlist) { AllEventsIntroPanelEventsLabel1.Text = "Free Guestlist events"; AllEventsIntroPanelEventsLabel2.Text = "Free Guestlist events"; AllEventsIntroPanelEventsLabel3.Text = "Free Guestlist events"; } else { AllEventsIntroPanelEventsLabel1.Text = "events"; AllEventsIntroPanelEventsLabel2.Text = "events"; AllEventsIntroPanelEventsLabel3.Text = "events"; } AllEventsIntroPanelHomeCountryLink.InnerText = AllEventsIntroPanelHomeCountryLink.InnerText.Replace("???", Country.Current.FriendlyName); if (DateTime.Now.Month == Month && DateTime.Now.Year == Year && Day == 0) AllEventsIntroPanelHomeCountryLink.HRef = Country.Current.UrlCalendar(Tickets, FreeGuestlist); else AllEventsIntroPanelHomeCountryLink.HRef = Country.Current.UrlCalendarDay(Tickets, FreeGuestlist, Year, Month, Day); } #endregion string dateFilterString = ""; if (HotTickets) { MonthViewPanel.Visible = false; DayViewPanel.Visible = false; HotTicketsEventListPanel.Visible = true; EventSet es = eventsForDisplay.GetTopHotTicketEvents(); HotTicketsEventListNoEventsP.Visible = es.Count == 0; HotTicketsEventListEventsDiv.Visible = es.Count > 0; if (es.Count > 0) { HotTicketsEventList.DataSource = es; HotTicketsEventList.ItemTemplate = this.LoadTemplate("/Templates/Events/EventList0.ascx"); HotTicketsEventList.DataBind(); } } else if (Day == 0) { MonthViewPanel.Visible = true; DayViewPanel.Visible = false; HotTicketsEventListPanel.Visible = false; #region firstCellDate, lastCellDate DateTime firstOfMonth = new DateTime(Year, Month, 1); DateTime firstCellDate = firstOfMonth.Previous(DayOfWeek.Monday, true); DateTime lastOfMonth = firstOfMonth.AddDays(DateTime.DaysInMonth(Year, Month) - 1); DateTime lastCellDate = lastOfMonth.Next(DayOfWeek.Sunday, true); #endregion dateFilterString = firstOfMonth.ToString("MMMM yyyy"); #region get event set EventSet es = eventsForDisplay.GetEventsBetweenDates(firstCellDate, lastCellDate); #endregion #region bind to calendar CustomControls.DsiCalendar uiCal = this.BuddyDisplay ? new CustomControls.BuddyCalendar() : new CustomControls.DsiCalendar(); uiCalPlaceHolder.Controls.Add(uiCal); uiCal.ShowCountryFriendlyName = !(eventsForDisplay.FilterByCountry || eventsForDisplay.FilterByPlace || eventsForDisplay.FilterByVenue); uiCal.ShowPlace = !(eventsForDisplay.FilterByPlace || eventsForDisplay.FilterByVenue); uiCal.ShowVenue = !eventsForDisplay.FilterByVenue; uiCal.Tickets = Tickets; uiCal.Month = Month; uiCal.AllEvents = es; uiCal.StartDate = firstCellDate; uiCal.EndDate = lastCellDate; #endregion #region set up next / prev month links string nextMonthUrl = ChangeMonthUrl(lastOfMonth.AddDays(1).Month, lastOfMonth.AddDays(1).Year); string prevMonthUrl = ChangeMonthUrl(firstOfMonth.AddDays(-1).Month, firstOfMonth.AddDays(-1).Year); #region set up links uiCal.NextMonthUrl = nextMonthUrl; uiCal.PrevMonthUrl = prevMonthUrl; MonthNameLabel.Text = firstOfMonth.ToString("MMMM") + " " + Year.ToString(); MonthNameLabel1.Text = firstOfMonth.ToString("MMMM") + " " + Year.ToString(); BackLink.InnerHtml = "< " + firstOfMonth.AddDays(-1).ToString("MMMM"); BackLink1.InnerHtml = "< " + firstOfMonth.AddDays(-1).ToString("MMMM"); BackLink.HRef = prevMonthUrl; BackLink1.HRef = prevMonthUrl; NextLink.InnerHtml = lastOfMonth.AddDays(1).ToString("MMMM") + " >"; NextLink1.InnerHtml = lastOfMonth.AddDays(1).ToString("MMMM") + " >"; NextLink.HRef = nextMonthUrl; NextLink1.HRef = nextMonthUrl; #endregion if (uiCal.AllEvents.Count == 0) { Event latestPastEvent = eventsForDisplay.GetLatestPastEvent(firstOfMonth); if (latestPastEvent == null) { #region disable the back link if we have no past events BackLink.HRef = ""; BackLink1.HRef = ""; BackLink.Disabled = true; BackLink1.Disabled = true; #endregion } else { #region set up the back link with the month of the latest past event BackLink.HRef = ChangeMonthUrl(latestPastEvent.DateTime.Month, latestPastEvent.DateTime.Year); BackLink1.HRef = ChangeMonthUrl(latestPastEvent.DateTime.Month, latestPastEvent.DateTime.Year); BackLink.InnerHtml = "< " + latestPastEvent.DateTime.ToString("MMMM"); BackLink1.InnerHtml = "< " + latestPastEvent.DateTime.ToString("MMMM"); if (latestPastEvent.DateTime.Year != Year) { BackLink.InnerHtml = "< " + latestPastEvent.DateTime.ToString("MMMM") + " " + latestPastEvent.DateTime.Year.ToString(); BackLink1.InnerHtml = "< " + latestPastEvent.DateTime.ToString("MMMM") + " " + latestPastEvent.DateTime.Year.ToString(); } #endregion } Event nextFutureEvent = eventsForDisplay.GetNextFutureEvent(lastOfMonth); if (nextFutureEvent == null) { #region disable the forward link if we have no future events NextLink.HRef = ""; NextLink1.HRef = ""; NextLink.Disabled = true; NextLink1.Disabled = true; #endregion } else { #region set up the back link with the month of the first future event NextLink.HRef = ChangeMonthUrl(nextFutureEvent.DateTime.Month, nextFutureEvent.DateTime.Year); NextLink1.HRef = ChangeMonthUrl(nextFutureEvent.DateTime.Month, nextFutureEvent.DateTime.Year); NextLink.InnerHtml = nextFutureEvent.DateTime.ToString("MMMM") + " >"; NextLink1.InnerHtml = nextFutureEvent.DateTime.ToString("MMMM") + " >"; if (nextFutureEvent.DateTime.Year != Year) { NextLink.InnerHtml = nextFutureEvent.DateTime.ToString("MMMM") + " " + nextFutureEvent.DateTime.Year.ToString() + " >"; NextLink1.InnerHtml = nextFutureEvent.DateTime.ToString("MMMM") + " " + nextFutureEvent.DateTime.Year.ToString() + " >"; } #endregion } #region ensure links are fully disabled if (BackLink.Disabled) BackLink.Attributes["class"] = "DisabledAnchor"; if (BackLink1.Disabled) BackLink1.Attributes["class"] = "DisabledAnchor"; if (NextLink.Disabled) NextLink.Attributes["class"] = "DisabledAnchor"; if (NextLink1.Disabled) NextLink1.Attributes["class"] = "DisabledAnchor"; #endregion } #endregion } else { MonthViewPanel.Visible = false; DayViewPanel.Visible = true; HotTicketsEventListPanel.Visible = false; DateTime day = new DateTime(Year, Month, Day); dateFilterString = day.ToString("dddd dd MMMM yyyy"); #region get event set EventSet es = eventsForDisplay.GetEventsForDay(day); #endregion DayViewNoEventsP.Visible = es.Count == 0; DayViewEventsDiv.Visible = es.Count > 0; if (es.Count > 0) { DayViewDataList.DataSource = es; if (es.Count < 20) DayViewDataList.ItemTemplate = this.LoadTemplate("/Templates/Events/EventList0.ascx"); else if (es.Count < 50) DayViewDataList.ItemTemplate = this.LoadTemplate("/Templates/Events/EventList1.ascx"); else DayViewDataList.ItemTemplate = this.LoadTemplate("/Templates/Events/EventList2.ascx"); //DayViewDataList.ItemTemplate = this.LoadTemplate("/Templates/Events/EventList2.ascx"); DayViewDataList.DataBind(); } #region set up next / prev day links DayMonthLink.InnerText = "Show calendar for " + day.ToString("MMMM yyyy"); DayMonthLink1.InnerText = "Show calendar for " + day.ToString("MMMM yyyy"); DayMonthLink.HRef = ChangeMonthUrl(day.Month, day.Year); DayMonthLink1.HRef = ChangeMonthUrl(day.Month, day.Year); string nextDayUrl = ChangeDayUrl(day.AddDays(1).Month, day.AddDays(1).Year, day.AddDays(1).Day); string prevDayUrl = ChangeDayUrl(day.AddDays(-1).Month, day.AddDays(-1).Year, day.AddDays(-1).Day); #region set up links DayNameLabel.Text = dateFilterString; DayNameLabel1.Text = dateFilterString; DayBackLink.InnerHtml = "< " + day.AddDays(-1).ToString("dddd dd"); DayBackLink1.InnerHtml = "< " + day.AddDays(-1).ToString("dddd dd"); DayBackLink.HRef = prevDayUrl; DayBackLink1.HRef = prevDayUrl; DayNextLink.InnerHtml = day.AddDays(1).ToString("dddd dd") + " >"; DayNextLink1.InnerHtml = day.AddDays(1).ToString("dddd dd") + " >"; DayNextLink.HRef = nextDayUrl; DayNextLink1.HRef = nextDayUrl; #endregion if (es.Count == 0) { Event latestPastEvent = eventsForDisplay.GetLatestPastEvent(day); if (latestPastEvent == null) { #region disable the back link if we have no past events DayBackLink.HRef = ""; DayBackLink1.HRef = ""; DayBackLink.Disabled = true; DayBackLink1.Disabled = true; #endregion } else { #region set up the back link with the month of the latest past event DayBackLink.HRef = ChangeDayUrl(latestPastEvent.DateTime.Month, latestPastEvent.DateTime.Year, latestPastEvent.DateTime.Day); DayBackLink1.HRef = ChangeDayUrl(latestPastEvent.DateTime.Month, latestPastEvent.DateTime.Year, latestPastEvent.DateTime.Day); if (latestPastEvent.DateTime.Year != Year) { DayBackLink.InnerHtml = "< " + latestPastEvent.DateTime.ToString("dddd dd MMMM yyyy"); DayBackLink1.InnerHtml = "< " + latestPastEvent.DateTime.ToString("dddd dd MMMM yyyy"); } else if (latestPastEvent.DateTime.Month != Month) { DayBackLink.InnerHtml = "< " + latestPastEvent.DateTime.ToString("dddd dd MMMM"); DayBackLink1.InnerHtml = "< " + latestPastEvent.DateTime.ToString("dddd dd MMMM"); } else { DayBackLink.InnerHtml = "< " + latestPastEvent.DateTime.ToString("dddd dd"); DayBackLink1.InnerHtml = "< " + latestPastEvent.DateTime.ToString("dddd dd"); } #endregion } Event nextFutureEvent = eventsForDisplay.GetNextFutureEvent(day); if (nextFutureEvent == null) { #region disable the forward link if we have no future events DayNextLink.HRef = ""; DayNextLink1.HRef = ""; DayNextLink.Disabled = true; DayNextLink1.Disabled = true; #endregion } else { #region set up the back link with the month of the first future event DayNextLink.HRef = ChangeDayUrl(nextFutureEvent.DateTime.Month, nextFutureEvent.DateTime.Year, nextFutureEvent.DateTime.Day); DayNextLink1.HRef = ChangeDayUrl(nextFutureEvent.DateTime.Month, nextFutureEvent.DateTime.Year, nextFutureEvent.DateTime.Day); if (nextFutureEvent.DateTime.Year != Year) { DayNextLink.InnerHtml = nextFutureEvent.DateTime.ToString("dddd dd MMMM yyyy") + " >"; DayNextLink1.InnerHtml = nextFutureEvent.DateTime.ToString("dddd dd MMMM yyyy") + " >"; } if (nextFutureEvent.DateTime.Month != Month) { DayNextLink.InnerHtml = nextFutureEvent.DateTime.ToString("dddd dd MMMM") + " >"; DayNextLink1.InnerHtml = nextFutureEvent.DateTime.ToString("dddd dd MMMM") + " >"; } else { DayNextLink.InnerHtml = nextFutureEvent.DateTime.ToString("dddd dd") + " >"; DayNextLink1.InnerHtml = nextFutureEvent.DateTime.ToString("dddd dd") + " >"; } #endregion } #region ensure links are fully disabled if (DayBackLink.Disabled) DayBackLink.Attributes["class"] = "DisabledAnchor"; if (DayBackLink1.Disabled) DayBackLink1.Attributes["class"] = "DisabledAnchor"; if (DayNextLink.Disabled) DayNextLink.Attributes["class"] = "DisabledAnchor"; if (DayNextLink1.Disabled) DayNextLink1.Attributes["class"] = "DisabledAnchor"; #endregion } #endregion } #region Set up intro text and page title if (HotTickets) { if (eventsForDisplay.FilterByBrand) { Brand b = new Brand(BrandK); HotTicketsIntroPanelBrandLink.HRef = b.Url(); HotTicketsIntroPanelBrandLink.InnerText = b.Name; ((Spotted.Master.DsiPage)this.Page).SetPageTitle("Hot tickets for " + b.FriendlyName + " events", b.FriendlyName); HotTicketsIntroPanelTicketsCalendarLink.HRef = b.UrlCalendar(true, false); } else if (eventsForDisplay.FilterByGroup) { Group g = new Group(GroupK); HotTicketsIntroPanelNonBrandInAtLabel.Text = "recommended by"; HotTicketsIntroPanelNonBrandObjectLink.HRef = g.Url(); HotTicketsIntroPanelNonBrandObjectLink.InnerText = g.FriendlyName; ((Spotted.Master.DsiPage)this.Page).SetPageTitle("Hot tickets recommended by " + g.FriendlyName, g.FriendlyName); HotTicketsIntroPanelTicketsCalendarLink.HRef = g.UrlCalendar(true, false); } else if (eventsForDisplay.FilterByVenue) { HotTicketsIntroPanelNonBrandInAtLabel.Text = "at"; Venue v = new Venue(VenueK); HotTicketsIntroPanelNonBrandObjectLink.InnerText = v.FriendlyName; HotTicketsIntroPanelNonBrandObjectLink.HRef = v.Url(); ((Spotted.Master.DsiPage)this.Page).SetPageTitle("Hot tickets for events at " + v.FriendlyName, v.Name); HotTicketsIntroPanelTicketsCalendarLink.HRef = v.UrlCalendar(true, false); } else if (eventsForDisplay.FilterByPlace) { HotTicketsIntroPanelNonBrandInAtLabel.Text = "in"; Place p = new Place(PlaceK); HotTicketsIntroPanelNonBrandObjectLink.InnerText = p.FriendlyName; HotTicketsIntroPanelNonBrandObjectLink.HRef = p.Url(); ((Spotted.Master.DsiPage)this.Page).SetPageTitle("Hot tickets for events in " + p.FriendlyName, p.Name); HotTicketsIntroPanelTicketsCalendarLink.HRef = p.UrlCalendar(true, false); } else if (eventsForDisplay.FilterByCountry) { HotTicketsIntroPanelNonBrandInAtLabel.Text = "in"; HotTicketsIntroPanelNonBrandObjectLink.InnerText = FilterCountry.FriendlyName; HotTicketsIntroPanelNonBrandObjectLink.HRef = FilterCountry.Url(); ((Spotted.Master.DsiPage)this.Page).SetPageTitle("Hot tickets for events in " + FilterCountry.FriendlyName, FilterCountry.Name); HotTicketsIntroPanelTicketsCalendarLink.HRef = FilterCountry.UrlCalendar(true, false); } else if (eventsForDisplay.FilterWorldwide) { ((Spotted.Master.DsiPage)this.Page).SetPageTitle("Hot tickets worldwide"); HotTicketsIntroPanelTicketsCalendarLink.HRef = Calendar.UrlCalendar(true, false); } } else { ObjectCalendarIntroBrand.Visible = eventsForDisplay.FilterByBrand; ObjectCalendarIntroNonBrand.Visible = !eventsForDisplay.FilterByBrand; if (eventsForDisplay.FilterByBrand) { Brand b = new Brand(BrandK); ObjectCalendarIntroBrandAnchor.HRef = b.Url(); ObjectCalendarIntroBrandAnchor.InnerText = b.Name; ((Spotted.Master.DsiPage)this.Page).SetPageTitle(b.FriendlyName + (FreeGuestlist ? " Free Guestlist" : "") + " calendar for " + dateFilterString, b.FriendlyName); } else if (eventsForDisplay.FilterByGroup) { Group g = new Group(GroupK); ObjectCalendarIntroInAtLabel.Text = "recommended by"; ObjectCalendarIntroObjectLink.HRef = g.Url(); ObjectCalendarIntroObjectLink.InnerText = g.FriendlyName; ((Spotted.Master.DsiPage)this.Page).SetPageTitle(g.FriendlyName + (FreeGuestlist ? " Free Guestlist" : "") + " calendar for " + dateFilterString, g.FriendlyName); } else if (eventsForDisplay.FilterByVenue) { ObjectCalendarIntroInAtLabel.Text = "at"; Venue v = new Venue(VenueK); ObjectCalendarIntroObjectLink.InnerText = v.FriendlyName; ObjectCalendarIntroObjectLink.HRef = v.Url(); ((Spotted.Master.DsiPage)this.Page).SetPageTitle(v.FriendlyName + (FreeGuestlist ? " Free Guestlist" : "") + " events calendar for " + dateFilterString, v.Name); } else if (eventsForDisplay.FilterByPlace) { ObjectCalendarIntroInAtLabel.Text = "in"; Place p = new Place(PlaceK); ObjectCalendarIntroObjectLink.InnerText = p.FriendlyName; ObjectCalendarIntroObjectLink.HRef = p.Url(); ((Spotted.Master.DsiPage)this.Page).SetPageTitle(p.FriendlyName + (FreeGuestlist ? " Free Guestlist" : "") + " events calendar for " + dateFilterString, p.Name); } else if (eventsForDisplay.FilterByCountry) { ObjectCalendarIntroInAtLabel.Text = "in"; ObjectCalendarIntroObjectLink.InnerText = FilterCountry.FriendlyName; ObjectCalendarIntroObjectLink.HRef = FilterCountry.Url(); ((Spotted.Master.DsiPage)this.Page).SetPageTitle((FreeGuestlist ? "Free Guestlist calendar" : " Calendar") + " for " + FilterCountry.FriendlyName + ", " + dateFilterString, FilterCountry.Name); } else if (eventsForDisplay.FilterWorldwide) { ((Spotted.Master.DsiPage)this.Page).SetPageTitle((FreeGuestlist ? "Free Guestlist calendar" : " Calendar") + " for " + dateFilterString); } if (Personalise && !BuddyDisplay) ((Spotted.Master.DsiPage)this.Page).SetPageTitle("My calendar"); else if (BuddyDisplay) ((Spotted.Master.DsiPage)this.Page).SetPageTitle("Buddy calendar"); } #endregion } }
void UpdateAncestors(Venue v) { this.VenueK = v.K; UpdateAncestors(v.Place); }
string venueString(Venue v) { string name = v.Name.TruncateWithDots(maxLength); if (name.ToLower().StartsWith("the ")) { name = name.Substring(4) + " (" + name.Substring(0, 3) + ")"; } return name; }
public void MergeAndDelete(Event merge) { if (this.K == merge.K) throw new DsiUserFriendlyException("Can't merge event into itself!"); Cambro.Web.Helpers.WriteAlertHeader(); //throw new Exception("This function isn't finished yet!"); Cambro.Web.Helpers.WriteAlert("Starting merge...", 1); #region Articles if (true) { Query q = new Query(); q.QueryCondition = new Q(Article.Columns.EventK, merge.K); ArticleSet ars = new ArticleSet(q); foreach (Article a in ars) { Cambro.Web.Helpers.WriteAlert("Merging article " + a.K + "...", 2); a.ParentObjectK = this.K; a.EventK = this.K; if (a.Relevance <= Model.Entities.Article.RelevanceEnum.Venue) a.VenueK = this.VenueK; else a.VenueK = 0; if (a.Relevance <= Model.Entities.Article.RelevanceEnum.Place) a.PlaceK = this.Venue.PlaceK; else a.PlaceK = 0; if (a.Relevance <= Model.Entities.Article.RelevanceEnum.Country) a.CountryK = this.Venue.Place.CountryK; else a.CountryK = 0; a.UrlFragment = this.UrlFilterPartVenueDate; a.Update(); #region Threads if (true) { Update u = new Update(); u.Table = TablesEnum.Thread; u.Where = new Q(Thread.Columns.ArticleK, a.K); u.Changes.Add(new Assign(Thread.Columns.UrlFragment, a.UrlFilterPart)); u.Changes.Add(new Assign(Thread.Columns.EventK, this.K)); u.Changes.Add(new Assign(Thread.Columns.VenueK, this.VenueK)); u.Changes.Add(new Assign(Thread.Columns.PlaceK, this.Venue.PlaceK)); u.Changes.Add(new Assign(Thread.Columns.CountryK, this.Venue.Place.CountryK)); u.Run(); } #endregion #region Galleries if (true) { Update u = new Update(); u.Table = TablesEnum.Gallery; u.Where = new Q(Gallery.Columns.ArticleK, a.K); u.Changes.Add(new Assign(Gallery.Columns.UrlFragment, a.UrlFilterPart)); u.Run(); } #endregion #region Photos if (true) { Update u = new Update(); u.Table = TablesEnum.Photo; u.Where = new Q(Photo.Columns.ArticleK, a.K); u.Changes.Add(new Assign(Photo.Columns.UrlFragment, a.UrlFilterPart)); u.Run(); } #endregion } Cambro.Web.Helpers.WriteAlert("Done merging articles...", 2); } #endregion #region Banners if (true) { Cambro.Web.Helpers.WriteAlert("Merging banners...", 4); Update u = new Update(); u.Table = TablesEnum.Banner; u.Where = new Q(Banner.Columns.EventK, merge.K); u.Changes.Add(new Assign(Banner.Columns.EventK, this.K)); u.Run(); Cambro.Web.Helpers.WriteAlert("Done merging banners...", 4); } #endregion #region Comp if (true) { Cambro.Web.Helpers.WriteAlert("Merging competitions...", 5); Update u = new Update(); u.Table = TablesEnum.Comp; u.Where = new Q(Comp.Columns.EventK, merge.K); u.Changes.Add(new Assign(Comp.Columns.EventK, this.K)); u.Run(); Cambro.Web.Helpers.WriteAlert("Done merging competitions...", 5); } #endregion #region EventMusicType if (true) { Cambro.Web.Helpers.WriteAlert("Merging music types...", 6); Query q1 = new Query(); q1.TableElement = MusicType.EventJoin; q1.QueryCondition = new Q(Event.Columns.K, merge.K); MusicTypeSet ems1 = new MusicTypeSet(q1); Query q2 = new Query(); q2.TableElement = MusicType.EventJoin; q2.QueryCondition = new Q(Event.Columns.K, this.K); MusicTypeSet ems2 = new MusicTypeSet(q2); bool hasAllMuisc = false; ArrayList majorTypes = new ArrayList(); ArrayList relevantTypes = new ArrayList(); #region find major types foreach (MusicType mt in ems1) { if (mt.K == 1) { hasAllMuisc = true; break; } if (mt.ParentK == 1 && !majorTypes.Contains(mt.K)) majorTypes.Add(mt.K); } if (!hasAllMuisc) { foreach (MusicType mt in ems2) { if (mt.K == 1) { hasAllMuisc = true; break; } if (mt.ParentK == 1 && !majorTypes.Contains(mt.K)) majorTypes.Add(mt.K); } } #endregion if (!hasAllMuisc) { foreach (MusicType mt in ems1) { if (!majorTypes.Contains(mt.ParentK) && !relevantTypes.Contains(mt.K)) relevantTypes.Add(mt.K); } foreach (MusicType mt in ems2) { if (!majorTypes.Contains(mt.ParentK) && !relevantTypes.Contains(mt.K)) relevantTypes.Add(mt.K); } } if (hasAllMuisc || relevantTypes.Count == 0) { Delete d = new Delete(TablesEnum.EventMusicType, new Q(EventMusicType.Columns.EventK, this.K)); d.Run(); EventMusicType emt = new EventMusicType(); emt.EventK = this.K; emt.MusicTypeK = 1; emt.Update(); } else { Delete d = new Delete(TablesEnum.EventMusicType, new Q(EventMusicType.Columns.EventK, this.K)); d.Run(); foreach (int mtK in relevantTypes) { EventMusicType emt = new EventMusicType(); emt.EventK = this.K; emt.MusicTypeK = mtK; emt.Update(); } } Cambro.Web.Helpers.WriteAlert("Done merging music types...", 6); } #endregion #region EventBrand if (true) { Cambro.Web.Helpers.WriteAlert("Merging brands...", 7); EventBrandSet ebs = new EventBrandSet(new Query(new Q(EventBrand.Columns.EventK, merge.K))); foreach (EventBrand eb in ebs) { try { EventBrand ebThis = new EventBrand(this.K, eb.BrandK); } catch { EventBrand ebThis = new EventBrand(); ebThis.EventK = this.K; ebThis.BrandK = eb.BrandK; ebThis.Update(); } } Cambro.Web.Helpers.WriteAlert("Done merging brands...", 7); } #endregion #region Gallery if (true) { Cambro.Web.Helpers.WriteAlert("Merging galleries...", 9); Update u = new Update(); u.Table = TablesEnum.Gallery; u.Where = new Q(Gallery.Columns.EventK, merge.K); u.Changes.Add(new Assign(Gallery.Columns.EventK, this.K)); u.Changes.Add(new Assign(Gallery.Columns.UrlFragment, this.UrlFilterPartVenueDate)); u.Run(); Cambro.Web.Helpers.WriteAlert("Done merging galleries...", 9); } #endregion #region Photo if (true) { Cambro.Web.Helpers.WriteAlert("Merging photos...", 10); Update u = new Update(); u.Table = TablesEnum.Photo; u.Where = new Q(Photo.Columns.EventK, merge.K); u.Changes.Add(new Assign(Photo.Columns.EventK, this.K)); u.Changes.Add(new Assign(Photo.Columns.UrlFragment, this.UrlFilterPartVenueDate)); u.Run(); Cambro.Web.Helpers.WriteAlert("Done merging photos...", 10); } #endregion #region GroupEvent if (true) { Cambro.Web.Helpers.WriteAlert("Merging group-event links...", 11); GroupEventSet ges = new GroupEventSet(new Query(new Q(GroupEvent.Columns.EventK, merge.K))); foreach (GroupEvent ge in ges) { try { GroupEvent geThis = new GroupEvent(ge.GroupK, this.K); } catch { GroupEvent geThis = new GroupEvent(); geThis.EventK = this.K; geThis.GroupK = ge.GroupK; geThis.Update(); } } Cambro.Web.Helpers.WriteAlert("Done merging group-event links...", 11); } #endregion #region Thread ParentObjects if (true) { Cambro.Web.Helpers.WriteAlert("Merging topics (1/2)...", 12); Update u = new Update(); u.Table = TablesEnum.Thread; u.Where = new And( new Q(Thread.Columns.ParentObjectType, Model.Entities.ObjectType.Event), new Q(Thread.Columns.ParentObjectK, merge.K)); u.Changes.Add(new Assign(Thread.Columns.ParentObjectK, this.K)); u.Run(); Cambro.Web.Helpers.WriteAlert("Done merging topics (1/2)...", 12); } #endregion #region Thread if (true) { Cambro.Web.Helpers.WriteAlert("Merging topics (2/2)...", 13); Update u = new Update(); u.Table = TablesEnum.Thread; u.Where = new And( new Q(Thread.Columns.EventK, merge.K), new Q(Thread.Columns.ArticleK, 0)); u.Changes.Add(new Assign(Thread.Columns.EventK, this.K)); u.Changes.Add(new Assign(Thread.Columns.UrlFragment, this.UrlFilterPartVenueDate)); u.Run(); Cambro.Web.Helpers.WriteAlert("Done merging topics (2/2)...", 13); } #endregion #region UsrEventAttended if (true) { Cambro.Web.Helpers.WriteAlert("Merging members...", 14); UsrEventAttendedSet ueas = new UsrEventAttendedSet(new Query(new Q(UsrEventAttended.Columns.EventK, merge.K))); foreach (UsrEventAttended uea in ueas) { try { UsrEventAttended ueaThis = new UsrEventAttended(uea.UsrK, this.K); bool changed = false; if (!uea.SendUpdate && ueaThis.SendUpdate) { ueaThis.SendUpdate = false; changed = true; } if (uea.Spotter && !ueaThis.Spotter) { ueaThis.Spotter = true; changed = true; } if (changed) ueaThis.Update(); } catch { UsrEventAttended ueaThis = new UsrEventAttended(); ueaThis.EventK = this.K; ueaThis.UsrK = uea.UsrK; ueaThis.SendUpdate = uea.SendUpdate; ueaThis.Spotter = uea.Spotter; ueaThis.Update(); } } Cambro.Web.Helpers.WriteAlert("Done merging members...", 14); } #endregion if (!this.HasPic) { Cambro.Web.Helpers.WriteAlert("Merging picture...", 15); this.Pic = merge.Pic; this.PicMiscK = merge.PicMiscK; this.PicPhotoK = merge.PicPhotoK; this.PicState = merge.PicState; merge.Pic = Guid.Empty; merge.PicMiscK = 0; merge.PicPhotoK = 0; merge.PicState = ""; merge.Update(); Cambro.Web.Helpers.WriteAlert("Done merging picture...", 15); } this.AdminNote += "Event " + merge.K + " was merged with this one " + DateTime.Now.ToString() + ". The admin note from event " + merge.K + " is:\n********************\n" + merge.AdminNote + "\n********************\n"; if (!this.HasGuestlist && merge.HasGuestlist) { Cambro.Web.Helpers.WriteAlert("Merging guestlist...", 16); this.HasGuestlist = true; this.GuestlistOpen = merge.GuestlistOpen; this.GuestlistFinished = merge.GuestlistOpen; this.GuestlistLimit = merge.GuestlistLimit; this.GuestlistCount = merge.GuestlistCount; this.GuestlistDetails = merge.GuestlistDetails; this.GuestlistPromoterK = merge.GuestlistPromoterK; this.GuestlistRegularPrice = merge.GuestlistRegularPrice; this.GuestlistPrice = merge.GuestlistPrice; this.GuestlistPromotion = merge.GuestlistPromotion; Delete d = new Delete(TablesEnum.UsrEventGuestlist, new Q(UsrEventGuestlist.Columns.EventK, this.K)); d.Run(); Update u = new Update(); u.Table = TablesEnum.UsrEventGuestlist; u.Where = new Q(UsrEventGuestlist.Columns.EventK, merge.K); u.Changes.Add(new Assign(UsrEventGuestlist.Columns.EventK, this.K)); u.Run(); Cambro.Web.Helpers.WriteAlert("Done merging guestlist...", 16); } if (merge.Donated) this.Donated = true; if (merge.HasHilight) this.HasHilight = true; this.UpdateUsrAttendCount(false); this.Update(); int mergeVenueK = merge.VenueK; Cambro.Web.Helpers.WriteAlert("Deleting old event...", 17); merge.DeleteAll(null); Cambro.Web.Helpers.WriteAlert("Done deleting old event...", 17); if (mergeVenueK != this.VenueK) { Venue mergeVenue = new Venue(mergeVenueK); Cambro.Web.Helpers.WriteAlert("Updating stats for old venue...", 18); mergeVenue.UpdateTotalComments(null); mergeVenue.UpdateTotalEvents(null); Cambro.Web.Helpers.WriteAlert("Done updating stats for old venue...", 18); } Cambro.Web.Helpers.WriteAlert("Updating stats for new event...", 19); this.UpdateMusicTypesStringNoUpdate(); this.UpdateTotalComments(null); this.UpdateHasSpotter(null); this.UpdateTotalPhotos(null); this.Venue.UpdateTotalEvents(null); Cambro.Web.Helpers.WriteAlert("Done updating stats for new event...", 19); this.Update(); Cambro.Web.Helpers.WriteAlert("Done merging events!", 20); }
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; }
private static Query GetEventsQuery(Venue venue, DateTime fromDate, DateTime toDate) { Query query = GetEventsQuery(fromDate, toDate); query.QueryCondition = new And(query.QueryCondition, new Q(Event.Columns.VenueK, venue.K)); return query; }
public void ChangeVenue(int NewVenueK, bool UpdateChildUrlFragments) { if (this.VenueK != NewVenueK) { Venue OldVenue = this.Venue; Venue NewVenue = new Venue(NewVenueK); Update uThreads = new Update(); uThreads.Table = TablesEnum.Thread; uThreads.Where = new Q(Thread.Columns.EventK, this.K); uThreads.Changes.Add(new Assign(Thread.Columns.VenueK, NewVenue.K)); uThreads.Changes.Add(new Assign(Thread.Columns.PlaceK, NewVenue.PlaceK)); uThreads.Changes.Add(new Assign(Thread.Columns.CountryK, NewVenue.Place.CountryK)); uThreads.Run(); Update uArticle = new Update(); uArticle.Table = TablesEnum.Article; uArticle.Where = new Q(Article.Columns.EventK, this.K); uArticle.Changes.Add(new Assign(Article.Columns.VenueK, NewVenue.K)); uArticle.Changes.Add(new Assign(Article.Columns.PlaceK, NewVenue.PlaceK)); uArticle.Changes.Add(new Assign(Article.Columns.CountryK, NewVenue.Place.CountryK)); uArticle.Run(); this.VenueK = NewVenue.K; this.Update(); OldVenue.UpdateTotalComments(null); this.Venue = null; this.UpdateTotalComments(null); Utilities.UpdateChildUrlFragmentsJob job = new Utilities.UpdateChildUrlFragmentsJob(Model.Entities.ObjectType.Event, this.K, UpdateChildUrlFragments); job.ExecuteAsynchronously(); } }
void BindVenueData(int VenueK) { Venue v = new Venue(VenueK); if (v != null) { CalendarLink.HRef = v.UrlCalendar(); //TicketsLink.HRef = v.UrlCalendar(true, false); //HotTicketsLink.HRef = v.UrlApp("hottickets"); //FreeGuestlistLink.HRef = v.UrlCalendar(false, true); ChangePanel(VenueSelectedPanel); this.SetPageTitle(v.Name + " in " + v.Place.Name, v.Name); VenueHeader.Text = CurrentVenue.Name; VenueNameLabel.Text = CurrentVenue.Name; PlaceNameLink.HRef = CurrentVenue.Place.Url(); PlaceNameLink.InnerText = CurrentVenue.Place.Name; } }
public void CountUsrs_PlaceConditions_IncludingIfUsrHasBeenToEventInTown() { new Delete(TablesEnum.Usr, new Q(true)).Run(); Random r = new Random(); List<int> placeKs = new List<int>() { 1, 2, 3, 4 }; Venue v = new Venue() { PlaceK = placeKs[0] }; v.Update(); Event e = new Event() { VenueK = v.K }; e.Update(); int usrsToCreate = 15; int usrs = 0; usrsToCreate.Times(() => { Usr u = new Usr() { Email = Guid.NewGuid().ToString(), IsSkeleton = false, IsEmailVerified = true, SendFlyers = true }; u.Update(); int i = r.Next(placeKs.Count * 2); if (i < placeKs.Count) { UsrEventAttended ue = new UsrEventAttended() { UsrK = u.K, EventK = e.K }; ue.Update(); usrs++; } }); Assert.AreEqual(usrs, Flyer.CountUsrs(placeKs, new List<int>(), false)); }
public bool CanEdit(Venue v) { if (this.IsSuper || this.IsAdmin) return true; if (this.K == v.OwnerUsrK && v.AddedDateTime > DateTime.Now.AddMonths(-1)) return true; if (this.IsEnabledPromoterOfConfirmedVenue(v)) return true; return false; }
public static EventSet GetEvents(Venue venue, DateTime from, DateTime to) { Query eventsQuery = GetEventsQuery(venue, from, to); return new EventSet(eventsQuery); }
public void PanelSignUpFormClick(object o, System.EventArgs e) { Page.Validate(); if (Page.IsValid) { if (IsEdit) { if (!CanEdit) throw new Exception("You can't edit this promoter!"); #region Store changes to promoter in admin note string oldDetails = ""; if (!Cambro.Web.Helpers.StripHtml(Name.Text).Equals(CurrentPromoter.Name)) oldDetails += "Name: [" + CurrentPromoter.Name + "] - [" + Cambro.Web.Helpers.StripHtml(Name.Text) + "]\n"; if (!Cambro.Web.Helpers.StripHtml(ContactName.Text).Equals(CurrentPromoter.ContactName)) oldDetails += "ContactName: [" + CurrentPromoter.ContactName + "] - [" + Cambro.Web.Helpers.StripHtml(ContactName.Text) + "]\n"; if (!Cambro.Web.Helpers.StripHtml(PhoneNumber.Text).Equals(CurrentPromoter.PhoneNumber)) oldDetails += "PhoneNumber: [" + CurrentPromoter.PhoneNumber + "] - [" + Cambro.Web.Helpers.StripHtml(PhoneNumber.Text) + "]\n"; if (!Cambro.Web.Helpers.StripHtml(AddressStreet.Text).Equals(CurrentPromoter.AddressStreet)) oldDetails += "AddressStreet: [" + CurrentPromoter.AddressStreet + "] - [" + Cambro.Web.Helpers.StripHtml(AddressStreet.Text) + "]\n"; if (!Cambro.Web.Helpers.StripHtml(AddressArea.Text).Equals(CurrentPromoter.AddressArea)) oldDetails += "AddressArea: [" + CurrentPromoter.AddressArea + "] - [" + Cambro.Web.Helpers.StripHtml(AddressArea.Text) + "]\n"; if (!Cambro.Web.Helpers.StripHtml(AddressTown.Text).Equals(CurrentPromoter.AddressTown)) oldDetails += "AddressTown: [" + CurrentPromoter.AddressTown + "] - [" + Cambro.Web.Helpers.StripHtml(AddressTown.Text) + "]\n"; if (!Cambro.Web.Helpers.StripHtml(AddressCounty.Text).Equals(CurrentPromoter.AddressCounty)) oldDetails += "AddressCounty: [" + CurrentPromoter.AddressCounty + "] - [" + Cambro.Web.Helpers.StripHtml(AddressCounty.Text) + "]\n"; if (!Cambro.Web.Helpers.StripHtml(AddressPostcode.Text).Equals(CurrentPromoter.AddressPostcode)) oldDetails += "AddressPostcode: [" + CurrentPromoter.AddressPostcode + "] - [" + Cambro.Web.Helpers.StripHtml(AddressPostcode.Text) + "]\n"; if (!int.Parse(AddressCountry.SelectedValue).Equals(CurrentPromoter.AddressCountryK)) oldDetails += "CountryK: [" + CurrentPromoter.AddressCountryK + "] - [" + int.Parse(AddressCountry.SelectedValue).ToString() + "]\n"; if (!((Promoter.VatStatusEnum)Convert.ToInt32(VatStatusDropDownList.SelectedValue)).Equals(CurrentPromoter.VatStatus)) oldDetails += "VatStatus: [" + CurrentPromoter.VatStatus.ToString() + "] - [" + ((Promoter.VatStatusEnum)Convert.ToInt32(VatStatusDropDownList.SelectedValue)).ToString() + "]\n"; if (!Cambro.Web.Helpers.StripHtml(VatNumberTextBox.Text.Trim()).Equals(CurrentPromoter.VatNumber)) oldDetails += "VatNumber: [" + CurrentPromoter.VatNumber + "] - [" + Cambro.Web.Helpers.StripHtml(VatNumberTextBox.Text.Trim()) + "]\n"; if (!Convert.ToInt32(VatCountryDropDownList.SelectedValue).Equals(CurrentPromoter.VatCountryK)) oldDetails += "VatCountryK: [" + CurrentPromoter.VatCountryK.ToString() + "] - [" + Convert.ToInt32(VatCountryDropDownList.SelectedValue).ToString() + "]\n"; if (!Cambro.Web.Helpers.StripHtml(BankNameTextBox.Text).Equals(CurrentPromoter.BankName)) oldDetails += "BankName: [" + CurrentPromoter.BankName + "] - [" + Cambro.Web.Helpers.StripHtml(BankNameTextBox.Text) + "]\n"; if (!Cambro.Web.Helpers.StripHtml(BankAccountNameTextBox.Text).Equals(CurrentPromoter.BankAccountName)) oldDetails += "BankAccountName: [" + CurrentPromoter.BankAccountName + "] - [" + Cambro.Web.Helpers.StripHtml(BankAccountNameTextBox.Text) + "]\n"; if (!Cambro.Web.Helpers.StripHtml(BankAccountNumberTextBox.Text).Equals(CurrentPromoter.BankAccountNumber)) oldDetails += "BankAccountNumber: [" + CurrentPromoter.BankAccountNumber + "] - [" + Cambro.Web.Helpers.StripHtml(BankAccountNumberTextBox.Text) + "]\n"; if (!Cambro.Web.Helpers.StripHtml(BankAccountSortCodeTextBox.Text).Equals(CurrentPromoter.BankAccountSortCode)) oldDetails += "BankAccountSortCode: [" + CurrentPromoter.BankAccountSortCode + "] - [" + Cambro.Web.Helpers.StripHtml(BankNameTextBox.Text) + "]\n"; if (uiAgency.Checked != CurrentPromoter.IsAgency) oldDetails += "IsAgency: [" + CurrentPromoter.IsAgency.ToString() + "] - [" + uiAgency.Checked.ToString() + "]\n"; if (oldDetails.Length > 0) CurrentPromoter.AdminNote += "\n" + Usr.Current.NickName + " (" + Usr.Current.K.ToString() + ") changed these details on " + DateTime.Now.ToString() + ":\n" + oldDetails; #endregion } else { Guid DuplicateGuid = (Guid)ViewState["PromoterDuplicateGuid"]; PromoterSet ps = new PromoterSet(new Query(new Q(Promoter.Columns.DuplicateGuid, DuplicateGuid))); if (ps.Count > 0) { Response.Redirect(ps[0].UrlApp("edit")); return; } else { #region Initialise promoter record CurrentPromoter = new Promoter(); CurrentPromoter.DateTimeSignUp = DateTime.Now; CurrentPromoter.AddedByUsrK = Usr.Current.K; CurrentPromoter.HasGuestlist = true; CurrentPromoter.GuestlistCharge = 0.25m; CurrentPromoter.GuestlistCredit = 20; CurrentPromoter.GuestlistCreditLimit = 0; CurrentPromoter.Status = Promoter.StatusEnum.Enabled; CurrentPromoter.PricingMultiplier = 1.0; CurrentPromoter.TotalPaid = 0; CurrentPromoter.DuplicateGuid = (Guid)ViewState["PromoterDuplicateGuid"]; CurrentPromoter.LetterType = Promoter.LetterTypes.CurrentNewPromoter; CurrentPromoter.LetterStatus = Promoter.LetterStatusEnum.New; CurrentPromoter.IsSkeleton = false; CurrentPromoter.OfferType = Promoter.OfferTypes.None; Random r = new Random(); CurrentPromoter.AccessCodeRandom = r.Next(1000, 9999).ToString() + r.Next(1000, 9999).ToString(); CurrentPromoter.ClientSector = (Promoter.ClientSectorEnum)Convert.ToInt32(Sector.SelectedValue); CurrentPromoter.SalesCampaignK = int.Parse(SalesCampaignDropDown.SelectedValue); if (!Usr.Current.IsAdmin) { CurrentPromoter.PrimaryUsrK = Usr.Current.K; CurrentPromoter.AddedMethod = Promoter.AddedMedhods.EndUser; } else { CurrentPromoter.AddedMethod = Promoter.AddedMedhods.SalesUser; } // assign new Promoter to Usr.Current if they are on a promoter sales team or to a randomly assigned promoter sales person, as requested by Dave 7/2/07 if (Usr.Current.SalesTeam > 0) { CurrentPromoter.SalesStatus = Promoter.SalesStatusEnum.Proactive; CurrentPromoter.SalesUsrK = Usr.Current.K; } else { CurrentPromoter.SalesStatus = Promoter.SalesStatusEnum.New; // Randomly assign a sales usr List<Usr> promoterSalesUsrs; if (CurrentPromoter.ClientSector.Equals(Promoter.ClientSectorEnum.Promoter)) promoterSalesUsrs = Usr.GetNewPromoterSalesUsrsNameAndK().ToList(); else promoterSalesUsrs = new List<Usr>() { new Usr(1) }; CurrentPromoter.SalesUsrK = promoterSalesUsrs[r.Next(0, promoterSalesUsrs.Count)].K; } CurrentPromoter.SalesStatusExpires = DateTime.Today.AddMonths(3); CurrentPromoter.SalesNextCall = DateTime.Now.AddDays(3); // If first call is on a weekend, then make it Monday if(CurrentPromoter.SalesNextCall.DayOfWeek == DayOfWeek.Saturday) CurrentPromoter.SalesNextCall = DateTime.Now.AddDays(2); else if(CurrentPromoter.SalesNextCall.DayOfWeek == DayOfWeek.Sunday) CurrentPromoter.SalesNextCall = DateTime.Now.AddDays(1); #endregion } } #region Update promoter record with form contents CurrentPromoter.Name = Cambro.Web.Helpers.StripHtml(Name.Text); CurrentPromoter.ContactName = Cambro.Web.Helpers.StripHtml(ContactName.Text); CurrentPromoter.PhoneNumber = Cambro.Web.Helpers.StripHtml(PhoneNumber.Text); CurrentPromoter.AddressStreet = Cambro.Web.Helpers.StripHtml(AddressStreet.Text); CurrentPromoter.AddressArea = Cambro.Web.Helpers.StripHtml(AddressArea.Text); CurrentPromoter.AddressTown = Cambro.Web.Helpers.StripHtml(AddressTown.Text); CurrentPromoter.AddressCounty = Cambro.Web.Helpers.StripHtml(AddressCounty.Text); CurrentPromoter.AddressPostcode = Cambro.Web.Helpers.StripHtml(AddressPostcode.Text); bool updateTicketInvoices = false; // new VAT details, for Ticket System. 22/5/07 if (CurrentPromoter.VatStatus != Promoter.VatStatusEnum.Registered && CurrentPromoter.VatStatus != (Promoter.VatStatusEnum)Convert.ToInt32(VatStatusDropDownList.SelectedValue)) updateTicketInvoices = true; CurrentPromoter.VatStatus = (Promoter.VatStatusEnum)Convert.ToInt32(VatStatusDropDownList.SelectedValue); CurrentPromoter.VatCountryK = Convert.ToInt32(VatCountryDropDownList.SelectedValue); CurrentPromoter.VatNumber = Cambro.Web.Helpers.StripHtml(VatNumberTextBox.Text.Trim()); // new Admin only data entry fields, as requested by Dave 7/2/07 if (Usr.Current.IsAdmin || Usr.Current.IsSuperAdmin) { CurrentPromoter.AccountsEmail = Cambro.Web.Helpers.StripHtml(AccountsEmail.Text); CurrentPromoter.AccountsName = Cambro.Web.Helpers.StripHtml(AccountsName.Text); CurrentPromoter.AccountsPhone = Cambro.Web.Helpers.StripHtml(AccountsPhone.Text); CurrentPromoter.ContactPersonalTitle = Cambro.Web.Helpers.StripHtml(PersonalTitle.Text); CurrentPromoter.ContactTitle = Cambro.Web.Helpers.StripHtml(JobTitle.Text); CurrentPromoter.PhoneNumber2 = Cambro.Web.Helpers.StripHtml(PhoneNumber2.Text); CurrentPromoter.WebAddress = Cambro.Web.Helpers.StripHtml(WebAddress.Text); CurrentPromoter.ClientSector = (Promoter.ClientSectorEnum)Convert.ToInt32(Sector.SelectedValue); CurrentPromoter.SalesCampaignK = int.Parse(SalesCampaignDropDown.SelectedValue); CurrentPromoter.IsAgency = uiAgency.Checked; // new admin only bank details, as requested by Dave 15/6/07 CurrentPromoter.BankName = Cambro.Web.Helpers.StripHtml(BankNameTextBox.Text); CurrentPromoter.BankAccountName = Cambro.Web.Helpers.StripHtml(BankAccountNameTextBox.Text); CurrentPromoter.BankAccountNumber = Cambro.Web.Helpers.StripHtml(BankAccountNumberTextBox.Text); CurrentPromoter.BankAccountSortCode = Cambro.Web.Helpers.StripHtml(BankAccountSortCodeTextBox.Text); if (this.AccessMultiRadio.Checked && this.uiAccessUsersMultiSelector.Count > 0 && (Usr.Current.IsAdmin || Usr.Current.IsSuperAdmin)){ CurrentPromoter.PrimaryUsrK = int.Parse(uiPrimaryUserDropDown.SelectedValue); }else { CurrentPromoter.PrimaryUsrK = 0; CurrentPromoter.AdminNote += "\n" + Usr.Current.NickName + " (" + Usr.Current.K.ToString() + ") has setup this account with no primary user - " + DateTime.Now.ToString() + "\n"; } } if (!IsEdit) { if (CurrentPromoter.PrimaryUsrK > 0) CurrentPromoter.AddQuestionsThread(CurrentPromoter.PrimaryUsr, Cambro.Web.Helpers.StripHtml(Name.Text)); else CurrentPromoter.AddQuestionsThread(Usr.Current, Cambro.Web.Helpers.StripHtml(Name.Text)); } Country newCountry = new Country(int.Parse(AddressCountry.SelectedValue)); CurrentPromoter.AddressCountryK = newCountry.K; CurrentPromoter.Update(); if (updateTicketInvoices) CurrentPromoter.UpdateTicketInvoiceItemTaxCode(); CurrentPromoter.CreateUniqueUrlName(); #endregion #region Add / remove selected users if (CurrentPromoter.PrimaryUsrK == Usr.Current.K || Usr.Current.IsAdmin || Usr.Current.IsSuperAdmin) { ArrayList SelectedUsers = new ArrayList(); ArrayList CurrentUsers = new ArrayList(); if (CurrentPromoter.PrimaryUsrK > 0) { SelectedUsers.Add(CurrentPromoter.PrimaryUsrK); } if (AccessMultiRadio.Checked) { foreach (var pair in this.uiAccessUsersMultiSelector.Selections) { Usr u = new Usr(int.Parse(pair.Value)); if (!SelectedUsers.Contains(u.K)) SelectedUsers.Add(u.K); } } foreach (Usr u in CurrentPromoter.AdminUsrs) { if (!CurrentUsers.Contains(u.K)) CurrentUsers.Add(u.K); } if (SelectedUsers.Count > 0) { Usr JohnB = new Usr(1); Thread t = new Thread(CurrentPromoter.QuestionsThreadK); foreach (int usrK in SelectedUsers) { if (!CurrentUsers.Contains(usrK)) { PromoterUsr pu = new PromoterUsr(); pu.PromoterK = CurrentPromoter.K; pu.UsrK = usrK; pu.Update(); t.Invite(new List<int>(new int[] { usrK }), JohnB, DateTime.Now, new List<int>(), !IsEdit, null, false); ThreadUsr tu = new ThreadUsr(CurrentPromoter.QuestionsThreadK, usrK); tu.Favourite = true; tu.Update(); CurrentPromoter.AdminNote += "\n" + Usr.Current.NickName + " (" + Usr.Current.K.ToString() + ") added new user to admins - " + DateTime.Now.ToString() + " - " + pu.UsrK.ToString() + " (" + pu.Usr.NickName + ")\n"; CurrentPromoter.Update(); pu.Usr.UpdateIsPromoter(); } } } //if (!AccessNoAccountUsersRadio.Checked) //{ foreach (int usrK in CurrentUsers) { if (!SelectedUsers.Contains(usrK)) { PromoterUsr pu = new PromoterUsr(CurrentPromoter.K, usrK); CurrentPromoter.AdminNote += "\n" + Usr.Current.NickName + " (" + Usr.Current.K.ToString() + ") removed user from the admins - " + DateTime.Now.ToString() + " - " + pu.UsrK.ToString() + " (" + pu.Usr.NickName + ")\n"; CurrentPromoter.Update(); pu.Delete(); pu.Update(); pu.Usr.UpdateIsPromoter(); try { ThreadUsr tu = new ThreadUsr(CurrentPromoter.QuestionsThreadK, usrK); tu.Delete(); tu.Update(); UpdateTotalParticipantsJob job = new UpdateTotalParticipantsJob(tu.Thread); job.ExecuteSynchronously(); } catch { } } } //} //else //{ // foreach (int usrK in CurrentUsers) // { // PromoterUsr pu = new PromoterUsr(CurrentPromoter.K, usrK); // CurrentPromoter.AdminNote += "\n" + Usr.Current.NickName + " (" + Usr.Current.K.ToString() + ") removed user from the admins - " + DateTime.Now.ToString() + " - " + pu.UsrK.ToString() + " (" + pu.Usr.NickName + ")\n"; // CurrentPromoter.Update(); // pu.Delete(); // pu.Update(); // pu.Usr.UpdateIsPromoter(); // try // { // ThreadUsr tu = new ThreadUsr(CurrentPromoter.QuestionsThreadK, usrK); // tu.Delete(); // tu.Update(); // tu.Thread.UpdateTotalParticipants(); // } // catch { } // } //} } #endregion #region Add / remove selected brands ArrayList SelectedBrands = new ArrayList(); ArrayList CurrentBrands = new ArrayList(); if (AccountTypeRadioEvents.Checked) { foreach (var pair in this.uiBrandMultiSelector.Selections) { Brand b = new Brand(int.Parse(pair.Value)); if (!SelectedBrands.Contains(b.K)) SelectedBrands.Add(b.K); } } CurrentPromoter.AllBrands = null; foreach (Brand b in CurrentPromoter.AllBrands) { if (!CurrentBrands.Contains(b.K)) CurrentBrands.Add(b.K); } string failedBrands = ""; foreach (int brandK in SelectedBrands) { if (!CurrentBrands.Contains(brandK)) { Brand b = new Brand(brandK); bool changeStatus = false; if (b.PromoterK == 0) { CurrentPromoter.AdminNote += "\n" + Usr.Current.NickName + " (" + Usr.Current.K.ToString() + ") added brand - " + DateTime.Now.ToString() + " - " + b.K + " (" + b.Name + ") - "; b.PromoterK = CurrentPromoter.K; changeStatus = true; } else if (b.PromoterStatus.Equals(Brand.PromoterStatusEnum.Unconfirmed)) { CurrentPromoter.AdminNote += "\n" + Usr.Current.NickName + " (" + Usr.Current.K.ToString() + ") added brand - " + DateTime.Now.ToString() + " - " + b.K + " (" + b.Name + ") - removed from promoter " + b.PromoterK + " (" + b.Promoter.Name + ") - "; b.PromoterK = CurrentPromoter.K; changeStatus = true; } else //brand owned by someone else! { CurrentPromoter.AdminNote += "\n" + Usr.Current.NickName + " (" + Usr.Current.K.ToString() + ") attempted to add brand - " + DateTime.Now.ToString() + " - " + b.K + " (" + b.Name + "), but it's already confirmed to promoter " + b.PromoterK + " (" + b.Promoter.Name + ")\n"; failedBrands = (failedBrands.Length == 0 ? "" : ", ") + b.Name; } if (changeStatus) { bool foundBrandOwner = false; CurrentPromoter.AdminUsrs = null; foreach (Usr u in CurrentPromoter.AdminUsrs) { if (b.OwnerUsrK == u.K) foundBrandOwner = true; } if (foundBrandOwner || Usr.Current.IsAdmin) { b.PromoterStatus = Brand.PromoterStatusEnum.Confirmed; CurrentPromoter.AdminNote += "(status confirmed)\n"; } else { b.PromoterStatus = Brand.PromoterStatusEnum.Unconfirmed; CurrentPromoter.AdminNote += "(status new)\n"; } } b.Update(); CurrentPromoter.Update(); } } foreach (int brandK in CurrentBrands) { if (!SelectedBrands.Contains(brandK)) { Brand b = new Brand(brandK); CurrentPromoter.AdminNote += "\n" + Usr.Current.NickName + " (" + Usr.Current.K.ToString() + ") removed brand - " + DateTime.Now.ToString() + " - " + b.K + " (" + b.Name + ")"; b.PromoterStatus = Brand.PromoterStatusEnum.Unconfirmed; b.PromoterK = 0; b.Update(); CurrentPromoter.Update(); } } #endregion #region Add / remove selected venues ArrayList SelectedVenues = new ArrayList(); ArrayList CurrentVenues = new ArrayList(); if (VenuesRadioYes.Checked) { foreach (var pair in this.uiVenuesMultiSelector.Selections) { Venue v = new Venue(int.Parse(pair.Value)); if (!SelectedVenues.Contains(v.K)) SelectedVenues.Add(v.K); } } CurrentPromoter.AllVenues = null; foreach (Venue v in CurrentPromoter.AllVenues) { if (!CurrentVenues.Contains(v.K)) CurrentVenues.Add(v.K); } string failedVenues = ""; foreach (int venueK in SelectedVenues) { if (!CurrentVenues.Contains(venueK)) { Venue v = new Venue(venueK); bool changeStatus = false; if (v.PromoterK == 0) { CurrentPromoter.AdminNote += "\n" + Usr.Current.NickName + " (" + Usr.Current.K.ToString() + ") added venue - " + DateTime.Now.ToString() + " - " + v.K + " (" + v.Name + ") - "; v.PromoterK = CurrentPromoter.K; changeStatus = true; } else if (v.PromoterStatus.Equals(Venue.PromoterStatusEnum.Unconfirmed)) { CurrentPromoter.AdminNote += "\n" + Usr.Current.NickName + " (" + Usr.Current.K.ToString() + ") added venue - " + DateTime.Now.ToString() + " - " + v.K + " (" + v.Name + ") - removed from promoter " + v.PromoterK + " (" + v.Promoter.Name + ") - "; v.PromoterK = CurrentPromoter.K; changeStatus = true; } else //venue owned by someone else! { CurrentPromoter.AdminNote += "\n" + Usr.Current.NickName + " (" + Usr.Current.K.ToString() + ") attempted to add venue - " + DateTime.Now.ToString() + " - " + v.K + " (" + v.Name + "), but it's already confirmed to promoter " + v.PromoterK + " (" + v.Promoter.Name + ")\n"; failedVenues = (failedVenues.Length == 0 ? "" : ", ") + v.Name + " in " + v.Place.Name; } if (changeStatus) { bool foundVenueOwner = false; CurrentPromoter.AdminUsrs = null; foreach (Usr u in CurrentPromoter.AdminUsrs) { if (v.OwnerUsrK == u.K) foundVenueOwner = true; } if (foundVenueOwner || Usr.Current.IsAdmin) { v.PromoterStatus = Venue.PromoterStatusEnum.Confirmed; CurrentPromoter.AdminNote += "(status confirmed)\n"; } else { v.PromoterStatus = Venue.PromoterStatusEnum.Unconfirmed; CurrentPromoter.AdminNote += "(status new)\n"; } } v.Update(); CurrentPromoter.Update(); } } foreach (int venueK in CurrentVenues) { if (!SelectedVenues.Contains(venueK)) { Venue v = new Venue(venueK); CurrentPromoter.AdminNote += "\n" + Usr.Current.NickName + " (" + Usr.Current.K.ToString() + ") removed venue - " + DateTime.Now.ToString() + " - " + v.K + " (" + v.Name + ")"; v.PromoterStatus = Venue.PromoterStatusEnum.Unconfirmed; v.PromoterK = 0; v.Update(); CurrentPromoter.Update(); } } #endregion this.ViewState["CurrentPromoterK"] = CurrentPromoter.K; CurrentPromoter = new Promoter(CurrentPromoter.K); CurrentPromoter.FixQuestionsThreadUsrs(); CurrentPromoter.UpdateModerators(); Usr.Current.LegalTermsPromoter2 = true; Usr.Current.Update(); if (failedBrands.Length > 0 || failedVenues.Length > 0) { //show error form... BrandErrorLabel.Text = failedBrands; VenueErrorLabel.Text = failedVenues; BrandErrorPanel.Visible = failedBrands.Length > 0; VenueErrorPanel.Visible = failedVenues.Length > 0; ChangePanel(PanelBrandVenueError); } else { if (IsEdit) { if (Usr.Current.IsAdmin) Response.Redirect(CurrentPromoter.Url()); else ChangePanel(PanelEditDone); } else { if (!Usr.Current.IsAdmin) { Thread t = new Thread(CurrentPromoter.QuestionsThreadK); Response.Redirect(t.Url()); } else { Response.Redirect(CurrentPromoter.Url()); } } } } }
public void DeleteSelected(object o, System.EventArgs e) { OutputP.InnerHtml = ""; foreach (string str in Request.Form.Keys) { if (str.StartsWith("ucAdminEventSelectedK") && Request.Form[str].Equals("1")) { string str1 = str.Substring(21); OutputP.InnerHtml += "Deleting event " + str1 + "..."; try { int eventK = int.Parse(str1); Event ev = new Event(eventK); if (ev.IsNew || ev.IsEdited) { Event.DeleteReturnStatus status = ev.DeleteAllUsr(Usr.Current); if (status.Equals(Event.DeleteReturnStatus.FailComments)) { OutputP.InnerHtml += " <b>FAILED</b> - event has " + ev.TotalComments + " comments. Please contact admin to delete this event."; } else if (status.Equals(Event.DeleteReturnStatus.FailPhotos)) { OutputP.InnerHtml += " <b>FAILED</b> - event has " + ev.TotalPhotos + " photos. Please contact admin to delete this event."; } else if (status.Equals(Event.DeleteReturnStatus.FailNoPermission)) { OutputP.InnerHtml += " <b>FAILED</b> - no permission to delete this event. Please contact admin with details."; } else if (status.Equals(Event.DeleteReturnStatus.FailException)) { OutputP.InnerHtml += " <b>FAILED</b> - exception while deleting event. Please contact admin with details."; } else if (status.Equals(Event.DeleteReturnStatus.FailPromoter)) { OutputP.InnerHtml += " <b>FAILED</b> - event has promoter objects - e.g. banners, guestlists or competitions. Please contact admin to delete this event."; } else if (status.Equals(Event.DeleteReturnStatus.Success)) { OutputP.InnerHtml += " Done."; } } else { OutputP.InnerHtml += " <b>FAILED</b> - event is not new - someone must have enabled it. Please contact admin with details."; } } catch { OutputP.InnerHtml += " <b>FAILED</b> - exception while deleting event. Maybe someone already deleted this event."; } OutputP.InnerHtml += "<br>"; } if (str.StartsWith("ucAdminVenueSelectedK") && Request.Form[str].Equals("1")) { string str1 = str.Substring(21); OutputP.InnerHtml += "Deleting venue " + str1 + "..."; try { int venueK = int.Parse(str1); Venue ven = new Venue(venueK); if (ven.IsNew || ven.IsEdited) { Venue.DeleteReturnStatus status = ven.DeleteAllUsr(Usr.Current); if (status.Equals(Venue.DeleteReturnStatus.FailComments)) { OutputP.InnerHtml += " <b>FAILED</b> - venue has " + ven.TotalComments + " comments. Please contact admin to delete this venue."; } else if (status.Equals(Venue.DeleteReturnStatus.FailEvents)) { OutputP.InnerHtml += " <b>FAILED</b> - venue has " + ven.Events.Count + " photos. Please contact admin to delete this venue."; } else if (status.Equals(Venue.DeleteReturnStatus.FailPhotos)) { OutputP.InnerHtml += " <b>FAILED</b> - venue has more than 5 photos. Please contact admin to delete this venue."; } else if (status.Equals(Venue.DeleteReturnStatus.FailNoPermission)) { OutputP.InnerHtml += " <b>FAILED</b> - no permission to delete this venue. Please contact admin with details."; } else if (status.Equals(Venue.DeleteReturnStatus.FailException)) { OutputP.InnerHtml += " <b>FAILED</b> - exception while deleting venue. Please contact admin with details."; } else if (status.Equals(Venue.DeleteReturnStatus.FailPromoter)) { OutputP.InnerHtml += " <b>FAILED</b> - venue has promoter objects - e.g. banners, guestlists or competitions. Please contact admin with details."; } else if (status.Equals(Venue.DeleteReturnStatus.Success)) { OutputP.InnerHtml += " Done."; } } else { OutputP.InnerHtml += " <b>FAILED</b> - venue is not new - someone must have enabled it. Please contact admin with details."; } } catch { OutputP.InnerHtml += " <b>FAILED</b> - exception while deleting venue. Maybe someone already deleted this venue."; } OutputP.InnerHtml += "<br>"; } } OutputP.Visible = true; Bind(); }
public void ForumInfo_Load(object o, System.EventArgs e) { if (!CurrentForumCheck) return; PanelThreadDescTypeNone.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.None); PanelThreadDescTypeEvent.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.Event); PanelThreadDescTypeVenue.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.Venue); PanelThreadDescTypePlace.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.Place); PanelThreadDescTypeCountry.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.Country); PanelThreadDescTypeArticle.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.Article); PanelThreadDescTypeBrand.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.Brand); PanelThreadDescTypeGroup.Visible = ThreadParentType.Equals(Model.Entities.ObjectType.Group); PanelThreadDescRelatedPanel.Visible = false; PanelThreadDescGroupBrandPanel.Visible = false; PanelThreadDescBrandPanel.Visible = false; FavouriteGroupPanel.Visible = (ThreadParentType.Equals(Model.Entities.ObjectType.Group) && CurrentGroupUsr != null && CurrentGroupUsr.IsMember); SetPageTitle("General discussions"); if (ThreadParentType.Equals(Model.Entities.ObjectType.None)) { ThreadDescWorldwideHomeCountryLink.InnerText = ThreadDescWorldwideHomeCountryLink.InnerText.Replace("???", Country.Current.FriendlyName); ThreadDescWorldwideHomeCountryLink.HRef = Country.Current.UrlDiscussion(); } if (ThreadParentType.Equals(Model.Entities.ObjectType.Event)) { Event ev = new Event(ObjectK); ThreadDescEventEventLink.InnerText = ev.Name; ThreadDescEventEventLink.HRef = ev.Url(); ThreadDescEventVenueLink.InnerText = ev.Venue.Name; ThreadDescEventVenueLink.HRef = ev.Venue.Url(); ThreadDescEventPlaceLink.InnerText = ev.Venue.Place.Name; ThreadDescEventPlaceLink.HRef = ev.Venue.Place.Url(); ThreadDescEventDateLabel.Text = ev.FriendlyDate(false); PanelThreadDescRelatedPanel.Visible = ev.Brands.Count > 0; string brandsHtml = ""; for (int i = 0; i < ev.Brands.Count; i++) { brandsHtml += (i == 0 ? "" : (i == (ev.Brands.Count - 1) ? " or " : ", ")) + "the <b><a href=\"" + ev.Brands[i].UrlDiscussion() + "\">" + ev.Brands[i].Name + " forum</a></b>"; } PanelThreadDescRelatedPh.Controls.Add(new LiteralControl(brandsHtml)); SetPageTitle(ev.Name + " discussions"); } if (ThreadParentType.Equals(Model.Entities.ObjectType.Venue)) { Venue v = new Venue(ObjectK); ThreadDescVenueVenueLink.InnerText = v.Name; ThreadDescVenueVenueLink.HRef = v.Url(); ThreadDescVenuePlaceLink.InnerText = v.Place.Name; ThreadDescVenuePlaceLink.HRef = v.Place.Url(); SetPageTitle(v.Name + " discussions"); } if (ThreadParentType.Equals(Model.Entities.ObjectType.Place)) { Place t = new Place(ObjectK); ThreadDescPlacePlaceLink.InnerText = t.Name; ThreadDescPlacePlaceLink.HRef = t.Url(); SetPageTitle(t.Name + " discussions"); } if (ThreadParentType.Equals(Model.Entities.ObjectType.Country)) { Country c = new Country(ObjectK); ThreadDescCountryLabel.Text = c.FriendlyName; ThreadDescCountryLink.HRef = c.Url(); SetPageTitle(c.FriendlyName + " discussions"); } if (ThreadParentType.Equals(Model.Entities.ObjectType.Article)) { Article a = new Article(ObjectK); ThreadDescArticleArticleLink.InnerText = a.Title; ThreadDescArticleArticleLink.HRef = a.Url(); SetPageTitle(a.Title + " discussions"); } if (ThreadParentType.Equals(Model.Entities.ObjectType.Brand)) { Brand b = new Brand(ObjectK); ThreadDescBrandBrandLink.InnerText = b.Name; ThreadDescBrandBrandLink.HRef = b.Url(); SetPageTitle(b.Name + " discussions"); if (b.Group.TotalComments > 0) { PanelThreadDescBrandPanel.Visible = true; PanelThreadDescBrandGroupChatAnchor.InnerText = b.Group.FriendlyName + " group chat"; PanelThreadDescBrandGroupChatAnchor.HRef = b.Group.UrlDiscussion(); PanelThreadDescBrandGroupChatCommentsLabel.Text = b.Group.TotalComments.ToString("#,##0") + " comment" + (b.Group.TotalComments == 1 ? "" : "s"); } } if (ThreadParentType.Equals(Model.Entities.ObjectType.Group)) { ThreadDescGroupGroupLink.InnerText = CurrentGroup.FriendlyName + " group"; ThreadDescGroupGroupLink.HRef = CurrentGroup.Url(); SetPageTitle(CurrentGroup.FriendlyName + " discussions"); if (CurrentGroup.BrandK > 0) { PanelThreadDescGroupBrandPanel.Visible = true; PanelThreadDescGroupBrandAnchor.HRef = CurrentGroup.Brand.UrlDiscussion(); PanelThreadDescGroupBrandAnchor.InnerText = CurrentGroup.Brand.Name + " public chat"; PanelThreadDescGroupBrandCommentsLabel.Text = CurrentGroup.Brand.TotalComments.ToString("#,##0") + " comment" + (CurrentGroup.Brand.TotalComments == 1 ? "" : "s"); } } }
private void CreateUsr(int musicTypeK, int homePlaceK, int eventPlaceK, int visitPlaceK, bool isPromoter) { Usr u = new Usr() { Email = Guid.NewGuid().ToString(), IsSkeleton = false, IsEmailVerified = true, SendFlyers = true, HomePlaceK = homePlaceK, IsPromoter = isPromoter }; u.Update(); UsrMusicTypeFavourite um = new UsrMusicTypeFavourite() { UsrK = u.K, MusicTypeK = musicTypeK }; um.Update(); Venue v = new Venue() { PlaceK = eventPlaceK }; v.Update(); Event e = new Event() { VenueK = v.K }; e.Update(); UsrEventAttended ue = new UsrEventAttended() { UsrK = u.K, EventK = e.K }; ue.Update(); UsrPlaceVisit up = new UsrPlaceVisit() { UsrK = u.K, PlaceK = visitPlaceK }; up.Update(); }