コード例 #1
0
        public ActionResult SaveDocument(string projectCode, int projectId, int issueId, string documentId)
        {
            if (NoSettings())
            {
                return(Redirect("~/configure"));
            }

            UserWidgetData <LucidChartUser> userData = GeminiContext.UserWidgetStore.Get <LucidChartUser>(CurrentUser.Entity.Id, Constants.AppId, Constants.ControlId);

            if (userData == null || userData.IsNew)
            {
                return(Authenticate(string.Empty, string.Empty, string.Format("apps/lucidchart/editdocument/{0}/{1}/{2}", projectCode, projectId, issueId)));
            }

            string name = new LucidChartsConsumer(UserContext.Url, userData.Value).GetDocumentDescription(documentId).Name;

            byte[] img = new LucidChartsConsumer(UserContext.Url, userData.Value).GetDocumentImage(documentId, 0, 500, false);

            byte[] thumb = new LucidChartsConsumer(UserContext.Url, userData.Value).GetDocumentImage(documentId, 0, 128, true);

            IssueWidgetData <List <LucidChartData> > data = GeminiContext.IssueWidgetStore.Get <List <LucidChartData> >(issueId, Constants.AppId, Constants.ControlId);

            if (data == null || data.IsNew)
            {
                data = new IssueWidgetData <List <LucidChartData> >();

                data.IssueId = issueId;

                data.AppId = Constants.AppId;

                data.ControlId = Constants.ControlId;

                data.Value = new List <LucidChartData>();
            }

            LucidChartData doc = data.Value.Find(d => string.Compare(d.DocumentId, documentId, true) == 0);

            if (doc == null)
            {
                data.Value.Add(new LucidChartData()
                {
                    DocumentId = documentId, Image = img, ThumnailImage = thumb, DocumentName = name
                });
            }
            else
            {
                doc.DocumentName = name;

                doc.Image = img;

                doc.ThumnailImage = thumb;
            }

            GeminiContext.IssueWidgetStore.Save <List <LucidChartData> >(data.IssueId, data.AppId, data.ControlId, data.Value);

            string redirectURL = Countersoft.Gemini.Infrastructure.Helpers.NavigationHelper.GetIssuePageUrl(projectId, projectCode, issueId, UserContext.Card.Id, UserContext.Url);

            return(Redirect(redirectURL));
        }
コード例 #2
0
        public ActionResult Image(string appid, string controlid, int issueid, string documentid)
        {
            IssueWidgetData <List <LucidChartData> > data = GeminiContext.IssueWidgetStore.Get <List <LucidChartData> >(issueid, appid, controlid);

            LucidChartData image = data.Value.Find(d => string.Compare(d.DocumentId, documentid, true) == 0);

            return(File(image == null ? new byte[0] : image.Image, "image/png"));
        }