Exemplo n.º 1
0
        private async void OnAddRoleExecute()
        {
            if (!_rbacManager.LoggedUser.IsAdmin && !_rbacManager.LoggedUserHasPermission(AclVerbNames.UserConfiguration))
            {
                await _messageDialogService.ShowAccessDeniedMessageAsync(this);

                return;
            }

            var dialogResult = await _messageDialogService
                               .ShowInputMessageAsync(this, "Nowa rola", "Podaj nazwę dla nowej roli:");

            if (!String.IsNullOrWhiteSpace(dialogResult))
            {
                if (await _rbacManager.RoleExistsAsync(dialogResult))
                {
                    await _messageDialogService
                    .ShowInformationMessageAsync(this, "Rola już istnieje...", "Rola o podanej nazwie już istnieje.");

                    return;
                }
                else
                {
                    var role = await _rbacManager.GetNewRole(dialogResult);

                    _rbacManager.AddRole(role);
                    Roles.Add(role);
                }
            }
        }
Exemplo n.º 2
0
        public async override void OnAddExecute()
        {
            if (!_rbacManager.LoggedUserHasPermission(AclVerbNames.CanAddOrder))
            {
                await _dialogService.ShowAccessDeniedMessageAsync(this);

                return;
            }

            _regionManager.RequestNavigate(RegionNames.ContentRegion, ViewNames.OrderWizardView);
        }
Exemplo n.º 3
0
        //TODO: Refactor with OnMouseDoubleClick
        public async override void OnAddExecute()
        {
            if (!_rbacManager.LoggedUserHasPermission(AclVerbNames.CanAddCustomer))
            {
                await _dialogService.ShowAccessDeniedMessageAsync(this);

                return;
            }

            var parameters = new NavigationParameters();

            parameters.Add("ID", Guid.Empty);
            parameters.Add("ViewFullName", ViewNames.CustomerView);

            ShowDetail(parameters);
        }
Exemplo n.º 4
0
        public override void OnNavigatedTo(NavigationContext navigationContext)
        {
            _navigationService = navigationContext.NavigationService;

            var id = navigationContext.Parameters.GetValue <Guid>("ID");

            Load(id);

            if (!_rbacManager.LoggedUserHasPermission(AclVerbNames.UserConfiguration))
            {
                IsReadOnly = true;
            }
        }
Exemplo n.º 5
0
        public async void OnNavigatedTo(NavigationContext navigationContext)
        {
            if (!_rBACManager.LoggedUserHasPermission(AclVerbNames.ApplicationConfiguration))
            {
                await _dialogService.ShowAccessDeniedMessageAsync(this, message : "Nie masz praw dostępu do tego modułu.");

                navigationContext.NavigationService.Journal.GoBack();
            }

            if (navigationContext.NavigationService.Region.RegionManager.Regions.ContainsRegionWithName(RegionNames.SettingsEditorViewRegion))
            {
                navigationContext.NavigationService.Region.RegionManager.Regions.Remove(RegionNames.SettingsEditorViewRegion);
            }

            if (navigationContext.NavigationService.Region.RegionManager.Regions.ContainsRegionWithName(RegionNames.GeneralSettingsTabControlRegion))
            {
                navigationContext.NavigationService.Region.RegionManager.Regions.Remove(RegionNames.GeneralSettingsTabControlRegion);
            }

            if (navigationContext.NavigationService.Region.RegionManager.Regions.ContainsRegionWithName(RegionNames.SettingsTabControlRegion))
            {
                _regionManager.Regions[RegionNames.SettingsTabControlRegion].RemoveAll();
            }

            var tabViews = new string[6]
            {
                ViewNames.GeneralSettingsView,
                ViewNames.HardwareTypesView,
                ViewNames.StatusConfigView,
                ViewNames.NumerationSettingsView,
                ViewNames.UserSettingsView,
                ViewNames.PrintTemplateSettingsView
            };

            foreach (var view in tabViews)
            {
                if (!_regionManager.Regions[RegionNames.SettingsTabControlRegion].Views.Contains(view))
                {
                    _regionManager.RequestNavigate(RegionNames.SettingsTabControlRegion, view);
                }
            }
        }