public ActionResult Foil(int controlNumber) { DocumentsManager Dm = new DocumentsManager(Response); Dm.InscriptionFoil(controlNumber); return(null); }
public BenchConfigWindow(MainWindow mainWindow) { InitializeComponent(); _mainWindow = mainWindow; Left = (_mainWindow.Left + _mainWindow.Width) - Width; Top = _mainWindow.Top; DocsManager = new DocumentsManager(mainWindow.App); Topmost = true; string[] lines = File.ReadAllLines($@"{_defaultConfigPath}\{_typesLisseFile}"); _lisses = lines.Skip(2).Select(line => $"{line.Split(';')[0]}").ToList(); lines = File.ReadAllLines($@"{_defaultConfigPath}\{_pateresLisseSapinFile}"); _pateresLisseSapin = lines.Skip(2).Select(line => $"{line.Split(';')[0]}").ToList(); LoadComboFromFile(LisseCombo, _typesLisseFile); LoadComboFromFile(LameCombo, _typesBoisFile); LoadComboFromFile(PatereTypeCombo, _pateresLisseSapinFile); LoadColoringComboFromFile(LisseColoringCombo, _configColorFile); LoadColoringComboFromFile(ConsoleColoringCombo, _configColorFile); LoadColoringComboFromFile(PatereColoringCombo, _standardPatereFile); SelectCombos(); Loaded += (e, s) => WriteConfigToFile(); }
public async Task <IActionResult> Delete( [FromServices] DocumentsManager manager, [FromServices] FileStorageProvider fileStorageProvider, [FromForm] long key, [FromHeader] Guid personUniqueId, [FromQuery] string uniqueCode) { using (var attachmentsRep = new Repository <DocumentAttachment>(_provider)) { var documentRep = new Repository <Document>(attachmentsRep); var document = documentRep.Get(x => x.UniqueCode == uniqueCode && x.SenderPerson.UniqueId == personUniqueId).FirstOrDefault(); if (document == null) { return(Json(ApiResponse.Failed(ApiErrorCode.ValidationError, "Невозможно удалить файлы не привязанные к документу"))); } var savedAttachment = attachmentsRep.Get(x => x.Id == key && x.Document.Id == document.Id).FirstOrDefault(); if (savedAttachment == null) { return(Json(ApiResponse.Failed(ApiErrorCode.ValidationError, "Невозможно удалить файлы не привязанные к документу"))); } await attachmentsRep.DeleteAsync(savedAttachment); await _historyManager.WriteEntry(document, document.SenderPerson, $"Файл: {savedAttachment.FileName} - удален", attachmentsRep); await attachmentsRep.CommitAsync(); var bucket = fileStorageProvider.GetDocumentBucket(); await bucket.DeleteAsync(new ObjectId(savedAttachment.StorageId)); } return(Json(ApiResponse.Success(true))); }
public ActionResult Foil() { DocumentsManager Dm = new DocumentsManager(Response); Dm.InscriptionFoil(Convert.ToInt32(Session["controlNumber"])); return(null); }
public void SaveDocumentInsert_FailDeliverableIDDoesNotExist() { bool exceptionCaught = false; string errorMsg = string.Empty; string deliverableIdPartialErrorMsg = "Deliverable Id"; //Arrange DocumentUploadViewModel testDocViewModel = new DocumentUploadViewModel() { FileExtension = "1234567890123456789012345", // > 25 chars DocumentAccessTypeId = 1 //DEPT }; //Act try { var docManager = new DocumentsManager(mockDocumentService.Object, mockUserService.Object, mockDropDownListService.Object); docManager.Save(testDocViewModel); } catch (Exception ex) { exceptionCaught = true; errorMsg = ex.Message; } //Assert Assert.IsTrue(exceptionCaught); Assert.IsTrue(errorMsg.Contains(deliverableIdPartialErrorMsg)); }
public DAOJson() { DocumentsManager docManager = new DocumentsManager(); docManager.LoadDocument(); this.PATH = DocumentsManager.PATH; _log = new AdpSerilog(); }
public async Task <IActionResult> CreateOther( [FromHeader] Guid personUniqueId, [FromBody] CreateDocumentRequest <OtherDocumentDetail> model, [FromServices] DocumentsManager manager) { var documentId = await manager.CreateDocumentAsync(User.Identity.Name, personUniqueId, model); return(Json(new ApiResponse <string>(documentId))); }
public async Task <IActionResult> DownloadPackage( [FromQuery] Guid personUniqueId, [FromQuery] string documentUniqueId, [FromServices] DocumentsManager manager) { var packageBytes = await manager.CreatePackageAsync(User.Identity.Name, personUniqueId, documentUniqueId); return(File(packageBytes, "application/zip", $"{documentUniqueId}.zip")); }
public async Task <IActionResult> Attachments( [FromHeader] Guid personUniqueId, [FromQuery] string documentUniqueId, [FromServices] DocumentsManager manager) { var attachments = await manager.GetAttachmentsAsync(User.Identity.Name, personUniqueId, documentUniqueId); return(Json(ApiResponse.Success(attachments))); }
public async Task <IActionResult> Retired( [FromHeader] Guid personUniqueId, [FromQuery] string documentUniqueId, [FromServices] DocumentsManager manager) { await manager.RetireDocumentAsync(User.Identity.Name, personUniqueId, documentUniqueId); return(Json(new ApiResponse <bool>(true))); }
public async Task <IActionResult> UploadAndValidatePackage( [FromServices] ICryptoProviderService cryptoProvider, [FromServices] DocumentsManager manager, IFormFile attachmentFile) { var result = await manager.UploadAndValidatePackageAsync(cryptoProvider, attachmentFile); return(Json(ApiResponse.Success(result))); }
public void CleanTest() { DocumentsManager docManager = new DocumentsManager(TipoFichero.TXT); File.Delete(docManager.GetPath()); docManager.tipo = TipoFichero.JSON; File.Delete(docManager.GetPath()); docManager.tipo = TipoFichero.XML; File.Delete(docManager.GetPath()); }
private void MoveDocument(int docId, int path) { var document = DocumentsManager.GetDocumentByID(docId, true); DocumentsManager.MoveDocumentToNextStep(new MoveDocumentToNextStepParams(document, path) { ForceCheckout = true, SkipPermissionsCheck = true });; }
public async Task <IActionResult> SendToSign( [FromHeader] Guid personUniqueId, [FromQuery] string documentUniqueId, [FromBody] SignedDraftModel model, [FromServices] DocumentsManager manager, [FromServices] ICryptoProviderService cryptoProvider) { await manager.SignDocumentAsync(User.Identity.Name, personUniqueId, documentUniqueId, model.Signature, cryptoProvider); return(Json(new ApiResponse <bool>(true))); }
public async Task <IActionResult> GetXml( [FromHeader] Guid personUniqueId, [FromQuery] string documentUniqueId, [FromServices] DocumentsManager manager) { var xml = await manager.GenerateXmlAsync(User.Identity.Name, documentUniqueId); var base64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(xml.Data)); return(Json(ApiResponse.Success(base64))); }
public async Task <IActionResult> DownloadFile( [FromQuery] Guid personUniqueId, [FromQuery] string uniqueCode, [FromQuery] long fileId, [FromServices] DocumentsManager manager) { var customFile = await manager.GetFileAsync(User.Identity.Name, personUniqueId, uniqueCode, fileId); var ms = new MemoryStream(customFile.FileContents); return(File(ms, customFile.ContentType, customFile.FileName)); }
public async Task <IActionResult> Get( [FromQuery] DocumentGroupTypeEnum documentGroupType, [FromQuery] DocumentStatusEnum documentStatus, [FromHeader] Guid personUniqueId, [FromQuery] DataSourceLoadOptionsImpl options, [FromServices] DocumentsManager manager) { using (var repository = new Repository <Document>(_provider)) { var query = await manager.GetMyDocumentsAsync(User.Identity.Name, personUniqueId, documentGroupType, documentStatus, repository); return(this.JsonEx(DataSourceLoader.Load(query, options))); } }
public async Task <IActionResult> Card( [FromHeader] Guid personUniqueId, [FromQuery] string documentUniqueId, [FromServices] DocumentsManager manager) { var card = await manager.GetDocumentCardAsync(User.Identity.Name, personUniqueId, documentUniqueId); if (card == null) { return(Json(ApiResponse.Failed(ApiErrorCode.ResourceNotFound, $"Документ с номером {documentUniqueId} не найден"))); } return(Json(ApiResponse.Success(card))); }
public void TestInit() { _log.Info("Inicialiazamos Tests"); _log.Debug("Limpiamos de ficheros existentes"); DocumentsManager docMan = new DocumentsManager(TipoFichero.JSON); String filename = docMan.GetPath(); if (File.Exists(filename)) { File.Delete(filename); } _log.Debug("Obtenemos el alumno DAO con el formato actual."); iAlumnoDao = new AlumnoDao <Alumno>(DAOFactory <Alumno> .getFormat()); }
public void InitTest() { DocumentsManager docManager = new DocumentsManager(TipoFichero.TXT); if (File.Exists(docManager.GetPath())) { File.Delete(docManager.GetPath()); } docManager.tipo = TipoFichero.JSON; if (File.Exists(docManager.GetPath())) { File.Delete(docManager.GetPath()); } docManager.tipo = TipoFichero.XML; if (File.Exists(docManager.GetPath())) { File.Delete(docManager.GetPath()); } }
private void treeControl1_NodeExpanded(object sender, UserControls.TreeControl.ContainerEventArgs e) { FoldersManager manager = new FoldersManager(); ((FolderVO)e.Node).Folders = manager.GetSubFoldersOfFolder((FolderVO)e.Node); DocumentsManager manager1 = new DocumentsManager(); ((FolderVO)e.Node).Documents = manager1.GetDocumentsOfFolder((FolderVO)e.Node); //Trash DocumentDetailsListItem temp; flowLayoutPanel1.Controls.Clear(); foreach (DocumentVO doc in (e.Node as FolderVO).Documents) { temp = new DocumentDetailsListItem(); temp.Document = doc; temp.HighlightColor = Color.Azure; flowLayoutPanel1.Controls.Add(temp); } }
public DAOXml() { docManager = new DocumentsManager(); docManager.LoadDocument(); }
public async Task <IActionResult> AddFileToDocument(IFormFile attachmentFile, [FromHeader] Guid personUniqueId, [FromQuery] string uniqueCode, [FromServices] FileStorageProvider fileStorageProvider, [FromServices] DocumentsManager manager) { var existAttachmentFile = await manager.CheckExistAttachmentFile(User.Identity.Name, uniqueCode, personUniqueId, attachmentFile); if (existAttachmentFile) { return(Json(ApiResponse.Success(false))); } var bucket = fileStorageProvider.GetDocumentBucket(); var fileStream = new MemoryStream(); await attachmentFile.CopyToAsync(fileStream); var metadata = new AttachmentFileMetadata { FileName = attachmentFile.FileName, ContentType = attachmentFile.ContentType, Size = fileStream.Length, Uploaded = DateTime.Now, ContentHash = Helper.CalculateSha1Hash(fileStream.ToArray()) }; fileStream.Position = 0; var id = await bucket.UploadFromStreamAsync(attachmentFile.FileName, fileStream, new GridFSUploadOptions() { Metadata = metadata.ToBsonDocument() }); var result = await manager.AddAttachmentFileToDraft(User.Identity.Name, uniqueCode, personUniqueId, new FileAttachmentResponse { FileId = id.ToString(), FileName = attachmentFile.FileName }); return(Json(ApiResponse.Success(result))); }
// Handle Notiications recieved via oneSignal and take appropriate actions private static async void HandleNotificationOpened(OSNotificationOpenedResult result) { OSNotificationPayload payload = result.notification.payload; Dictionary <string, object> additionalData = payload.additionalData; string message = payload.body; string actionID = result.action.actionID; var extraMessage = "Notification opened with text: " + message; if (additionalData != null) { string id = ""; // the id of the object to open string kind = ""; // the kind of object the id belongs to and take relevant action to open page based on this if (additionalData.ContainsKey("id")) { id = (additionalData["id"].ToString()); } if (additionalData.ContainsKey("kind")) { kind = (additionalData["kind"].ToString()); } switch (kind) { case "Document": { Document obj; if (await CrossConnectivity.Current.IsRemoteReachable("https://www.google.com")) { obj = await DocumentsManager.GetAsync(id); } else { obj = await new StorageService <Document>().GetItemAsync(id); } if (obj != null) { await(tabbedNavigation._tabs[0].BindingContext as FreshBasePageModel).CoreMethods.PushPageModel <AddDocumentViewModel>(obj, true, Device.RuntimePlatform == Device.iOS); } break; } case "Teledeclaration": { Teledeclaration obj; if (await CrossConnectivity.Current.IsRemoteReachable("https://www.google.com")) { obj = await TeledeclarationsManager.GetAsync(id); } else { obj = await new StorageService <Teledeclaration>().GetItemAsync(id); } if (obj != null) { await(tabbedNavigation._tabs[0].BindingContext as FreshBasePageModel).CoreMethods.PushPageModel <TeledeclarationSecureActionViewModel>(obj, true, true); } break; } case "Ordonnance": { Ordonnance obj; if (await CrossConnectivity.Current.IsRemoteReachable("https://www.google.com")) { obj = await OrdonnanceManager.GetAsync(id); } else { obj = await new StorageService <Ordonnance>().GetItemAsync(id); } if (obj != null) { if (tabbedNavigation != null) { await tabbedNavigation.SwitchSelectedRootPageModel <OrdonnancesListViewModel>(); } await(tabbedNavigation._tabs[2].BindingContext as FreshBasePageModel).CoreMethods.PushPageModel <OrdonnanceCreateEditViewModel>(obj, true); } break; } case "InvoiceToSecure": { if (await CrossConnectivity.Current.IsRemoteReachable("https://www.google.com")) { var request = new GetListRequest(20, 1, sortField: "createdAt", sortDirection: SortDirectionEnum.Desc); var invoices = await InvoicesManager.GetListAsync(request); if (invoices != null && invoices.rows != null && invoices.rows.Count > 0) { var invoice = invoices.rows.First(); if (invoice.FilePath.Contains(".pdf")) { await(tabbedNavigation._tabs[0].BindingContext as FreshBasePageModel).CoreMethods.PushPageModel <SecuriseBillsViewModel>(invoice, true); } else { await(tabbedNavigation._tabs[0].BindingContext as FreshBasePageModel).CoreMethods.PushPageModel <OrdonnanceViewViewModel>(invoice, true); } } } break; } default: break; } } }
public DAOTxt() { DocumentsManager docManager = new DocumentsManager(); docManager.LoadDocument(); _log = new AdpSerilog(); }