Example #1
0
        public static BIEvent CreateBiEvent(IDnaDataReader reader, ITheGuideSystem theGuideSys, IRiskModSystem riskModSys)
        {
            EventTypes et = (EventTypes)reader.GetInt32("EventType");
            
            BIEvent be = null;

            switch (et)
            {
                case EventTypes.ET_POSTNEEDSRISKASSESSMENT: be = new BIPostNeedsRiskAssessmentEvent(theGuideSys, riskModSys); break;
                case EventTypes.ET_POSTTOFORUM:             be = new BIPostToForumEvent(riskModSys); break;
                case EventTypes.ET_MODERATIONDECISION_POST: be = new BIPostModerationDecisionEvent(riskModSys); break;

                default: throw new InvalidOperationException("Event Type " + et.ToString() + " not supported");
            }

            be.SetProperties(reader);

            return be;
        }   
        public void RiskModSystem_When_Disabled_Check_RecordPostModerationDecision_Returns_False()
        {
            // Create with "Disabled" is true
            var rm = new RiskModSystem(null, true);

            var postModDecisionEvent = new BIPostModerationDecisionEvent(null);
            bool recModDec = rm.RecordPostModerationDecision(postModDecisionEvent);
            Assert.IsFalse(recModDec);
        }
Example #3
0
        public bool RecordPostModerationDecision(BIPostModerationDecisionEvent ev)
        {
            // When disabled, don't record this event
            if (Disabled)
                return false;

            DateTime startTime = DateTime.Now;

            using (IDnaDataReader reader = RiskModDataReaderCreator.CreateDnaDataReader("moderation"))
            {
                reader.AddParameter("EntryId", ev.ThreadEntryId);
                reader.AddParameter("isArticle", 0);
                reader.AddParameter("Status", ev.ModDecisionStatus);
                reader.AddParameter("isComplain", ev.IsComplaint);
                reader.AddParameter("DateStatusChanged", ev.EventDate);
                reader.Execute();
            }

            var props = new Dictionary<string, object>() 
            { 
                { "ThreadEntryId", ev.ThreadEntryId },
                { "Status",  ev.ModDecisionStatus },
                { "isComplaint", ev.IsComplaint},
                { "DateStatusChanged",ev.EventDate }
            };
            BIEventProcessor.BIEventLogger.Log(TraceEventType.Verbose, "RecordPostModerationDecision() end", startTime, props);

            return true;
        }