Ejemplo n.º 1
0
        public Configures_Tables(Oe.Folder_Tables o)
            : this()
        {
            this.Tables = o;

            var cfgs = WMain.Instance.Configures.FindAll(a =>
            {
                return((int)(a.TargetSqlElementType & SqlElementTypes.Tables) > 0 && a.Validate(o));
            });

            foreach (var cfg in cfgs)
            {
                _Configures_StackPanel.Children.Add(new Label
                {
                    Content = (string)cfg.Properties[GenProperties.Caption]
                    ,
                    ToolTip = (string)cfg.Properties[GenProperties.Tips]
                });
            }
        }
Ejemplo n.º 2
0
        public Oe.Database Fill(Oe.Database oedb)
        {
            SetDataLimit();
            oedb.Folders.Clear();
            var db = this.Server.Databases[oedb.Text];  // todo: check exists


            var sf = new Oe.Folder_Schemas {
                Parent = oedb, Text = "Schemas", Tag = db.Schemas
            };

            sf.Schemas.AddRange(
                from Schema o in db.Schemas
                where o.IsSystemObject == false || o.Name == "dbo"
                select new Oe.Schema
            {
                Parent = sf,
                Text   = o.Name,
                Tag    = o,
                Name   = o.Name,
                Owner  = o.Owner
            });
            oedb.Folders.Add(sf);



            var tf = new Oe.Folder_Tables {
                Parent = oedb, Text = "Tables", Tag = db.Tables
            };

            tf.Tables.AddRange(
                from Table o in db.Tables
                where o.IsSystemObject == false
                select new Oe.Table
            {
                Parent     = tf,
                Text       = o.Schema + "." + o.Name,
                Tag        = o,
                Name       = o.Name,
                Schema     = o.Schema,
                Owner      = o.Owner,
                CreateDate = o.CreateDate
            });
            oedb.Folders.Add(tf);



            var vf = new Oe.Folder_Views {
                Parent = oedb, Text = "Views", Tag = db.Views
            };

            vf.Views.AddRange(
                from View o in db.Views
                where o.IsSystemObject == false
                select new Oe.View
            {
                Parent     = vf,
                Text       = o.Schema + "." + o.Name,
                Tag        = o,
                Name       = o.Name,
                Schema     = o.Schema,
                Owner      = o.Owner,
                CreateDate = o.CreateDate
            });
            oedb.Folders.Add(vf);



            var ff = new Oe.Folder_UserDefinedFunctions {
                Parent = oedb, Text = "UserDefinedFunctions", Tag = db.UserDefinedFunctions
            };

            ff.UserDefinedFunctions.AddRange(
                from UserDefinedFunction o in db.UserDefinedFunctions
                where o.IsSystemObject == false
                select o.FunctionType == UserDefinedFunctionType.Table ?
                (Oe.UserDefinedFunctionBase) new Oe.UserDefinedFunction_Table
            {
                Parent     = ff,
                Text       = o.Schema + "." + o.Name,
                Tag        = o,
                Name       = o.Name,
                Schema     = o.Schema,
                Owner      = o.Owner,
                CreateDate = o.CreateDate
            } :
                (Oe.UserDefinedFunctionBase) new Oe.UserDefinedFunction_Scale
            {
                Parent     = ff,
                Text       = o.Name,
                Tag        = o,
                Name       = o.Name,
                Schema     = o.Schema,
                Owner      = o.Owner,
                CreateDate = o.CreateDate
            });
            oedb.Folders.Add(ff);



            var spf = new Oe.Folder_StoredProcedures {
                Parent = oedb, Text = "StoredProcedures", Tag = db.StoredProcedures
            };

            spf.StoredProcedures.AddRange(
                from StoredProcedure o in db.StoredProcedures
                where o.IsSystemObject == false
                select new Oe.StoredProcedure
            {
                Parent     = spf,
                Text       = o.Schema + "." + o.Name,
                Tag        = o,
                Name       = o.Name,
                Schema     = o.Schema,
                Owner      = o.Owner,
                CreateDate = o.CreateDate
            });
            oedb.Folders.Add(spf);



            var ttf = new Oe.Folder_UserDefinedTableTypes {
                Parent = oedb, Text = "UserDefinedTableTypes", Tag = db.UserDefinedTableTypes
            };

            ttf.UserDefinedTableTypes.AddRange(
                from UserDefinedTableType o in db.UserDefinedTableTypes
                select new Oe.UserDefinedTableType
            {
                Parent     = ttf,
                Text       = o.Schema + "." + o.Name,
                Tag        = o,
                Name       = o.Name,
                Schema     = o.Schema,
                Owner      = o.Owner,
                CreateDate = o.CreateDate
            });
            oedb.Folders.Add(ttf);



            return(oedb);
        }