標籤:des style blog color io ar for 資料 div
錯誤:已有開啟的與此 Command 相關聯的 DataReader,必須首先將它關閉
原代碼:
public void UpdatePermissionUserTypeByRightID(int rightID, string userTypes) { var targetList = ListAll().Where(s => s.rightID == rightID); foreach (var item in targetList) { item.permissionUserType = userTypes; //注意,如果子節點可見,則父節點一定可見 //修改父節點許可權,如果有父節點的話,注意要避免父節點中的角色ID重複 if (item.parentID > 0) { MenuNodes parent1 = getByID(item.parentID); string tempPUserTypes = JimShared.GetNoOverlapStr(item.permissionUserType, parent1.permissionUserType); parent1.permissionUserType = tempPUserTypes; } } //!提交資料 commit(); }
修改後:(只是加了一個tolist())
public void UpdatePermissionUserTypeByRightID(int rightID, string userTypes) { var targetList = ListAll().Where(s => s.rightID == rightID).ToList(); foreach (var item in targetList) { item.permissionUserType = userTypes; //注意,如果子節點可見,則父節點一定可見 //修改父節點許可權,如果有父節點的話,注意要避免父節點中的角色ID重複 if (item.parentID > 0) { MenuNodes parent1 = getByID(item.parentID); string tempPUserTypes = JimShared.GetNoOverlapStr(item.permissionUserType, parent1.permissionUserType); parent1.permissionUserType = tempPUserTypes; } } //!提交資料 commit(); }
已有開啟的與此 Command 相關聯的 DataReader,必須首先將它關閉