Exemple #1
0
        async void OnAddRole(object sender, Mi e)
        {
            SelectRolesDlg dlg    = new SelectRolesDlg();
            long           userID = _lvUser.SelectedRow.ID;

            if (await dlg.Show(RoleRelations.User, userID.ToString(), e))
            {
                List <long> roles = new List <long>();
                foreach (var row in dlg.SelectedItems.OfType <Row>())
                {
                    roles.Add(row.ID);
                }
                if (roles.Count > 0 && await AtCm.AddUserRole(userID, roles))
                {
                    _lvRole.Data = await AtCm.Query("用户-关联角色", new { userid = userID });
                }
            }
        }
Exemple #2
0
        async void OnAddRole(object sender, Mi e)
        {
            string         prvID = _lvPrv.SelectedItem.To <Prv>().ID;
            SelectRolesDlg dlg   = new SelectRolesDlg();

            if (await dlg.Show(RoleRelations.Prv, prvID, e))
            {
                List <RolePrv> ls = new List <RolePrv>();
                foreach (var row in dlg.SelectedItems.OfType <Row>())
                {
                    ls.Add(new RolePrv(row.ID, prvID));
                }
                if (ls.Count > 0 && await AtCm.BatchSave(ls))
                {
                    RefreshRelation(prvID);
                    await AtCm.DeleteDataVer(ls.Select(rm => rm.RoleID).ToList(), "privilege");
                }
            }
        }
Exemple #3
0
        async void OnAddRole(object sender, Mi e)
        {
            SelectRolesDlg dlg    = new SelectRolesDlg();
            long           menuID = _fv.Data.To <Menu>().ID;

            if (await dlg.Show(RoleRelations.Menu, menuID.ToString(), e))
            {
                List <RoleMenu> ls = new List <RoleMenu>();
                foreach (var row in dlg.SelectedItems.OfType <Row>())
                {
                    ls.Add(new RoleMenu(row.ID, menuID));
                }
                if (ls.Count > 0 && await AtCm.BatchSave(ls))
                {
                    _lvRole.Data = await AtCm.Query <RoleMenu>("菜单-关联的角色", new { menuid = menuID });

                    await AtCm.DeleteDataVer(ls.Select(rm => rm.RoleID).ToList(), "menu");
                }
            }
        }