示例#1
0
        public override void OsbideSolutionDownloaded(object sender, SolutionDownloadedEventArgs e)
        {
            base.OsbideSolutionDownloaded(sender, e);
            SolutionDownloadEvent download = new SolutionDownloadEvent()
            {
                AssignmentId      = e.DownloadedSubmission.AssignmentId,
                AuthorId          = e.DownloadedSubmission.EventLog.SenderId,
                DownloadingUserId = e.DownloadingUser.Id,
                SolutionName      = e.DownloadedSubmission.SolutionName
            };

            //let others know that we have a new event
            NotifyEventCreated(this, new EventCreatedArgs(download));
        }
        IOsbideEvent IOsbideEvent.FromDict(Dictionary <string, object> values)
        {
            SolutionDownloadEvent evt = new SolutionDownloadEvent();

            if (values.ContainsKey("Id"))
            {
                evt.Id = (int)values["Id"];
            }
            if (values.ContainsKey("EventLogId"))
            {
                evt.EventLogId = (int)values["EventLogId"];
            }
            if (values.ContainsKey("EventLog"))
            {
                evt.EventLog = (EventLog)values["EventLog"];
            }
            if (values.ContainsKey("EventDate"))
            {
                evt.EventDate = (DateTime)values["EventDate"];
            }
            if (values.ContainsKey("SolutionName"))
            {
                evt.SolutionName = values["SolutionName"].ToString();
            }
            if (values.ContainsKey("AssignmentName"))
            {
                evt.AssignmentId = (int)values["AssignmentId"];
            }
            if (values.ContainsKey("DownloadingUserId"))
            {
                evt.DownloadingUserId = (int)values["DownloadingUserId"];
            }
            if (values.ContainsKey("AuthorId"))
            {
                evt.AuthorId = (int)values["AuthorId"];
            }
            return(evt);
        }