/// <summary> /// 获取指定用户,和其所属的班级的共享课程表 /// </summary> public DataTable SelByUidAndClass(int uid) { //获取自己所属于哪些班级 B_ClassRoom classBll = new B_ClassRoom(); DataTable classDT = classBll.SelByUid(uid); string where = ""; for (int i = 0; i < classDT.Rows.Count; i++) { int rid = Convert.ToInt32(classDT.Rows[i]["RoomID"]); if (i == 0) { where += " CHARINDEX('," + rid + ",',','+A.ClassIDS+',')>0 "; } else { where += " OR CHARINDEX('," + rid + ",',','+A.ClassIDS+',')>0 "; } } if (!string.IsNullOrEmpty(where)) { where = " OR(A.ClassIDS IS NOT NULL AND (" + where + "))"; } return(SqlHelper.JoinQuery("A.*,B.Salt AS Alias,B.UserName", TbName, "ZL_User", "A.UserID=B.UserID", "A.UserID=" + uid + where, "A.CDate DESC")); }