Пример #1
0
 public static MvcHtmlString ResultsLink(this HtmlHelper html, Document doc, ResultFormat format)
 {
     var shortName = format.GetExtension().Substring(1).ToUpperInvariant();	//Remove .
     return html.ActionLink(
         linkText: " ",
         //linkText: "Download " + shortName,
         actionName: "Results",
         routeValues: new { controller = "Documents", format, id = doc.Id.DocumentId, name = doc.Name + format.GetExtension() },
         htmlAttributes: new {
             target = "DocumentPreview",
             @class = "DownloadIcon Sprite16 " + shortName,
             title = "Download OCR results as a " + shortName + " file"
         }
     );
 }
Пример #2
0
        static object GetJsonObject(Document doc)
        {
            if (doc.State == DocumentState.Scanned)
                return new {
                    id = doc.Id.DocumentId,
                    state = "Scanned",

                    formats = doc.ResultFormats.Select(f => new { name = f.ToString(), extension = f.GetExtension() }).ToArray(),

                    name = doc.Name,
                    extension = MimeTypes.GetExtension(doc.MimeType),
                    size = doc.Length,
                    date = doc.DateUploaded
                };
            else
                return new {
                    id = doc.Id.DocumentId,
                    state = doc.State.ToString(),
                    progress = doc.ScanProgress,
                    progressCaption = GetBarCaption(doc.State, doc.ScanProgress),

                    name = doc.Name,
                    extension = MimeTypes.GetExtension(doc.MimeType),
                    size = doc.Length,
                    date = doc.DateUploaded
                };
        }