/// <summary> /// 导出用户清单 /// </summary> protected void ExportUserGroup() { var schoolName = Request["school"]; using (AppBLL bll = new AppBLL()) { var sql = "select distinct Name as 用户名称,Password as 密码 from tbUserGroupInfo where teacherid<'9999999990000' and (Status<>'1' or status is null) order by Name"; DataTable table = bll.FillDataTableByText(sql); string fileName = string.Format("{0}.xls", schoolName); string excelHtml = DataTableToHtml(table, string.Format("{0}成绩分析系统用户清单", schoolName)); UtilHelper.DownToExcel(fileName, excelHtml); } }
protected void ExportXJ() { int micYear = int.Parse(Request["micYear"]); string semester = Request["semester"]; string gradeNo = Request["gradeNo"]; string courseCode = Request["courseCode"]; int testType = int.Parse(Request["testType"]); int testNo = int.Parse(Request["testNo"]); int scoreSort = int.Parse(Request["scoreSort"]); using (AppBLL bll = new AppBLL()) { var sql = ""; DataTable table = null; if (testType == 1) { sql += scoreSort == 1 ? ",avg(Numscore) as Score,operator" : ",avg(standardscore) as Score,operator"; sql += " from s_vw_ClassScoreNum " + " where Gradeno=@gradeNo" + " and Academicyear=@micYear" + " and semester=@semester" + " and CourseCode=@courseCode" + " and TestType=@testType" + " and STATE is NULL" + " group by Academicyear,SRID,CourseCode,Teacherid,MarkCode,operator"; table = bll.FillDataTableByText(sql, new { gradeno = gradeNo, micYear = micYear, semester = semester, courseCode = courseCode, testType = testType }); } else { sql += scoreSort == 1 ? ",Numscore as Score,operator" : ",standardscore as Score,operator"; sql += " from s_vw_ClassScoreNum" + " Where GradeNo=@gradeNo" + " and Academicyear=@micYear" + " and CourseCode=@courseCode" + " and TestNo=@testNo" + " and STATE is NULL"; table = bll.FillDataTableByText(sql, new { gradeno = gradeNo, micYear = micYear, courseCode = courseCode, testno = testNo }); } string fileName = string.Format("{0}.xls", "学籍数据"); string excelHtml = DataTableToHtml(table, "学 籍"); UtilHelper.DownToExcel(fileName, excelHtml); } }