protected override void ExecuteMethod() { //диалог var dr = MessageService.ShowYesNoMessageDialog("Подтверждение", "Вы уверены, что хотите удалить выделенный РТЗ?", defaultYes: true); if (dr != MessageDialogResult.Yes) { return; } try { //удаление FileInfo fileInfo = FilesStorageService.FindFile(ViewModel.SelectedShippingCalculationFile.Id, GlobalAppProperties.Actual.ShippingCostFilesPath); File.Delete(fileInfo.FullName); UnitOfWork.Repository <ShippingCostFile>().Delete(ViewModel.SelectedShippingCalculationFile.Model); ViewModel.TechnicalRequrementsTaskWrapper.ShippingCostFiles.Remove(ViewModel.SelectedShippingCalculationFile); //сохранение ViewModel.TechnicalRequrementsTaskWrapper.AcceptChanges(); UnitOfWork.SaveChanges(); } catch (Exception e) { MessageService.ShowOkMessageDialog("Exception", e.PrintAllExceptions()); } ViewModel.SelectedShippingCalculationFile = null; }
protected override void ExecuteMethod() { using (var fdb = new FolderBrowserDialog()) { var result = fdb.ShowDialog(); if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fdb.SelectedPath)) { var taskPath = fdb.SelectedPath; foreach (var requrement in ViewModel.TechnicalRequrementsTaskWrapper.Requrements.Where(x => x.IsActual.HasValue && x.IsActual.Value)) { var reqDirName = $"{requrement.Model.Id} {requrement.SalesUnit.Product.Designation.ReplaceUncorrectSimbols().LimitLengh()} ({requrement.Amount} רע.)"; var dirPath = Path.Combine(taskPath, reqDirName); _fileManagerService.CreateDirectoryPathIfNotExists(dirPath); foreach (var file in requrement.Files.Where(technicalRequrementsFileWrapper => technicalRequrementsFileWrapper.IsActual)) { var storageDirectory = GlobalAppProperties.Actual.TechnicalRequrementsFilesPath; string addToFileName = $"{file.Name.ReplaceUncorrectSimbols().LimitLengh()}"; FilesStorageService.CopyFileFromStorage(file.Id, storageDirectory, dirPath, addToFileName, false); } } Process.Start(taskPath); } } }
protected override void ExecuteMethod() { var storageDirectory = GlobalAppProperties.Actual.TechnicalRequrementsFilesAnswersPath; string addToFileName = $"{ViewModel.SelectedAnswerFile.Name.ReplaceUncorrectSimbols().LimitLengh()}"; FilesStorageService.CopyFileFromStorage(ViewModel.SelectedAnswerFile.Id, storageDirectory, addToFileName: addToFileName); }
public ProgressTrackingController() { CloudStorageAccount cloudStorageAccount; if (CloudStorageAccount.TryParse( ConfigurationManager.ConnectionStrings["AzureStorage"].ConnectionString, out cloudStorageAccount)) { _filesStorageService = new FilesStorageService(cloudStorageAccount); } }
protected override void ExecuteMethod() { try { FilesStorageService.OpenFileFromStorage(ViewModel.SelectedAnswerFile.Id, GlobalAppProperties.Actual.TechnicalRequrementsFilesAnswersPath, ViewModel.SelectedAnswerFile.Name); } catch (Exception e) { MessageService.ShowOkMessageDialog("Exception", e.PrintAllExceptions()); } }
protected override void ExecuteMethod() { try { FilesStorageService.OpenFileFromStorage(GetFileId, GetFilePath, GetFileName); } catch (Exception e) { MessageService.ShowOkMessageDialog("Exception", e.PrintAllExceptions()); } }
protected override void ExecuteMethod() { using (var fdb = new FolderBrowserDialog()) { var result = fdb.ShowDialog(); if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fdb.SelectedPath)) { var targetDirectoryPath = fdb.SelectedPath; foreach (var answerFile in ViewModel.TechnicalRequrementsTaskWrapper.AnswerFiles) { var storageDirectory = GlobalAppProperties.Actual.TechnicalRequrementsFilesAnswersPath; string addToFileName = $"{answerFile.Name.ReplaceUncorrectSimbols().LimitLengh()}"; FilesStorageService.CopyFileFromStorage(answerFile.Id, storageDirectory, targetDirectoryPath, addToFileName, false); } Process.Start("explorer.exe", targetDirectoryPath); } } }
public static void ProcessQueueMessage([ServiceBusTrigger("resizepicturesqueue")] ResizePictureMessage message, TextWriter logger) { var azureStorageConnectionString = ConfigurationManager.ConnectionStrings["AzureWebJobsStorage"].ConnectionString; byte[] data; using (var client = new WebClient()) { data = client.DownloadData(message.PictureReference); } var thumbnail = ImageResizer.CreateThumbnail(Image.FromStream(new MemoryStream(data))); var filesStorageService = new FilesStorageService(azureStorageConnectionString); var uploadedFileUrl = filesStorageService.UploadFile(Guid.NewGuid().ToString(), thumbnail, "image/jpeg").Result; using (var context = new ConstructionsProgressTrackerContext()) { context.ProgressTrackingEntries.Single(e => e.Id == message.Id).ThumbnailPictureReference = uploadedFileUrl; context.SaveChanges(); } logger.WriteLine($"Thumbnail for entry: {message.Id} successfully created. Available at {uploadedFileUrl}."); }
public ProgressTrackingController() { _filesStorageService = new FilesStorageService(ConfigurationManager.ConnectionStrings["AzureStorage"].ConnectionString); }
protected override void ExecuteMethod() { var storageDirectory = GlobalAppProperties.Actual.ShippingCostFilesPath; FilesStorageService.CopyFileFromStorage(ViewModel.SelectedShippingCalculationFile.Id, storageDirectory); }