private void BtnSave_Click(object sender, RoutedEventArgs e) { DataRow row = this.GridView.GetFocusedDataRow(); if (row != null) { int F_RoleID = int.Parse(row["F_ID"].ToString()); List <TreeNodeInfo> l = TreeControl.GetSelectNodes(); SystemManager.Instance.Services.Role_Right_RelationService.Delete(F_RoleID); foreach (TreeNodeInfo info in l) { Library.Model.Role_Right_Relation relation = new Library.Model.Role_Right_Relation(); relation.F_RoleID = F_RoleID; relation.F_RightID = int.Parse(info.ID); SystemManager.Instance.Services.Role_Right_RelationService.Add(relation); } List <TreeNodeInfo> l1 = TreeControl1.GetSelectNodes(); SystemManager.Instance.Services.Role_WorkflowService.Delete(F_RoleID); foreach (TreeNodeInfo info in l1) { if (!string.IsNullOrEmpty(info.ID)) { Library.Model.Role_Workflow relation = new Library.Model.Role_Workflow(); relation.F_RoleID = F_RoleID; relation.F_WFID = int.Parse(info.ID); SystemManager.Instance.Services.Role_WorkflowService.Add(relation); } } MessageBox.Show("保存成功!"); } }