private void MenuAddRecord_OnClick(object sender, RoutedEventArgs e) { AreaAuthorization aa = DataGrid1.SelectedItem as AreaAuthorization; if (aa == null) { return; } var win = new CardRoleWindow(); win.ShowOkButton(); if (win.ShowDialog() == true) { //var roles = win.GetSelectedRoles(); //foreach (var role in roles) //{ // AreaAuthorizationRecord aar = new AreaAuthorizationRecord(aa, role); // if (aarService.Post(aar) == null) // { // MessageBox.Show("分配权限失败"); // break; // } //} var role = win.Role; if (role != null) { AreaAuthorizationRecord aar = new AreaAuthorizationRecord(aa, role); if (aarService.Post(aar) == null) { MessageBox.Show("分配权限失败"); } } } }
private void MenuSetRole_OnClick(object sender, RoutedEventArgs e) { var tag = DataGrid1.SelectedItem as Tag; if (tag == null) { return; } var win = new CardRoleWindow(); win.ShowOkButton(); if (win.ShowDialog() == true) { if (service.SetRole(tag.Id + "", win.Role.Id + "") == null) { MessageBox.Show("设置失败"); return; } LoadData(); } }