示例#1
0
        public override IList <DatabaseView> Views(string viewName)
        {
            var views = new Views(Owner, viewName)
                        .Execute(ConnectionAdapter);

            if (string.IsNullOrEmpty(viewName) || !views.Any())
            {
                if (_serverVersion == 0)
                {
                    _serverVersion = new ServerVersion().Execute(ConnectionAdapter);
                }

                var materializedViews = new MaterializedViews(Owner, viewName)
                {
                    ServerVersion = _serverVersion
                };
                var mviews = materializedViews
                             .Execute(ConnectionAdapter);
                foreach (var mview in mviews)
                {
                    views.Add(mview);
                }
            }
            return(views);
        }
        private void AddView(int i)
        {
            if (Views == null)
            {
                Views = new ObservableCollection <ViewModelBase>();
            }
            switch (i)
            {
            case 1:
                if (!Views.Any(x => x.GetType() == typeof(FirstViewModel)))
                {
                    Views.Add(new FirstViewModel());
                }
                break;

            case 2:
                if (!Views.Any(x => x.GetType() == typeof(SecondViewModel)))
                {
                    Views.Add(new SecondViewModel());
                }
                break;

            case 3:
                if (!Views.Any(x => x.GetType() == typeof(ThirdViewModel)))
                {
                    Views.Add(new ThirdViewModel());
                }
                break;
            }
            OnPropertyChanged("Views");
        }
示例#3
0
        private string GetXmlDirectoryFromView()
        {
            if (CurrentView == null || !Views.Any())
            {
                return(null);
            }

            var view = Views.FirstOrDefault(p => p.Item2.Name == CurrentView.Name).Item1;

            view = view?.Split(' ')[0]?.ToLower();
            if (string.IsNullOrEmpty(view?.Trim()))
            {
                return(null);
            }

            var path = "";

            switch (view)
            {
            case "layout":
                path = Globals.Strings.LayoutsDirectory;
                break;

            case "angular":
                path = Globals.Strings.AngularDirectory;
                break;

            default:
                return(null);
            }

            return(path);
        }
示例#4
0
        public override void DoImpl()
        {
            // menu itself will be updated and rearranged elsewhere (by the Editor control)

            if (Views.Any(v => v.Name == _viewName))
            {
                var top = Views.Peek();
                if (top.Name != _viewName)
                {
                    throw new ValidationException(Resources.Views_CanOnlyPopTopView_Message);
                }
                else
                {
                    var oldViewStack = Vault.Metadata["views"];
                    var newViewStack = "[" + Views.Skip(1).Select(v => v.Name).StringJoin() + "]";

                    try
                    {
                        // give view a chance to save this change
                        Vault.Metadata["views"] = newViewStack;

                        top.Discard();
                        Views.Pop();
                    }
                    catch (Exception)
                    {
                        Vault.Metadata["views"] = oldViewStack;
                        throw;
                    }
                }
            }
            else
            {
                var factory = VaultViewFactories.All.Single(v => v.Name == _viewName);
                var view    = factory.Create();

                var oldViewStack = Vault.Metadata["views"];
                var newViewStack = "[" + view.MkArray().Concat(Views).Select(v => v.Name).StringJoin() + "]";

                try
                {
                    // give view a chance to save this change
                    Vault.Metadata["views"] = newViewStack;

                    view.Apply(Ctx);
                    Views.Push(view);
                }
                catch (Exception)
                {
                    Vault.Metadata["views"] = oldViewStack;
                    throw;
                }
            }
        }
        private void InitProcessingDelegatesInfo()
        {
            if (!ModelCreationOptions.HasFlag(GraphSemanticModelCreationOptions.CollectProcessingDelegates))
            {
                IsProcessing = Views.Any(v => v.IsProcessing);
                return;
            }

            var processingViewSymbols = Views.Where(v => v.IsProcessing)
                                        .Select(v => v.Symbol)
                                        .ToImmutableHashSet();

            IsProcessing = processingViewSymbols.Count > 0;

            if (!IsProcessing)
            {
                return;
            }

            _cancellation.ThrowIfCancellationRequested();
            var declaringNodes = Symbol.DeclaringSyntaxReferences
                                 .Select(r => r.GetSyntax(_cancellation));
            var walker = new ProcessingDelegatesWalker(PXContext, processingViewSymbols, _cancellation);

            foreach (var node in declaringNodes)
            {
                walker.Visit(node);
            }

            foreach (var(viewName, paramsDelegateInfo) in walker.ParametersDelegateListByView)
            {
                ViewsByNames[viewName].ParametersDelegates = paramsDelegateInfo.ToImmutableArray();
            }

            _cancellation.ThrowIfCancellationRequested();

            foreach (var(viewName, processDelegateInfo) in walker.ProcessDelegateListByView)
            {
                ViewsByNames[viewName].ProcessDelegates = processDelegateInfo.ToImmutableArray();
            }

            _cancellation.ThrowIfCancellationRequested();

            foreach (var(viewName, finalProcessDelegateInfo) in walker.FinallyProcessDelegateListByView)
            {
                ViewsByNames[viewName].FinallyProcessDelegates = finalProcessDelegateInfo.ToImmutableArray();
            }
        }
        public override IList <DatabaseView> Views(string viewName)
        {
            var views = new Views(Owner, viewName)
                        .Execute(DbConnection, DbTransaction);

            if (string.IsNullOrEmpty(viewName) || !views.Any())
            {
                var mviews = new MaterializedViews(Owner, viewName)
                             .Execute(DbConnection, DbTransaction);
                foreach (var mview in mviews)
                {
                    views.Add(mview);
                }
            }
            return(views);
        }
示例#7
0
        public override IList <DatabaseView> Views(string viewName)
        {
            var views = new Views(CommandTimeout, Owner, viewName)
                        .Execute(ConnectionAdapter);

            if (string.IsNullOrEmpty(viewName) || !views.Any())
            {
                var mviews = new MaterializedViews(CommandTimeout, Owner, viewName)
                             .Execute(ConnectionAdapter);
                foreach (var mview in mviews)
                {
                    views.Add(mview);
                }
            }
            return(views);
        }
示例#8
0
 public bool Any()
 {
     return(HubVariables.Any() ||
            Datajobs.Any() ||
            Datalinks.Any() ||
            Connections.Any() ||
            Tables.Any() ||
            ColumnValidations.Any() ||
            CustomFunctions.Any() ||
            FileFormats.Any() ||
            RemoteAgentHubs.Any() ||
            DatalinkTests.Any() ||
            Views.Any() ||
            Apis.Any() ||
            Dashboards.Any() ||
            ListOfValues.Any() ||
            Tags.Any() ||
            TagObjects.Any());
 }
示例#9
0
 private bool DetectSingleSchema()
 {
     if (Tables.Any(o => o.Schema != DefaultSchema))
     {
         return(false);
     }
     if (Views.Any(o => o.Schema != DefaultSchema))
     {
         return(false);
     }
     if (StoredProcedures.Any(o => o.Schema != DefaultSchema))
     {
         return(false);
     }
     if (Functions.Any(o => o.Schema != DefaultSchema))
     {
         return(false);
     }
     if (Triggers.Any(o => o.Schema != DefaultSchema))
     {
         return(false);
     }
     return(true);
 }
示例#10
0
 private bool CanSaveConfigExecute(object sender)
 {
     return(StoredProcs.Any() || Views.Any() || Tables.Any());
 }
示例#11
0
 //
 public bool UserView(int userId)
 {
     return(Views.Any(x => x.UserID == userId));
 }