Пример #1
0
        public List<ElectronicDocumentDiscrepancyTypeNomenclature> GetValidationDiscrepancies(string xmlContent, ApplicationDataDo applicationDataDo, IList<AttachedDocDo> attachedDocuments)
        {
            List<ElectronicDocumentDiscrepancyTypeNomenclature> discrepancies = new List<ElectronicDocumentDiscrepancyTypeNomenclature>();

            string[] supportedFileFormats = { "pdf", "doc", "docx", "xls", "xlsx", "eml", "p7s", "ats", "sxw", "txt", "rtf", "jpg", "jpeg", "j2k", "png", "tiff", "tif", };
            RioDocumentMetadata documentMetaData = rioDocumentParser.GetDocumentMetadataFromXml(xmlContent);

            if (documentMetaData.IsZeuService)
            {
                if (!rioValidator.CheckEmail(applicationDataDo.Email))
                {
                    discrepancies.Add(ElectronicDocumentDiscrepancyTypeNomenclature.NoEmail);
                }
            }

            if (!rioValidator.CheckDocumentSize(xmlContent))
            {
                discrepancies.Add(ElectronicDocumentDiscrepancyTypeNomenclature.SizeTooLarge);
            }

            if (!rioValidator.CheckSignatureValidity(xmlContent, documentMetaData.SignatureXPath, documentMetaData.SignatureXPathNamespaces))
            {
                discrepancies.Add(ElectronicDocumentDiscrepancyTypeNomenclature.NotAuthenticated);
            }

            if (attachedDocuments != null && attachedDocuments.Count > 0)
            {
                if (!rioValidator.CheckSupportedFileFormats(attachedDocuments.Select(e => e.FileName).ToList(), supportedFileFormats))
                {
                    discrepancies.Add(ElectronicDocumentDiscrepancyTypeNomenclature.IncorrectAttachmentsFormat);
                }
            }

            //TODO: Implement
            //if (!rioValidator.CheckValidXmlSchema(xmlContent, GetSchemasPath()))
            //{
            //    discrepancies.Add(ElectronicDocumentDiscrepancyTypeNomenclature.IncorrectFormat);
            //}

            //TODO: Implement
            //if (!skipCertificateChainValidation) //take it from Web.config
            //{
            //    var revocationErrors = rioValidator.CheckCertificateValidity(xmlContent, applicationDataDo.ElectronicServiceApplicant, documentMetaData.SignatureXPath, documentMetaData.SignatureXPathNamespaces);
            //    if (revocationErrors != null && revocationErrors.Count() > 0)
            //    {
            //        discrepancies.Add(ElectronicDocumentDiscrepancyTypeNomenclature.NotAuthenticated);
            //    }
            //}

            //TODO: Implement
            //if (!rioValidator.CheckForVirus(xmlContent, null, 0))
            //{
            //    discrepancies.Add(ElectronicDocumentDiscrepancyTypeNomenclature.IncorrectAttachmentsFormat);
            //}

            return discrepancies;
        }
Пример #2
0
        private Guid CreateReceiptDocFileContent(Doc initialDoc, Doc receiptDoc, Doc rootDoc, List<ElectronicDocumentDiscrepancyTypeNomenclature> discrepancies, ApplicationDataDo applicationDataDo)
        {
            bool isDocAcknowledged = discrepancies == null || discrepancies.Count() == 0;

            string registerIndex;
            string sequenceNumber;
            DateTime receiptOrSigningDate;

            string receiptMessage;
            if (!isDocAcknowledged)
            {
                registerIndex = receiptDoc.RegIndex;
                sequenceNumber = receiptDoc.RegNumber.Value.ToString("D6");
                receiptOrSigningDate = receiptDoc.RegDate.Value;

                receiptMessage = this.rioDocumentParser.XmlSerializeReceiptNotAcknowledgedMessage(
                    this.CreateReceiptNotAcknowledgedMessage(registerIndex, sequenceNumber, receiptOrSigningDate, applicationDataDo, discrepancies));
            }
            else
            {
                registerIndex = initialDoc.RegIndex;
                sequenceNumber = initialDoc.RegNumber.Value.ToString("D6");
                receiptOrSigningDate = initialDoc.RegDate.Value;

                string aisUserIdentifier = "Системен потребител";
                string aisURI = "ГВА АИС";

                string htmlFormat = @"<p>Номер на преписка: <b>{0}</b><br/>Код за достъп: <b>{1}</b><br/></p>";
                string regUri = rootDoc != null ? rootDoc.RegUri : initialDoc.RegUri;
                string accessCode = rootDoc != null ? rootDoc.AccessCode : initialDoc.AccessCode;
                string caseAccessIdentifier = String.Format(htmlFormat, regUri, accessCode);

                receiptMessage = this.rioDocumentParser.XmlSerializeReceiptAcknowledgedMessage(
                    this.CreateReceiptAcknowledgedMessage(registerIndex, sequenceNumber, receiptOrSigningDate, aisUserIdentifier, aisURI, caseAccessIdentifier, applicationDataDo));
            }

            byte[] content = Utf8Utils.GetBytes(receiptMessage);
            Guid fileKey = WriteToBlob(content);

            return fileKey;
        }
Пример #3
0
        private ReceiptNotAcknowledgedMessage CreateReceiptNotAcknowledgedMessage(
            string registerIndex,
            string sequenceNumber,
            DateTime receiptOrSigningDate,
            ApplicationDataDo applicationDataDo,
            List<ElectronicDocumentDiscrepancyTypeNomenclature> discrepancies)
        {
            var receiptMessage = new ReceiptNotAcknowledgedMessage();
            receiptMessage.MessageURI = new DocumentURI();
            receiptMessage.MessageURI.RegisterIndex = registerIndex;
            receiptMessage.MessageURI.SequenceNumber = sequenceNumber;
            receiptMessage.MessageURI.ReceiptOrSigningDate = receiptOrSigningDate;
            receiptMessage.Applicant = applicationDataDo.ElectronicServiceApplicant;
            receiptMessage.ElectronicServiceProvider = applicationDataDo.ElectronicServiceProviderBasicData;
            receiptMessage.TransportType = "0006-000001";   //Чрез уеб базирано приложение;
            receiptMessage.DocumentTypeURI = applicationDataDo.DocumentTypeURI;
            receiptMessage.DocumentTypeName = applicationDataDo.DocumentTypeName;
            receiptMessage.MessageCreationTime = receiptOrSigningDate;
            receiptMessage.Discrepancies = new Discrepancies();
            receiptMessage.Discrepancies.DiscrepancyCollection = new DiscrepancyCollection();
            foreach (var discrepancy in discrepancies)
            {
                receiptMessage.Discrepancies.DiscrepancyCollection.Add(discrepancy.Uri);
            }

            return receiptMessage;
        }
Пример #4
0
        private ReceiptAcknowledgedMessage CreateReceiptAcknowledgedMessage(
            string registerIndex,
            string sequenceNumber,
            DateTime receiptOrSigningDate,
            string aisUserIdentifier,
            string aisURI,
            string caseAccessIdentifier,
            ApplicationDataDo applicationDataDo)
        {
            var receiptMessage = new ReceiptAcknowledgedMessage();
            receiptMessage.DocumentURI = new DocumentURI();
            receiptMessage.DocumentURI.RegisterIndex = registerIndex;
            receiptMessage.DocumentURI.SequenceNumber = sequenceNumber;
            receiptMessage.DocumentURI.ReceiptOrSigningDate = receiptOrSigningDate;
            receiptMessage.Applicant = applicationDataDo.ElectronicServiceApplicant;
            receiptMessage.ElectronicServiceProvider = applicationDataDo.ElectronicServiceProviderBasicData;
            receiptMessage.TransportType = "0006-000001";   //Чрез уеб базирано приложение;
            receiptMessage.DocumentTypeURI = applicationDataDo.DocumentTypeURI;
            receiptMessage.DocumentTypeName = applicationDataDo.DocumentTypeName;
            receiptMessage.RegisteredBy = new RegisteredBy();
            receiptMessage.RegisteredBy.Officer = new Officer();
            receiptMessage.RegisteredBy.Officer.AISUserIdentifier = aisUserIdentifier;
            receiptMessage.RegisteredBy.AISURI = aisURI;
            receiptMessage.CaseAccessIdentifier = caseAccessIdentifier;

            return receiptMessage;
        }