Exemple #1
0
        public ActionResult UploadScanVersion(Guid originalID, Guid documentID, HttpPostedFileBase file)
        {
            if (file != null)
            {
                ScansRepository scanRepo    = new ScansRepository();
                Scan            visibleScan = scanRepo.GetScan(originalID);

                //jeœli skan jest dodany do dokumentu podczas tej edycji, to nie mam jeszcze przypisanego ID dokumentu
                if (!visibleScan.DocumentID.HasValue)
                {
                    _repository.SetDocumentScan(visibleScan.ScanID, documentID);
                    _repository.SubmitChanges();
                }

                if (visibleScan.OriginalScanID.HasValue)
                {
                    originalID = visibleScan.OriginalScanID.Value;
                }

                ScanBrowser browser = ScanBrowserFactory.Create();
                byte[]      content = new byte[file.ContentLength];
                file.InputStream.Read(content, 0, file.ContentLength);
                ScanInfo info = browser.GetScanFromFile(content, file.FileName);
                try
                {
                    _repository.AddScanVersion(originalID, info.FileName, info.MimeType, info.Scan, info.ScanPreview ?? new byte[0], "image/png", info.ScanZoom ?? new byte[0], AppContext.GetCID());
                }
                catch { }
            }

            return(RedirectToAction("Edit", new { documentID = documentID }));// (result);
        }
Exemple #2
0
        public ActionResult AddScanVersion(Guid originalScanId, Guid versionScanId, Guid documentId)
        {
            try
            {
                DocumentRepository docRepository = new DocumentRepository();
                docRepository.AddScanVersion(originalScanId, versionScanId, documentId);
                docRepository.SubmitChanges();
            }
            catch
            {
            }

            return(new EmptyResult());//RedirectToAction("Edit", "Documents", new { documentId = documentId });
        }