public TorreHanoiApplicationService(ITorreHanoiDomainService domainService, ILogger log, IDesignerService designerService) { _domainService = domainService; _adpterTorreHanoi = new TorreHanoiAdapter(); _log = log; _designerService = designerService; }
private void LoadAndSaveConfiguration(string directory, string configName, IDesignerService service) { FilesGroup filesGroup = service.GetConfigFilesForExport(); filesGroup.MainFile = configName; CommandInvoker invoker = new CommandInvoker(); invoker.AddCommand(new ExportConfigurationCommand(string.Format("Экспорт файлов конфигурации: {0}", configName), directory, filesGroup, service)); invoker.AddCommand( new ExportHardwareEquipmentSourceCommand("Экспорт аппаратных источников", _remotePresentationClient, _standalonePresentationClient)); CommandInvoker.Execute(invoker); }
public CandidateController(INotificationHandler <DomainNotification> notifications, IPeopleService peopleService, IBestWorkTimeService bwtService, IOccupationService occupationService, IWorkAvailabilityService waService, IDesignerService designerService, IDeveloperService developerService, IKnowledgeService knowledgeService) : base(notifications) { this.peopleService = peopleService; this.bwtService = bwtService; this.waService = waService; this.occupationService = occupationService; this.designerService = designerService; this.developerService = developerService; this.knowledgeService = knowledgeService; }
public void SetUp() { var mockLogger = new Mock <ILogger>(); mockLogger.Setup(s => s.Logar(It.IsAny <string>(), It.IsAny <TipoLog>())); _domainService = new Mock <ITorreHanoiDomainService>(); _domainService.Setup(s => s.Criar(It.IsAny <int>())).Returns(Guid.NewGuid); _domainService.Setup(s => s.ObterPor(It.IsAny <Guid>())).Returns(() => new global::Domain.TorreHanoi.TorreHanoi(3, mockLogger.Object)); _domainService.Setup(s => s.ObterTodos()).Returns(() => new List <global::Domain.TorreHanoi.TorreHanoi> { new global::Domain.TorreHanoi.TorreHanoi(3, mockLogger.Object) }); _designerService = new DesignerService(); }
public void Export(IDesignerService service) { // получаем имя файла - куда будет сохранена конфигурация string configFileName = GetConfigurationFile(_config); if (string.IsNullOrEmpty(configFileName)) return; //загружаем все необходимые файлы с сервера и сохраняем на клиенте try { LoadAndSaveConfiguration(_config.ConfigurationFolder, configFileName, service); //ExportConfigurationController.Instanse.SuccessMessage("Экспорт конфигурации успешно завершен"); _successMessageDelegate.Invoke("Экспорт конфигурации успешно завершен"); } catch (Exception ex) { _config.EventLog.WriteError(string.Format("ImportExport.LoadAndSaveConfiguration: \n{0}", ex)); //ExportConfigurationController.Instanse.ErrorMessage(string.Format("При экспорте конфигурации произошла неизвестная ошибка: {0}", ex)); _errorMessageDelegate.Invoke(string.Format("При экспорте конфигурации произошла неизвестная ошибка: {0}", ex)); } }
public void Export(PresentationInfo[] presentationInfos, IDesignerService designerService) { if (presentationInfos == null || presentationInfos.Length == 0) return; try { //if (!ExportPresentationController.Instanse.ConfirmExport(presentationInfos.Select(pi => pi.Name))) // return; string newPresentationName; if (!_exportPresentationController.ConfirmExport(_config.ScenarioFolder, "*.xml", presentationInfos.Select(pi => pi.Name), out newPresentationName)) return; CommandInvoker invoker = new CommandInvoker(); //IContinue isContinue = // ExportPresentationController.Instanse.GetUserInteractive(presentationInfos.Length == 1); IContinue isContinue = _exportPresentationController.GetUserInteractive(presentationInfos.Length == 1); // сначала экспортируем схемы для презентации ExportPresentationSchemaFilesCommand exportPresentationSchemaFilesCommand = new ExportPresentationSchemaFilesCommand(string.Format("экспорт файлов-схем для сценария"), _remotePresentationClient, _config.ScenarioFolder); invoker.AddCommand(exportPresentationSchemaFilesCommand); // теперь для каждой презентации своя команда //List<TechnicalServices.Common.Command> presentationExportCommandList = // new List<TechnicalServices.Common.Command>(presentationInfos.Length); foreach (PresentationInfo presentationInfo in presentationInfos) { //presentationExportCommandList.Add( Command exportPresentationCommand = new ExportPresentationCommand(string.Format("Экспорт сценария {0}", presentationInfo.Name), presentationInfo, presentationInfos.Length == 1 ? newPresentationName : null, _remotePresentationClient, _standalonePresentationClient, new Func<string, bool>(isContinue.Continue)); invoker.AddCommand(exportPresentationCommand); } // экспорт глобальных сорсов ExportGlobalSourcesCommand exportGlobalSourcesCommand = new ExportGlobalSourcesCommand("Экспорт глобальных источников", _remotePresentationClient, _standalonePresentationClient); invoker.AddCommand(exportGlobalSourcesCommand); // выполняем bool isSuccess = CommandInvoker.Execute(invoker); //ExportPresentationController.Instanse.SuccessMessage("Экспорт презентаций успешно завершен"); if (isSuccess) _exportPresentationController.SuccessMessage("Экспорт сценариев успешно завершен"); } catch (InterruptOperationException) { _exportPresentationController.ErrorMessage(string.Format("Экспорт сценариев был прерван пользователем")); //ExportPresentationController.Instanse.ErrorMessage( // string.Format("Экспорт сценариев был прерван пользователем")); } catch (Exception ex) { _exportPresentationController.ErrorMessage(string.Format("При экспорте сценариев произошла неизвестная ошибка: {0}", ex)); //ExportPresentationController.Instanse.ErrorMessage( // string.Format("При экспорте сценариев произошла неизвестная ошибка: {0}", ex)); } }
public DesignerController(INotificationHandler <DomainNotification> notifications, IMediatorHandler mediator , IDesignerService designerService) : base(notifications, mediator) { this.designerService = designerService; }