private void GetDocumentSaved() { NSUserDefaults defaults = NSUserDefaults.StandardUserDefaults; NSData encodedObject = (NSData)defaults.ValueForKey(DocumentSavedKey); // Check if there are documents saved if (encodedObject == null) { return; } // Get documents saved and build the list NSMutableArray listDoc = (NSMutableArray)NSKeyedUnarchiver.UnarchiveObject(encodedObject); DocumentsList = new List <Document>(); for (nuint i = 0; i < listDoc.Count; i++) { DocumentArchive docSaved = listDoc.GetItem <DocumentArchive>(i); // Build Document c# object form DocumentArchive NsObject Document doc = new Document(); doc.Name = docSaved.Name; doc.ServerRelativeUrl = docSaved.ServerRelativeUrl; doc.BytesArray = docSaved.BytesArray; DocumentsList.Add(doc); } // Load data and reload TableView tableView.Source = new DocumentTableDataSource(this.DocumentsList, this); tableView.ReloadData(); }
public ActionResult Index(Guid id, Guid?idPreservation) { return(ActionResultHelper.TryCatchWithLogger(() => { DocumentArchive archive = ArchiveService.GetArchive(id); if (archive == null) { throw new Exception(string.Format("Nessun archivio trovato con id {0}", id)); } AwardBatchViewModel model = new AwardBatchViewModel() { ArchiveName = archive.Name, IdArchive = archive.IdArchive, IdPreservation = idPreservation }; if (idPreservation.HasValue && idPreservation.Value != Guid.Empty) { model.FromDate = null; model.ToDate = null; } return View(model); }, _loggerService)); }
private BindingList <Document> getDocumentsByAttributeValue(DocumentArchive archive, DocumentAttributeValue attributeValue, bool?stringContains, int?skip, int?take) { try { logger.InfoFormat("getDocumentsByAttributeValue archive.IdArchive:{0} archive.Name:{1} attributeValue.Attribute.Name:{2} attributeValue.Value:{3}", archive.IdArchive, archive.Name, attributeValue.Attribute.Name, attributeValue.Value); BindingList <DocumentAttribute> attributes = AttributeService.GetAttributesFromArchive(archive.IdArchive); // Recupero la lista di documenti. BindingList <Document> documents = DocumentService.GetDocumentsByAttributeValue(archive, attributeValue, stringContains, skip, take); if (documents == null || documents.Count == 0) { throw new DocumentNotFound_Exception("Nessun documento trovato con attributo \"{0}\" e valore \"{1}\".", attributeValue.Attribute.Name, attributeValue.Value); } logger.InfoFormat("getDocumentsByAttributeValue documenti trovati: {0}.", documents.Count); return(documents); } catch (Exception ex) { logger.Error(ex); throw; } }
public ActionResult CheckArchivePreservationConfiguration(Guid id) { return(ActionResultHelper.TryCatchWithLogger(() => { CheckPreservationArchiveConfigurationViewModel model = new CheckPreservationArchiveConfigurationViewModel() { IdArchive = id }; DocumentArchive archive = ArchiveService.GetArchive(id); ICollection <DocumentAttribute> archiveAttributes = AttributeService.GetAttributesFromArchive(id); model.ArchiveName = archive.Name; model.ArchiveAttributes = archiveAttributes.Where(x => !x.KeyOrder.HasValue || x.KeyOrder == 0) .OrderBy(o => o.DisplayName) .ToDictionary(k => k.IdAttribute.ToString(), v => v.DisplayName); //model.DateAttributes.Add(Guid.Empty.ToString(), "--Crea attributo (Date)"); archiveAttributes.Where(x => x.AttributeType.Equals("System.DateTime", StringComparison.InvariantCultureIgnoreCase)) .OrderBy(o => o.DisplayName).ToList().ForEach(f => model.DateAttributes.Add(f.IdAttribute.ToString(), f.DisplayName)); model.PathPreservation = archive.PathPreservation; model.MainDateAttribute = archiveAttributes.Where(x => x.IsMainDate == true).Select(s => s.IdAttribute.ToString()).SingleOrDefault(); model.PrimaryKeyAttributes = archiveAttributes.Where(x => x.KeyOrder > 0).OrderBy(o => o.KeyOrder) .ToDictionary(k => k.IdAttribute.ToString(), v => v.DisplayName); ValidateArchiveForPreservationInteractor interactor = new ValidateArchiveForPreservationInteractor(_loggerService); ValidateArchiveForPreservationResponseModel response = interactor.Process(new ValidateArchiveForPreservationRequestModel() { IdArchive = id }); model.HasPreservations = response.HasPreservations; model.ValidationErrors = response.ValidationErrors; model.IsValidated = response.IsValidated; return PartialView("_CheckArchivePreservationConfiguration", model); }, _loggerService)); }
public EmptyResponseModel Process(ModifyArchivePreservationAttributesRequestModel request) { _logger.Info($"Process -> Edit preservation attributes for archive {request.IdArchive}"); DocumentArchive archive = ArchiveService.GetArchive(request.IdArchive); if (archive == null) { _logger.Error($"Archive with id {request.IdArchive} not found"); throw new Exception($"Archive with id {request.IdArchive} not found"); } ICollection <DocumentAttribute> attributes = AttributeService.GetAttributesFromArchive(request.IdArchive); if (attributes == null || attributes.Count == 0) { _logger.Error($"There aren't attributes for archive with id {request.IdArchive}"); throw new Exception($"There aren't attributes for archive with id {request.IdArchive}"); } foreach (DocumentAttribute attribute in attributes) { attribute.ConservationPosition = null; if (request.OrderedPreservationAttributes.ContainsKey(attribute.IdAttribute)) { attribute.ConservationPosition = request.OrderedPreservationAttributes[attribute.IdAttribute]; } _logger.Debug($"Update attribute {attribute.IdAttribute}: ConservationPosition = {attribute.ConservationPosition}"); AttributeService.UpdateAttribute(attribute); } return(new EmptyResponseModel()); }
public ActionResult SetArchivePreservationConfiguration(ArchivePreservationConfigurationViewModel model) { DocumentArchive archive = ArchiveService.GetArchive(model.Archive.IdArchive); archive.PreservationConfiguration = JsonConvert.SerializeObject(model.ArchiveConfiguration); ArchiveService.UpdateArchive(archive); return(RedirectToAction("ArchivePreservationConfiguration", new { id = model.Archive.IdArchive })); }
private void SaveDocumentInDevice(DocumentArchive doc) { this.DocumentsDownloadedList.Add(doc); // Archiver document object NSData encodedObject = NSKeyedArchiver.ArchivedDataWithRootObject(this.DocumentsDownloadedList); NSUserDefaults.StandardUserDefaults.SetValueForKey(encodedObject, DocumentSavedKey); NSUserDefaults.StandardUserDefaults.Synchronize(); }
/// <summary> /// Inserisce un nuovo Archive /// </summary> /// <param name="Archive">DocumentArchive da inserire</param> public static Guid AddArchive(DocumentArchive Archive) { // IsLegal è sempre true o false e LastIdBiblos non è mai null if (String.IsNullOrEmpty(Archive.Name)) { throw new Exception("Impossibile proseguire. Name deve essere valorizzato"); } return(DbAdminProvider.AddArchive(Archive)); }
public SaveAwardBatchXMLResponseModel Process(SaveAwardBatchXMLRequestModel request) { DocumentArchive[] archives = _documentsClient.GetArchives(); DocumentAttribute[] attributes = _documentsClient.GetAttributesDefinition(request.ArchiveName); AwardBatch awardBatch = _preservationService.GetAwardBatch(request.IdAwardBatch); if (awardBatch == null) { _logger.Warn(string.Concat("GenerateAwardBatchPDVInteractor -> award batch with id ", request.IdAwardBatch, " not found")); throw new Exception(string.Concat("Award batch with id ", request.IdAwardBatch, " not found")); } DocumentArchive pdvArchive = archives.SingleOrDefault(s => s.Name.Equals(request.ArchiveName, StringComparison.InvariantCultureIgnoreCase)); if (pdvArchive == null) { _logger.Warn(string.Concat("GenerateAwardBatchPDVInteractor -> archive ", request.ArchiveName, " not found")); throw new Exception(string.Concat("Archive ", request.ArchiveName, " not found")); } Document chainDocument = new Document() { Archive = pdvArchive }; chainDocument = _documentsClient.InsertDocumentChain(chainDocument); Document document = new Document { Content = new DocumentContent() { Blob = request.Content }, Name = string.Concat(UtilityService.GetSafeFileName(awardBatch.Name), ".xml"), Archive = pdvArchive, AttributeValues = new System.ComponentModel.BindingList <DocumentAttributeValue>() }; document.AttributeValues.Add(new DocumentAttributeValue() { Value = document.Name, Attribute = attributes.Single(f => f.Name.Equals("Filename", StringComparison.InvariantCultureIgnoreCase)) }); document.AttributeValues.Add(new DocumentAttributeValue() { Value = awardBatch.Name, Attribute = attributes.Single(f => f.Name.Equals("Signature", StringComparison.InvariantCultureIgnoreCase)) }); document = _documentsClient.AddDocumentToChain(document, chainDocument.IdDocument, Library.Common.Enums.DocumentContentFormat.Binary); awardBatch.IdPDVDocument = document.IdDocument; _preservationService.UpdateAwardBatch(awardBatch); return(new SaveAwardBatchXMLResponseModel() { IdDocument = document.IdDocument }); }
internal void DeleteArchive(DocumentArchive archiveToClone) { using (Model.BiblosDS2010Entities db = new Model.BiblosDS2010Entities(BiblosDSConnectionString)) { Model.Archive entityArchive = db.Archive.Where(x => x.IdArchive == archiveToClone.IdArchive).SingleOrDefault(); if (entityArchive != null) { db.Archive.DeleteObject(entityArchive); db.SaveChanges(); } } }
public ActionResult ArchivePreservation(Guid id) { try { DocumentArchive model = ArchiveService.GetArchive(id); return(View(model)); } catch (Exception ex) { logger.Error(ex); throw; } }
private void DownloadDocument(Document doc) { System.Diagnostics.Debug.WriteLine("Downloading..." + doc.Name); Task.Run(async() => { try { // Download file from server byte[] bytesArray = await AysaClient.Instance.GetDocumentFile(doc.ServerRelativeUrl); InvokeOnMainThread(() => { // Build document with its file to save in the device DocumentArchive doc1 = new DocumentArchive(); doc1.Name = doc.Name; doc1.ServerRelativeUrl = doc.ServerRelativeUrl; // Encode Data var text = System.Text.Encoding.Default.GetString(bytesArray); text = text.Replace("\"", ""); bytesArray = Convert.FromBase64String(text); doc1.BytesArray = bytesArray; SaveDocumentInDevice(doc1); DownloadSynchronizeDocuments(); }); } catch (HttpUnauthorized) { InvokeOnMainThread(() => { ShowSessionExpiredError(); // Dismiss an Activity Indicator in the status bar UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; }); } catch (Exception ex) { InvokeOnMainThread(() => { ShowErrorAlert(ex.Message); // Dismiss an Activity Indicator in the status bar UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; }); } }); }
public ActionResult AwardBatchRDVSign(Guid id) { return(ActionResultHelper.TryCatchWithLogger(() => { DocumentArchive archive = ArchiveService.GetArchive(id); ViewBag.messageId = Guid.NewGuid().ToString(); AwardBatchRDVSignViewModel viewModel = new AwardBatchRDVSignViewModel() { ArchiveName = archive.Name, IdArchive = archive.IdArchive }; return View(viewModel); }, _loggerService)); }
public bool StoreTransitArchiveDocumentAttaches(string archiveName) { bool bReturn = true; try { DocumentArchive archive = ArchiveService.GetArchiveByName(archiveName); if (archive == null) { throw new BiblosDS.Library.Common.Exceptions.Archive_Exception("Archive not found"); } BindingList <DocumentAttach> documents = DocumentService.GetDocumentAttachesInTransito(archive.IdArchive, 0); // esegue la query nel db DocumentAttach document; foreach (var item in documents) { try { document = DocumentService.GetDocumentAttach(item.IdDocumentAttach); using (var clientChannel = WCFUtility.GetClientConfigChannel <IServiceDocumentStorage>(ServerService.WCF_DocumentStorage_HostName)) { (clientChannel as IServiceDocumentStorage).AddAttachToDocument(document); } } catch (Exception e) { bReturn = false; Logging.WriteLogEvent(LoggingSource.BiblosDS_WS, "Document.ProcessCheckInTransitoDocumentAttach", e.ToString(), LoggingOperationType.BiblosDS_CheckInTransitoDocument, LoggingLevel.BiblosDS_Warning); } } // end foreach return(bReturn); } catch (Exception ex) { Logging.WriteLogEvent(LoggingSource.BiblosDS_WS, "Document.ProcessCheckInTransitoDocument", ex.ToString(), LoggingOperationType.BiblosDS_CheckInTransitoDocument, LoggingLevel.BiblosDS_Warning); return(false); } }
public ActionResult ExecuteArchivePreservationMigrator(Guid id) { return(ActionResultHelper.TryCatchWithLogger(() => { DocumentArchive archive = ArchiveService.GetArchive(id); CustomerCompanyViewModel customerCompany = Session["idCompany"] as CustomerCompanyViewModel; ExecuteArchivePreservationMigratorViewModel model = new ExecuteArchivePreservationMigratorViewModel() { IdArchive = id, ArchiveName = archive.Name, IdCompany = customerCompany.CompanyId }; return PartialView("_ExecuteArchivePreservationMigrator", model); }, _loggerService)); }
public static BindingList <DocumentStorage> GetStoragesNotRelatedToArchive(DocumentArchive Archive) { try { return(DbProvider.GetStoragesNotRelatedToArchive(Archive.IdArchive)); } catch (Exception e) { Logging.WriteLogEvent(BiblosDS.Library.Common.Enums.LoggingSource.BiblosDS_General, "StorageService.GetStoragesNotRelatedToArchive", e.ToString(), BiblosDS.Library.Common.Enums.LoggingOperationType.BiblosDS_General, BiblosDS.Library.Common.Enums.LoggingLevel.BiblosDS_Errors); throw e; } }
public static string GetPathTransito(DocumentArchive archive, Guid idServer) { string pathTransito = string.Empty; var serverConfig = DbProvider.GetArchiveServerConfig(idServer, archive.IdArchive); if (serverConfig != null) { pathTransito = serverConfig.TransitPath; } else { pathTransito = archive.PathTransito; } return(pathTransito); }
public static void UpdateArchiveLastIdBiblos(Guid idArchive, int lastIdBiblos) { DocumentArchive currentArchive = DbProvider.GetArchive(idArchive); if (currentArchive == null) { throw new Exceptions.Archive_Exception($"Archive {idArchive} not found"); } if (lastIdBiblos < currentArchive.LastIdBiblos) { throw new Exceptions.Archive_Exception($"Non è possibile impostare il valore {lastIdBiblos} in quanto è inferiore all'ultimo IdBiblos ({currentArchive.LastIdBiblos}) impostato per l'archivio."); } DbProvider.UpdateArchiveBiblosId(idArchive, lastIdBiblos); }
private DocumentAttribute getAttributeByArchiveAndName(DocumentArchive archive, string attributeName) { // Recupero l'attributo a partire dal suo nome. BindingList <DocumentAttribute> attributes = AttributeService.GetAttributesFromArchive(archive.IdArchive); foreach (DocumentAttribute item in attributes) { if (item.Name.Equals(attributeName, StringComparison.InvariantCultureIgnoreCase)) { return(item); } } throw new AttributeNotFoundException("Attributo \"{0}\" non configurato per l'archivio \"{1}\".", attributeName, archive.Name); }
public static BindingList <DocumentStorage> GetStorageActiveFromArchive(DocumentArchive Archive) { try { return(DbProvider.GetStoragesActiveFromArchive(Archive.IdArchive)); } catch (Exception e) { Logging.WriteLogEvent(LoggingSource.BiblosDS_General, "StorageService." + System.Reflection.MethodBase.GetCurrentMethod().Name, e.ToString(), LoggingOperationType.BiblosDS_General, LoggingLevel.BiblosDS_Errors); throw e; } }
public ValidateArchiveForPreservationResponseModel Process(ValidateArchiveForPreservationRequestModel request) { DocumentArchive archive = ArchiveService.GetArchive(request.IdArchive); if (archive == null) { _logger.Error($"Archive with id {request.IdArchive} not found"); throw new Exception($"Archive with id {request.IdArchive} not found"); } ValidateArchiveForPreservationResponseModel response = new ValidateArchiveForPreservationResponseModel() { IdArchive = request.IdArchive }; if (_preservationService.ExistPreservationsByArchive(archive)) { response.HasPreservations = true; response.ValidationErrors.Add("Non è possibile configurare un archivio con delle conservazioni già eseguite"); } response.HasPathPreservation = true; if (string.IsNullOrEmpty(archive.PathPreservation)) { response.HasPathPreservation = false; response.ValidationErrors.Add("Non è stato definito il percorso di conservazione"); } ICollection <DocumentAttribute> archiveAttributes = AttributeService.GetAttributesFromArchive(archive.IdArchive); response.HasDateMainAttribute = true; if (!archiveAttributes.Any(x => x.IsMainDate == true)) { response.HasDateMainAttribute = false; response.ValidationErrors.Add("Non è stato definito un attributo di tipo MainDate"); } response.HasPrimaryKeyAttribute = true; if (!archiveAttributes.Any(x => x.KeyOrder.HasValue && x.KeyOrder.Value > 0)) { response.HasPrimaryKeyAttribute = false; response.ValidationErrors.Add("Non è stato definito un attributo di tipo Primary Key"); } return(response); }
public ActionResult ArchiveConfigurationWizard(Guid id) { return(ActionResultHelper.TryCatchWithLogger(() => { DocumentArchive archive = ArchiveService.GetArchive(id); if (archive == null) { throw new Exception(string.Format("Nessun archivio trovato con id {0}", id)); } ArchiveConfigurationWizardViewModel model = new ArchiveConfigurationWizardViewModel() { IdArchive = id }; return View(model); }, _loggerService)); }
/// <summary> /// Salva le modifiche a un DocumentArchive /// </summary> /// <param name="Archive">DocumentArchive modificato</param> public static void UpdateArchive(DocumentArchive Archive, bool convertDateMain = true) { // IsLegal è sempre true o false e LastIdBiblos non è mai null DocumentArchive dbArchive = DbProvider.GetArchive(Archive.IdArchive); if (Archive.IdArchive == Guid.Empty || String.IsNullOrEmpty(Archive.Name)) { throw new Exception("Impossibile proseguire. IdArchive e Name devono essere valorizzati"); } DbAdminProvider.UpdateArchive(Archive); if (convertDateMain && dbArchive.IsLegal != Archive.IsLegal && Archive.IsLegal && DbProvider.ExistMainDateAttribute(Archive.IdArchive)) { ConvertArchiveConservationEnabled(Archive); } }
public static bool IsArchiveRedirectable(Guid idArchive, out ArchiveServerConfig archiveServerConfig) { DocumentArchive currentArchive = DbProvider.GetArchive(idArchive); archiveServerConfig = null; if (currentArchive == null) { throw new Exceptions.Archive_Exception($"Archive {idArchive} not found"); } ArchiveServerConfig serverConfig = DbProvider.GetArchiveServerConfig(idArchive); if (serverConfig != null && serverConfig.Server.ServerRole == ServerRole.Remote) { archiveServerConfig = serverConfig; return(true); } return(false); }
public ActionResult ArchivePreservationConfigurationSummary(Guid id, bool isCompleteWithErrors) { return(ActionResultHelper.TryCatchWithLogger(() => { DocumentArchive archive = ArchiveService.GetArchive(id); ICollection <DocumentAttribute> attributes = AttributeService.GetAttributesFromArchive(id); ArchiveWizardStepBaseViewModel model = new ArchiveWizardStepBaseViewModel() { IdArchive = id, ArchiveName = archive.Name, PathPreservation = archive.PathPreservation, MainDateAttribute = attributes.SingleOrDefault(s => s.IsMainDate == true).DisplayName, SelectedPreservationAttributes = attributes.Where(x => x.ConservationPosition > 0).OrderBy(o => o.ConservationPosition).Select(s => s.DisplayName).ToList(), SelectedPrimaryKeyAttributes = attributes.Where(x => x.KeyOrder > 0).OrderBy(o => o.KeyOrder).Select(s => s.DisplayName).ToList(), IsCompleted = true, IsCompleteWithErrors = isCompleteWithErrors }; return PartialView("_ArchivePreservationConfigurationSummary", model); }, _loggerService)); }
public ActionResult ArchivePreservationAttributesConfiguration(Guid id) { return(ActionResultHelper.TryCatchWithLogger(() => { DocumentArchive archive = ArchiveService.GetArchive(id); ICollection <DocumentAttribute> archiveAttributes = AttributeService.GetAttributesFromArchive(id); ArchivePreservationAttributesConfigurationViewModel model = new ArchivePreservationAttributesConfigurationViewModel() { IdArchive = id, ArchiveName = archive.Name, ArchiveAttributes = archiveAttributes.Where(x => !x.ConservationPosition.HasValue || x.ConservationPosition == 0) .OrderBy(o => o.DisplayName) .ToDictionary(k => k.IdAttribute.ToString(), v => v.DisplayName), PreservationAttributes = archiveAttributes.Where(x => x.ConservationPosition > 0).OrderBy(o => o.ConservationPosition) .ToDictionary(k => k.IdAttribute.ToString(), v => v.DisplayName) }; return PartialView("_ArchivePreservationAttributesConfiguration", model); }, _loggerService)); }
private static void ConvertArchiveConservationEnabled(DocumentArchive archive) { EntityProvider currentProvider = DbProvider; ICollection <Document> toUpdateDocuments = currentProvider.GetPreservationDocumentsNoDateMain(archive); currentProvider.BeginNoSaveNoTransaction(); foreach (Document doc in toUpdateDocuments) { BindingList <DocumentAttributeValue> docAttributes = currentProvider.GetFullDocumentAttributeValues(doc.IdDocument); AttributeService.ParseAttributeValues(archive, docAttributes, out DateTime? mainDate); if (mainDate.HasValue) { Guid mainDateAttributeId = docAttributes.Where(x => x.Attribute.IsMainDate == true).Single().IdAttribute; doc.DateMain = mainDate; currentProvider.UpdateDateMain(doc.IdDocument, mainDate); logger.Info($"ConvertArchiveConservationEnabled -> IdDocument: {doc.IdDocument} - IdArchive: {archive.IdArchive} - MainDate attribute Id: {mainDateAttributeId} - MainDate value: {mainDate:dd/MM/yyyy HH:mm:ss}"); } } currentProvider.SaveChanges(); }
public ActionResult ExecuteVerify(PreservationVerifyIndexModel postedModel) { return(ActionResultHelper.TryCatchWithLogger(() => { PreservationVerifyExecuteModel model = new PreservationVerifyExecuteModel { fromDate = postedModel.fromDate, toDate = postedModel.toDate }; //crea l'elenco dei job di verifica 1 per conservazione chiusa List <PreservationVerifyJob> jobs = new List <PreservationVerifyJob>(); foreach (Guid idArchive in postedModel.selectedArchives.Select(s => Guid.Parse(s))) { //conservazioni chiuse per archivio DocumentArchive archive = ArchiveService.GetArchive(idArchive); IList <Preservation> preservations = _preservationService.ArchivePreservationClosedInDate(idArchive, postedModel.fromDate, postedModel.toDate.AddDays(1).AddSeconds(-1)); if (preservations.Count > 0) { jobs.AddRange(preservations.Select(p => new PreservationVerifyJob { idArchive = idArchive.ToString(), idPreservation = p.IdPreservation.ToString(), archiveName = archive.Name })); } else { jobs.Add(new PreservationVerifyJob { idArchive = idArchive.ToString(), idPreservation = Guid.Empty.ToString(), archiveName = archive.Name }); } } model.jobs = jobs.ToArray(); return View(model); }, _loggerService)); }
private BindingList <Document> getDocumentsByAttributeValue(string archiveName, string attributeName, string attributeValue, bool?stringContains, int?skip, int?take) { try { // Recupero l'archivio. DocumentArchive archive = ArchiveService.GetArchiveByName(archiveName); // Recupero l'attributo a partire dal suo nome. BindingList <DocumentAttribute> attributes = AttributeService.GetAttributesFromArchive(archive.IdArchive); DocumentAttribute attribute = getAttributeByArchiveAndName(archive, attributeName); DocumentAttributeValue value = new DocumentAttributeValue { Attribute = attribute, Value = attributeValue }; return(getDocumentsByAttributeValue(archive, value, stringContains, skip, take)); } catch (Exception ex) { logger.Error(ex); throw; } }
static void VerifyCacheLimit(object idArchive) { try { logger.InfoFormat("VerifyCacheLimit idArchive: {0}", idArchive); var cache = DbProvider.GetCahceSize(System.Environment.MachineName); DocumentArchive archive = DbProvider.GetArchive((Guid)idArchive); if (cache.GetValueOrDefault() > archive.MaxCache.GetValueOrDefault()) { var toDel = DbProvider.GetDocumentCache(System.Environment.MachineName, 20, 0); foreach (var item in toDel) { logger.InfoFormat("VerifyCacheLimit idArchive: {0} DeleteCache: {1} IdDocument: {2}", idArchive, item.FileName, item.IdDocument); DeleteCache(item, new Document(item.IdDocument)); } } } catch (Exception ex) { logger.Error(ex); } }