Пример #1
0
        protected override DialogOptions GetDialogOptions()
        {
            var opt = base.GetDialogOptions();

            opt.Buttons = new List <DialogButton>
            {
                new DialogButton {
                    Text  = Q.Text("Dialogs.OkButton"),
                    Click = delegate
                    {
                        RolePermissionService.Update(new RolePermissionUpdateRequest
                        {
                            RoleID      = options.RoleID,
                            Permissions = permissions.Value.Select(x => x.PermissionKey).ToList(),
                            Module      = null,
                            Submodule   = null
                        }, response => {
                            DialogClose();
                            Window.SetTimeout(delegate()
                            {
                                Q.NotifySuccess(Q.Text("Site.RolePermissionDialog.SaveSuccess"));
                            }, 0);
                        });
                    },
                },
                new DialogButton {
                    Text  = Q.Text("Dialogs.CancelButton"),
                    Click = DialogClose
                }
            };
            opt.Title = String.Format(Q.Text("Site.RolePermissionDialog.DialogTitle"), options.Title);
            return(opt);
        }
Пример #2
0
        public RolePermissionDialog(RolePermissionDialogOptions opt)
            : base(opt)
        {
            permissions = new PermissionCheckEditor(this.ById("Permissions"),
                                                    new PermissionCheckEditorOptions {
                ShowRevoke = false
            });

            RolePermissionService.List(new RolePermissionListRequest
            {
                RoleID    = options.RoleID,
                Module    = null,
                Submodule = null
            }, response =>
            {
                permissions.Value = response.Entities.Select(x => new UserPermissionRow {
                    PermissionKey = x
                }).ToList();
            });
        }