Adding DMS Tab to a Module

1. Add xModule-Control to the new created Tab

Design Mode

XAML Code:

<tl:xDockTabItem Header="DMS" Name="tabDMS" Uid="4352f300-c8a7-430f-a10a-bd291d2a3de6" IsEnabled="False">
    <tl:xGrid Uid="d68e9eec-9a33-4eae-96ab-d8884dae960d">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <tl:xModule Name="xModDMS" Grid.Row="0" Grid.Column="0" ModuleID="modDMS3" IsEnabled="True" />
    </tl:xGrid>
</tl:xDockTabItem>

2. Initialize and load DMS Control

public xModule DmsModule
{
    get
    {
        return this.GetControlByNameAndTyp<xModule>("xModDMS");
    }
}

public IxDmsModule DmsControl
{
    get
    {
        if (DmsModule == null) return null;
        return DmsModule.ModuleWHO as IxDmsModule;
    }
}
public virtual void InitDms()
{            
    if (DmsControl != null)
    {
        DmsControl.Init(hybrid, "proz_charg");
    }
}

For newly created tables or hybrids, the connection between the DMS-tables and the current table will be done by creating a SQL Command for inserting a new record in dms_class, dms_categories, dms_tree and dms_treepos

$START
-- create the new dms class
if not exists (select * from dms_class where id = 'my_dms_class') then
    insert into dms_class("id", "matchcode", "default_category")
    values ('my_dms_class', 'My-Class', null)
endif;

-- create a dms category for the class and set it as default
if not exists (select * from dms_categories where class='my_dms_class') then
    insert into dms_categories (id, class, matchcode, default_arch_type, default_arch_zeitraum)
    values ((select max(id) from dms_categories) + 1, 'my_dms_class', 'Standard', null, null);
    update dms_class set default_category=(select max(id) from dms_categories)
    where id='my_dms_class';
endif;

--create a dms tree for the class
if not exists (select * from dms_tree where ref_hybrid='my_dms_class') then
    insert into dms_tree (nr, "type", ref_hybrid)
    values (((select coalesce( max(nr), 1) from dms_tree) + 1), 1, 'my_dms_class')
endif;

-- create a tree root node for the class as well as a default folder
if not exists(select * from dms_treepos where treenr = (select nr from dms_tree where ref_hybrid = 'my_dms_class') and handle = 0) then
    insert into dms_treepos (treenr, handle, lnode, rnode, "info", dms_class_id, typ)
    values ((select nr from dms_tree where ref_hybrid = 'my_dms_class'),0,1,4,'My-Class','my_dms_class',10);
    insert into dms_treepos (treenr, handle, lnode, rnode, "info", dms_class_id, dms_categories_id, typ)
    values ((select nr from dms_tree where ref_hybrid = 'my_dms_class'),1,2,3,'Standard','my_dms_class',(select default_category from dms_class where "id"= 'my_dms_class'), 20);
endif;

$ENDE

Last updated