///<summary> ///下一个高分学员 ///<para>Id:高分学员Id</para> /// </summary> public JiaJiNewWebModel.LernerScore MaxStuContentNext(int Id) { try { LernerScore infor = new LernerScore(); DataTable dt1 = MySqlDB.GetDataTable("select MAX(LearnSorceID) from learnsorce", CommandType.Text, null); int Sid = (int)dt1.Rows[0][0]; if (Id >= Sid) { infor.LearnerGonsis = "已经是最后一章了"; return(infor); } else { string sql = "SELECT a.LearnSorceID,a.LearnerID,a.Sorce,a.LearnerGonsis,c.LearnName,c.LearnImage,a.LearnerContent,a.HeatHot from learnsorce a INNER JOIN `languages` b on a.LanguageID=b.LanguageID INNER JOIN learner c on a.LearnerID = c.LearnerID where a.LearnSorceID >@Id LIMIT 1"; MySqlParameter[] para = { new MySqlParameter("@Id", Id) }; DataTable dt = MySqlDB.GetDataTable(sql, CommandType.Text, para); infor.LearnSorceID = (int)dt.Rows[0]["LearnSorceID"]; infor.LearnerGonsis = dt.Rows[0]["LearnerGonsis"].ToString(); Log4netHelper.WriteLog("日志报告"); return(infor); } } catch (Exception ex) { Log4netHelper.WriteLog("错误报告", ex); throw ex; } }
/// <summary> /// 高分学员详细页面 /// </summary> /// <param name="Id"></param> /// <returns></returns> public JiaJiNewWebModel.LernerScore MaxStuContent(int LearnSorceID) { try { string sql = "update learnsorce set HeatHot=HeatHot+1 where learnsorce.LearnSorceID=" + LearnSorceID + ";"; sql += "SELECT a.LearnSorceID,a.LearnerID,a.Sorce,a.LearnerGonsis,c.LearnName,c.LearnImage,a.LearnerContent,a.HeatHot,a.LanguageID,b.LanguageName from learnsorce a INNER JOIN `languages` b on a.LanguageID = b.LanguageID INNER JOIN learner c on a.LearnerID = c.LearnerID INNER JOIN country d on c.CountryID = d.CountryID where a.LearnSorceID = " + LearnSorceID + ""; LernerScore la = new LernerScore(); DataTable dt = MySqlDB.GetDataTable(sql, CommandType.Text, null); la.LearnSorceID = (int)dt.Rows[0]["LearnSorceID"]; la.LearnerID = (int)dt.Rows[0]["LearnerID"]; la.Sorce = dt.Rows[0]["Sorce"].ToString(); la.LearnerGonsis = dt.Rows[0]["LearnerGonsis"].ToString(); la.LearnName = dt.Rows[0]["LearnName"].ToString(); la.LanguageID = (int)dt.Rows[0]["LanguageID"]; la.LanguageName = dt.Rows[0]["LanguageName"].ToString(); la.LearnImage = dt.Rows[0]["LearnImage"].ToString(); la.LearnerContent = dt.Rows[0]["LearnerContent"].ToString(); la.HeatHot = (int)dt.Rows[0]["HeatHot"]; return(la); } catch (Exception ex) { Log4netHelper.WriteLog("错误报告", ex); throw ex; } }