コード例 #1
0
ファイル: SessionInfo.cs プロジェクト: gdlprj/duscusys
        public static SessionInfo Get()
        {
            if (_inst == null)
                _inst = new SessionInfo();

            return _inst;
        }
コード例 #2
0
ファイル: DaoUtils.cs プロジェクト: z-saffarpour/duscusys
        public static ArgPoint clonePoint(DiscCtx ctx, ArgPoint ap, Topic topic, Person owner, String name)
        {
            var top = ctx.Topic.FirstOrDefault(t0 => t0.Id == topic.Id);

            if (top == null)
            {
                return(null);
            }

            var ownPoints = top.ArgPoint.Where(p0 => p0.Person.Id == owner.Id);
            int orderNr   = 1;

            foreach (var pt in ownPoints)
            {
                if (pt.OrderNumber > orderNr)
                {
                    orderNr = pt.OrderNumber;
                }
            }

            var pointCopy = DaoUtils.NewPoint(top, orderNr + 1);

            pointCopy.Point            = name;
            pointCopy.Description.Text = ap.Description.Text;

            foreach (var src in ap.Description.Source)
            {
                var newSrc = new Source {
                    Text = src.Text
                };
                pointCopy.Description.Source.Add(newSrc);
            }

            foreach (var cmt in ap.Comment)
            {
                if (cmt.Person == null)
                {
                    continue;
                }

                var comment = new Comment();
                comment.Text = cmt.Text;
                var commentPersonId = cmt.Person.Id;
                comment.Person = ctx.Person.FirstOrDefault(p0 => p0.Id == commentPersonId);
                pointCopy.Comment.Add(comment);
            }

            var ownId = SessionInfo.Get().person.Id;
            var self  = ctx.Person.FirstOrDefault(p0 => p0.Id == ownId);

            foreach (var media in ap.Attachment)
            {
                var attach = new Attachment();
                attach.ArgPoint      = pointCopy;
                attach.Format        = media.Format;
                attach.Link          = media.Link;
                attach.Name          = media.Name;
                attach.Title         = media.Title;
                attach.VideoEmbedURL = media.VideoEmbedURL;
                attach.VideoLinkURL  = media.VideoLinkURL;
                attach.VideoThumbURL = media.VideoThumbURL;
                attach.OrderNumber   = media.OrderNumber;

                if (media.Thumb != null)
                {
                    attach.Thumb = (byte[])media.Thumb.Clone();
                }

                if (media.MediaData != null && media.MediaData.Data != null)
                {
                    var mediaClone = new MediaData();
                    mediaClone.Data  = (byte[])media.MediaData.Data.Clone();
                    attach.MediaData = mediaClone;
                }

                attach.Person = self;
            }

            pointCopy.Person = self;

            pointCopy.Topic = top;

            return(pointCopy);
        }
コード例 #3
0
        public static void startResultViewer()
        {
            if (SessionInfo.Get().discussion == null)
            {
                MessageDlg.Show("No default discussion");
            }
            else
            {
                if (SessionInfo.Get().person.Session == null)
                {
                    MessageDlg.Show(
                        string.Format(
                            "The function requires experimental mode (session)!",
                            SessionInfo.Get().person.Name));
                    return;
                }
                var tsd = new TopicSelectionDlg(SessionInfo.Get().discussion);
                tsd.ShowDialog();
                if (tsd.topic == null)
                {
                    return;
                }

                if (tsd.Html)
                {
                    var reportUrl = string.Format(
                        "http://{0}/discsvc/report?discussionId={1}&topicId={2}&sessionId={3}",
                        ConfigManager.ServiceServer,
                        SessionInfo.Get().discussion.Id,
                        tsd.topic.Id,
                        SessionInfo.Get().person.Session.Id);

                    try
                    {
                        System.Diagnostics.Process.Start("chrome", reportUrl);
                    }
                    catch
                    {
                        System.Diagnostics.Process.Start(reportUrl);
                    }
                    //var browser = WebkitBrowserWindow.Instance(reportUrl, tsd.topic.Id);
                    //browser.Show();
                    //browser.Activate();
                }
                else
                {
                    BusyWndSingleton.Show("Exporting, please wait...");
                    try
                    {
                        (new PdfReportDriver()).Run(SessionInfo.Get().person.Session,
                                                    tsd.topic,
                                                    SessionInfo.Get().discussion,
                                                    SessionInfo.Get().person);
                    }
                    finally
                    {
                        BusyWndSingleton.Hide();
                    }
                }
            }
        }