private void ExportTotalReport(HttpContext context) { var exXls = new ExportXls(); var fieldsNames = new List<string>(); fieldsNames.Add("课程名称"); fieldsNames.Add("授课教师"); fieldsNames.Add("总平均分(满分52分)"); fieldsNames.Add("总体满意度"); fieldsNames.Add("评估等级"); fieldsNames.Add("课程内容满意度"); fieldsNames.Add("培训讲师满意度"); fieldsNames.Add("培训组织和管理满意度"); fieldsNames.Add("实评人数"); fieldsNames.Add("培训时间"); var quesBll = new BLL.Questionnaire(); var dt = quesBll.GetTotalReport(); dt.Columns.Remove("CourseId"); dt.AcceptChanges(); var filename = "课程评估总体情况统计表.xls"; exXls.ExportTotalReportToxls(context.Response, fieldsNames, dt, filename); }
/// <summary> /// 课程评估总体情况表 /// </summary> private void SetTotalReports() { 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='10'> <span style=\"font-size: 25px;font-weight: bold\">课程评估总体情况统计表</span><br/> </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>总平均分(满分52分)</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("<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.GetTotalReport(); var i = 0; if (dt != null && dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { var totalSatisfy = Convert.ToDouble(row["TotalSatisfy"]) >= 1.0 ? "100%" : string.Format("{0:N2}%", Convert.ToDouble(row["TotalSatisfy"]) * 100); var totalCourse = Convert.ToDouble(row["TotalCourse"]) >= 1.0 ? "100%" : string.Format("{0:N2}%", Convert.ToDouble(row["TotalCourse"]) * 100); var totalTeacher = Convert.ToDouble(row["TotalTeacher"]) >= 1.0 ? "100%" : string.Format("{0:N2}%", Convert.ToDouble(row["TotalTeacher"]) * 100); var totalOrg = Convert.ToDouble(row["TotalOrg"]) >= 1.0 ? "100%" : string.Format("{0:N2}%", Convert.ToDouble(row["TotalOrg"]) * 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>" + string.Format("{0:N2}",row["TotalAvgScore"]) + " </td>"); str.Append("<td>" + totalSatisfy + " </td>"); str.Append("<td>" + row["ToLevel"] + " </td>"); str.Append("<td>" + totalCourse + " </td>"); str.Append("<td>" + totalTeacher + " </td>"); str.Append("<td>" + totalOrg + " </td>"); str.Append("<td>" + row["TotalDone"] + " </td>"); str.Append("<td>" + row["TeachTime"] + " </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=\"getTotalReports()\" style=\"width: 120px\">导出</a>"); str.Append("</td>"); str.Append("</tr>"); str.Append("</table>"); divReports.InnerHtml = str.ToString(); }
private void SetValue() { try { var courseId = Guid.Empty; var coursebll = new BLL.Course(); if (!string.IsNullOrEmpty(Request.QueryString["cid"])) { courseId = new Guid(Request.QueryString["cid"]); hCourseid.Value = courseId.ToString(); } else //取个默认的 { courseId = coursebll.GetTop1Guid(); hCourseid.Value = courseId.ToString(); } var courseModel = coursebll.GetModel(courseId); courseName.InnerText = courseModel.CourseName; coursePlace.InnerText = courseModel.TeachPlace; teacherName.InnerText = courseModel.TeacherName; trainTime.InnerText = courseModel.TeachTime; var question = new BLL.Questionnaire(); var dsResult = question.GetReportTile(courseId); if (dsResult != null && dsResult.Tables.Count > 0) { var row = dsResult.Tables[0].Rows[0]; spTotalAvg.InnerText = string.Format("{0:N2}", row["totalAvg"]) + " 分(满分52)"; satisfaction.InnerText =Convert.ToDouble(row["Satisfy"])>=1.0? "100%": string.Format("{0:N2}" + "%", ((Convert.ToDecimal(row["Satisfy"])) * 100)); level.InnerText = question.GetLevel((Convert.ToDouble(row["Satisfy"]))); } var dsrr = question.GetTotalReport(); if (dsrr != null && dsrr.Rows.Count > 0) { var result = dsrr.Select(string.Format(" CourseId='{0}'",courseId)); if (result.Length > 0) { divCourseContent.InnerText = Convert.ToDouble(result[0]["TotalCourse"]) >= 1.0 ? "100%" : string.Format("{0:N2}" + "%", ((Convert.ToDecimal(result[0]["TotalCourse"])) * 100)); divTeacher.InnerText = Convert.ToDouble(result[0]["TotalTeacher"]) >= 1.0 ? "100%" : string.Format("{0:N2}" + "%", ((Convert.ToDecimal(result[0]["TotalTeacher"])) * 100)); divOrg.InnerText = Convert.ToDouble(result[0]["TotalOrg"]) >= 1.0 ? "100%" : string.Format("{0:N2}" + "%", ((Convert.ToDecimal(result[0]["TotalOrg"])) * 100)); } } //var totalAvg = question.GetTotalAvg(courseId.ToString()); //spTotalAvg.InnerText = totalAvg.ToString(); //satisfaction.InnerText = string.Format("{0:N2}" + "%", (((float) totalAvg/52)*100)); //level.InnerText = question.GetLevel(((float)totalAvg / 52)); var statifyPercent = question.GetSatisfyPercent(courseId); if (statifyPercent != null) { htp1.Value = string.Format("{0:N2}", ((statifyPercent[0])*100)); htp2.Value = string.Format("{0:N2}", ((statifyPercent[1]) * 100)); htp3.Value = string.Format("{0:N2}", ((statifyPercent[2]) * 100)); htp4.Value = string.Format("{0:N2}", ((statifyPercent[3]) * 100)); htp5.Value = string.Format("{0:N2}", ((statifyPercent[4]) * 100)); // nofinish.InnerText = statifyPercent[5].ToString(); totalPeople.InnerText = statifyPercent[6].ToString()+" 人"; totalDone.InnerText = statifyPercent[7].ToString() + " 人"; evProgress.InnerText = string.Format("{0:N2}%", ((statifyPercent[7] / statifyPercent[6]) * 100)); } SetDetail(courseId); #region old tendency //var tendency = question.GetTendency(courseId); //if (tendency != null) //{ // htot1.Value = string.Format("{0:N2}", ((tendency[0]) )); // htot2.Value = string.Format("{0:N2}", ((tendency[1]))); // htot3.Value = string.Format("{0:N2}", ((tendency[2]))); // htot4.Value = string.Format("{0:N2}", ((tendency[3]))); // htot5.Value = string.Format("{0:N2}", ((tendency[4]))); //} #endregion #region old the six //var theTop6 = question.GetTheSix(courseId, true); //if (theTop6 != null) //{ // var result = new StringBuilder(); // var i = 0; // foreach (var thetop in theTop6) // { // i++; // result.Append(i + "、" + thetop + @"<br>"); // } // top6.InnerHtml = result.ToString(); //} //var theBottom6 = question.GetTheSix(courseId, false); //if (theBottom6 != null) //{ // var result = new StringBuilder(); // var i = 0; // foreach (var thebop in theBottom6) // { // i++; // result.Append(i + "、" + thebop + @"<br>"); // } // bot6.InnerHtml = result.ToString(); //} #endregion } catch (Exception ex) { LogHelper.WriteLogofExceptioin(ex); } }
void GenerateEvReportData(Guid courseId) { ISheet sheet1 = hssfworkbook.CreateSheet("评估报告单"); ICellStyle cellstyleHead = hssfworkbook.CreateCellStyle(); cellstyleHead.VerticalAlignment = VerticalAlignment.Center; //表头样式 cellstyleHead.BorderBottom = BorderStyle.Thin; cellstyleHead.BorderLeft = BorderStyle.Thin; cellstyleHead.BorderRight = BorderStyle.Thin; cellstyleHead.BorderTop = BorderStyle.Thin; cellstyleHead.WrapText = true; cellstyleHead.Alignment= HorizontalAlignment.Center; var font = hssfworkbook.CreateFont(); font.FontHeightInPoints = 15; font.FontName = "宋体"; font.Boldweight = 700; cellstyleHead.SetFont(font); //表体样式 ICellStyle cellstyleContent = hssfworkbook.CreateCellStyle(); cellstyleContent.BorderBottom = BorderStyle.Thin; cellstyleContent.BorderLeft = BorderStyle.Thin; cellstyleContent.BorderRight = BorderStyle.Thin; cellstyleContent.BorderTop = BorderStyle.Thin; cellstyleContent.Alignment = HorizontalAlignment.Center; var font1 = hssfworkbook.CreateFont(); font1.FontHeightInPoints = 14; font1.FontName = "宋体"; font1.Boldweight = 10; cellstyleContent.SetFont(font1); cellstyleContent.WrapText = true; ICellStyle cellstyleConTitle = hssfworkbook.CreateCellStyle(); cellstyleConTitle.BorderBottom = BorderStyle.Thin; cellstyleConTitle.BorderLeft = BorderStyle.Thin; cellstyleConTitle.BorderRight = BorderStyle.Thin; cellstyleConTitle.BorderTop = BorderStyle.Thin; cellstyleConTitle.Alignment = HorizontalAlignment.Center; cellstyleConTitle.VerticalAlignment = VerticalAlignment.Center; var font11 = hssfworkbook.CreateFont(); font11.FontHeightInPoints = 14; font11.FontName = "宋体"; font11.Boldweight = 600; cellstyleConTitle.SetFont(font11); cellstyleConTitle.WrapText = true; ICellStyle cellstyleConTitleLeft = hssfworkbook.CreateCellStyle(); cellstyleConTitleLeft.BorderBottom = BorderStyle.Thin; cellstyleConTitleLeft.BorderLeft = BorderStyle.Thin; cellstyleConTitleLeft.BorderRight = BorderStyle.Thin; cellstyleConTitleLeft.BorderTop = BorderStyle.Thin; cellstyleConTitleLeft.Alignment = HorizontalAlignment.Left; cellstyleConTitleLeft.VerticalAlignment = VerticalAlignment.Center; var fontTitleLeft = hssfworkbook.CreateFont(); fontTitleLeft.FontHeightInPoints = 14; fontTitleLeft.FontName = "宋体"; fontTitleLeft.Boldweight = 10; cellstyleConTitleLeft.SetFont(fontTitleLeft); cellstyleConTitleLeft.WrapText = true; IRow title = sheet1.CreateRow(0); title.Height = 600; for (int f = 0; f < 6; f++) { ICell cell = title.CreateCell(f); sheet1.SetColumnWidth(f, 13 * 256); cell.SetCellValue(DateTime.Now.Year+ "年中青年干部教育管理培训班课程评估表"); cell.CellStyle = cellstyleHead; } SetCellRangeAddress(sheet1, 0, 0, 0, 5); sheet1.SetColumnWidth(0, 15 * 256); sheet1.SetColumnWidth(1, 25 * 256); sheet1.SetColumnWidth(2, 15 * 256); sheet1.SetColumnWidth(3, 15 * 256); sheet1.SetColumnWidth(4, 15 * 256); sheet1.SetColumnWidth(5, 15 * 256); var coubll= new BLL.Course(); var couModel = coubll.GetModel(courseId); var question = new BLL.Questionnaire(); var exportDs = question.GetReportTile(courseId); if (exportDs != null && exportDs.Tables.Count > 0&&exportDs.Tables[0].Rows.Count>0) { var datarow = exportDs.Tables[0].Rows[0]; IRow row1 = sheet1.CreateRow(1); ICell cell1 = row1.CreateCell(0); cell1.CellStyle = cellstyleConTitle; cell1.SetCellValue("课程名称"); ICell cell2 = row1.CreateCell(1); cell2.CellStyle = cellstyleContent; cell2.SetCellValue( couModel.CourseName); ICell cell3 = row1.CreateCell(2); cell3.CellStyle = cellstyleConTitle; cell3.SetCellValue("培训地点"); ICell cell4 = row1.CreateCell(3); cell4.CellStyle = cellstyleContent; cell4.SetCellValue(couModel.TeachPlace); ICell cell5 = row1.CreateCell(4); cell5.CellStyle = cellstyleContent; cell5.SetCellValue(couModel.TeachPlace); ICell cell6 = row1.CreateCell(5); cell6.CellStyle = cellstyleContent; cell6.SetCellValue(couModel.TeachPlace); SetCellRangeAddress(sheet1, 1, 1, 3, 5); IRow row2 = sheet1.CreateRow(2); ICell cell21 = row2.CreateCell(0); cell21.CellStyle = cellstyleConTitle; cell21.SetCellValue("培训讲师"); ICell cell22 = row2.CreateCell(1); cell22.CellStyle = cellstyleContent; cell22.SetCellValue( couModel.TeacherName); ICell cell23 = row2.CreateCell(2); cell23.CellStyle = cellstyleConTitle; cell23.SetCellValue("培训时间"); ICell cell24 = row2.CreateCell(3); cell24.CellStyle = cellstyleContent; cell24.SetCellValue(couModel.TeachTime); ICell cell25 = row2.CreateCell(4); cell25.CellStyle = cellstyleContent; cell25.SetCellValue(couModel.TeachTime); ICell cell26 = row2.CreateCell(5); cell26.CellStyle = cellstyleContent; cell26.SetCellValue(couModel.TeachTime); SetCellRangeAddress(sheet1, 2, 2, 3, 5); IRow row3 = sheet1.CreateRow(3); ICell cell31 = row3.CreateCell(0); cell31.CellStyle = cellstyleConTitle; cell31.SetCellValue("应评人数"); ICell cell32 = row3.CreateCell(1); cell32.CellStyle = cellstyleContent; cell32.SetCellValue(datarow["totalNum"].ToString()+"人"); ICell cell33 = row3.CreateCell(2); cell33.CellStyle = cellstyleConTitle; cell33.SetCellValue("实评人数"); ICell cell34 = row3.CreateCell(3); cell34.CellStyle = cellstyleContent; cell34.SetCellValue(datarow["totalDone"].ToString() + "人"); ICell cell35 = row3.CreateCell(4); cell35.CellStyle = cellstyleContent; cell35.SetCellValue(datarow["totalDone"].ToString() + "人"); ICell cell36 = row3.CreateCell(5); cell36.CellStyle = cellstyleContent; cell36.SetCellValue(datarow["totalDone"].ToString() + "人"); SetCellRangeAddress(sheet1, 3, 3, 3, 5); IRow row4 = sheet1.CreateRow(4); ICell cell41 = row4.CreateCell(0); cell41.CellStyle = cellstyleConTitle; cell41.SetCellValue("总体平均分"); ICell cell42 = row4.CreateCell(1); cell42.CellStyle = cellstyleContent; cell42.SetCellValue(string.Format("{0:N2}", datarow["totalAvg"]) + " 分(满分52)"); ICell cell43 = row4.CreateCell(2); cell43.CellStyle = cellstyleConTitle; cell43.SetCellValue("满意度"); ICell cell44 = row4.CreateCell(3); cell44.CellStyle = cellstyleContent; cell44.SetCellValue(Convert.ToDouble(datarow["Satisfy"]) >= 1.0 ? "100%" : string.Format("{0:N2}" + "%", ((Convert.ToDecimal(datarow["Satisfy"])) * 100))); ICell cell45 = row4.CreateCell(4); cell45.CellStyle = cellstyleConTitle; cell45.SetCellValue("等级"); ICell cell46 = row4.CreateCell(5); cell46.CellStyle = cellstyleContent; cell46.SetCellValue(question.GetLevel(Convert.ToDouble(datarow["Satisfy"]))); SetCellRangeAddress(sheet1, 4, 4, 3, 5); var resultTotalReport = question.GetTotalReport(); if (resultTotalReport != null && resultTotalReport.Rows.Count > 0) { var cr = resultTotalReport.Select(string.Format(" CourseId='{0}'", courseId)); if (cr.Length > 0) { IRow row5 = sheet1.CreateRow(5); ICell cell51 = row5.CreateCell(0); cell51.CellStyle = cellstyleConTitle; cell51.SetCellValue("课程内容"); ICell cell52 = row5.CreateCell(1); cell52.CellStyle = cellstyleContent; // cell52.SetCellValue(cr[0]["TotalCourse"].ToString()); cell52.SetCellValue(Convert.ToDouble(cr[0]["TotalCourse"]) >= 1.0 ? "100%" : string.Format("{0:N2}" + "%", ((Convert.ToDecimal(cr[0]["TotalCourse"])) * 100))); ICell cell53 = row5.CreateCell(2); cell53.CellStyle = cellstyleConTitle; cell53.SetCellValue("培训讲师"); ICell cell54 = row5.CreateCell(3); cell54.CellStyle = cellstyleContent; // cell54.SetCellValue(cr[0]["TotalTeacher"].ToString()); cell54.SetCellValue(Convert.ToDouble(cr[0]["TotalTeacher"]) >= 1.0 ? "100%" : string.Format("{0:N2}" + "%", ((Convert.ToDecimal(cr[0]["TotalTeacher"])) * 100))); ICell cell55 = row5.CreateCell(4); cell55.CellStyle = cellstyleConTitle; cell55.SetCellValue("培组织管理"); ICell cell56 = row5.CreateCell(5); cell56.CellStyle = cellstyleContent; // cell56.SetCellValue(cr[0]["TotalOrg"].ToString()); cell56.SetCellValue(Convert.ToDouble(cr[0]["TotalOrg"]) >= 1.0 ? "100%" : string.Format("{0:N2}" + "%", ((Convert.ToDecimal(cr[0]["TotalOrg"])) * 100))); } } var reportBody = question.GetReport(courseId); if (reportBody != null && reportBody.Tables.Count > 0) { var result = new Dictionary<int, double[]>(); if (reportBody != null && reportBody.Tables.Count > 0) { foreach (DataRow row in reportBody.Tables[0].Rows) { result.Add((int)row["num"], new[] { Convert.ToDouble(row["top1"]), Convert.ToDouble(row["top2"]), Convert.ToDouble(row["top3"]), Convert.ToDouble(row["top4"]), Convert.ToDouble(row["top5"]) }); } } var allTop1 = string.Format("{0:N2}" + "%", result[1][0] * 100); var allTop2 = string.Format("{0:N2}" + "%", result[1][1] * 100); var allTop3 = string.Format("{0:N2}" + "%", result[1][2] * 100); var allTop4 = string.Format("{0:N2}" + "%", result[1][3] * 100); var allTop5 = string.Format("{0:N2}" + "%", result[1][4] * 100); IRow row6 = sheet1.CreateRow(6); ICell cell61 = row6.CreateCell(0); cell61.CellStyle = cellstyleConTitle; cell61.SetCellValue("培训满意度评价项目"); ICell cell62 = row6.CreateCell(1); cell62.CellStyle = cellstyleConTitle; cell62.SetCellValue("培训满意度评价项目"); ICell cell63 = row6.CreateCell(2); cell63.CellStyle = cellstyleContent; cell63.SetCellValue("很满意"); ICell cell64 = row6.CreateCell(3); cell64.CellStyle = cellstyleContent; cell64.SetCellValue("满意"); ICell cell65 = row6.CreateCell(4); cell65.CellStyle = cellstyleContent; cell65.SetCellValue("一般"); ICell cell66 = row6.CreateCell(5); cell66.CellStyle = cellstyleContent; cell66.SetCellValue("不满意"); SetCellRangeAddress(sheet1, 6, 6, 0, 1); IRow row7 = sheet1.CreateRow(7); ICell cell71 = row7.CreateCell(0); cell71.CellStyle = cellstyleConTitle; cell71.SetCellValue("本次课程总体满意度"); ICell cell72 = row7.CreateCell(1); cell72.CellStyle = cellstyleConTitle; cell72.SetCellValue("本次课程总体满意度"); ICell cell73 = row7.CreateCell(2); cell73.CellStyle = cellstyleContent; cell73.SetCellValue(allTop2); ICell cell74 = row7.CreateCell(3); cell74.CellStyle = cellstyleContent; cell74.SetCellValue(allTop3); ICell cell75 = row7.CreateCell(4); cell75.CellStyle = cellstyleContent; cell75.SetCellValue(allTop4); ICell cell76 = row7.CreateCell(5); cell76.CellStyle = cellstyleContent; cell76.SetCellValue(allTop5); SetCellRangeAddress(sheet1, 7, 7, 0, 1); var startRowNum = 8; var startKey = 2; SetDetailValue("课程内容", new []{"课程主题清晰明确","课程内容丰富、能吸引人","课程内容切合实际,能指导实践","课程内容重点突出,易于理解","课程内容有助于个人发展"}, result, ref startRowNum, sheet1, cellstyleContent, cellstyleConTitle, ref startKey, cellstyleConTitleLeft); SetDetailValue("培训讲师", new[] { "讲师准备比较充分", "语言表达清晰,态度端正", "仪表仪容端庄大方,有亲和力", "培训方式多样,生动有趣", "与学员沟通和互动有效" }, result, ref startRowNum, sheet1, cellstyleContent, cellstyleConTitle, ref startKey, cellstyleConTitleLeft); SetDetailValue("培训组织和管理", new[] { "培训服务周到细致", "培训时间安排和控制合理", "培训场所、设备安排到位" }, result, ref startRowNum, sheet1, cellstyleContent, cellstyleConTitle, ref startKey, cellstyleConTitleLeft); IRow endrow = sheet1.CreateRow(startRowNum); ICell endcell1 = endrow.CreateCell(0); endcell1.CellStyle = cellstyleConTitle; endcell1.SetCellValue("测评单位"); ICell endcell12 = endrow.CreateCell(1); endcell12.CellStyle = cellstyleContent; endcell12.SetCellValue("海淀区教育党校"); ICell endcell13 = endrow.CreateCell(2); endcell13.CellStyle = cellstyleConTitle; endcell13.SetCellValue("测评时间"); ICell endcell14 = endrow.CreateCell(3); endcell14.CellStyle = cellstyleContent; endcell14.SetCellValue(DateTime.Now.ToString("yyyy-MM-dd")); ICell endcell15 = endrow.CreateCell(4); endcell15.CellStyle = cellstyleContent; endcell15.SetCellValue(DateTime.Now.ToString("yyyy-MM-dd")); ICell endcell16 = endrow.CreateCell(5); endcell16.CellStyle = cellstyleContent; endcell16.SetCellValue(DateTime.Now.ToString("yyyy-MM-dd")); SetCellRangeAddress(sheet1, startRowNum, startRowNum, 3, 5); } } GetSuggestion(courseId.ToString()); }