public Guid SendCommandUpdateData(Guid idRepository, Guid idUDS, Guid correlationId, UDSModel model) { CommandFacade <ICommandUpdateUDSData> commandFacade = new CommandFacade <ICommandUpdateUDSData>(); IdentityContext identity = new IdentityContext(DocSuiteContext.Current.User.FullUserName); UDSBuildModel commandModel = CreateUDSCommandModel(idRepository, idUDS, model); ICommandUpdateUDSData commandUpdate = new CommandUpdateUDSData(correlationId, CurrentTenant.TenantName, CurrentTenant.UniqueId, CurrentTenant.TenantAOO.UniqueId, identity, commandModel); commandFacade.Push(commandUpdate); return(commandUpdate.Id); }
private void ConfirmRepository(UDSModel model, DateTimeOffset activeDate, Guid idRepository) { if (idRepository.Equals(Guid.Empty)) { throw new ArgumentNullException("idRepository"); } UDSSchemaRepositoryModelMapper repositoryschemaModelMapper = new UDSSchemaRepositoryModelMapper(); UDSRepositoryModelMapper repositoryModelMapper = new UDSRepositoryModelMapper(repositoryschemaModelMapper); UDSBuildModel commandModel = new UDSBuildModel(model.SerializeToXml()); IdentityContext identity = new IdentityContext(DocSuiteContext.Current.User.FullUserName); string tenantName = DocSuiteContext.Current.ProtocolEnv.CorporateAcronym; Guid tenantId = DocSuiteContext.Current.CurrentTenant.TenantId; WebAPIDto <UDSRepository> resultDto = null; WebAPIImpersonatorFacade.ImpersonateFinder(Currentfinder, (impersonationType, finder) => { finder.UniqueId = idRepository; finder.EnablePaging = false; finder.ExpandProperties = true; finder.ActionType = UDSRepositoryFinderActionType.FindElement; resultDto = finder.DoSearch().FirstOrDefault(); finder.ResetDecoration(); }); UDSRepository repository = resultDto.Entity; commandModel.UDSRepository = repositoryModelMapper.Map(repository, new UDSRepositoryModel()); commandModel.ActiveDate = activeDate; commandModel.UniqueId = repository.UniqueId; commandModel.RegistrationUser = repository.RegistrationUser; if (repository.Version > 0) { ICommandUpdateUDS commandUpdate = new CommandUpdateUDS(CurrentTenant.TenantName, CurrentTenant.UniqueId, CurrentTenant.TenantAOO.UniqueId, identity, commandModel); CommandFacade <ICommandUpdateUDS> commandUpdateFacade = new CommandFacade <ICommandUpdateUDS>(); commandUpdateFacade.Push(commandUpdate); } else { ICommandCreateUDS commandInsert = new CommandCreateUDS(CurrentTenant.TenantName, CurrentTenant.UniqueId, CurrentTenant.TenantAOO.UniqueId, identity, commandModel); CommandFacade <ICommandCreateUDS> commandCreateFacade = new CommandFacade <ICommandCreateUDS>(); commandCreateFacade.Push(commandInsert); } }
/// <summary> /// Konstruktor. /// </summary> /// <param name="viewManager">Obiekt menadżera widoków.</param> /// <param name="view">Obiekt widoku zarządzanego przez prezentera.</param> /// <param name="subtitlesManager">Obiekt modelu menadżera plików.</param> /// <param name="commandFacade"></param> public ToolbarPresenter(IViewManager viewManager, IToolbarView view, SubtitlesManager subtitlesManager, CommandFacade commandFacade) : base(viewManager, view) { this.subtitlesManager = subtitlesManager; this.commandFacade = commandFacade; }
static void Main(string[] args) { Console.WriteLine("Добрый день."); #region while (true) { Console.WriteLine($"Пожалуйста, введите команду, либо {CommandNames.Help} для вызова списка и описания команд..."); var enteringCommand = Console.ReadLine(); var commandTypeAndArguments = enteringCommand.Trim().Split(" ", 2); var commandType = commandTypeAndArguments[0].Trim(); if (commandType.Equals(CommandNames.End)) { break; } switch (commandType) { case CommandNames.Help: CommandFacade.Help(); break; case CommandNames.Add: if (commandTypeAndArguments.Length > 1) { try { var commandArguments = FormatCommandKeyValuePairsOfArguments(commandTypeAndArguments[1].Trim().Split("/")); CommandFacade.Add(commandArguments); } catch (Exception e) { Console.WriteLine(e); } } break; case CommandNames.Delete: if (commandTypeAndArguments.Length > 1) { try { var commandArguments = FormatCommandKeyValuePairsOfArguments(commandTypeAndArguments[1].Trim().Split("/")); CommandFacade.Delete(commandArguments); } catch (Exception e) { Console.WriteLine(e); } } break; case CommandNames.Update: if (commandTypeAndArguments.Length > 1) { try { var commandArguments = FormatCommandKeyValuePairsOfArguments(commandTypeAndArguments[1].Trim().Split("/")); CommandFacade.Update(commandArguments); } catch (Exception e) { Console.WriteLine(e); } } break; case CommandNames.Find: if (commandTypeAndArguments.Length > 1) { try { var commandArguments = FormatCommandKeyValuePairsOfArguments(commandTypeAndArguments[1].Trim().Split("/")); CommandFacade.Find(commandArguments); } catch (Exception e) { Console.WriteLine(e); } } break; default: Console.WriteLine("Не удалось корректно определить команду."); break; } } #endregion }
/// <summary> /// Executes a CliCommands implementation /// </summary> /// <typeparam name="C">The type of the class implementing BaseCliCommands</typeparam> /// <param name="commands">An instance of the class implementing BaseCliCommands</param> /// <param name="args">The CLI arguments input</param> public static C Execute <C>(C commands, string[] args) where C : BaseCliCommands { return(CommandFacade.Execute(commands, args)); }