示例#1
0
        public MailSender(Event e, Person p)
        {
            Event = e;
            EventPersons = Event.Persons.Select(x => x.Person);
            //_attachments = new List<LinkedResource>();
            //foreach (var person in EventPersons)
            //{
            //    if (person.Image != null)
            //    {
            //        var ms = new MemoryStream(person.Image);
            //        var resource = new LinkedResource(ms, "image/png") { ContentId = person.ExternalID.ToString() };
            //        _attachments.Add(resource);

            //    }
            //}
            Wallposts = Event.Wallposts.OrderByDescending(x => x.Date);
            EventTriggerPerson = p;
        }
示例#2
0
 internal string SmaLink(Person p, Event ev, bool use)
 {
     if (!use)
         return string.Empty;
     return
         "<table style='width:100%; background-color: #18cef2; margin-top:30px' cellspaing='0' cellpadding='0' border='0'>" +
         "<tr>" +
         "<td>" +
         "<a href='http://www.signmiapp.com/account/index/" + p.ExternalID + "?eventid=" +
         (ev != null ? ev.ExternalID.ToString() : "") +
         "' style='display: block; padding: 20px 10px;font-size: 20px;'>" +
         "<table style='width:100%' cellpadding='0' cellspacing='0' border='0'><tr>" +
         "<td style='color:#ffffff'>" +
         "To signmiapp.com" +
         "</td>" +
         "<td align='right'>" +
         "<img src='http://static.signmiapp.com/images/right-arrow.png' alt='right arrow' style='border:0' />" +
         "</td>" +
         "</tr></table>" +
         "</a>" +
         "</td>" +
         "</tr>" +
         "</table>";
 }
示例#3
0
 internal string GetWhenWhereTable(Event ev, bool use)
 {
     if (!use)
         return string.Empty;
     var body = "<table border='0' style='padding:10px'><tr>";
     body += "<td><strong>Where ?:</strong></td><td>" + ev.Place + "</td>";
     body += "</tr><tr>";
     body += "<td><strong>When ?:</strong></td><td>" + ev.Date.ToLongDateString().Replace("den ", "") + " at " + ev.Date.ToShortTimeString() + "</td>";
     body += "</tr></table>";
     return body;
 }
示例#4
0
        public string SmaAttending(IEnumerable<Person> persons, Person p, bool use, IEnumerable<Person> personPersons, Event ev)
        {
            var html = string.Empty;
            if (!use)
                return html;
            var ps = persons.Where(x => x.Events.Any(y => y.EventID == ev.ID)).ToList();
            var personsPersonList = personPersons.ToList();
            foreach (var attending in Enums.GetEnumToList<Enums.Attending>().OrderByDescending(x => x.ToString()))
            {
                if (
                    !ps.Any(
                        x => x.Events.Any(y => (Enums.Attending)y.Attending == attending && y.EventID == ev.ID)))
                    continue;
                var attendings = ps.Where(x => x.Events.Any(y => (Enums.Attending)y.Attending == attending && y.EventID == ev.ID)).ToList();
                html += "<tr>" +
                            "<td style='padding: 10px'>" +
                                "<table border='0' cellpadding='0' cellspacing='0'>" +
                                    "<tr>" +
                                        "<td>" +
                                            "<img src='http://static.signmiapp.com/images/" + attending + "@2x.png' alt='" + attending + "' />" +
                                        "</td>" +
                                        "<td style='padding-left: 15px; color: #ffffff'>" +
                                            attending +
                                        "</td>" +
                                    "</tr>" +
                                "</table>" +
                            "</td>" +
                       "</tr>";
                html += "<tr>" +
                            "<td style='padding:5px'>";

                foreach (var person in attendings)
                {
                    html += "<table style='width: 100%; margin-bottom: 1px; background-color: #000000;' border='0' cellpadding='0' cellspacing='0'>" +
                            "<tr>" +
                                "<td style='vertical-align: top; padding: 5px; width: 60px'>" +
                                    "<img src='" + (person.ImageID != null ? "http://api.signmiapp.com/images/" + person.ImageID + ".png" : "http://static.signmiapp.com/images/defaultboy.png") + "' style='width: 50px; height: 50px' />" +
                                "</td>" +
                                "<td style='vertical-align: central; padding: 10px; color: orange'>" +
                                    (personsPersonList.SingleOrDefault(x => x.ID == person.ID) ?? new Person { Name = person.Name }).Name +
                                "</td>" +
                            "</tr>" +
                        "</table>";
                }



                html += "</td>" +
                        "</tr>";
            }


            return html;
        }
示例#5
0
        private static ApiModels.Event BuildEvent(Event e, Person p)
        {


            var ev = e.Persons.FirstOrDefault(x => x.PersonID == p.ID) ?? new EventPerson { Attending = 0, Creator = true, Viewed = true };

            var theEvent = new ApiModels.Event
            {
                Creator = e.Persons.Any(x => x.PersonID == p.ID && x.Creator),
                Id = e.ExternalID,
                Name = e.Name,
                Place = e.Place,
                Date = e.Date.ToShortDateString() + " " +
                       e.Date.ToShortTimeString(),
                DayOfWeek = e.Date.DayOfWeek.ToString(),
                Status = e.Status,
                Viewed = ev.Viewed,
                UserAttendStatus = ev.Attending


            };
            if (theEvent.Id == Guid.Empty)
            {
                theEvent.Persons = p.Persons.Select(x => new ApiModels.Person
                {
                    Id = x.Person.ExternalID,
                    Name = x.Nickname,
                    ImageID = x.Person.ImageID
                    //Image = Convert.ToBase64String(x.Person.Image ?? new byte[0])
                }).OrderBy(x => x.Name);
            }
            else
            {
                var pp = p.Persons;

                theEvent.Persons = e.Persons.Select(y => new ApiModels.Person
                {
                    Id = y.Person.ExternalID,
                    Attending = y.Attending,
                    //Image = images ? Convert.ToBase64String(y.Person.Image ?? new byte[0]) : string.Empty,
                    ImageID = y.Person.ImageID,
                    Name =
                            pp.Any(x => x.ParentID == y.Person.ID)
                                ? pp.First(x => x.ParentID == y.Person.ID).Nickname
                                : y.Person.Name,

                });

                theEvent.Wallposts = e.Wallposts.OrderByDescending(x => x.Date).Select(x => new ApiModels.Wallpost
                {

                    Date = x.Date.ToShortDateString() + " " +
                            x.Date.ToShortTimeString(),
                    PersonId = x.Persons.First(y => y.Writer).Person.ExternalID,
                    Writer = pp.Any(q => q.ParentID == x.Persons.First(y => y.Writer).PersonID) ? pp.First(q => q.ParentID == x.Persons.First(y => y.Writer).PersonID).Nickname : x.Persons.First(y => y.Writer).Person.Name,
                    Message = x.Message,
                    ImageID = x.Persons.First(y => y.Writer).Person.ImageID,
                    Viewed = x.Persons.First(y => y.PersonID == p.ID).Viewed

                });

                //theEvent.Image = e.Wallposts.Any() ? Convert.ToBase64String(e.Wallposts.OrderByDescending(x => x.Date).First().Persons.Single(x=>x.Writer).Person.Image) : Convert.ToBase64String(e.Persons.Single(x=>x.Creator).Person.Image);
                theEvent.ImageID = e.Wallposts.Any() ? e.Wallposts.OrderByDescending(x => x.Date).First().Persons.Single(x => x.Writer).Person.ImageID : e.Persons.Single(x => x.Creator).Person.ImageID;

            }



            return theEvent;
        }