Esempio n. 1
0
        private async void LoadData(string id)
        {
            userGroup = await UsersGroups.Get(id);

            txtNombre.Text    = userGroup.Name;
            tgAdminGroup.IsOn = userGroup.IsStaff;
        }
Esempio n. 2
0
        private async void Guardar()
        {
            userGroup.Name             = txtNombre.Text;
            userGroup.Id               = txtNombre.Text;
            userGroup.IsStaff          = tgAdminGroup.IsOn;
            userGroup.ModulePrivileges = modulePrivileges;

            if (await UsersGroups.save(userGroup))
            {
                CloureManager.GoBack();
            }
        }
Esempio n. 3
0
        private async void GetPrivileges(string grupo_id = "")
        {
            stackModulesPrivileges.Children.Clear();
            modulePrivileges = await UsersGroups.GetPrivileges(grupo_id);

            foreach (ModulePrivileges module in modulePrivileges)
            {
                TextBlock txtModuleTitle = new TextBlock();
                txtModuleTitle.HorizontalAlignment     = HorizontalAlignment.Stretch;
                txtModuleTitle.HorizontalTextAlignment = TextAlignment.Center;
                txtModuleTitle.Text = module.ModuleTitle;

                if (module.ClourePrivileges != null)
                {
                    StackPanel stackPrivileges = new StackPanel();

                    if (module.ClourePrivileges.Count > 0)
                    {
                        foreach (ClourePrivilege privilege in module.ClourePrivileges)
                        {
                            Grid             grid = new Grid();
                            TextBlock        txtPrivilegeTitle = new TextBlock();
                            ColumnDefinition colTitle          = new ColumnDefinition();
                            ColumnDefinition colControl        = new ColumnDefinition();
                            colTitle.Width   = new GridLength(1, GridUnitType.Star);
                            colControl.Width = new GridLength(200, GridUnitType.Pixel);
                            grid.ColumnDefinitions.Add(colTitle);
                            grid.ColumnDefinitions.Add(colControl);

                            txtPrivilegeTitle.Text = privilege.Title;
                            Grid.SetColumn(txtPrivilegeTitle, 0);

                            grid.Children.Add(txtPrivilegeTitle);

                            if (privilege.Type == "bool")
                            {
                                ToggleSwitch toggleSwitch = new ToggleSwitch();
                                toggleSwitch.Tag      = privilege;
                                toggleSwitch.IsOn     = CloureManager.ParseBoolObject(privilege.Value);
                                toggleSwitch.Toggled += ToggleSwitch_Toggled;
                                Grid.SetColumn(toggleSwitch, 1);
                                grid.Children.Add(toggleSwitch);
                            }

                            stackPrivileges.Children.Add(grid);
                        }
                        stackModulesPrivileges.Children.Add(txtModuleTitle);
                        stackModulesPrivileges.Children.Add(stackPrivileges);
                    }
                }
            }
        }
        private async void DisplayDeleteDialog(UserGroup item)
        {
            ContentDialog deleteFileDialog = new ContentDialog
            {
                Title             = "¿Está seguro que desea eliminar este registro?",
                Content           = "El registro se borrará de forma permanente",
                PrimaryButtonText = "Borrar",
                CloseButtonText   = "Cancelar"
            };

            ContentDialogResult result = await deleteFileDialog.ShowAsync();

            // Delete the file if the user clicked the primary button.
            /// Otherwise, do nothing.
            if (result == ContentDialogResult.Primary)
            {
                bool api_result = await UsersGroups.Delete(item.Id);

                if (api_result)
                {
                    LoadData();
                }
            }
        }
        public async void LoadData()
        {
            List <UserGroup> items = await UsersGroups.GetList();

            lstItems.ItemsSource = items;
        }