private void ExportTeacherReport(HttpContext context) { var exXls = new ExportXls(); var fieldsNames = new List<string>(); fieldsNames.Add("课程名称"); fieldsNames.Add("讲师准备比较充分"); fieldsNames.Add("语言表达清晰,态度端正"); fieldsNames.Add("仪表仪容端庄大方,有亲和力"); fieldsNames.Add("培训方式多样,生动有趣"); fieldsNames.Add("与学员沟通和互动有效"); var quesBll = new BLL.Questionnaire(); var dt = quesBll.GetTeacherReport(); dt.Columns.Remove("CourseId"); dt.Columns.Remove("TeacherName"); dt.Columns.Remove("TeachTime"); dt.Columns.Remove("TeacherBearing"); dt.Columns.Remove("TeacherCommunication"); dt.Columns.Remove("TeacherLanguage"); dt.Columns.Remove("TeacherPrepare"); dt.Columns.Remove("TeacherStyle"); dt.Columns.Remove("TotalDone"); dt.Columns.Remove("TotalTeacher"); dt.AcceptChanges(); var filename = "培训讲师各指标满意度分布表.xls"; exXls.ExportTeacherReportToxls(context.Response, fieldsNames, dt, filename); }
private void SetTeacherReports() { var str = new StringBuilder(); str.Append("<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" bordercolor=\"#000000\" bgcolor=\"#FFFFFF\" " + " style=\"border-collapse:collapse;font-size: 14px;text-align:center\" >"); str.Append("<tr height=\"40\"> "); str.Append("<td colspan='6'> <span style=\"font-size: 25px;font-weight: bold\">培训讲师各指标满意度分布表</span><br/> </td>"); str.Append("</tr> "); str.Append("<tr height=\"35\" bgcolor=\"#F0F9FF\" >"); str.Append("<td rowspan=\"2\" ><strong>课程名称</strong></td>"); // str.Append("<td rowspan=\"2\" ><strong>培训教师</strong></td>"); // str.Append("<td rowspan=\"2\" ><strong>培训时间</strong></td>"); str.Append("<td colspan=\"5\" ><strong>培训讲师各指标满意度</strong></td>"); str.Append("</tr>"); str.Append("<tr height=\"35\" bgcolor=\"#F0F9FF\">"); str.Append("<td><strong>讲师准备比较充分</strong></td>"); str.Append("<td><strong>语言表达清晰,态度端正</strong></td>"); str.Append("<td><strong>仪表仪容端庄大方,有亲和力</strong></td>"); str.Append("<td><strong>培训方式多样,生动有趣</strong></td>"); str.Append("<td><strong>与学员沟通和互动有效</strong></td>"); str.Append("</tr>"); var report = new BLL.Questionnaire(); var dt = report.GetTeacherReport(); var i = 0; if (dt != null && dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { var teacherBearingP = Convert.ToDouble(row["TeacherBearingP"]) >= 1.0 ? "100%" : string.Format("{0:N2}%", Convert.ToDouble(row["TeacherBearingP"]) * 100); var teacherCommunicationP = Convert.ToDouble(row["TeacherCommunicationP"]) >= 1.0 ? "100%" : string.Format("{0:N2}%", Convert.ToDouble(row["TeacherCommunicationP"]) * 100); var teacherLanguageP = Convert.ToDouble(row["TeacherLanguageP"]) >= 1.0 ? "100%" : string.Format("{0:N2}%", Convert.ToDouble(row["TeacherLanguageP"]) * 100); var teacherPrepareP = Convert.ToDouble(row["TeacherPrepareP"]) >= 1.0 ? "100%" : string.Format("{0:N2}%", Convert.ToDouble(row["TeacherPrepareP"]) * 100); var teacherStyleP = Convert.ToDouble(row["TeacherStyleP"]) >= 1.0 ? "100%" : string.Format("{0:N2}%", Convert.ToDouble(row["TeacherStyleP"]) * 100); i++; var color = i % 2 == 1 ? "#FFFFFF" : "#F0F9FF"; str.Append("<tr height=\"35\" bgcolor=\"" + color + "\" > "); str.Append("<td>" + row["CourseName"] + " </td>"); // str.Append("<td>" + row["TeacherName"] + " </td>"); // str.Append("<td>" + row["TeachTime"] + " </td>"); str.Append("<td>" + teacherPrepareP + " </td>"); str.Append("<td>" + teacherLanguageP + " </td>"); str.Append("<td>" + teacherBearingP + " </td>"); str.Append("<td>" + teacherStyleP + " </td>"); str.Append("<td>" + teacherCommunicationP + " </td>"); str.Append("</tr>"); } } //i++; //var color1 = i % 2 == 1 ? "#FFFFFF" : "#F0F9FF"; //str.Append("<tr height=\"35\" bgcolor=\"" + color1 + "\" > "); //str.Append("<td colspan='10'>"); //str.Append("总平均分=各项得分总和/实评人数;满意度=(很满意+满意)/实评人数; 课程(讲师或者组织)的满意度=每项满意度相加/项数 "); //str.Append("</td>"); //str.Append("</tr>"); str.Append("<tr height=\"35\" bgcolor=\"#FFFFFF\" > "); str.Append("<td colspan='10'>"); str.Append("<a href=\"javascript:void(0)\" class=\"easyui-linkbutton c6\" iconcls=\"icon-ok\" onclick=\"getTeacherReports()\" style=\"width: 120px\">导出</a>"); str.Append("</td>"); str.Append("</tr>"); str.Append("</table>"); divReports.InnerHtml = str.ToString(); }