private void ExportCourseReport(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.GetCourseReport(); dt.Columns.Remove("CourseId"); dt.Columns.Remove("CourseSubject"); dt.Columns.Remove("CourseDevelop"); dt.Columns.Remove("CourseKey"); dt.Columns.Remove("CoursePractical"); dt.Columns.Remove("CourseRich"); dt.Columns.Remove("TotalDone"); dt.Columns.Remove("TotalCourse"); dt.AcceptChanges(); var filename = "课程内容满意度分布表.xls"; exXls.ExportCourseReportToxls(context.Response, fieldsNames, dt, filename); }
private void SetCourseReports() { 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.GetCourseReport(); var i = 0; if (dt != null && dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { var courseSubjectP = Convert.ToDouble(row["CourseSubjectP"]) >= 1.0 ? "100%" : string.Format("{0:N2}%", Convert.ToDouble(row["CourseSubjectP"]) * 100); var courseDevelopP = Convert.ToDouble(row["CourseDevelopP"]) >= 1.0 ? "100%" : string.Format("{0:N2}%", Convert.ToDouble(row["CourseDevelopP"]) * 100); var courseKeyP = Convert.ToDouble(row["CourseKeyP"]) >= 1.0 ? "100%" : string.Format("{0:N2}%", Convert.ToDouble(row["CourseKeyP"]) * 100); var coursePracticalP = Convert.ToDouble(row["CoursePracticalP"]) >= 1.0 ? "100%" : string.Format("{0:N2}%", Convert.ToDouble(row["CoursePracticalP"]) * 100); var courseRichP = Convert.ToDouble(row["CourseRichP"]) >= 1.0 ? "100%" : string.Format("{0:N2}%", Convert.ToDouble(row["CourseRichP"]) * 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>" + courseSubjectP + " </td>"); str.Append("<td>" + courseRichP + " </td>"); str.Append("<td>" + coursePracticalP + " </td>"); str.Append("<td>" + courseKeyP + " </td>"); str.Append("<td>" + courseDevelopP + " </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=\"getCourseReports()\" style=\"width: 120px\">导出</a>"); str.Append("</td>"); str.Append("</tr>"); str.Append("</table>"); divReports.InnerHtml = str.ToString(); }