public JObject PageLoad(long start, long limit, string field, string direction, string searchInfo) { try { DBSortPage dbsort = new DBSortPage(start, limit, field, direction); DBServer dbserver = new SqlServer(); CourseStu mybase = new CourseStu(dbserver); string logincode = searchInfo; string term = getTerm(); string filterf = null; JObject jobj = null; DataTable table = null; if (logincode.Length == 9) { filterf = string.Format("select distinct VBC.nvcElectiveNum,nvcCourseName,nvcCourseNature,nvcName,(select count(*) from V_Evaluate_Vote AS VEV where VEV.nvcStuNo+VEV.nvcElectiveNum =VBC.nvcStuNo+VBC.nvcElectiveNum) as isVote,nvcTeaPhoto,nvcTeacher from V_BaseInfo_CourseStu as VBC where nvcStuNo='{0}' AND VBC.nvcElectiveNum like '%{1}%'", logincode, term); table = dbserver.ExecuteTable(filterf); jobj = CreateJsonInstance_S(table); } else { filterf = string.Format("select nvcElectiveNum,nvcCourseName,nvcCourseNature,COUNT(*) as nvcCount from V_Evaluate_Vote where nvcLoginCode='{0}' and nvcElectiveNum like '%{1}%' group by nvcElectiveNum,nvcLoginCode,nvcCourseName,nvcCourseNature", logincode, term); table = dbserver.ExecuteTable(filterf); jobj = CreateJsonInstance_T(table); } return(jobj); } catch (Exception ex) { return(ShowDataLoadError(ex.Message)); } }
public JObject PageLoad_T(long start, long limit, string field, string direction, string searchInfo, string logincode) { try { DBSortPage dbsort = new DBSortPage(start, limit, field, direction); DBServer dbserver = new SqlServer(); CourseStu mybase = new CourseStu(dbserver); string term = String.Empty; if (searchInfo == null) { term = getTerm(); } else { string[] data = searchInfo.Split(';'); term = data[0] + "-" + data[1]; } //对同一个同一学年教授多门课 string cmdText = string.Format("select nvcElectiveNum from V_BaseInfo_EduTask where nvcLoginCode='{0}' and nvcElectiveNum like '%{1}%'", logincode, term); DataTable table = dbserver.ExecuteTable(cmdText); JArray array = new JArray(); JObject jobj = null; DataTable dt = new DataTable(); dt.Columns.Add("nvcElectiveNum"); dt.Columns.Add("nvcCourseName"); dt.Columns.Add("nvcCourseNature"); dt.Columns.Add("nvcEvaGrade"); dt.Columns.Add("avgScore"); dt.Columns.Add("intEvaPeo"); dt.Columns.Add("intNotEvaPeo"); dt.Columns.Add("nvcConPeo"); foreach (DataRow row in table.Rows) { string nums = (row["nvcElectiveNum"] != null) ? row["nvcElectiveNum"].ToString() : null; string filterf = string.Format("select nvcElectiveNum,nvcCourseName,nvcCourseNature,(select nvcEvaGrade from V_Evaluate_Level where (select avg(intScore) from V_BaseInfo_CourseStu where nvcElectiveNum ='{0}' )between intLowMark and intHighMark)as nvcEvaGrade,avg(intScore) AS avgScore,(select count(nvcStuNo) from V_BaseInfo_CourseStu where intIsEvaluate=1 and nvcElectiveNum ='{0}') AS intEvaPeo,(select count(nvcStuNo) from V_BaseInfo_CourseStu where intIsEvaluate=0 and nvcElectiveNum ='{0}') AS intNotEvaPeo,(select count(nvcStuNo) from V_BaseInfo_CourseStu where nvcElectiveNum ='{0}' and (intIsEvaluate=1 and (nvcContents!='' or nvcContents!=NULL))) As nvcConPeo from V_BaseInfo_CourseStu where nvcElectiveNum ='{0}' group by nvcElectiveNum,nvcLoginCode,nvcCourseName,nvcCourseNature", nums); DataRow dr = dbserver.ExecuteRow(filterf); if (dr != null) { dt.Rows.Add(dr["nvcElectiveNum"], dr["nvcCourseName"], dr["nvcCourseNature"], dr["nvcEvaGrade"], dr["avgScore"], dr["intEvaPeo"], dr["intNotEvaPeo"], dr["nvcConPeo"]); } } jobj = CreateJsonInstance_T(dt); return(jobj); } catch (Exception ex) { return(ShowDataLoadError(ex.Message)); } }
public JObject PageLoad(long start, long limit, string field, string direction, string searchInfo) { try { DBSortPage dbsort = new DBSortPage(start, limit, field, direction); DBServer dbserver = new SqlServer(); CourseStu mybase = new CourseStu(dbserver); string term = getTerm(); string filterf = string.Format("nvcStuNo='{0}' and nvcElectiveNum like '%{1}%'", searchInfo, term); return(mybase.Load(dbsort, filterf)); } catch (Exception ex) { return(ShowDataLoadError(ex.Message)); } }
public JObject Edit(JObject data) { try { DBServer dbserver = new SqlServer(); CourseStu model = new CourseStu(dbserver); if (model.Update(data)) { return(ShowSuccess("保存成功.")); } else { return(ShowExecuteError("保存失败.")); } } catch (Exception ex) { return(ShowExecuteError(ex.Message)); } }