123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.ScoreManage;
- using EMIS.DataLogic.Common.Students;
- using EMIS.ViewModel.ScoreManage;
- using System.Linq.Expressions;
- using EMIS.ViewModel;
- using EMIS.Entities;
- using Bowin.Common.Linq;
- using EMIS.ViewModel.CacheManage;
- using Bowin.Common.Utility;
- using System.Data;
- using NPOI.HSSF.UserModel;
- using NPOI.SS.UserModel;
- using NPOI.HSSF.Util;
- namespace EMIS.CommonLogic.ScoreManage
- {
- public class SpecialityScoreByFinalScoreServices : BaseServices, ISpecialityScoreByFinalScoreServices
- {
- public SpecialityScoreSumDAL specialityScoreSumDAL { get; set; }
- public StudentsDAL StudentsDAL { get; set; }
- public SpecialityScoreGTView SpecialityScoreSumTable(Guid? collegeID, int? years, int? standardID, int? schoolyearNumID, int? schoolcodeID, Guid? classmajorID, List<int> CourseTypeIDList)
- {
- Expression<Func<CF_Student, bool>> studentExp = (x => true);
- Expression<Func<CF_Grademajor, bool>> grademajorExp = (x => true);
- Expression<Func<CF_Facultymajor, bool>> facultyExp = (x => true);
- Expression<Func<EMIS.Entities.CF_Schoolyear, bool>> schoolyearExp = (x => true);
- Expression<Func<ER_FinallyScore, bool>> scoreExp = x => true;
- Expression<Func<EM_EducationMissionClass, bool>> missionClassExp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- SpecialityScoreGTView summaryView = new SpecialityScoreGTView();
- if (collegeID.HasValue)
- {
- facultyExp = facultyExp.And(x => x.CollegeID == collegeID);
- }
- if (years.HasValue)
- {
- grademajorExp = grademajorExp.And(x => x.GradeID == years);
- }
- if (standardID.HasValue)
- {
- facultyExp = facultyExp.And(x => x.StandardID == standardID);
- }
- if (classmajorID.HasValue)
- {
- studentExp = studentExp.And(x => x.ClassmajorID == classmajorID);
- }
- if (schoolyearNumID.HasValue)
- {
- scoreExp = scoreExp.And(x => x.SchoolyearNumID == schoolyearNumID);
- }
- if (schoolcodeID.HasValue)
- {
- schoolyearExp = schoolyearExp.And(x => x.SchoolcodeID == schoolcodeID);
- }
- if (CourseTypeIDList.Count > 0)
- {
- scoreExp = scoreExp.And(x => CourseTypeIDList.Contains((int)x.CourseTypeID));
- }
- var courseQuery = specialityScoreSumDAL.GetCoursematerialViewQueryable(scoreExp, studentExp, grademajorExp, facultyExp, schoolyearExp);
- courseQuery = courseQuery.OrderBy(x => x.StartTermID).ThenBy(x => x.CourseName);
- //先获取当前院系所、学年、专业、学年数、学期
- var queryCoursematerialPlan = courseQuery.ToList();
- var queryFinallyScore = specialityScoreSumDAL.GetFinalScoreQueryable(scoreExp, studentExp, grademajorExp, facultyExp, schoolyearExp).ToList();
- var queryCredit= specialityScoreSumDAL.GetCreditQueryable(scoreExp, studentExp, grademajorExp, facultyExp, schoolyearExp).ToList();
- var studentList = StudentsDAL.GetBaseStudentViewQueryable(studentExp, grademajorExp, facultyExp).ToList();
- summaryView.StudentList = studentList.OrderBy(x => x.LoginID).ToList();
- summaryView.SchoolyearNums = new List<SpecialityScoreSummaryYearView>();
- summaryView.SpecialityCreditView = new List<SpecialityCreditView>();
- //开始建立树形结构,顶层是学年数,从大到小排序
- List<SpecialityCreditView> specialityCreditView = new List<SpecialityCreditView>();
- //specialityCreditView.Tital = "学分统计";
- if (queryCredit.Count() > 0)
- {
- var creditList = (from s in studentList
- join credit in queryCredit
- on s.UserID equals credit.UserID into scr
- from a in scr.DefaultIfEmpty()
- orderby s.LoginID
- select new SpecialityCreditView
- {
- UserID = s.UserID,
- RequiredCredit = a == null ? 0 : ((a.RequiredCredit ?? 0) - (a.PractiseCredit ?? 0)),
- OptionalCourseCredit = a == null ? 0 : (((a.OptionalCourseCredit ?? 0) - (a.SchoolbasedCredit ?? 0) - (a.ElectiveCredit ?? 0) - (a.GeneralEducationCredit ?? 0))),
- FreeSelectionCourseCredit = a == null ? 0 : (((a.FreeSelectionCourseCredit ?? 0) - (a.ElectivePublicCredit ?? 0))),
- GeneralEducationCredit = a == null ? 0 : (a.GeneralEducationCredit ?? 0),
- ElectiveCredit = a == null ? 0 : (a.ElectiveCredit ?? 0),
- ElectivePublicCredit = a == null ? 0 : (a.ElectivePublicCredit ?? 0),
- SchoolbasedWithClub = a == null ? 0 : (a.SchoolbasedWithClub ?? 0),
- SchoolbasedTotalCredit = a == null ? 0 : (a.SchoolbasedNotCredit ?? 0 + a.SchoolbasedCredit ?? 0),
- SchoolbasedNotCredit = a == null ? 0 : (a.SchoolbasedNotCredit ?? 0),
- SchoolbasedCredit = a == null ? 0 : (a.SchoolbasedCredit ?? 0),
- SchoolbasedRealCredit = a == null ? 0 : (a.SchoolbasedRealCredit ?? 0),
- PractiseWithClub = a == null ? 0 : (a.PractiseWithClub ?? 0),
- PractiseTotalCredit = a == null ? 0 : (a.PractiseNotCredit ?? 0 + a.PractiseCredit ?? 0),
- PractiseNotCredit = a == null ? 0 : (a.PractiseNotCredit ?? 0),
- PractiseCredit = a == null ? 0 : (a.PractiseCredit ?? 0),
- PractiseRealCredit = a == null ? 0 : (a.PractiseRealCredit ?? 0),
- ClubWithSchoolbasedCredit = a == null ? 0 : (((a.PractiseWithClub ?? 0) > 4 ? 4 : (a.PractiseWithClub ?? 0)) + ((a.SchoolbasedWithClub ?? 0) > 4 ? 4 : (a.SchoolbasedWithClub ?? 0)) + (a.SchoolbasedNotCredit ?? 0)),
- TotalCredit = a == null ? 0 : ((a.RequiredCredit ?? 0) + (a.OptionalCourseCredit ?? 0) + (a.FreeSelectionCourseCredit ?? 0) - (a.PractiseCredit ?? 0) - (a.SchoolbasedCredit ?? 0)
- + (a.PractiseNotCredit ?? 0) + ((a.PractiseWithClub ?? 0) > 4 ? 4 : (a.PractiseWithClub ?? 0)) + (a.SchoolbasedNotCredit ?? 0) + ((a.SchoolbasedWithClub ?? 0) > 4 ? 4 : (a.SchoolbasedWithClub ?? 0))),
- AvgScore = a == null ? 0 : (Math.Round((decimal)(a.AvgScore ?? 0), 2)),
- });
- specialityCreditView = creditList.ToList();
- }
- //foreach()
- summaryView.SpecialityCreditView = specialityCreditView;
- //var schoolyearNums = queryCoursematerialPlan.Select(x => x.SchoolyearNumID).Distinct().OrderBy(x => x).ToList();
- var startTermIDs = queryCoursematerialPlan.Select(x => x.StartTermID).Distinct().OrderBy(x => x).ToList();
- foreach (var startTermID in startTermIDs)
- {
- SpecialityScoreSummaryYearView schoolyearNumView = new SpecialityScoreSummaryYearView();
- schoolyearNumView.Title = IdNameExt.GetName(DictionaryItem.CF_Startterm, startTermID);
- //schoolyearNumView. = schoolyearNum;
- schoolyearNumView.CoursematerialNum = 0;
- //第二层,学期,按开课学期排序,不是按学期ID
- schoolyearNumView.SchoolCodeView = new List<SpecialityScoreSummarySchoolcodeView>();
- var schoolcodeList = queryCoursematerialPlan.Where(x => x.StartTermID == startTermID)
- .GroupBy(x => new { x.StartTermID })
- .Select(x => x.Key).OrderBy(x => x.StartTermID).ToList();
- foreach (var schoolCode in schoolcodeList)
- {
- SpecialityScoreSummarySchoolcodeView schoolCodeView = new SpecialityScoreSummarySchoolcodeView();
- schoolCodeView.Title = IdNameExt.GetName(DictionaryItem.CF_Startterm, schoolCode.StartTermID);
- //schoolCodeView.SchoolCodeID = schoolCode.SchoolcodeID;
- schoolCodeView.StartTermID = schoolCode.StartTermID;
- //第三层,课程,按名称排序
- schoolCodeView.CoursematerialList = new List<SpecialityScoreSummaryCoursematerialView>();
- schoolCodeView.CourseTypeList = new List<SpecialityCreditCourseTypeView>();
- List<SpecialityCreditCourseTypeView> creditCourseTypeViewList = new List<SpecialityCreditCourseTypeView>();
- var coursematerialList = queryCoursematerialPlan.Where(x => x.StartTermID == schoolCode.StartTermID)
- .GroupBy(x => new { x.CoursematerialID, x.CourseName, x.Credit, x.CourseTypeID })
- .Select(x => x.Key).OrderBy(x => x.CourseName).ToList();
- foreach (var coursematerial in coursematerialList)
- {
- SpecialityScoreSummaryCoursematerialView coursematerialView = new SpecialityScoreSummaryCoursematerialView();
- coursematerialView.Title = coursematerial.CourseName;
- coursematerialView.CoursematerialID = coursematerial.CoursematerialID;
- coursematerialView.Credit = coursematerial.Credit;
- coursematerialView.Tag = specialityScoreSumDAL.GetIsByCourseTypeID((int)coursematerial.CourseTypeID);
- //该课程所有学生均未录入成绩时,不汇总到专业成绩里
- var scoreCount = queryFinallyScore.Where(x => x.StarttermID == schoolCode.StartTermID && x.CoursematerialID == coursematerialView.CoursematerialID).ToList().Count();
- if (scoreCount == 0)
- continue;
- //最后一层,成绩,按学生学号排序
- var scoreList = (from s in studentList
- join fs in queryFinallyScore.Where(x => x.StarttermID == schoolCode.StartTermID && x.CoursematerialID == coursematerialView.CoursematerialID)
- on s.UserID equals fs.UserID into dfs
- from efs in dfs.DefaultIfEmpty()
- orderby s.LoginID
- select new SpecialityScoreSummaryScoreView
- {
- UserID = s.UserID,
- Score = (efs == null) ? null : efs.TotalScoreStr,
- //Credit = efs.ScoreCredit,
- //Score = (efs == null ) ? (int?)null : Convert.ToInt32(Math.Round((Convert.ToDecimal(efs.TotalScore)), 0))
- }).ToList();
-
- coursematerialView.ScoreList = scoreList;
- schoolCodeView.CoursematerialList.Add(coursematerialView);
- schoolyearNumView.CoursematerialNum += 1;
- }
- //schoolyearNumView.SchoolCodeView.Add(schoolCodeView);
- //因为某课程所有学生均未录入成绩时,不汇总到专业成绩里,如果某学期和学年数所有课程没有录入成绩时,不显示一二层学期和学年标题
- if (schoolCodeView.CoursematerialList.Count > 0)
- schoolyearNumView.SchoolCodeView.Add(schoolCodeView);
- }
- //summaryView.SchoolyearNums.Add(schoolyearNumView);
- //因为某课程所有学生均未录入成绩时,不汇总到专业成绩里,如果某学期和学年数所有课程没有录入成绩时,不显示一二层学期和学年标题
- if (schoolyearNumView.SchoolCodeView.Count > 0)
- summaryView.SchoolyearNums.Add(schoolyearNumView);
- }
- return summaryView;
- }
- public List<int> GetCourseTypeID()
- {
- return specialityScoreSumDAL.GetCourseTypeQueryble();
- }
- public void ExportSpecialityScoreSumTable(Guid? collegeID, int? years, int? standardID, int? schoolyearNumID, int? schoolcodeID, Guid? classmajorID, List<int> courseTypeIDList, bool isCredit)
- {
- string html = "";
- NpoiExcelHelper neh = new NpoiExcelHelper();
- var specialtyScoreSummaryView = this.SpecialityScoreSumTable(collegeID, years, standardID, schoolyearNumID, schoolcodeID, classmajorID, courseTypeIDList);
- Func<IWorkbook, HSSFCellStyle> noPassStyleFunc = (x =>
- {
- var style = (HSSFCellStyle)x.CreateCellStyle();
- style.BorderBottom = BorderStyle.THIN;
- style.BorderLeft = BorderStyle.THIN;
- style.BorderRight = BorderStyle.THIN;
- style.BorderTop = BorderStyle.THIN;
- style.Alignment = HorizontalAlignment.CENTER;
- style.VerticalAlignment = VerticalAlignment.CENTER;
- var font = (HSSFFont)x.CreateFont();
- font.FontHeightInPoints = 12;
- font.Boldweight = (short)FontBoldWeight.BOLD;
- font.Color = HSSFColor.RED.index;
- style.SetFont(font);
- return style;
- });
- List<NpoiExcelCellStyle> styleList = new List<NpoiExcelCellStyle>();
- var dtResult = new DataTable();
- if (specialtyScoreSummaryView != null)
- {
- var detail = new List<string>();
- var firstRow = new List<string>();
- var secondRow = new List<string>();
- var thirdRow = new List<string>();
- var thirdRow1 = new List<string>();
- var thirdRow2 = new List<string>();
- var forthRow = new List<List<string>>();
- var detailRow = new List<string>();
- //生成第一、二、三行表头,学年和学期和课程
- //第一行开头
- firstRow.Add("<tr>");
- firstRow.Add("<td rowspan=\"2\" colspan=\"3\" row=\"0\" col=\"0\">学期</td>");
- if (isCredit)
- {
- firstRow.Add("<td rowspan=\"2\" colspan=\"10\" row=\"0\" col=\"3\">学分统计</td>");
- }
- //第二行开头
- secondRow.Add("<tr>");
- //第三行开头
- thirdRow.Add("<tr>");
- thirdRow.Add("<td rowspan=\"0\" colspan=\"0\" row=\"2\" col=\"0\">次序</td>");
- thirdRow.Add("<td rowspan=\"0\" colspan=\"0\" row=\"2\" col=\"1\">学号</td>");
- thirdRow.Add("<td rowspan=\"0\" colspan=\"0\" row=\"2\" col=\"2\">姓名</td>");
- if (isCredit)
- {
- thirdRow.Add("<td rowspan=\"0\" colspan=\"0\" row=\"2\" col=\"3\">总学分</td>");
- thirdRow.Add("<td rowspan=\"0\" colspan=\"0\" row=\"2\" col=\"4\">必修学分</td>");
- thirdRow.Add("<td rowspan=\"0\" colspan=\"0\" row=\"2\" col=\"5\">限选学分</td>");
- thirdRow.Add("<td rowspan=\"0\" colspan=\"0\" row=\"2\" col=\"6\">通识教育</td>");
- thirdRow.Add("<td rowspan=\"0\" colspan=\"0\" row=\"2\" col=\"7\">任选学分</td>");
- thirdRow.Add("<td rowspan=\"0\" colspan=\"0\" row=\"2\" col=\"8\">方向选修</td>");
- thirdRow.Add("<td rowspan=\"0\" colspan=\"0\" row=\"2\" col=\"9\">公共选修</td>");
- thirdRow.Add("<td rowspan=\"0\" colspan=\"0\" row=\"2\" col=\"10\">实践环节</td>");
- thirdRow.Add("<td rowspan=\"0\" colspan=\"0\" row=\"2\" col=\"11\">俱乐部(含校本)</td>");
- thirdRow.Add("<td rowspan=\"0\" colspan=\"0\" row=\"2\" col=\"12\">平均分</td>");
- }
- //第四行(第三行附加)
- thirdRow1.Add("<tr>");
- thirdRow1.Add("<td rowspan=\"0\" colspan=\"0\" row=\"3\" col=\"0\"></td>");
- thirdRow1.Add("<td rowspan=\"0\" colspan=\"0\" row=\"3\" col=\"1\"></td>");
- thirdRow1.Add("<td rowspan=\"0\" colspan=\"0\" row=\"3\" col=\"2\"></td>");
- if (isCredit)
- {
- thirdRow1.Add("<td rowspan=\"0\" colspan=\"0\" row=\"3\" col=\"3\"></td>");
- thirdRow1.Add("<td rowspan=\"0\" colspan=\"0\" row=\"3\" col=\"4\"></td>");
- thirdRow1.Add("<td rowspan=\"0\" colspan=\"0\" row=\"3\" col=\"5\"></td>");
- thirdRow1.Add("<td rowspan=\"0\" colspan=\"0\" row=\"3\" col=\"6\"></td>");
- thirdRow1.Add("<td rowspan=\"0\" colspan=\"0\" row=\"3\" col=\"7\"></td>");
- thirdRow1.Add("<td rowspan=\"0\" colspan=\"0\" row=\"3\" col=\"8\"></td>");
- thirdRow1.Add("<td rowspan=\"0\" colspan=\"0\" row=\"3\" col=\"9\"></td>");
- thirdRow1.Add("<td rowspan=\"0\" colspan=\"0\" row=\"3\" col=\"10\"></td>");
- thirdRow1.Add("<td rowspan=\"0\" colspan=\"0\" row=\"3\" col=\"11\"></td>");
- thirdRow1.Add("<td rowspan=\"0\" colspan=\"0\" row=\"3\" col=\"12\"></td>");
- }
- //第五行(第三行附加)
- thirdRow2.Add("<tr>");
- thirdRow2.Add("<td rowspan=\"0\" colspan=\"0\" row=\"4\" col=\"0\"></td>");
- thirdRow2.Add("<td rowspan=\"0\" colspan=\"0\" row=\"4\" col=\"1\"></td>");
- thirdRow2.Add("<td rowspan=\"0\" colspan=\"0\" row=\"4\" col=\"2\"></td>");
- if (isCredit)
- {
- thirdRow2.Add("<td rowspan=\"0\" colspan=\"0\" row=\"4\" col=\"3\"></td>");
- thirdRow2.Add("<td rowspan=\"0\" colspan=\"0\" row=\"4\" col=\"4\"></td>");
- thirdRow2.Add("<td rowspan=\"0\" colspan=\"0\" row=\"4\" col=\"5\"></td>");
- thirdRow2.Add("<td rowspan=\"0\" colspan=\"0\" row=\"4\" col=\"6\"></td>");
- thirdRow2.Add("<td rowspan=\"0\" colspan=\"0\" row=\"4\" col=\"7\"></td>");
- thirdRow2.Add("<td rowspan=\"0\" colspan=\"0\" row=\"4\" col=\"8\"></td>");
- thirdRow2.Add("<td rowspan=\"0\" colspan=\"0\" row=\"4\" col=\"9\"></td>");
- thirdRow2.Add("<td rowspan=\"0\" colspan=\"0\" row=\"4\" col=\"10\"></td>");
- thirdRow2.Add("<td rowspan=\"0\" colspan=\"0\" row=\"4\" col=\"11\"></td>");
- thirdRow2.Add("<td rowspan=\"0\" colspan=\"0\" row=\"4\" col=\"12\"></td>");
- }
- for (var i = 0; i < specialtyScoreSummaryView.StudentList.Count; i++)
- {
- var student = specialtyScoreSummaryView.StudentList[i];
- var credit = specialtyScoreSummaryView.SpecialityCreditView[i];
- var studentColumns = new List<string>();
- studentColumns.Add("<tr>");
- studentColumns.Add("<td rowspan=\"0\" colspan=\"0\" row=\"" + (5 + i).ToString() + "\" col=\"0\">" + (i + 1).ToString() + "</td>");
- studentColumns.Add("<td rowspan=\"0\" colspan=\"0\" row=\"" + (5 + i).ToString() + "\" col=\"1\">" + student.LoginID + "</td>");
- studentColumns.Add("<td rowspan=\"0\" colspan=\"0\" row=\"" + (5 + i).ToString() + "\" col=\"2\">" + student.UserName + "</td>");
- if (isCredit)
- {
- studentColumns.Add("<td rowspan=\"0\" colspan=\"0\" row=\"" + (5 + i).ToString() + "\" col=\"3\">" + credit.TotalCredit + "</td>");
- studentColumns.Add("<td rowspan=\"0\" colspan=\"0\" row=\"" + (5 + i).ToString() + "\" col=\"4\">" + credit.RequiredCredit + "</td>");
- studentColumns.Add("<td rowspan=\"0\" colspan=\"0\" row=\"" + (5 + i).ToString() + "\" col=\"5\">" + credit.OptionalCourseCredit + "</td>");
- studentColumns.Add("<td rowspan=\"0\" colspan=\"0\" row=\"" + (5 + i).ToString() + "\" col=\"6\">" + credit.GeneralEducationCredit + "</td>");
- studentColumns.Add("<td rowspan=\"0\" colspan=\"0\" row=\"" + (5 + i).ToString() + "\" col=\"7\">" + credit.FreeSelectionCourseCredit + "</td>");
- studentColumns.Add("<td rowspan=\"0\" colspan=\"0\" row=\"" + (5 + i).ToString() + "\" col=\"8\">" + credit.ElectiveCredit + "</td>");
- studentColumns.Add("<td rowspan=\"0\" colspan=\"0\" row=\"" + (5 + i).ToString() + "\" col=\"9\">" + credit.ElectivePublicCredit + "</td>");
- studentColumns.Add("<td rowspan=\"0\" colspan=\"0\" row=\"" + (5 + i).ToString() + "\" col=\"10\">" + credit.PractiseNotCredit + "</td>");
- studentColumns.Add("<td rowspan=\"0\" colspan=\"0\" row=\"" + (5 + i).ToString() + "\" col=\"11\">" + credit.ClubWithSchoolbasedCredit + "</td>");
- studentColumns.Add("<td rowspan=\"0\" colspan=\"0\" row=\"" + (5 + i).ToString() + "\" col=\"12\">" + credit.AvgScore + "</td>");
- }
- forthRow.Add(studentColumns);
- }
- //前三行明细
- var index = 3;
- if (isCredit)
- {
- index = 13;
- }
- for (var i = 0; i < specialtyScoreSummaryView.SchoolyearNums.Count; i++)
- {
- var schoolyearNum = specialtyScoreSummaryView.SchoolyearNums[i];
- firstRow.Add("<td rowspan=\"2\" colspan=\"" + schoolyearNum.CoursematerialNum + "\" row=\"0\" col=\"" + index.ToString() + "\">" + schoolyearNum.Title + "</td>");
- for (var j = 0; j < schoolyearNum.SchoolCodeView.Count; j++)
- {
- var schoolcode = schoolyearNum.SchoolCodeView[j];
- secondRow.Add("<td rowspan=\"1\" colspan=\"" + schoolcode.CoursematerialList.Count + "\" row=\"1\" col=\"" + index.ToString() + "\">" + schoolcode.Title + "</td>");
- for (var k = 0; k < schoolcode.CoursematerialList.Count; k++)
- {
- var coursematerial = schoolcode.CoursematerialList[k];
- thirdRow.Add("<td rowspan=\"0\" colspan=\"0\" row=\"2\" col=\"" + index.ToString() + "\">" + coursematerial.Title + "</td>");
- thirdRow1.Add("<td rowspan=\"0\" colspan=\"0\" row=\"3\" col=\"" + index.ToString() + "\">" + coursematerial.Tag + "</td>");
- thirdRow2.Add("<td rowspan=\"0\" colspan=\"0\" row=\"4\" col=\"" + index.ToString() + "\">" + coursematerial.Credit + "</td>");
- for (var l = 0; l < coursematerial.ScoreList.Count; l++)
- {
- var score = coursematerial.ScoreList[l];
- if (score.Score != "" && score.Score != null)
- {
- decimal tmpScore;
- if (decimal.TryParse(score.Score, out tmpScore))
- {
- if (tmpScore < 60)
- {
- styleList.Add(new NpoiExcelCellStyle { ColumnIndex = index, RowIndex = l + 5, StyleFunc = noPassStyleFunc });
- }
- }
- else
- {
- styleList.Add(new NpoiExcelCellStyle { ColumnIndex = index, RowIndex = l + 5, StyleFunc = noPassStyleFunc });
- }
- forthRow[l].Add("<td rowspan=\"0\" colspan=\"0\" row=\"" + (l + 5).ToString() + "\" col=\"" + index.ToString() + "\">" + score.Score.ToString() + "</td>");
- }
- else
- {
- forthRow[l].Add("<td rowspan=\"0\" colspan=\"0\" row=\"" + (l + 5).ToString() + "\" col=\"" + index.ToString() + "\"></td>");
- }
- }
- index++;
- }
- }
- }
- //第一行结尾
- firstRow.Add("</tr>");
- //第二行结尾
- secondRow.Add("</tr>");
- //第三行结尾
- thirdRow.Add("</tr>");
- thirdRow1.Add("</tr>");
- thirdRow2.Add("</tr>");
- html += string.Join("", firstRow);
- html += string.Join("", secondRow);
- html += string.Join("", thirdRow);
- html += string.Join("", thirdRow1);
- html += string.Join("", thirdRow2);
- for (var i = 0; i < specialtyScoreSummaryView.StudentList.Count; i++)
- {
- html += string.Join("", forthRow[i]);
- html += "</tr>";
- }
- }
- neh.PresetCellStyle(styleList);
- neh.ExportTable(html, "专业成绩汇总");
- }
- }
- }
|