public void BuildDataTree(DataPermissionTree tree) { this.Dispatcher.BeginInvoke((Action<DataPermissionTree>)delegate(DataPermissionTree result) { this.DataTree.ItemsSource = result.DataPermissions; }, tree); }
public void UpdateRolePermission(int roleId, int editType, string roleName, AccessPermissionTree accessTree, DataPermissionTree dataTree, Action<bool> EndUpdatePermission) { this._ServiceProxy.BeginUpdateRolePermission(roleId, editType, roleName, accessTree, dataTree, delegate(IAsyncResult ar) { bool isSuccess = this._ServiceProxy.EndUpdateRolePermission(ar); EndUpdatePermission(isSuccess); }, null); }
public bool UpdateRolePermission(int roleId,int editType, string roleName, AccessPermissionTree accessTree, DataPermissionTree dataTree) { UserDataAccess.UpdateRolePermission(roleId,editType,roleName,accessTree,dataTree); return true; }
public DataPermissionTree GetDataPermissionTree(int roleId) { DataPermissionTree tree = new DataPermissionTree(); return tree; }
public static void UpdateRolePermission(int roleId,int editType, string roleName, AccessPermissionTree accessTree, DataPermissionTree dataTree) { string xmlAccessTree = string.Empty; string xmlDataTree = string.Empty; if (editType == 1) { StringBuilder accessStr = new StringBuilder(); accessStr.Append("<AccessTree>"); foreach (CategoryNode cate in accessTree.CategoryNodes) { foreach (ModuleNode module in cate.ModuleNodes) { foreach (OperationNode operation in module.OperationNodes) { accessStr.AppendFormat("<Access Id=\"{0}\"/>", operation.Id); } } } accessStr.Append("</AccessTree>"); xmlAccessTree = accessStr.ToString(); StringBuilder dataStr = new StringBuilder(); dataStr.Append("<DataTree>"); foreach (DataPermission data in dataTree.DataPermissions) { foreach (ExChangeSystem sys in data.ExChangeSystems) { foreach (Target target in sys.Targets) { dataStr.AppendFormat("<Data Id=\"{0}\"/>", target.TargetId); } } } dataStr.Append("</DataTree>"); xmlDataTree = dataStr.ToString(); } using (SqlConnection sqlConnection = DataAccess.GetSqlConnection()) { SqlCommand command = sqlConnection.CreateCommand(); command.CommandText = "dbo.UpdateRolePermission"; command.CommandType = System.Data.CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("@roleId", roleId)); if (editType ==0) { command.Parameters.Add(new SqlParameter("@roleName", roleName)); } if (editType == 1) { command.Parameters.Add(new SqlParameter("@xmlAccessTree", xmlAccessTree)); command.Parameters.Add(new SqlParameter("@xmlDataTree", xmlDataTree)); } command.ExecuteNonQuery(); } }