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); } }