private void ShowDocumentCommandExecuted(ReportModel obj) { var appPath = (string)ApplicationSettings.Read("DocumentsPath"); var exportPath = string.Concat(appPath, obj.Report.Path); if (File.Exists(exportPath)) { Process.Start(exportPath); } else { PopupService.ShowMessage("File not found", MessageType.Failed); } }
private void AddFileFromHdd(string path) { var appPath = (string)ApplicationSettings.Read("DocumentsPath"); var filePath = Path.GetFileName(path); var fullPath = string.Concat(appPath, filePath); try { if (File.Exists(fullPath)) File.Delete(fullPath); File.Copy(path, fullPath); var report = new ReportModel(new Report() { ID = Guid.NewGuid(), EventID = _event.Event.ID, Date = DateTime.Now, Name = Path.GetFileNameWithoutExtension(path), Path = filePath }); _event.Reports.Insert(0, report); _eventDataUnit.ReportsRepository.Add(report.Report); _event.RefreshReports(); // update Updates table var update = new EventUpdate() { ID = Guid.NewGuid(), EventID = _event.Event.ID, Date = DateTime.Now, UserID = AccessService.Current.User.ID, Message = Resources.MESSAGE_FUNCTION_SHEET_WAS_CREATED, OldValue = null, NewValue = report.Name, ItemId = report.Report.ID, ItemType = "EventReport", Field = "DocumentUpload", Action = UpdateAction.Added }; _eventDataUnit.EventUpdatesRepository.Add(update); var document = new Document() { ID = report.Report.ID, EventID = _event.Event.ID, Path = filePath, Name = Path.GetFileNameWithoutExtension(path), IsEnabled = true, IsCommon = false }; _event.Documents.Add(document); _eventDataUnit.DocumentsRepository.Add(document); } catch (Exception ex) { PopupService.ShowMessage(ex.Message, MessageType.Failed); } }