1 /// <summary>
2 /// 获取老师学生聊天记录
3 /// </summary>
4 /// <returns></returns>
5 public DataSet GetTeacherStudentMsg(string strWhere)
6 {
7 StringBuilder strSql = new StringBuilder();
8 strSql.Append(@"select r.ID, st.name as 学生姓名, r.time as 时间,tc.name as 老师姓名,r.contents as 聊天内容
9 ,case when r.who = 1 then '学生发出'else '老师发出' end as a
10 from dbo.tb_FriendTeacherRecord2 r,dbo.tb_basic_students st,dbo.tb_basic_teacher tc
11 where st.pk_student = r.StudentID and tc.pk_teacher = r.TeacherID");
12 if (strWhere.Trim() != "")
13 {
14 strSql.Append(" and " + strWhere);
15 }
16 DataSet ds = DbHelper.ExecuteDataset(strSql.ToString());
17 foreach (DataRow row in ds.Tables[0].Rows)// int i = 1; i < ds.Tables[0].Rows.Count; i++)
18 {
19 StringBuilder sbtext = new StringBuilder(@"{\rtf1\ansi\ansicpg936\deff0\deflang1033\deflangfe2052{\fonttbl{\f0\fmodern\fprq6\fcharset134\'cb\'ce\'cc\'e5;}}{\colortbl ;\red0\green128\blue0;\red0\green0\blue255;}\viewkind4\uc1\pard");
20 sbtext.Append(UTF8Encoding.GetEncoding("GB2312").GetString(Hex2Bytes(row[4].ToString())));
21 sbtext.Append(@"\cf0\par}");
22 row["聊天内容"] = GetHtml(sbtext.ToString());
23 }
24 return ds;
25 }