コード例 #1
0
        private void createListView(Type type)
        {
            Type[] documentTypes = Sinapse.Utils.GetTypesImplementingInterface(
                Assembly.GetAssembly(typeof(ISinapseDocument)), type);

            ListViewItem listViewItem;

            ListViewItem.ListViewSubItem subitem;

            foreach (Type documentType in documentTypes)
            {
                object[] attr = documentType.GetCustomAttributes(typeof(DocumentDescription), false);
                if (attr.Length > 0)
                {
                    DocumentDescription desc = attr[0] as DocumentDescription;
                    listViewItem          = new ListViewItem(desc.Name);
                    listViewItem.ImageKey = desc.Extension;
                    listViewItem.Tag      = documentType;

                    subitem      = new ListViewItem.ListViewSubItem(listViewItem, desc.Description);
                    subitem.Name = "Description";
                    listViewItem.SubItems.Add(subitem);

                    listView.Items.Add(listViewItem);
                }
            }
        }
コード例 #2
0
        public static void Build()
        {
            smallIcons = new Dictionary <String, Icon>();
            largeIcons = new Dictionary <String, Icon>();

            IntPtr processHandle = System.Diagnostics.Process.GetCurrentProcess().Handle;
            IntPtr iconPtr;

            // Special Icons
            smallIcons.Add("null", Sinapse.WinForms.Properties.Resources.Unknown);
            largeIcons.Add("null", Sinapse.WinForms.Properties.Resources.Unknown);

            // Document Icons
            foreach (Type type in DocumentManager.TypeList)
            {
                object[] attr = type.GetCustomAttributes(typeof(DocumentDescription), false);
                if (attr.Length > 0)
                {
                    DocumentDescription desc = (attr[0] as DocumentDescription);
                    iconPtr = ExtractIcon(processHandle, desc.IconPath, desc.SmallIconIndex);
                    if (iconPtr != IntPtr.Zero)
                    {
                        smallIcons.Add(desc.Extension, Icon.FromHandle(iconPtr));
                    }

                    iconPtr = ExtractIcon(processHandle, desc.IconPath, desc.LargeIconIndex);
                    if (iconPtr != IntPtr.Zero)
                    {
                        largeIcons.Add(desc.Extension, Icon.FromHandle(iconPtr));
                    }
                }
            }
        }
コード例 #3
0
 protected override void ReadEndElementEvent(object sender, ReadElementEventArgs eventArgs)
 {
     if (eventArgs.NameEquals("dokumentbeskrivelse") && _currentDocumentDescription != null)
     {
         _documentDescriptions.Add(_currentDocumentDescription);
         _currentDocumentDescription = null;
     }
 }
        public DocumentObject AddDocumentObject(DocumentDescription documentDescription, int versionNumber,
                                                string variantFormatId)
        {
            var documentObject = CreateDocumentObject(versionNumber, variantFormatId);

            documentObject.DocumentDescription = documentDescription;
            _ephorteContext.Add(documentObject);
            return documentObject;
        }
コード例 #5
0
        public DocumentObject AddDocumentObject(DocumentDescription documentDescription, int versionNumber,
                                                string variantFormatId)
        {
            var documentObject = CreateDocumentObject(versionNumber, variantFormatId);

            documentObject.DocumentDescription = documentDescription;
            _ephorteContext.Add(documentObject);
            return(documentObject);
        }
コード例 #6
0
        public void AddRegistryEntryDocument(RegistryEntry registryEntry, DocumentDescription documentDescription,
                                             string documentLinkTypeId)
        {
            var registryEntryDocument = _ephorteContext.Create <RegistryEntryDocument>();

            registryEntryDocument.RegistryEntry       = registryEntry;
            registryEntryDocument.DocumentDescription = documentDescription;
            registryEntryDocument.DocumentLinkTypeId  = documentLinkTypeId;
            _ephorteContext.Add(registryEntryDocument);
        }
コード例 #7
0
 protected override void ReadStartElementEvent(object sender, ReadElementEventArgs eventArgs)
 {
     if (eventArgs.Path.Matches("dokumentbeskrivelse", "registrering"))
     {
         _currentDocumentDescription = new DocumentDescription
         {
             ArchivePartSystemId = _currentArchivePartSystemId
         }
     }
     ;
 }
コード例 #8
0
        private void listView_ItemActivate(object sender, EventArgs e)
        {
            if (listView.SelectedItems.Count > 0)
            {
                int n = 1;

                this.selectedType        = listView.SelectedItems[0].Tag as Type;
                this.selectedDescription =
                    selectedType.GetCustomAttributes(typeof(DocumentDescription), false)[0]
                    as DocumentDescription;
                tbDescription.Text = selectedDescription.Description;
                tbName.Text        = selectedDescription.DefaultName + n;
            }
        }
コード例 #9
0
        private DocumentObject AddNewVersionOfDocument(DocumentDescription documentDescription1, string fileformatId)
        {
            var documentObject = _ephorte.AddDocumentObject(documentDescription1.Id, 2, VariantFormatId.Production, MainFileName, fileformatId);

            EphorteContext.SaveChanges();

            Assert.AreEqual(fileformatId, GetDocumentObject(documentDescription1.Id, VariantFormatId.Production, 2).FileformatId, "FileformatId documentDescription1");

            //This time we add a text-document to an existing document-description
            _ephorte.CheckinTextDocument(documentDescription1.Id, documentObject.VariantFormatId, documentObject.VersionNumber, TextFileContent + " - v2");

            //Note that the checksum is not yet calculated "locally".
            Assert.IsNull(documentObject.Checksum);

            return(GetDocumentObject(documentObject)); //Re-fetch document-object
        }
コード例 #10
0
        private void AddMainDocument(RegistryEntry registryEntry,
                                     out DocumentDescription documentDescription1,
                                     out DocumentObject documentObject1)
        {
            //Add document description
            documentDescription1 = _ephorte.AddDocumentDescription();

            //Add a document-object with a given document-description
            documentObject1 = _ephorte.AddDocumentObject(documentDescription1, 1, VariantFormatId.Production);

            //Add a registry-entry-document with the given registry-entry and document-description. This is the main document (H
            _ephorte.AddRegistryEntryDocument(registryEntry, documentDescription1, DocumentLinkTypeId.MainDocument);

            //This first version of the (main) document is uploded before any the pending changes are saved, and will be checked in when doing SaveChanges
            _ephorte.UploadTextDocument(documentObject1, MainFileName, TextFileContent + " - v1");
        }
コード例 #11
0
 public XElement Serialize()
 {
     return(new XElement(UblNames.Cac + nameof(DocumentReference),
                         ID.Serialize(nameof(ID)),
                         CopyIndicator.Serialize(nameof(CopyIndicator)),
                         UUID.Serialize(nameof(UUID)),
                         IssueDate.Serialize(nameof(IssueDate)),
                         IssueTime.Serialize(nameof(IssueTime)),
                         DocumentTypeCode.Serialize(nameof(DocumentTypeCode)),
                         DocumentType.Serialize(nameof(DocumentType)),
                         XPath.Serialize(nameof(XPath)),
                         LanguageID.Serialize(nameof(LanguageID)),
                         LocaleCode.Serialize(nameof(LocaleCode)),
                         VersionID.Serialize(nameof(VersionID)),
                         DocumentStatusCode.Serialize(nameof(DocumentStatusCode)),
                         DocumentDescription.Serialize(nameof(DocumentDescription)),
                         Attachment?.Serialize(),
                         ValidityPeriod?.Serialize(nameof(ValidityPeriod)),
                         IssuerParty?.Serialize(nameof(IssuerParty))
                         ));
 }
        public ActionResult ViewDocument(string path,
                                         int quality, int width)
        {
            string fileNameExtension = Path.GetExtension(path).TrimStart('.');

            fileNameExtension = fileNameExtension.ToLower();
            string appDataPath = Server.MapPath(AppDataVirtualPath);
            DocumentDescription documentDescription = SignatureHandler.GetPageDescriptions(Path.Combine(appDataPath, path));
            int pageCount = documentDescription.Pages.Count;

            string[]             pageImageUrls         = GetImageUrls(path, 0, pageCount, width, quality);
            UrlHelper            urlHelper             = new UrlHelper(Request.RequestContext);
            string               documentDownloadUrl   = urlHelper.Action("GetDocument", "Signature", new { path });
            JavaScriptSerializer serializer            = new JavaScriptSerializer();
            string               documentDescriptionJs = LowerCaseJsonSerializer.SerializeObject(documentDescription);
            var result = new
            {
                path,
                docType               = "Pdf",
                fileType              = fileNameExtension,
                url                   = documentDownloadUrl,
                pdfDownloadUrl        = (string)null,
                name                  = path,
                imageUrls             = pageImageUrls,
                lic                   = true,
                pdfPrintUrl           = (string)null,
                pageHtml              = (object)null,
                pageCss               = (object)null,
                documentDescription   = documentDescriptionJs,
                urlForResourcesInHtml = (object)null,
                sharedCss             = (object)null,
                success               = true
            };

            return(Json(result));
        }
        private void AddMainDocument(RegistryEntry registryEntry,
                                     out DocumentDescription documentDescription1,
                                     out DocumentObject documentObject1)
        {
            //Add document description
            documentDescription1 = _ephorte.AddDocumentDescription();

            //Add a document-object with a given document-description
            documentObject1 = _ephorte.AddDocumentObject(documentDescription1, 1, VariantFormatId.Production);

            //Add a registry-entry-document with the given registry-entry and document-description. This is the main document (H
            _ephorte.AddRegistryEntryDocument(registryEntry, documentDescription1, DocumentLinkTypeId.MainDocument);

            //This first version of the (main) document is uploded before any the pending changes are saved, and will be checked in when doing SaveChanges
            _ephorte.UploadTextDocument(documentObject1, MainFileName, TextFileContent + " - v1");
        }
        private DocumentObject AddNewVersionOfDocument(DocumentDescription documentDescription1, string fileformatId)
        {
            var documentObject = _ephorte.AddDocumentObject(documentDescription1.Id, 2, VariantFormatId.Production, MainFileName, fileformatId);

            EphorteContext.SaveChanges();

            Assert.AreEqual(fileformatId, GetDocumentObject(documentDescription1.Id, VariantFormatId.Production, 2).FileformatId, "FileformatId documentDescription1");

            //This time we add a text-document to an existing document-description
            _ephorte.CheckinTextDocument(documentDescription1.Id, documentObject.VariantFormatId, documentObject.VersionNumber, TextFileContent + " - v2");

            //Note that the checksum is not yet calculated "locally".
            Assert.IsNull(documentObject.Checksum);

            return GetDocumentObject(documentObject); //Re-fetch document-object
        }
コード例 #15
0
 public static Validation <Error, DocumentUpdatedEvent> Create(Guid documentId, string number,
                                                               string description) =>
 DocumentNumber.Create(number)
 .Bind(num => DocumentDescription.Create(description)
       .Map(desc => new DocumentUpdatedEvent(new DocumentId(documentId), num, desc, DateTime.UtcNow)));
 public void AddRegistryEntryDocument(RegistryEntry registryEntry, DocumentDescription documentDescription,
                                      string documentLinkTypeId)
 {
     var registryEntryDocument = _ephorteContext.Create<RegistryEntryDocument>();
     registryEntryDocument.RegistryEntry = registryEntry;
     registryEntryDocument.DocumentDescription = documentDescription;
     registryEntryDocument.DocumentLinkTypeId = documentLinkTypeId;
     _ephorteContext.Add(registryEntryDocument);
 }
コード例 #17
0
 private static Validation <Error, Document> CreateDocument(string number = "1234", string description = "Test")
 {
     return(DocumentNumber.Create(number)
            .Bind(num => DocumentDescription.Create(description)
                  .Map(desc => new Document(new DocumentId(Guid.Empty), new UserId(Guid.Empty), num, desc))));
 }