Beispiel #1
0
        private void SignDocuments(Preservation preservation, ISignService _signService, Models.ArubaSignModel model)
        {
            string currentFilePath = Directory.GetFiles(preservation.Path, "IPDA*.xml").FirstOrDefault();

            if (currentFilePath != null)
            {
                //get file content
                byte[] content = System.IO.File.ReadAllBytes(currentFilePath);

                //sign document with aruba automatic
                VecompSoftware.Sign.ArubaSignService.ArubaSignModel arubaModel = new VecompSoftware.Sign.ArubaSignService.ArubaSignModel()
                {
                    DelegatedDomain   = model.DelegatedDomain,
                    DelegatedPassword = model.DelegatedPassword,
                    DelegatedUser     = model.DelegatedUser,
                    OTPPassword       = model.OTPPassword,
                    OTPAuthType       = model.OTPAuthType,
                    User          = model.User,
                    CertificateId = model.CertificateId,
                    TSAUser       = model.TSAUser,
                    TSAPassword   = model.TSAPassword
                };

                content = _signService.SignDocument(arubaModel, content, Path.GetFileName(currentFilePath), true);

                //save signed file back to disk
                ByteArrayToFile(currentFilePath, content);

                //update CloseDate field so that we can close the preservation
                _preservationService.ClosePreservation(preservation.IdPreservation);
            }
        }
Beispiel #2
0
        public ActionResult CloseOpenPreservations()
        {
            CustomerCompanyViewModel customerCompany = Session["idCompany"] as CustomerCompanyViewModel;
            var preservations = PreservationService.PreservationToClose(customerCompany.CompanyId);

            var    service = new PreservationService();
            string res     = "";

            foreach (var preservation in preservations)
            {
                if (!preservation.CloseDate.HasValue)
                {
                    if (service.VerifyExistingPreservation(preservation.IdPreservation))
                    {
                        service.ClosePreservation(preservation.IdPreservation);
                        string pattern  = "Conservazione <b>{0}</b> del {1} <b>CHIUSA</b> in questa esecuzione.<br/>";
                        string filePath = Path.Combine(preservation.Path, preservation.Label);
                        res += string.Format(pattern, preservation.IdPreservation, preservation.StartDate);

                        //aggiunge informazioni sull'ipda
                        res += GetIpdaInfo(service.verifiedIpda);
                    }
                    else
                    {
                        res += String.Join("<br/>", service.ErrorMessages);
                    }
                }
            }

            return(Json(new { result = res }));
        }
        public ActionResult ClosePreservation(Preservation preservation)
        {
            var service = new PreservationService();

            preservation = service.GetPreservation(preservation.IdPreservation, false);
            if (!preservation.CloseDate.HasValue)
            {
                service.ClosePreservation(preservation.IdPreservation);
            }
            return(RedirectToAction("PreservationDetails", new { id = preservation.IdPreservation }));
        }
Beispiel #4
0
        public ActionResult ClosePreservation(Preservation preservation)
        {
            var service = new PreservationService();

            preservation = service.GetPreservation(preservation.IdPreservation, false);
            if (!preservation.CloseDate.HasValue)
            {
                if (service.VerifyExistingPreservation(preservation.IdPreservation))
                {
                    service.ClosePreservation(preservation.IdPreservation);
                    TempData["ErrorMessages"] = new string[] { "Conservazione eseguita e chiusa con successo" }.ToList();
                }
                else
                {
                    TempData["ErrorMessages"] = service.ErrorMessages;
                }
            }

            return(RedirectToAction("PreservationCheck", "Preservation", new { id = preservation.IdPreservation }));
        }
        public ActionResult ClosePreservationWithoutDocuments(Guid idPreservationTask)
        {
            var service = new PreservationService();
            PreservationTask preservationTask = service.GetPreservationTask(idPreservationTask);

            service.SavePreservationTaskStatus(preservationTask, Library.Common.Objects.Enums.PreservationTaskStatus.Done, false, null);
            if (preservationTask.CorrelatedTasks != null)
            {
                foreach (PreservationTask correlatedtask in preservationTask.CorrelatedTasks)
                {
                    service.SavePreservationTaskStatus(correlatedtask, Library.Common.Objects.Enums.PreservationTaskStatus.Done, false, null);
                }
            }

            if (preservationTask.IdPreservation.HasValue)
            {
                service.ClosePreservation(preservationTask.IdPreservation.Value);
            }
            return(RedirectToAction("Index", "Home"));
        }