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 PanelNameNext(object o, System.EventArgs e) { if (Page.IsValid) { Guid DuplicateGuid = (Guid)ViewState["BrandDuplicateGuid"]; BrandSet bs = new BrandSet(new Query(new Q(Brand.Columns.DuplicateGuid, DuplicateGuid))); if (bs.Count > 0) Response.Redirect("/popup/newbrand/k-" + bs[0].K.ToString()); else { Brand b = new Brand(); b.DateTimeCreated = DateTime.Now; b.Name = Cambro.Web.Helpers.StripHtml(NameTextBox.Text.Trim()); b.IsNew = true; b.OwnerUsrK = Usr.Current.K; b.IsEdited = false; b.DuplicateGuid = DuplicateGuid; b.Update(); b.CreateUniqueUrlName(false); //create a new group Group g = new Group(); g.Name = b.Name; g.ThemeK = 1; g.Description = b.Name + " regulars group for discussing " + b.Name + " parties"; g.PostingRules = "Discussions about " + b.Name + " parties only. Other topics may be deleted by group moderators."; g.DateTimeCreated = DateTime.Now; g.PrivateGroupPage = false; g.PrivateChat = false; g.PrivateMemberList = false; g.Restriction = Bobs.Group.RestrictionEnum.None; g.CountryK = 0; g.PlaceK = 0; g.MusicTypeK = 0; g.BrandK = b.K; g.UrlName = "parties/" + b.UrlName; g.EmailOnAllThreads = false; g.DuplicateGuid = Guid.NewGuid(); g.Update(); b.GroupK = g.K; b.Update(); Response.Redirect("/popup/newbrand/k-" + b.K.ToString()); } } }
public void Merge_Click(object o, System.EventArgs e) { Brand master = new Brand(int.Parse(this.uiMasterBrandUrl.Value)); Brand merge = new Brand(int.Parse(this.uiMergeBrandUrl.Value)); if ( master.PromoterK > 0 && master.Promoter.IsEnabled && master.PromoterStatus.Equals(Brand.PromoterStatusEnum.Confirmed) && merge.PromoterK > 0 && merge.Promoter.IsEnabled && merge.PromoterStatus.Equals(Brand.PromoterStatusEnum.Confirmed) && master.PromoterK != merge.PromoterK) throw new Exception("Can't merge these brands - they are controlled by different promoters - contact admin."); master.MergeAndDelete(merge); Cambro.Web.Helpers.WriteAlertFooter(master.Url()); }
void uiGoToPromoterPageByBrandButton_Click(object sender, EventArgs e) { try { Brand b = new Brand(int.Parse(this.uiBrandsAutoComplete.Value)); if (b.Promoter == null) { this.uiBrandPromoterIsNullPanel.Visible = true; } else { Response.Redirect(b.Promoter.Url()); } } catch { } }
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 bool IsEnabledPromoterOfConfirmedBrand(Brand b) { if (!this.IsPromoter) return false; if (b.PromoterK > 0 && b.Promoter != null && b.PromoterStatus.Equals(Brand.PromoterStatusEnum.Confirmed) && this.IsPromoterK(b.PromoterK)) return true; return false; }
void SaveEvent() { bool duplicate = false; //Save the event if (IsNew) { //Duplicate? EventSet esDup = new EventSet(new Query(new Q(Event.Columns.DuplicateGuid, (Guid)ContainerPage.ViewStatePublic["EventDuplicateGuid"]))); if (esDup.Count == 0) { Event ev = Event.AddEvent( Cambro.Web.Helpers.StripHtml(EventName.Text).Trim(), CurrentVenue.K, StartTime, PanelDateCal.SelectedDate, Cambro.Misc.Utility.Snip(Cambro.Web.Helpers.StripHtml(EventShortDetailsHtml.Text), 500), EventLongDetailsHtml.GetHtml(), (Guid)ContainerPage.ViewStatePublic["EventDuplicateGuid"], EventCapacity.Text.Trim().Length > 0 ? int.Parse(EventCapacity.Text.Trim()) : null as int?, Usr.Current, MusicTypesUc.SelectedMusicTypes.ToArray(), null, SpotterRequestYes.Checked, SpotterRequestYes.Checked ? Cambro.Web.Helpers.StripHtml(SpotterRequestName.Text).Truncate(100) : "", SpotterRequestYes.Checked ? Cambro.Web.Helpers.StripHtml(SpotterRequestNumber.Text).Truncate(100) : "" ); ViewState["InsertedEventK"] = ev.K; } else { ViewState["InsertedEventK"] = esDup[0].K; duplicate = true; } } else if (IsEdit) { if (!Usr.Current.CanEdit(CurrentEvent)) throw new Exception("You may not edit this event!"); bool changedDate = false; bool changedVenue = false; CurrentEvent.Name = Cambro.Web.Helpers.StripHtml(EventName.Text).Trim(); CurrentEvent.StartTime = StartTime; if (CanEditDateVenue) { if (CurrentEvent.DateTime != PanelDateCal.SelectedDate) { CurrentEvent.DateTime = PanelDateCal.SelectedDate; changedDate = true; } } CurrentEvent.ShortDetailsHtml = Cambro.Misc.Utility.Snip(Cambro.Web.Helpers.StripHtml(EventShortDetailsHtml.Text), 500); CurrentEvent.LongDetailsHtml = EventLongDetailsHtml.GetHtml(); CurrentEvent.SpotterRequest = SpotterRequestYes.Checked; if (SpotterRequestYes.Checked) { CurrentEvent.SpotterRequestName = Cambro.Web.Helpers.StripHtml(SpotterRequestName.Text).Truncate(100); CurrentEvent.SpotterRequestNumber = Cambro.Web.Helpers.StripHtml(SpotterRequestNumber.Text).Truncate(100); } else { CurrentEvent.SpotterRequestName = ""; CurrentEvent.SpotterRequestNumber = ""; } if (EventCapacity.Text.Length > 0) CurrentEvent.Capacity = int.Parse(EventCapacity.Text); if (CurrentEvent.AdminNote.Length > 0) CurrentEvent.AdminNote += "\n"; CurrentEvent.AdminNote += "Event modified by " + Usr.Current.NickName + " (K=" + Usr.Current.K.ToString() + ") " + DateTime.Now.ToString(); if (Usr.Current.IsSuper) { CurrentEvent.IsNew = false; CurrentEvent.IsEdited = false; } else { CurrentEvent.IsEdited = true; CurrentEvent.ModeratorUsrK = Usr.GetEventModeratorUsrK(); } CurrentEvent.Update(); if (CanEditDateVenue) { Venue v = this.PanelDetailsVenuePicker.Venue; if (v!= null && CurrentEvent.VenueK != v.K) { changedVenue = true; CurrentEvent.ChangeVenue(v.K, false); } } if (changedDate || changedVenue) { CurrentEvent.UpdateUrlFragment(false); Utilities.UpdateChildUrlFragmentsJob job = new Utilities.UpdateChildUrlFragmentsJob(Model.Entities.ObjectType.Event, CurrentEvent.K, true); job.ExecuteAsynchronously(); } foreach (int ob in MusicTypesUc.SelectedMusicTypes) { MusicType mt = new MusicType(ob); try { EventMusicType emt = new EventMusicType(CurrentEvent.K, mt.K); } catch { EventMusicType emt = new EventMusicType(); emt.EventK = CurrentEvent.K; emt.MusicTypeK = mt.K; emt.Update(); } } CurrentEvent.MusicTypes = null; foreach (EventMusicType emt in CurrentEvent.EventMusicTypes) { if (!MusicTypesUc.SelectedMusicTypes.Contains(emt.MusicTypeK)) { emt.Delete(); emt.Update(); } } CurrentEvent.UpdateMusicTypesString(null); } if (IsNew || IsEdit) { if (!duplicate) { //Update brands... ArrayList selectedBrands = new ArrayList(); ArrayList eventBrands = new ArrayList(); ArrayList allBrandKs = new ArrayList(); ArrayList allBrands = new ArrayList(); foreach (var kvp in uiBrandsMultiSelector.Selections) { try { Brand b = new Brand(int.Parse(kvp.Value)); selectedBrands.Add(b.K); if (!allBrandKs.Contains(b.K)) { allBrandKs.Add(b.K); allBrands.Add(b); } } catch { } } foreach (Brand b in CurrentEvent.Brands) { eventBrands.Add(b.K); if (!selectedBrands.Contains(b.K)) CurrentEvent.AssignBrand(b.K, false, null); } foreach (int i in selectedBrands) { if (!eventBrands.Contains(i)) CurrentEvent.AssignBrand(i, true, null); } foreach (Brand b in allBrands) { b.UpdateTotalComments(null); } } } }
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 AssignBrand(int BrandK, bool Add, Transaction transaction) { try { EventBrand eb = new EventBrand(this.K, BrandK); if (!Add) { eb.Delete(transaction); } } catch { if (Add) { Brand b = new Brand(BrandK); EventBrand eb = new EventBrand(); eb.EventK = this.K; eb.BrandK = b.K; eb.Update(transaction); } } }
public string GroupAdminHtml(string action, Brand brand, Group group) { try { GroupUsr gu = null; if (GroupUsrHashtable.ContainsKey(group.K)) gu = (GroupUsr)GroupUsrHashtable[group.K]; else { gu = Usr.Current.GetGroupUsr(group.K); GroupUsrHashtable[group.K] = gu; } bool on = Usr.Current.CanGroupOwner(gu); bool tick = false; switch (action) { case "Location": tick = group.CountryK > 0; break; case "MusicType": tick = group.MusicTypeK > 0; break; case "Details": tick = group.LongDescriptionHtml.Length > 0; break; default: break; } string attributes = ""; if (on) { switch (action) { case "Location": attributes = "href=\"" + group.UrlApp("edit", "mode", "location", "promoterk", CurrentPromoter.K.ToString()) + "\""; break; case "MusicType": attributes = "href=\"" + group.UrlApp("edit", "mode", "musictype", "promoterk", CurrentPromoter.K.ToString()) + "\""; break; case "Details": attributes = "href=\"" + group.UrlApp("edit", "mode", "details", "promoterk", CurrentPromoter.K.ToString()) + "\""; break; default: break; } } else { attributes = "href=\"\" onclick=\"alert('You do not have permission to alter this.\\nPlease contact "; if (CurrentPromoter.PrimaryUsr != null) attributes += CurrentPromoter.PrimaryUsr.NickName + " and ask " + CurrentPromoter.PrimaryUsr.HimString(false); else attributes += CurrentPromoter.ContactName + " and ask them"; attributes += " to make you an owner of the " + brand.UrlName + " regulars group.');return false;\""; } return "<a " + attributes + "><img src=\"" + (tick ? "/gfx/icon-tick.png" : "/gfx/icon-cross.png") + "\" border=\"0\" height=\"21\" width=\"26\" align=\"absmiddle\">change</a>"; } catch { return "[Error]"; } }
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 } }
public static Q ThreadsQGroup(Brand b) { return new Q(Thread.Columns.GroupK, b.GroupK); }
protected void AddBrandEventsToEvents(object o, EventArgs e) { if (!string.IsNullOrEmpty(uiBrand.Value)) { Brand b = new Brand(int.Parse(uiBrand.Value)); foreach (var ev in b.Events) { AddEvent(ev.VerboseInfo, ev.K); } } }
private static Query GetEventsQuery(Brand brand, DateTime fromDate, DateTime toDate) { Query query = GetEventsQuery(fromDate, toDate); query.TableElement = Event.EventBrandJoin; query.QueryCondition = new And(query.QueryCondition, new Q(EventBrand.Columns.BrandK, brand.K)); return query; }
public static EventSet GetUpcomingEvents(Brand brand) { Query upcomingEventsQuery = Event.GetUpcomingEventsQuery(); upcomingEventsQuery.QueryCondition = new And(upcomingEventsQuery.QueryCondition, new Q(EventBrand.Columns.BrandK, brand.K)); upcomingEventsQuery.TableElement = Event.EventBrandJoin; return new EventSet(upcomingEventsQuery); }
public static EventSet GetEvents(Brand brand, DateTime from, DateTime to) { Query eventsQuery = GetEventsQuery(brand, from, to); return new EventSet(eventsQuery); }
public static EventSet GetEventsWithTickets(Brand brand, DateTime from, DateTime to) { Query upcomingEventsWithTicketsQuery = GetEventsWithTicketsQuery(brand.Promoter, from, to); upcomingEventsWithTicketsQuery.QueryCondition = new And(upcomingEventsWithTicketsQuery.QueryCondition, new Q(EventBrand.Columns.BrandK, brand.K)); upcomingEventsWithTicketsQuery.TableElement = new Join(upcomingEventsWithTicketsQuery.TableElement, EventBrand.Columns.EventK, Event.Columns.K); return new EventSet(upcomingEventsWithTicketsQuery); }
public static EventSet GetUpcomingEventsWithTickets(Brand brand) { return GetEventsWithTickets(brand, Time.Today, new DateTime(2099, 1, 1)); }
public bool CanEdit(Brand b) { if (this.IsSuper) return true; else if (this.K == b.OwnerUsrK && b.DateTimeCreated > DateTime.Now.AddMonths(-1)) return true; else if (this.IsEnabledPromoterOfConfirmedBrand(b)) return true; else return false; }
public void MergeAndDelete(Brand merge) { if (this.K == merge.K) throw new DsiUserFriendlyException("Can't merge brand into itself!"); Cambro.Web.Helpers.WriteAlertHeader(); Cambro.Web.Helpers.WriteAlert("Starting brand merge...", true); Cambro.Web.Helpers.WriteAlert("Merging promoter...", true); if (merge.PromoterK > 0 && merge.PromoterStatus.Equals(PromoterStatusEnum.Confirmed) && merge.Promoter.IsEnabled) { this.PromoterK = merge.PromoterK; this.PromoterStatus = 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..."); Cambro.Web.Helpers.WriteAlert("Merging events...", true); EventBrandSet ebs = new EventBrandSet(new Query(new Q(EventBrand.Columns.BrandK, merge.K))); foreach (EventBrand eb in ebs) { Cambro.Web.Helpers.WriteAlert("Merging event " + eb.EventK + "..."); eb.Event.AssignBrand(this.K, true, null); } Cambro.Web.Helpers.WriteAlert("Done merging events..."); Cambro.Web.Helpers.WriteAlert("Merging competitions...", true); Update uComp = new Update(); uComp.Table = TablesEnum.Comp; uComp.Where = new Q(Comp.Columns.BrandK, merge.K); uComp.Changes.Add(new Assign(Comp.Columns.BrandK, this.K)); uComp.Run(); Cambro.Web.Helpers.WriteAlert("Done merging competitions..."); if (merge.HasPic && !this.HasPic) { Cambro.Web.Helpers.WriteAlert("Copying picture...", true); try { Utilities.CopyPic(merge, this); } catch { Cambro.Web.Helpers.WriteAlert("Exception while copying picture...", true); } Cambro.Web.Helpers.WriteAlert("Done copying picture...", true); } this.Update(null); Cambro.Web.Helpers.WriteAlert("*** Merging group...", true); try { this.Group.MergeAndDelete(merge.Group); Cambro.Web.Helpers.WriteAlert("*** Done group merge...", true); } catch { Cambro.Web.Helpers.WriteAlert("*** Exception merging group...", true); } Cambro.Web.Helpers.WriteAlert("Deleting old brand...", true); merge.DeleteAll(null); Cambro.Web.Helpers.WriteAlert("Done deleting old brand..."); Cambro.Web.Helpers.WriteAlert("Updating stats...", true); this.CreateUniqueUrlName(true); this.UpdateTotalComments(null); Cambro.Web.Helpers.WriteAlert("Done updating stats..."); Cambro.Web.Helpers.WriteAlert("Done merging brands!", true); }
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 Q ThreadsQEvents(Brand b) { return new Q(EventBrand.Columns.BrandK, b.K); }
private void Page_Load(object sender, System.EventArgs e) { Usr.KickUserIfNotLoggedIn(); this.PanelDateLoad(sender, e); this.PanelConflictLoad(sender, e); this.PanelDetailsLoad(sender, e); this.PanelMusicTypesLoad(sender, e); this.PanelPicLoad(sender, e); int i = uiBrandsMultiSelector.Count;//need this to persist the brands? (Bug) if (!Page.IsPostBack) { #region Select initial panel if (IsNew) ChangePanel(PanelDate); else if (IsEdit) { if (Usr.Current.CanEdit(CurrentEvent)) { if (ContainerPage.Url["Page"].Equals("Pic")) { ChangePanel(PanelPic); PanelPicLoad(null, null); PanelPicBind(); } else if (ContainerPage.Url["Page"].Equals("Details")) ChangePanel(PanelDetails); else if (ContainerPage.Url["Page"].Equals("MusicType")) ChangePanel(PanelMusicTypes); else if (ContainerPage.Url["Page"].Equals("Date")) ChangePanel(PanelDate); else if (CanEditDateVenue) ChangePanel(PanelDate); else ChangePanel(PanelDetails); } else ChangePanel(PanelEditError); } else { ChangePanel(PanelSelectionError); } #endregion } if (IsEdit) { HeaderH1.InnerText = "Edit event - " + CurrentEvent.Name; ContainerPage.SetPageTitle("Edit event - " + CurrentEvent.Name); } else { HeaderH1.InnerText = "Add event"; ContainerPage.SetPageTitle("Add event"); } if (Request.Form["__EVENTTARGET"] != null && Request.Form["__EVENTTARGET"].Equals("PanelBrandDbComboNewBrandPostback")) { Brand newBrand = new Brand(int.Parse(Request.Form["__EVENTARGUMENT"])); uiBrandsMultiSelector.Add(newBrand.Name, newBrand.K.ToString()); } this.DataBind(); }
public string BrandAdminHtml(string action, Brand brand) { bool on = Usr.Current.CanEdit(brand); string attributes = "href=\"\" onclick=\"alert('You do not have permission to alter this.\\nPlease confirm your brand by following the instructions or calling us on 0207 835 5599.');return false;\""; if (action.Equals("Name")) { if (on) attributes = "href=\"" + brand.UrlApp("edit", "promoterk", CurrentPromoter.K.ToString()) + "\""; return "<div style=\"padding-top:5px;\"><a " + attributes + ">change</a></div>"; } else if (action.Equals("Picture")) { if (on) attributes = "href=\"" + brand.UrlApp("edit","page","pic","promoterk",CurrentPromoter.K.ToString()) + "\""; return "<a " + attributes + "><img src=\"" + (brand.HasPic ? "/gfx/icon-tick.png" : "/gfx/icon-cross.png") + "\" border=\"0\" height=\"21\" width=\"26\" align=\"absmiddle\">change</a>"; } else return ""; }
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 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 PicUploadDefaultSelect(object o, DataListCommandEventArgs e) { Brand b = new Brand(int.Parse(e.CommandArgument.ToString())); if (b.HasPic) { bool hasOldPic = CurrentEvent.HasPic; Guid oldPic = CurrentEvent.HasPic ? CurrentEvent.Pic : Guid.Empty; CurrentEvent.Pic = Guid.NewGuid(); Storage.AddToStore( Storage.GetFromStore(Storage.Stores.Pix, b.Pic, "jpg"), Storage.Stores.Pix, CurrentEvent.Pic, "jpg", CurrentEvent, "Pic"); CurrentEvent.Update(); if (hasOldPic) Storage.RemoveFromStore(Storage.Stores.Pix, oldPic, "jpg"); SavedRedirect(); } }
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"); } } }
public void ManageGotoClick(object o, System.EventArgs e) { if (!Usr.Current.IsSuper) throw new Exception("Only super admin!"); Brand gotoTarget = new Brand(int.Parse(this.uiManageGotoAutoComplete.Value)); Response.Redirect(gotoTarget.Url()); }