コード例 #1
0
        public TypesPage()
        {
            InitializeComponent();

            docTypes = DatabaseHandler.GetDocumentTypesTable();
            docTypes.AddIndexes();
            DocumentTypeList.ItemsSource = docTypes;

            if (!DatabaseHandler.userRole.DocumentType.HasFlag(Permissions.DELETE))
            {
                DocumentTypeList.Columns[2].Visibility = Visibility.Hidden;
            }

            if (!DatabaseHandler.userRole.DocumentType.HasFlag(Permissions.INSERT))
            {
                NewDocTypePanel.Visibility = Visibility.Collapsed;
            }
            if (!DatabaseHandler.userRole.DocumentType.HasFlag(Permissions.UPDATE))
            {
                DocumentTypeList.Columns[1].IsReadOnly = true;
            }

            pointTypes = DatabaseHandler.GetPointTypesTable();
            pointTypes.AddIndexes();
            PointsTypeList.ItemsSource = pointTypes;

            if (!DatabaseHandler.userRole.PointTypes.HasFlag(Permissions.DELETE))
            {
                PointsTypeList.Columns[2].Visibility = Visibility.Hidden;
            }

            if (!DatabaseHandler.userRole.PointTypes.HasFlag(Permissions.INSERT))
            {
                NewPointTypePanel.Visibility = Visibility.Collapsed;
            }
            if (!DatabaseHandler.userRole.PointTypes.HasFlag(Permissions.UPDATE))
            {
                PointsTypeList.Columns[1].IsReadOnly = true;
            }
        }