コード例 #1
0
 public void RemoveResolution(ResolutionExchange exchange)
 {
     this._resolutions.Add(exchange);
     using var scope   = _scopeFactory.CreateScope();
     using var service = scope.ServiceProvider.GetRequiredService <ResolutionService>();
     service.RemoveResolution(exchange.Resolution);
 }
コード例 #2
0
        public ResolutionExchange CreateResolution(string committeeId, int?roleId = null)
        {
            using var scope   = _scopeFactory.CreateScope();
            using var service = scope.ServiceProvider.GetRequiredService <ResolutionService>();
            var resolution = service.CreateResolutionForCommittee(committeeId, roleId);
            var exchange   = new ResolutionExchange(_scopeFactory)
            {
                Resolution = resolution,
            };

            _resolutions.Add(exchange);
            var args = new ResolutionExchangeUpdatedEventArgs()
            {
                CommitteeId  = committeeId,
                ResolutionId = resolution.ResaElementId,
                Topic        = resolution.Topic,
            };

            ResolutionExchangeUpdated?.Invoke(this, args);
            return(exchange);
        }
コード例 #3
0
        public ResolutionExchange GetResolution(string resolutionId)
        {
            var exchange = _resolutions.FirstOrDefault(n => n.Resolution.ResaElementId == resolutionId);

            if (exchange == null)
            {
                using var scope   = _scopeFactory.CreateScope();
                using var service = scope.ServiceProvider.GetRequiredService <ResolutionService>();

                var resolution = service.GetResolution(resolutionId);
                if (resolution == null)
                {
                    // Resolution not found!
                    return(null);
                }
                else
                {
                    exchange            = new ResolutionExchange(_scopeFactory);
                    exchange.Resolution = resolution;
                    _resolutions.Add(exchange);
                }
            }
            return(exchange);
        }