示例#1
0
        public void Fill(IDataReader dr) {
            JournalId = Null.SetNullInteger(dr["JournalId"]);
            JournalTypeId = Null.SetNullInteger(dr["JournalTypeId"]);
            PortalId = Null.SetNullInteger(dr["PortalId"]);
            UserId = Null.SetNullInteger(dr["UserId"]);
            ProfileId = Null.SetNullInteger(dr["ProfileId"]);
            SocialGroupId = Null.SetNullInteger(dr["GroupId"]);
            if (!String.IsNullOrEmpty(Null.SetNullString(dr["JournalXML"]))) {
                JournalXML = new XmlDocument();
                JournalXML.LoadXml(dr["JournalXML"].ToString());
                XmlNode xRoot = JournalXML.DocumentElement;
                XmlNode xNode = xRoot.SelectSingleNode("//items/item/body");
                if (xNode != null) {
                    Body = xNode.InnerText;
                }
            }
            DateCreated = Null.SetNullDateTime(dr["DateCreated"]);
            DateUpdated = Null.SetNullDateTime(dr["DateUpdated"]);
            ObjectKey = Null.SetNullString(dr["ObjectKey"]);
            AccessKey = Null.SetNullGuid(dr["AccessKey"]);
            Title = Null.SetNullString(dr["Title"]);
            Summary = Null.SetNullString(dr["Summary"]);
            string itemd = Null.SetNullString(dr["ItemData"]);
            ItemData = new ItemData();
            if (!string.IsNullOrEmpty(itemd)) {
                ItemData = itemd.FromJson<ItemData>();
            }
            ContentItemId = Null.SetNullInteger(dr["ContentItemId"]);
            JournalAuthor = new JournalEntity(dr["JournalAuthor"].ToString());
            JournalOwner = new JournalEntity(dr["JournalOwner"].ToString());
            JournalType = Null.SetNullString(dr["JournalType"]);

            IsDeleted = Null.SetNullBoolean(dr["IsDeleted"]);
            CommentsDisabled = Null.SetNullBoolean(dr["CommentsDisabled"]);
            CommentsHidden = Null.SetNullBoolean(dr["CommentsHidden"]);
        }
        public void AddAnnouncementToJournal(AnnouncementInfo announcement, int tabId, String journalType)
        {

            var objJournalType = JournalController.Instance.GetJournalType(journalType);

            var journalItem = new JournalItem
            {
                PortalId = announcement.PortalID,
                ProfileId = announcement.LastModifiedByUserID,
                UserId = announcement.LastModifiedByUserID,
                ContentItemId = announcement.ContentItemID,
                Title = announcement.Title
            };
            var data = new ItemData
            {
                Url = announcement.Permalink()
            };
            journalItem.ItemData = data;
            journalItem.Summary = HtmlUtils.Shorten(HtmlUtils.Clean(System.Web.HttpUtility.HtmlDecode(announcement.Description), false), 250, "...");
            journalItem.Body = announcement.Description;
            journalItem.JournalTypeId = objJournalType.JournalTypeId;
            journalItem.SecuritySet = "E,";

            JournalController.Instance.SaveJournalItem(journalItem, tabId);

        }