private void Page_Load(object sender, System.EventArgs e) { Event ev = new Event(int.Parse(Request.QueryString["EventK"])); if (!Usr.Current.IsAdmin) { if (!Usr.Current.IsPromoterK(ev.GuestlistPromoterK)) throw new DsiUserFriendlyException("You're not the promoter of this event!"); if (!ev.HasGuestlist) throw new DsiUserFriendlyException("Event doesn't have guestlist!"); if (!ev.GuestlistFinished) throw new DsiUserFriendlyException("Guestlist isn't closed yet!"); } EventLabel.Text = ev.Name + " @ " + ev.Venue.FriendlyName + "<br>" + ev.DateTime.ToString("dd MMMMM yyyy"); PriceLabel.Text = "Entry price for this guestlist: " + ev.GuestlistPrice.ToString("£0.##") + "."; if (ev.GuestlistDetails.Length > 0) PriceLabel.Text += "<br>Additional details: " + ev.GuestlistDetails; GuestlistDataList.DataSource = ev.GuestlistUsrs; if (Request.QueryString["Type"] != null && Request.QueryString["Type"].Equals("1")) GuestlistDataList.ItemTemplate = this.LoadTemplate("/Templates/Usrs/GuestlistNoPic.ascx"); else GuestlistDataList.ItemTemplate = this.LoadTemplate("/Templates/Usrs/Guestlist.ascx"); GuestlistDataList.DataBind(); }
protected string ReviewHtml(Event e) { if (e.DateTime <= DateTime.Today) return "<a href=\"" + e.UrlApp("review") + "\">Review</a>"; else return "<small>n/a</small>"; }
protected string PhotosHtml(Event e) { if (e.DateTime <= DateTime.Today) return "<a href=\"/pages/galleries/add/eventk-" + e.K.ToString() + "\">Add photos</a>"; else return "<small>n/a</small>"; }
protected string EditHtml(Event e) { if (Usr.Current.CanEdit(e)) return "<a href=\"" + e.UrlApp("edit") + "\">Edit</a> or <a href=\"" + e.UrlApp("edit","page","pic") + "\">" + (e.HasPic ? "edit" : "add") + " pic</a>"; else return "<small>n/a</small>"; }
private HtmlGenericControl CreateEventRow(Event e) { EventDisplay eventDisplay = (EventDisplay)this.LoadControl(EventDisplayControlSource); eventDisplay.CurrentEvent = e; eventDisplay.LinkToEventGallery = this.LinkToEventGallery; HtmlGenericControl div = new HtmlGenericControl("div"); div.Style.Add("padding", "0 8 0 8"); div.Controls.Add(eventDisplay); return div; }
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(Event e) { if (Usr.Current.CanEdit(e)) { string part = "<a href=\"/event-" + e.K.ToString() + "/edit\">Edit</a>"; if (e.HasPic) return part; else return part + " or <a href=\"/event-" + e.K.ToString() + "/edit/page-pic\">add pic</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(); }
private void Page_Load(object sender, System.EventArgs e) { Event ev = new Event(int.Parse(Request.QueryString["EventK"])); if (!Usr.Current.IsAdmin) { if (!Usr.Current.IsPromoterK(ev.GuestlistPromoterK)) throw new DsiUserFriendlyException("You're not the promoter of this event!"); if (!ev.HasGuestlist) throw new DsiUserFriendlyException("Event doesn't have guestlist!"); if (!ev.GuestlistFinished) throw new DsiUserFriendlyException("Guestlist isn't closed yet!"); } EventLabel.Text = ev.Name + " @ " + ev.Venue.FriendlyName + "<br>" + ev.DateTime.ToString("dd MMMMM yyyy");
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)))); }
public void EditEvent_Val(object o, ServerValidateEventArgs e) { if (Mode.Equals(Modes.Add)) { Event ev = new Event(int.Parse(EditEventDropDown.SelectedValue)); e.IsValid = !ev.HasGuestlist; } else e.IsValid = true; }
public bool IsEvent(Event evnt) { return evnt.VenueK.Equals(this.K); }
public void PanelEdit_Save(object o, System.EventArgs e) { if (Page.IsValid) { if (Mode.Equals(Modes.Add)) { Event ev = null; if (CurrentEvent != null) ev = CurrentEvent; else ev = new Event(int.Parse(EditEventDropDown.SelectedValue)); if (!ev.IsConfirmedPromoter(CurrentPromoter.K)) throw new DsiUserFriendlyException("You can't add a guestlist to this event!"); ev.HasGuestlist = true; ev.GuestlistPromotion = true; ev.GuestlistPromoterK = CurrentPromoter.K; ev.GuestlistDetails = Cambro.Web.Helpers.StripHtml(EditDetails.Text); ev.GuestlistPrice = double.Parse(EditPriceTextBox.Text); ev.GuestlistRegularPrice = double.Parse(EditRegularPriceTextBox.Text); ev.GuestlistLimit = int.Parse(EditLimit.Text); ev.GuestlistOpen = true; ev.Update(); } else if (Mode.Equals(Modes.Edit)) { if (CurrentPromoter.K != CurrentEvent.GuestlistPromoterK) throw new DsiUserFriendlyException("You can't edit this guestlist"); CurrentEvent.GuestlistDetails = Cambro.Web.Helpers.StripHtml(EditDetails.Text); CurrentEvent.GuestlistPrice = double.Parse(EditPriceTextBox.Text); CurrentEvent.GuestlistRegularPrice = double.Parse(EditRegularPriceTextBox.Text); CurrentEvent.GuestlistLimit = int.Parse(EditLimit.Text); CurrentEvent.Update(); } RedirectDone(); } }
/// <summary> /// This draws event links for brand public chat /// </summary> void AppendEventLink(StringBuilder sb, bool first, Event e) { if (!first) sb.Append("<br>"); sb.Append("<a href=\""); sb.Append(e.UrlDiscussion()); sb.Append("\">"); sb.Append(e.Name); sb.Append("</a> <small>@ "); sb.Append(e.Venue.Name); sb.Append(" in "); sb.Append(e.Venue.Place.Name); sb.Append(", "); sb.Append(e.FriendlyDate(false)); sb.Append(" - "); sb.Append(e.TotalComments.ToString("#,##0")); sb.Append(" comment"); if (e.TotalComments != 1) sb.Append("s"); sb.Append("</small>"); }
public void AddThreadPost_Click(object o, System.EventArgs e) { if (!CurrentForumCheckPermissionPost) return; if (Page.IsValid) { Usr.KickUserIfNotLoggedIn(); Thread.Maker m = new Thread.Maker(); m.DuplicateGuid = ContainerPage.ViewStatePublic["CommentDuplicateGuid"]; m.Subject = AddThreadSubjectTextBox.Text; m.Body = CommentHtml.GetHtml(); #region Work out the parent / group if (ThreadParentType.Equals(Model.Entities.ObjectType.Group) && AddThreadAdvancedCheckBox.Checked && AddThreadEventCheckBox.Checked) { Event ev = new Event(int.Parse(AddThreadEventDropDown.SelectedValue)); m.ParentType = Model.Entities.ObjectType.Event; m.ParentK = ev.K; m.GroupK = ObjectK; } else if ( !ThreadParentType.Equals(Model.Entities.ObjectType.Group) && AddThreadAdvancedCheckBox.Checked && AddThreadGroupRadioButton.Checked) { Group g = new Group(int.Parse(AddThreadGroupDropDown.SelectedValue)); m.ParentType = ThreadParentType; m.ParentK = ObjectK; m.GroupK = g.K; } else { m.ParentType = ThreadParentType; m.ParentK = ObjectK; if (ThreadParentType.Equals(Model.Entities.ObjectType.Group)) m.GroupK = ObjectK; } #endregion if (AddThreadAdvancedCheckBox.Checked && AddThreadNewsCheckBox.Checked) m.News = true; if (AddThreadAdvancedCheckBox.Checked && AddThreadPrivateRadioButton.Checked && AddThreadSealedCheckBox.Checked) m.Sealed = true; if (AddThreadAdvancedCheckBox.Checked && AddThreadPrivateRadioButton.Checked) m.Private = true; if (AddThreadAdvancedCheckBox.Checked && (ThreadParentType.Equals(Model.Entities.ObjectType.Group) || AddThreadGroupRadioButton.Checked) && AddThreadGroupPrivateCheckBox.Checked) m.Private = true; if (AddThreadAdvancedCheckBox.Checked && (AddThreadInviteCheckBox.Checked || AddThreadPrivateRadioButton.Checked)) { m.InviteKs = new List<int>(this.uiMultiBuddyChooser.SelectedUsrKs); } m.PostingUsr = Usr.Current; Thread.MakerReturn r = m.Post(); if (!r.Success && !r.Duplicate) throw new Exception(r.MessageHtml); Response.Redirect(r.Thread.Url()); } else { ContainerPage.AnchorSkip("NewThread"); } }
string eventString(Event ev, bool showVenue) { if (!showVenue) return ev.DateTime.ToString("dd (ddd)") + " - " + ev.Name.TruncateWithDots(maxLength); else return ev.DateTime.ToString("dd (ddd)") + " - " + ev.FriendlyNameNoDateTruncated(20); }
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 void CreateAttendEvent(Usr u, Event e) { Query q = new Query(); q.QueryCondition = new And( new Q(FacebookPost.Columns.DateTime, QueryOperator.GreaterThan, System.DateTime.Now.AddDays(-1)), new Q(FacebookPost.Columns.FacebookUid, u.Facebook.Uid), new Q(FacebookPost.Columns.Type, TypeEnum.AttendEvent)); FacebookPostSet fps = new FacebookPostSet(q); if (fps.Count < 5) { Query q1 = new Query(); q1.QueryCondition = new And( new Q(FacebookPost.Columns.FacebookUid, u.Facebook.Uid), new Q(FacebookPost.Columns.DataInt, e.K), new Or(new Q(FacebookPost.Columns.Type, TypeEnum.BuyTicket), new Q(FacebookPost.Columns.Type, TypeEnum.AttendEvent))); FacebookPostSet fps1 = new FacebookPostSet(q1); if (fps1.Count == 0) { FacebookPost fp = new FacebookPost(); fp.Hits = 0; fp.FacebookUid = u.Facebook.Uid; fp.DateTime = System.DateTime.Now; fp.Type = TypeEnum.AttendEvent; fp.Content = "EventK=" + e.K.ToString(); fp.DataInt = e.K; fp.UsrK = u.K; fp.Update(); //send facebook message //http://developers.facebook.com/docs/reference/api/post Dictionary<string, object> par = new Dictionary<string, object>(); par["picture"] = e.HasAnyPic ? e.AnyPicPath : "http://www.dontstayin.com/gfx/logo-90.png"; par["link"] = "http://" + Vars.DomainName + e.Url() + "?fbpk=" + fp.K.ToString(); par["name"] = e.FriendlyNameGeneric(true, false, false, false); par["caption"] = "Don't Stay In"; par["description"] = ("@ " + e.FriendlyNameGeneric(false, true, true, true) + " - " + e.ShortDetailsHtml).TruncateWithDots(990); u.Facebook.PutWallPost(e.IsFuture ? "I'm going to this..." : "I went to this...", par); } } }
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 static void AddEvent(Usr u, Event e, bool attendEvent) { throw new Exception("Disabled"); try { long id = 0; if (e.FacebookEventId.HasValue) { id = e.FacebookEventId.Value; } else { #region add event FacebookGraphAPI dsiPage = FacebookGraphAPI.GetPageApi(Facebook.Apps.Dsi); Dictionary<string, object> ev = new Dictionary<string, object>(); //access_token, name, description, location, street, city, privacy_type, start_time, end_time, picture ev["name"] = e.Name; ev["location"] = e.FriendlyNameGeneric(false, true, true, false); ev["file.jpg"] = Cropper.TryToGetLargerPic(e, 1.79); DateTime d = e.DateTime; if (e.StartTime == Model.Entities.Event.StartTimes.Morning) d = d.AddHours(6); else if (e.StartTime == Model.Entities.Event.StartTimes.Daytime) d = d.AddHours(14); else if (e.StartTime == Model.Entities.Event.StartTimes.Evening) d = d.AddHours(22); ev["start_time"] = d.ToString("s"); ev["end_time"] = d.AddHours(8).ToString("s"); ev["privacy_type"] = "OPEN"; ev["no_story"] = "1"; FacebookPost fp = new FacebookPost(); fp.Hits = 0; fp.FacebookUid = u.Facebook.Uid; fp.DateTime = System.DateTime.Now; fp.Type = TypeEnum.AddEvent; fp.Content = "EventK=" + e.K.ToString(); fp.DataInt = e.K; fp.UsrK = u.K; fp.Update(); Newtonsoft.Json.Linq.JObject post; try { ev["description"] = "Click for full details: http://" + Vars.DomainName + e.UrlShort() + "?fbpk=" + fp.K.ToString(); //Newtonsoft.Json.Linq.JObject post = u.Facebook.PutObject(u.Facebook.Uid.ToString(), "events", ev); post = dsiPage.PutObject(FacebookCommon.Common(Facebook.Apps.Dsi).PageId.ToString(), "events", ev); } catch { fp.Delete(); return; } try { id = long.Parse(post["id"].ToString()); } catch { } if (id > 0) { e.FacebookEventId = id; e.Update(); } #endregion } if (attendEvent && id > 0 && u.FacebookConnected && u.FacebookEventAttend) { try { u.Facebook.PutObject(id.ToString(), "attending", new Dictionary<string, object>()); } catch { } } } catch { } }
protected void RegisterDomain(object o, EventArgs e) { Domain d = new Domain(); d.DomainName = DomainName; if (!d.IsAvailable) { ErrorMessage = d.DomainName + " already exists!"; return; } d.PromoterK = PromoterK; if (uiOptionsList.SelectedPanelID == uiBrandDiv.ClientID) { d.RedirectApp = BrandRedirectApp; d.RedirectObjectK = BrandK; d.RedirectObjectType = Model.Entities.ObjectType.Brand; } else if (uiOptionsList.SelectedPanelID == uiVenueDiv.ClientID) { d.RedirectApp = VenueRedirectApp; d.RedirectObjectK = VenueK; d.RedirectObjectType = Model.Entities.ObjectType.Venue; } else if (uiOptionsList.SelectedPanelID == uiEventDiv.ClientID) { Event ev = new Event(EventK); if (!ev.IsPromoter(PromoterK)) throw new Exception("This event isn't in this promoter account!"); d.RedirectObjectK = EventK; d.RedirectObjectType = Model.Entities.ObjectType.Event; } else if (uiOptionsList.SelectedPanelID == uiGroupDiv.ClientID) { Group gr = new Group(GroupK); d.RedirectObjectK = GroupK; d.RedirectObjectType = Model.Entities.ObjectType.Group; } else { d.RedirectUrl = CustomUrl; } d.Update(); d.Register(); AddedDomain = d; SetStage(Stage.TestRedirect); }
public string UrlStyledEventLink(Event evnt, params string[] par) { return IStyledEventHolderExtentions.UrlStyledEventLink(this, evnt, par); }
void UpdateAncestors(Event e) { this.EventK = e.K; UpdateAncestors(e.Venue); }
public void PanelEdit_Save(object o, System.EventArgs e) { EnsureSecure(); if (Page.IsValid) { Comp c = null; if (Mode.Equals(Modes.Add)) { c = new Comp(); c.DateTimeAdded = DateTime.Now; c.PromoterK = CurrentPromoter.K; c.Status = Comp.StatusEnum.New; } else if (Mode.Equals(Modes.Edit)) { c = CurrentComp; } c.DisplayType = Comp.DisplayTypes.New; c.DateTimeStart = EditDateStart.SelectedDate; c.DateTimeClose = new DateTime(EditDateClose.SelectedDate.Year, EditDateClose.SelectedDate.Month, EditDateClose.SelectedDate.Day, 12, 0, 0); c.Question = Cambro.Web.Helpers.StripHtml(EditQuestion.Text.Trim()).Truncate(200); c.Answer1 = Cambro.Web.Helpers.StripHtml(EditAnswer1.Text.Trim()).Truncate(100); c.Answer2 = Cambro.Web.Helpers.StripHtml(EditAnswer2.Text.Trim()).Truncate(100); c.Answer3 = Cambro.Web.Helpers.StripHtml(EditAnswer3.Text.Trim()).Truncate(100); c.CorrectAnswer = EditCorrectRadio1.Checked ? 1 : (EditCorrectRadio2.Checked ? 2 : 3); c.Prize = Cambro.Web.Helpers.StripHtml(EditPrizesFirstDesc.Text.Trim()).Truncate(200); c.Prize2 = Cambro.Web.Helpers.StripHtml(EditPrizesSecondDesc.Text.Trim()).Truncate(200); c.Prize3 = Cambro.Web.Helpers.StripHtml(EditPrizesThirdDesc.Text.Trim()).Truncate(200); c.SponsorDetails = EditSponsorDescriptionHtml.GetHtml(); try { c.Winners = int.Parse(EditPrizesFirstNumber.Text.Trim()); } catch { throw new DsiUserFriendlyException("Number of first prizes must be a number"); } try { c.Winners2 = EditPrizesSecondNumber.Text.Trim().Equals("") ? 0 : int.Parse(EditPrizesSecondNumber.Text.Trim()); } catch { throw new DsiUserFriendlyException("Number of second prizes must be a number or blank"); } try { c.Winners3 = EditPrizesThirdNumber.Text.Trim().Equals("") ? 0 : int.Parse(EditPrizesThirdNumber.Text.Trim()); } catch { throw new DsiUserFriendlyException("Number of third prizes must be a number or blank"); } Usr u; try { u = new Usr(int.Parse(EditPrizeContact.SelectedValue)); } catch { throw new DsiUserFriendlyException("Prize contact not valid!"); } if (!u.IsEnabledPromoter(CurrentPromoter.K)) throw new DsiUserFriendlyException("Prize contact not valid!"); c.OwnerUsrK = u.K; try { c.PrizeValueRange = int.Parse(EditPrizesValue.SelectedValue); } catch { throw new DsiUserFriendlyException("Prize value not valid!"); } if (CurrentEvent != null) { c.LinkType = Comp.LinkTypes.Event; c.BrandK = 0; c.EventK = CurrentEvent.K; } else if (EditLinkNoneRadio.Checked) { c.LinkType = Comp.LinkTypes.None; c.BrandK = 0; c.EventK = 0; } else if (EditLinkEventRadio.Checked) { c.LinkType = Comp.LinkTypes.Event; c.BrandK = 0; if (UpcomingEvents.Count == 1) c.EventK = UpcomingEvents[0].K; else { Event ev; try { ev = new Event(int.Parse(EditLinkEventDropDown.SelectedValue)); } catch { throw new DsiUserFriendlyException("Can't use this event!"); } if (!ev.IsPromoter(CurrentPromoter.K)) throw new DsiUserFriendlyException("Can't use this event!"); c.EventK = ev.K; } } else if (EditLinkBrandRadio.Checked) { c.LinkType = Comp.LinkTypes.Brand; c.EventK = 0; c.BrandK = 0; if (CurrentPromoter.AllBrands.Count == 1) c.BrandK = CurrentPromoter.AllBrands[0].K; else { Brand b; try { b = new Brand(int.Parse(EditLinkBrandDropDown.SelectedValue)); } catch { throw new DsiUserFriendlyException("Can't use this brand!"); } if (b.PromoterK != CurrentPromoter.K) throw new DsiUserFriendlyException("Can't use this brand!"); c.BrandK = b.K; } } c.Update(); if (c.HasPic) RedirectDone(); else Response.Redirect(ContainerPage.Url.CurrentUrl("mode", "pic", "compk", c.K.ToString())); } }
public static void DailySendNewGalleryEmails() { DateTime StartDateTime = DateTime.Now; int UsrCount = 0; int FailCount = 0; try { Query q = new Query(); if (Vars.DevEnv) q.TopRecords=100; q.TableElement = new TableElement(TablesEnum.Gallery); q.TableElement = new Join( q.TableElement, new TableElement(TablesEnum.UsrEventAttended), QueryJoinType.Inner, new And( new Q(Gallery.Columns.EventK, UsrEventAttended.Columns.EventK, true), new Q(UsrEventAttended.Columns.SendUpdate, true) ) ); q.TableElement = new Join( q.TableElement, new TableElement(new Column(UsrEventAttended.Columns.UsrK, Usr.Columns.K)), QueryJoinType.Inner, new And( new Q(UsrEventAttended.Columns.UsrK, new Column(UsrEventAttended.Columns.UsrK, Usr.Columns.K), true), new Q(new Column(UsrEventAttended.Columns.UsrK, Usr.Columns.IsSkeleton),false), new Q(new Column(UsrEventAttended.Columns.UsrK, Usr.Columns.IsEmailVerified),true) ) ); q.TableElement = new Join( q.TableElement, new TableElement(TablesEnum.Event), QueryJoinType.Inner, new Q(Gallery.Columns.EventK, Event.Columns.K, true) ); q.TableElement = new Join( q.TableElement, new TableElement(TablesEnum.GalleryUsr), QueryJoinType.Left, new And( new Q(Gallery.Columns.K, GalleryUsr.Columns.GalleryK, true), new Q(UsrEventAttended.Columns.UsrK, GalleryUsr.Columns.UsrK, true) ) ); q.TableElement = new Join( q.TableElement, new TableElement(TablesEnum.Usr), QueryJoinType.Inner, new Q(Gallery.Columns.OwnerUsrK, Usr.Columns.K, true) ); q.TableElement = new Join( q.TableElement, new TableElement(TablesEnum.Photo), QueryJoinType.Left, new Q(Gallery.Columns.MainPhotoK, Photo.Columns.K, true) ); q.Columns = new ColumnSet( Gallery.Columns.K, Gallery.Columns.Name, Gallery.Columns.UrlFragment, Gallery.Columns.ArticleK, Gallery.Columns.MainPhotoK, Gallery.Columns.LivePhotos, Gallery.Columns.CreateDateTime, Gallery.Columns.EventK, Gallery.Columns.OwnerUsrK, Photo.Columns.K, Photo.Columns.Icon, Photo.Columns.ContentDisabled, Photo.Columns.Status, Usr.LinkColumns, UsrEventAttended.Columns.UsrK ); int daysPast = -3; if (Vars.DevEnv) daysPast = -30; q.QueryCondition=new And( new Q(Gallery.Columns.LastLiveDateTime,QueryOperator.GreaterThan,DateTime.Now.AddDays(daysPast)), Gallery.ShowOnSiteQ, new Or( new Q(GalleryUsr.Columns.ViewPhotosLatest,QueryOperator.IsNull,null), new Q(Gallery.Columns.LivePhotos,QueryOperator.GreaterThan,GalleryUsr.Columns.ViewPhotosLatest,true) ) ); q.OrderBy=new OrderBy( new OrderBy(UsrEventAttended.Columns.UsrK), new OrderBy(Event.Columns.DateTime, OrderBy.OrderDirection.Descending), new OrderBy(Event.Columns.K), new OrderBy(Gallery.Columns.LivePhotos, OrderBy.OrderDirection.Descending), new OrderBy(Gallery.Columns.K) ); GallerySet gs = new GallerySet(q); Usr CurrentUsr = null; Event CurrentEvent = null; Mailer CurrentMail = null; int RowCount = 0; int CurrentGalleryCount = 0; for (int count=0; count<gs.Count; count++) { try { Gallery CurrentGallery = gs[count]; if (CurrentUsr==null || CurrentGallery.JoinedUsrEventAttend.UsrK!=CurrentUsr.K) { if (CurrentMail!=null) { Console.WriteLine(CurrentUsr.Email+" - "+CurrentGalleryCount.ToString()+", IsSkeleton="+CurrentUsr.IsSkeleton+", IsEmailVerified="+CurrentUsr.IsEmailVerified); CurrentGalleryCount=0; CurrentMail.Body+="</tr></table>"; CurrentMail.Send(); } CurrentEvent = null; CurrentUsr = new Usr(CurrentGallery.JoinedUsrEventAttend.UsrK); UsrCount++; CurrentMail = new Mailer(); CurrentMail.Subject="New DontStayIn galleries "+DateTime.Today.ToString("ddddd dd MMMM yyyy"); CurrentMail.UsrRecipient = CurrentUsr; CurrentMail.Body="<p>Here are some galleries you might like to check out:</p>"; CurrentMail.Bulk=true; } if (CurrentEvent==null || CurrentGallery.EventK!=CurrentEvent.K) { if (CurrentEvent!=null) { CurrentMail.Body+="</tr></table>"; } CurrentEvent = new Event(CurrentGallery.EventK); CurrentMail.Body+="<p style=\"margin:15px 0px 1px 0px;\"><center><a href=\"[LOGIN("+CurrentEvent.Url()+")]\" style=\"line-height:21px;font-size:18px;font-weight:bold;\">"+CurrentEvent.Name+"</a></center></p>"; CurrentMail.Body+="<div style=\"margin:0px 0px 3px 0px;\"><center><small><a href=\"[LOGIN("+CurrentEvent.Venue.Url()+")]\">"+CurrentEvent.Venue.Name+"</a>, "+CurrentEvent.FriendlyDate(false)+", <a href=\"[LOGIN("+CurrentEvent.Url("ignore","")+")]\">click to ignore new galleries</a></small></center></div>"; RowCount = 0; CurrentMail.Body+="<table cellspacing=\"0\" cellpadding=\"7\" width=\"100%\" style=\"margin:0px 0px 3px 0px;\"><tr>"; } if (RowCount==3) { RowCount = 0; CurrentMail.Body+="</tr><tr>"; } CurrentMail.Body += "<td align=\"center\" valign=\"top\" width=\"33%\"><a href=\"[LOGIN(" + CurrentGallery.Url() + ")]\"><img src=\"" + CurrentGallery.PicPathAbsolute + "\" width=\"100\" height=\"100\" class=\"BorderBlack All\" border=\"0\"><div style=\"padding:5px 0px 0px 0px;\">" + CurrentGallery.NameSafe + "</div></a><div style=\"padding:5px 0px 0px 0px;\"><small>" + CurrentGallery.LivePhotos.ToString("#,##0") + " photo" + (CurrentGallery.LivePhotos == 1 ? "" : "s") + ". Added by <a href=\"[LOGIN(" + CurrentGallery.Owner.Url() + ")]\">" + CurrentGallery.Owner.NickName + "</a></small></div></td>"; RowCount++; CurrentGalleryCount++; } catch { FailCount++; CurrentUsr = null; CurrentEvent = null; CurrentMail = null; } gs.Kill(count); } } finally { string summary = "<p>Started: "+StartDateTime.ToLongTimeString()+"</p>"; summary += "<p>Ending: "+DateTime.Now.ToLongTimeString()+"</p>"; TimeSpan timeTaken = (DateTime.Now - StartDateTime); summary += "<p>Total time: "+timeTaken.TotalMinutes.ToString("0.##")+" min</p>"; summary += "<p><b>Users with unseen galleries: "+UsrCount.ToString("#,##0")+"</b></p>"; summary += "<p><b>Exceptions: "+FailCount.ToString("#,##0")+"</b></p>"; Mailer smAdmin = new Mailer(); smAdmin.TemplateType=Mailer.TemplateTypes.AdminNote; smAdmin.Body += "<h1>Summary</h1>"; smAdmin.Body += summary; smAdmin.Subject="Gallery email sent "+DateTime.Now.ToString(); smAdmin.To="*****@*****.**"; smAdmin.Send(); } }
public string UrlEventOptions(Event ev) { return UrlEventOptions(ev.K); }
public bool IsEvent(Event evnt) { return evnt.IsBrand(this.K); }
private static void ThreadSendMessagesToCommentAlerts(Thread parentThread, Usr postingUsr, List<int> alertedUsrKs) { #region Send messages to CommentAlerts try { CommentAlertSet cas = null; IDiscussable parent = null; try { parent = parentThread.ParentForumObject; } catch (Exception ex) { Bobs.Global.Log("316e602c-f6ce-4fa5-a628-b05335596a57", ex); } if (parentThread.GroupK == 0) { if (!parentThread.Private && !parentThread.ParentObjectType.Equals(Model.Entities.ObjectType.None) && !parentThread.ParentObjectType.Equals(Model.Entities.ObjectType.Country)) { Query q = new Query(); List<Q> al = new List<Q>(); try { #region Build query if (parentThread.ArticleK > 0) al.Add(new And(new Q(CommentAlert.Columns.ParentObjectType, Model.Entities.ObjectType.Article), new Q(CommentAlert.Columns.ParentObjectK, parentThread.ArticleK))); if (parentThread.PhotoK > 0) al.Add(new And(new Q(CommentAlert.Columns.ParentObjectType, Model.Entities.ObjectType.Photo), new Q(CommentAlert.Columns.ParentObjectK, parentThread.PhotoK))); if (parentThread.EventK > 0) { al.Add(new And(new Q(CommentAlert.Columns.ParentObjectType, Model.Entities.ObjectType.Event), new Q(CommentAlert.Columns.ParentObjectK, parentThread.EventK))); Event ev = new Event(parentThread.EventK); foreach (Brand b in ev.Brands) al.Add(new And(new Q(CommentAlert.Columns.ParentObjectType, Model.Entities.ObjectType.Brand), new Q(CommentAlert.Columns.ParentObjectK, b.K))); } if (parentThread.VenueK > 0) al.Add(new And(new Q(CommentAlert.Columns.ParentObjectType, Model.Entities.ObjectType.Venue), new Q(CommentAlert.Columns.ParentObjectK, parentThread.VenueK))); if (parentThread.PlaceK > 0) al.Add(new And(new Q(CommentAlert.Columns.ParentObjectType, Model.Entities.ObjectType.Place), new Q(CommentAlert.Columns.ParentObjectK, parentThread.PlaceK))); #endregion } catch (Exception ex) { Bobs.Global.Log("2120d49c-25e6-4988-9517-f6253583f6e6", ex); } if (al.Count > 0) { try { #region Get commentAlerts if (al.Count == 1) { q.QueryCondition = (Q)al[0]; } else { Q[] qarr = al.ToArray(); q.QueryCondition = new Or(qarr); } q.OrderBy = new OrderBy(CommentAlert.Columns.ParentObjectType); q.TableElement = new Join(CommentAlert.Columns.UsrK, new Column(CommentAlert.Columns.UsrK, Usr.Columns.K)); q.Columns = new ColumnSet( CommentAlert.Columns.ParentObjectK, CommentAlert.Columns.ParentObjectType, CommentAlert.Columns.UsrK, new JoinedColumnSet(CommentAlert.Columns.UsrK, Usr.EmailColumns) ); cas = new CommentAlertSet(q); #endregion } catch (Exception ex) { Bobs.Global.Log("345a3a46-4c6e-406b-909b-ee79997f21ee", ex); } } } } else { try { #region Get group commentAlerts Query q = new Query(); q.TableElement = new Join(CommentAlert.Columns.UsrK, new Column(CommentAlert.Columns.UsrK, Usr.Columns.K)); if (parentThread.GroupPrivate || parentThread.PrivateGroup) { q.QueryCondition = new And( new Q(CommentAlert.Columns.ParentObjectType, Model.Entities.ObjectType.Group), new Q(CommentAlert.Columns.ParentObjectK, parentThread.GroupK), new Q(GroupUsr.Columns.Status, GroupUsr.StatusEnum.Member)); q.TableElement = new Join( q.TableElement, new TableElement(TablesEnum.GroupUsr), QueryJoinType.Inner, new And( new Q(CommentAlert.Columns.ParentObjectType, Model.Entities.ObjectType.Group), new Q(CommentAlert.Columns.ParentObjectK, GroupUsr.Columns.GroupK, true), new Q(CommentAlert.Columns.UsrK, GroupUsr.Columns.UsrK, true), new Q(GroupUsr.Columns.Status, GroupUsr.StatusEnum.Member))); } else { q.QueryCondition = new And( new Q(CommentAlert.Columns.ParentObjectType, Model.Entities.ObjectType.Group), new Q(CommentAlert.Columns.ParentObjectK, parentThread.GroupK)); } q.OrderBy = new OrderBy(CommentAlert.Columns.ParentObjectType); q.Columns = new ColumnSet( CommentAlert.Columns.ParentObjectK, CommentAlert.Columns.ParentObjectType, CommentAlert.Columns.UsrK, new JoinedColumnSet(CommentAlert.Columns.UsrK, Usr.EmailColumns) ); cas = new CommentAlertSet(q); #endregion } catch (Exception ex) { Bobs.Global.Log("45e3f62f-cdfc-4d34-a506-b7a0b1fe9b94", ex); } } ThreadSendAlerts(parentThread, alertedUsrKs, postingUsr, cas, parent); } catch (Exception ex) { Bobs.Global.Log("1dacb724-64b1-4c53-9d95-f043221b1d39", ex); } #endregion }
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"); } } }
string GetLinkEventDropDownValue(Event e) { return e.K.ToString() + "," + e.DateTime.Year.ToString() + "," + (e.DateTime.Month - 1).ToString() + "," + e.DateTime.Day.ToString(); }