Esempio n. 1
0
        public PointView(int id)
        {
            InitializeComponent();

            this.id = id;


            typeToTable = new Dictionary <int, DataGrid>();
            categories  = new Dictionary <int, Expander>();

            pointTypes = DatabaseHandler.GetPointTypes();
            CategoryCombo.ItemsSource = pointTypes;

            Point point = DatabaseHandler.GetPoint(id);

            origName                    = point.Name;
            origType                    = point.CategoryID;
            PointName.Text              = point.Name;
            tabLabel                    = new TabLabel();
            tabLabel.tabName            = point.Name;
            CategoryCombo.SelectedValue = point.CategoryID;
            //CategoryName.Content = DatabaseHandler.GetPointCategory(point.id);

            docPoint = DatabaseHandler.GetDocumentsID(id);
            List <DocumentType> sortedCategories = DatabaseHandler.GetSortedCategories(id, docPoint);

            foreach (var category in sortedCategories)
            {
                CreateCategory(category.id, category.Name);
            }

            if (!DatabaseHandler.userRole.Points.HasFlag(Permissions.UPDATE))
            {
                CategoryCombo.IsEditable     = false;
                CategoryCombo.IsEnabled      = false;
                PointName.IsEnabled          = false;
                SavePointButton.Visibility   = Visibility.Collapsed;
                CancelPointButton.Visibility = Visibility.Collapsed;
            }

            if (!DatabaseHandler.userRole.PointDocConnections.HasFlag(Permissions.INSERT) &&
                !DatabaseHandler.userRole.PointDocConnections.HasFlag(Permissions.DELETE))
            {
                AddDocumentButton.Visibility = Visibility.Collapsed;
            }

            isDirty = false;
        }
Esempio n. 2
0
        public PointsPage(MainWindow mainWindow)
        {
            InitializeComponent();
            //points.AddIndexes();
            PointsList.ItemsSource = DatabaseHandler.GetPointsList();
            this.mainWindow        = mainWindow;

            //addhandler = AddPoint;

            NewPointTypeCombo.ItemsSource   = DatabaseHandler.GetPointTypes();
            NewPointTypeCombo.SelectedIndex = 0;

            if (!DatabaseHandler.userRole.Points.HasFlag(Permissions.INSERT))
            {
                AddNewPointGrid.Visibility = Visibility.Collapsed;
            }
        }