Exemplo n.º 1
0
        protected void SendEmail(object sender, EventArgs e)
        {
            Node n = new Node(int.Parse(base.Request.QueryString["id"]));
            if (((n.NodeTypeAlias == "Event") && ((int.Parse(n.GetProperty("owner").Value) == this.m.Id) || (this.m.Id == 0x4ae))) && (this.MaxNumberOfEmails > this.EmailsSent(n)))
            {
                Event event2 = new Event(n.Id);
                List<Member> list = new List<Member>();
                string selectedValue = this.rbl_receivers.SelectedValue;
                if (selectedValue != null)
                {
                    if (!(selectedValue == "coming"))
                    {
                        if (selectedValue == "waiting")
                        {
                            list.AddRange(RelationToMember(EventRelation.GetPeopleWaiting(n.Id, event2.OnWaitingList)));
                        }
                        else if (selectedValue == "both")
                        {
                            list.AddRange(RelationToMember(EventRelation.GetPeopleSignedUpLast(n.Id, event2.SignedUp)));
                            list.AddRange(RelationToMember(EventRelation.GetPeopleWaiting(n.Id, event2.OnWaitingList)));
                        }
                    }
                    else
                    {
                        list.AddRange(RelationToMember(EventRelation.GetPeopleSignedUpLast(n.Id, event2.SignedUp)));
                    }
                }

                MailMessage message = new MailMessage();
                string str = "<p>\r\n You receive this email because you have signed up \r\n                                            for an event on the umbraco community site http://our.umbraco.org</p>\r\n\r\n                                            <p>You can view the event page \r\n                                            <a href='http://our.umbraco.org" + library.NiceUrl(n.Id) + "'>here</a></p>";
                message.Subject = this.tb_subject.Text;
                message.Body = this.tb_body.Text + str;
                message.From = new MailAddress("*****@*****.**", "Our Umbraco - Events");
                message.ReplyToList.Add(new MailAddress(this.m.Email));
                message.IsBodyHtml = true;
                foreach (Member member in list)
                {
                    try
                    {
                        message.Bcc.Add(new MailAddress(member.Email, member.Text));
                    }
                    catch
                    {
                    }
                }
                new SmtpClient().Send(message);
                Document document = Document.MakeNew(this.tb_subject.Text, DocumentType.GetByAlias("EventNews"), new User(0), n.Id);
                document.getProperty("bodyText").Value = this.tb_body.Text;
                document.getProperty("subject").Value = this.tb_subject.Text;
                document.getProperty("sender").Value = this.m.Id;
                document.Publish(new User(0));
                library.UpdateDocumentCache(document.Id);
                document.Save();
                base.Response.Redirect(n.NiceUrl);
            }
        }
Exemplo n.º 2
0
 public static bool isFull(int eventId)
 {
     Event e = new Event(eventId);
     return e.IsFull;
 }
Exemplo n.º 3
0
 public static void SignUp(int memberId, int eventId)
 {
     Event e = new Event(eventId);
     e.SignUp(memberId, "no comment");
 }
Exemplo n.º 4
0
 public static void Cancel(int memberId, int eventId)
 {
     Event e = new Event(eventId);
     e.Cancel(memberId, "no comment");
 }
Exemplo n.º 5
0
        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";
        }
Exemplo n.º 6
0
 public string Sync(int eventId)
 {
     var umbracoEvent = new Event(eventId);
     umbracoEvent.syncCapacity();
     return "true";
 }
Exemplo n.º 7
0
        public string SignUp(int eventId)
        {
            var currentMemberId = Members.GetCurrentMember().Id;

            if (currentMemberId > 0)
            {
                var umbracoEvent = new Event(eventId);
                umbracoEvent.SignUp(currentMemberId, "no comment");
            }

            return "true";
        }
Exemplo n.º 8
0
        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);
        }