コード例 #1
0
ファイル: QueryViewUpdater.cs プロジェクト: xixiky/xms
        public bool Update(Domain.QueryView entity)
        {
            var original = _queryViewRepository.FindById(entity.QueryViewId);

            entity.ModifiedBy = _currentUser.SystemUserId;
            entity.ModifiedOn = DateTime.Now;
            var result = true;

            using (UnitOfWork.Build(_queryViewRepository.DbContext))
            {
                result = _queryViewRepository.Update(entity);
                _dependencyService.Update(entity);
                //localization
                _localizedLabelService.Update(entity.Name.IfEmpty(""), "LocalizedName", entity.QueryViewId, _appContext.BaseLanguage);
                _localizedLabelService.Update(entity.Description.IfEmpty(""), "Description", entity.QueryViewId, _appContext.BaseLanguage);
                //assigning roles
                if (original.AuthorizationEnabled || !entity.AuthorizationEnabled)
                {
                    _eventPublisher.Publish(new AuthorizationStateChangedEvent
                    {
                        ObjectId = new List <Guid> {
                            entity.QueryViewId
                        }
                        ,
                        State = false
                        ,
                        ResourceName = QueryViewDefaults.ModuleName
                    });
                }
                //set to cache
                _cacheService.SetEntity(entity);
            }
            return(result);
        }
コード例 #2
0
ファイル: QueryViewFinder.cs プロジェクト: zzdxpq007/xms
        public Domain.QueryView FindById(Guid id)
        {
            var dic = new Dictionary <string, string>();

            dic.Add("QueryViewId", id.ToString());
            Domain.QueryView entity = _cacheService.Get(dic, () =>
            {
                return(_queryViewRepository.FindById(id));
            });
            if (entity != null)
            {
                WrapLocalizedLabel(entity);
            }
            return(entity);
        }