public string Cancel(int eventId) { var currentMemberId = Members.GetCurrentMember().Id; if (currentMemberId > 0) { var umbracoEvent = new Event(eventId); umbracoEvent.Cancel(currentMemberId, "no comment"); } return "true"; }
public string Toggle(int eventId) { var umbracoEvent = new Event(eventId); var currentMemberId = Members.GetCurrentMember().Id; if (currentMemberId > 0) { if (Relation.IsRelated(eventId, currentMemberId) == false) umbracoEvent.SignUp(currentMemberId, "no comment"); else umbracoEvent.Cancel(currentMemberId, "no comment"); } return "true"; }
protected void createEvent(object sender, EventArgs e) { var hasAnchors = false; var hasLowKarma = false; var karma = int.Parse(_member.getProperty("reputationTotal").Value.ToString()); if (karma < 50) { hasLowKarma = true; } var umbracoHelper = new UmbracoHelper(UmbracoContext.Current); var contentService = ApplicationContext.Current.Services.ContentService; IContent content; //edit? if (string.IsNullOrEmpty(Request.QueryString["id"]) == false) { content = contentService.GetById(int.Parse(Request.QueryString["id"])); var publishedContent = umbracoHelper.TypedContent(Request.QueryString["id"]); //allowed? if (publishedContent.DocumentTypeAlias == "Event" && publishedContent.GetPropertyValue<int>("owner") == _member.Id) { content = SetDescription(content, hasLowKarma, ref hasAnchors); content.Name = tb_name.Text; content.SetValue("venue", tb_venue.Text); content.SetValue("latitude", tb_lat.Value); content.SetValue("longitude", tb_lng.Value); content.SetValue("capacity", tb_capacity.Text); var startDate = GetProperDate(dp_startdate.Text); var endDate = GetProperDate(dp_enddate.Text); content.SetValue("start", startDate); content.SetValue("end", endDate); var sync = tb_capacity.Text != publishedContent.GetPropertyValue<string>("capacity"); contentService.SaveAndPublishWithStatus(content); if (sync) { var ev = new Event(publishedContent); ev.syncCapacity(); } } } else { content = contentService.CreateContent(tb_name.Text, EventsRoot, "Event"); content = SetDescription(content, hasLowKarma, ref hasAnchors); content.SetValue("venue", tb_venue.Text); content.SetValue("latitude", tb_lat.Value); content.SetValue("longitude", tb_lng.Value); content.SetValue("capacity", tb_capacity.Text); var startDate = GetProperDate(dp_startdate.Text); var endDate = GetProperDate(dp_enddate.Text); content.SetValue("start", startDate); content.SetValue("end", endDate); content.SetValue("owner", _member.Id); content.SetValue("signedup", 0); contentService.SaveAndPublishWithStatus(content); } var redirectUrl = umbraco.library.NiceUrl(content.Id); if (hasLowKarma && hasAnchors) SendPotentialSpamNotification(tb_name.Text, redirectUrl, _member.Id); Response.Redirect(redirectUrl); }
public static void Cancel(int memberId, int eventId) { Event e = new Event(eventId); e.Cancel(memberId, "no comment"); }
public static void SignUp(int memberId, int eventId) { Event e = new Event(eventId); e.SignUp(memberId, "no comment"); }
public static bool isFull(int eventId) { Event e = new Event(eventId); return e.IsFull; }
public string Sync(int eventId) { var umbracoEvent = new Event(eventId); umbracoEvent.syncCapacity(); return "true"; }