Example #1
0
        public static async Task <GroupPermission> Get(GroupPermission group, DBSchemaItem item)
        {
            PermissionType type = GetPermissionType(item, out string code, out string name);

            var list = DBTable.Select(DBTable.CodeKey, CompareType.Equal, code).ToList();

            var permission = list.FirstOrDefault();

            if (list.Count > 1)
            {
                await permission.Merge(list);
            }

            if (permission == null)
            {
                permission = new GroupPermission()
                {
                    Type = type,
                    Code = code
                };
                permission.Attach();
            }
            if (string.IsNullOrEmpty(permission.ObjectName))
            {
                permission.ObjectName = name;
            }
            item.Access = permission.Access;

            if (group != null)
            {
                permission.Parent = group;
            }

            return(permission);
        }
Example #2
0
        protected virtual void EditNode(TreeNode node)
        {
            DBSchemaItemRef itemref  = (DBSchemaItemRef)node.Tag;
            string          fullname = itemref.ToString();

            if (this.tabControl1.TabPages.ContainsKey(fullname))
            {
                this.tabControl1.SelectedTab = this.tabControl1.TabPages[fullname];
            }
            else
            {
                ISchemaEditor editor = this.GetSchemaEditor(itemref);
                if (editor != null)
                {
                    try
                    {
                        DBSchemaItem item = this.provider.GetSchema(itemref);
                        editor.Item = item;

                        Control ctl  = editor.UIControl;
                        string  full = itemref.ToString();
                        this.tabControl1.TabPages.Add(full, itemref.Name);
                        TabPage pg = this.tabControl1.TabPages[full];
                        Perceiveit.Data.SchemaTests.Controls.EditorWraper wrapper = new Perceiveit.Data.SchemaTests.Controls.EditorWraper();
                        wrapper.InnerEditor   = editor;
                        wrapper.RequestClose += new EventHandler(wrapper_RequestClose);
                        pg.Controls.Add(wrapper);
                        ctl.Dock     = DockStyle.Fill;
                        wrapper.Dock = DockStyle.Fill;
                        this.tabControl1.SelectedTab = pg;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Could not load the schema editor :" + ex.Message + "\r\n\r\n" + ex.StackTrace);
                    }
                }
            }
        }
Example #3
0
        //
        // DoGenerateCreateScript + support methods
        //

        protected override string DoGenerateCreateScript(DBSchemaTypes type, DBSchemaItem schema, DBQuery script, DBStatementBuilder builder)
        {
            throw new NotImplementedException();
        }