Esempio n. 1
0
        public virtual List<TimelineItem> ToTimelineItems()
        {
            var ret = new List<TimelineItem>();

            var item = new TimelineItem
            {
                id = Id,
                start = CompletedDate ?? DueDate,
                group = "Tasks",
                channel = TimelineItem.Channel.Operational,
                classes = new List<string> { "task"},
                title = Title,
                content = Description,
                itemlink = "itemlink-" + (ParentItemId ?? Id),
                datatype = "Task"
            };

            if (CompletedDate == null)
            {
                item.classes.Add(DueDate <= DateTime.Now ? "overdue" : "due");
            }
            else
            {
                item.classes.Add("completed");
                if (CompletedDate > DueDate)
                {
                    item.classes.Add("late");
                }
            }
            ret.Add(item);

            return ret;
        }
Esempio n. 2
0
        public List<TimelineItem> ToTimelineItems()
        {
            var ret = new List<TimelineItem>();

            var item = new TimelineItem
            {
                id = Id,
                start = Date,
                group = "Email",
                channel = TimelineItem.Channel.Social,
                classes = new List<string> { "email" },
                title = Subject,
                content = Body,  
                itemlink = "itemlink-" + Id, //TODO: Perhaps try to link to previous emails?
                datatype = "Email"
            };

            

            ret.Add(item);

            return ret;
        }
        protected string FormatItem(TimelineItem item)
        {
            //if (String.IsNullOrEmpty(culture)) culture = "en-gb";

            //get subject info if available. 
            var subjects = GetSubjects(item.id);
            var avatarstring = new StringBuilder();

            foreach (var subject in subjects.Where(s => s.SubjectId != Currentuser.Id))
            {
                avatarstring.Append(String.Format(AvatarImageString, ImageHelper.GetAvatarUrl(subject.SubjectAvatarId, 20),
                                                  subject.SubjectName)); 
            }

            return String.Format("<table style='text-align:left;width:100%;padding:5px; margin-top:5px;font-weight:normal;border-bottom:1px solid #CCCCCC; ' cellpadding='0' cellspacing='0'><tr>" +
                                    
                                    "<td style='font-family: Helvetica,Arial,sans-serif;font-size: 14px; color: #000; padding: 0; margin:0;'>" +
                                    "<a href='{0}/Show/{1}'><span style='text-decoration:none; font-weight:bold; color:#33b9ed;'>" +
                                    "{2} <img src='{0}/Images/icons/{4}.png' alt='{4}' border='0' />&nbsp;{3} " +
                                    "</span></a></td>" +
                                    "<td style='width:80px;padding:7px 0 0 0 ;margin:0;'>" + avatarstring + "&nbsp;</td>" +
                                    "</tr>" +
                                     "<tr>" +
                                     
                                     "<td colspan='2' style='font-family: Helvetica,Arial,sans-serif;font-size: 12px; color: #000; padding: 0; margin:0;'><span style='padding-left:100px;font-size:11px;'>{5}</span></td>" +
                                    "</tr>" +
                                     "</table>"

                                    , HostName, item.id, item.start.ToString(), item.title, item.datatype.ToLower(), item.content.Truncate(100)); 

        }