protected void Page_Load(object sender, EventArgs e) { CacheTest.Text = DateTime.Now.ToString(); url = "http://" + Request.Url.Authority + Request.ApplicationPath + "/"; //图片新闻 // Text string NewsCommendAlias = ConfigurationManager.AppSettings["NewsCommendAlias"]; DataTable NewsCommendText = new DataTable(); NewsCommendText = DataQuery.GetSubCategories(NewsCommendAlias); FocusTabsTxt.DataSource = NewsCommendText; FocusTabsTxt.DataBind(); // Pic if (NewsCommendText.Rows.Count > 0) { DataTable NewsCommendPic = new DataTable(); //NewsCommendPic = new DAL.Article().GetArticleList(NewsCommendText.Rows[0][1].ToString(),false,1); //缓存 NewsCommendPic = DataQuery.ArticleQuery("", "1", NewsCommendText.Rows[0][2].ToString()).Tables[0]; if (NewsCommendPic != null) { NewsCommendPic.Columns.Add("FocusTabsIndex", typeof(String)); NewsCommendPic.Rows[0]["FocusTabsIndex"] = NewsCommendText.Rows[0]["XIndex"]; DataTable NewsCommendPicMerge = new DataTable(); for (int i = 1; i < NewsCommendText.Rows.Count; i++) { //NewsCommendPicMerge = new DAL.Article().GetArticleList(NewsCommendText.Rows[i][1].ToString(),false,1); //缓存 NewsCommendPicMerge = DataQuery.ArticleQuery("", "1", NewsCommendText.Rows[i][2].ToString()).Tables[0]; NewsCommendPicMerge.Columns.Add("FocusTabsIndex", typeof(String)); NewsCommendPicMerge.Rows[0]["FocusTabsIndex"] = NewsCommendText.Rows[i]["XIndex"]; NewsCommendPic.Merge(NewsCommendPicMerge); } FocusTabsPic.DataSource = NewsCommendPic; FocusTabsPic.DataBind(); } } //特别关注 string SubjectGUID = DataQuery.CategoryAliasToID(ConfigurationManager.AppSettings["TBGZ_Alias"]); string SubjectPath = DataQuery.CategoryPath(SubjectGUID); //专题路径 DataTable HotSubjects = new DataTable(); HotSubjects = DataQuery.GetNHotZT(); // 获取课件 //string SubjectHotGUID = DataQuery.CategoryAliasToID(ConfigurationManager.AppSettings["SAHot_Alias"]); // string SubjectHotPath = DataQuery.CategoryPath(SubjectGUID); DataTable HotCoursesMerge = new DataTable(); // 第一个专题 if (HotSubjects.Rows.Count > 0) { //string SubjectHotItemPath = SubjectPath + "/" + HotSubjects.Rows[0][0].ToString(); // DataTable HotCourses = new DAL.CategoryDAL().GetArticleIndexList(SubjectHotItemPath, "最新动态", 2, false); string HotSubjectAlias = DataQuery.CategoryIDToAlias(HotSubjects.Rows[0][0].ToString()); string SubjectNewAlias = DataQuery.GetChannelAliasByName(HotSubjectAlias, "最新动态"); string SubjectNewGuid = DataQuery.CategoryAliasToID(SubjectNewAlias); DataTable HotCourses = new DAL.Article().GetArticleList(SubjectNewGuid, false, 2); HotCourses.Columns.Add("SubjectID", Type.GetType("System.String")); HotCourses.Columns.Add("SubjectTitle", Type.GetType("System.String")); for (int i = 0; i < HotCourses.Rows.Count; i++) { HotCourses.Rows[i]["SubjectID"] = HotSubjects.Rows[0][0].ToString(); HotCourses.Rows[i]["SubjectTitle"] = HotSubjects.Rows[0][1].ToString(); } // 后N个专题 for (int i = 1; i < HotSubjects.Rows.Count; i++) { //SubjectHotItemPath = SubjectPath + "/" + HotSubjects.Rows[i][0].ToString(); //HotCoursesMerge = new DAL.CategoryDAL().GetArticleIndexList(SubjectHotItemPath, "最新动态", 2, false); HotSubjectAlias = DataQuery.CategoryIDToAlias(HotSubjects.Rows[i][0].ToString()); SubjectNewGuid = DataQuery.GetSubChannelGuidByName(HotSubjectAlias, "最新动态"); HotCoursesMerge = new DAL.Article().GetArticleList(SubjectNewGuid, false, 2); HotCoursesMerge.Columns.Add("SubjectID", Type.GetType("System.String")); HotCoursesMerge.Columns.Add("SubjectTitle", Type.GetType("System.String")); for (int j = 0; j < HotCoursesMerge.Rows.Count; j++) { HotCoursesMerge.Rows[j]["SubjectID"] = HotSubjects.Rows[i][0].ToString(); HotCoursesMerge.Rows[j]["SubjectTitle"] = HotSubjects.Rows[i][1].ToString(); } HotCourses.Merge(HotCoursesMerge); } SpecialFocusContent.DataSource = HotCourses; SpecialFocusContent.DataBind(); } //热点 ZjspccmEntities DB = new ZjspccmEntities(); var query = (from cn in DB.CategoryNodePositions join c in DB.Categories on cn.CategoryGUID equals c.CategoryGUID where (cn.CategoryPath.Contains("0c46ef80013847acb095bb5c902d08bd")) && (cn.YIndex == 5) orderby cn.XIndex descending select new { title = c.CategoryName, id = c.CategoryGUID }).Take(8); ListViewHotpoint.DataSource = query.ToList(); ListViewHotpoint.DataBind(); //树 if (!Page.IsPostBack) { #region sync //SeminarTree.ShowLines = true; //SeminarTree.ShowExpandCollapse = true; TreeNodeCollection tnc = new TreeNodeCollection(); //tnc = SeminarTree.Nodes; //tncRecursion(tnc, "2461c3d8f92d451599e054c1fb46fa11"); //TreeNodeCollection tnc2 = new TreeNodeCollection(); //tnc2 = SujectTree.Nodes; //tncRecursion(tnc2, "50ac3b6925644d269836e0a45e4671b4"); #endregion sync } #region async //SeminarTree.Nodes.Clear(); //Bind_Root("2461c3d8f92d451599e054c1fb46fa11", SeminarTree); #endregion async //导航 string NaviList1Alias = ConfigurationManager.AppSettings["subject"]; DataTable NaviList1Items = DataQuery.GetSubCategories(NaviList1Alias, "9"); //NaviList1.DataSource = NaviList1Items; // NaviList1.DataBind(); string NaviList2Alias = ConfigurationManager.AppSettings["MAJOR"]; DataTable NaviList2Items = DataQuery.GetSubCategories(NaviList2Alias, "9"); //NaviList2.DataSource = NaviList2Items; // NaviList2.DataBind(); string NaviList3Alias = ConfigurationManager.AppSettings["INSTITUTION"]; DataTable NaviList3Items = DataQuery.GetSubCategories(NaviList3Alias, "9"); // NaviList3.DataSource = NaviList3Items; // NaviList3.DataBind(); //主列表 string ChannelListAliasA1 = ConfigurationManager.AppSettings["HomeChannelListA_CategoryAlias_1"]; WebModules.HomeChannelListA HomeChannelListA1 = new WebModules.HomeChannelListA(ChannelListAliasA1); // ColumnShowSort1.DataSource = HomeChannelListA1.SubSortTable; //ColumnShowSort1.DataBind(); //ColumnVideo1.DataSource = HomeChannelListA1.PicInfo; // ColumnVideo1.DataBind(); // ColumnOtherL1.DataSource = HomeChannelListA1.TextInfoL; //ColumnOtherL1.DataBind(); // ColumnOtherR1.DataSource = HomeChannelListA1.TextInfoR; // ColumnOtherR1.DataBind(); string ChannelListATitle1 = ConfigurationManager.AppSettings["HomeChannelListA_Title_1"]; // ListATitle1.Text = ChannelListATitle1; // ListALink1.NavigateUrl = "level2.aspx?alias=" + ChannelListAliasA1; string ChannelListAliasA2 = ConfigurationManager.AppSettings["HomeChannelListA_CategoryAlias_2"]; WebModules.HomeChannelListA HomeChannelListA2 = new WebModules.HomeChannelListA(ChannelListAliasA2); // ColumnShowSort2.DataSource = HomeChannelListA2.SubSortTable; // ColumnShowSort2.DataBind(); // ColumnVideo2.DataSource = HomeChannelListA2.PicInfo; // ColumnVideo2.DataBind(); //ColumnOtherL2.DataSource = HomeChannelListA2.TextInfoL; // ColumnOtherL2.DataBind(); // ColumnOtherR2.DataSource = HomeChannelListA2.TextInfoR; // ColumnOtherR2.DataBind(); string ChannelListATitle2 = ConfigurationManager.AppSettings["HomeChannelListA_Title_2"]; // ListATitle2.Text = ChannelListATitle2; //ListALink2.NavigateUrl = "level2.aspx?alias=" + ChannelListAliasA2; string ChannelListAliasA3 = ConfigurationManager.AppSettings["HomeChannelListA_CategoryAlias_3"]; WebModules.HomeChannelListA HomeChannelListA3 = new WebModules.HomeChannelListA(ChannelListAliasA3); // ColumnShowSort3.DataSource = HomeChannelListA3.SubSortTable; // ColumnShowSort3.DataBind(); // ColumnVideo3.DataSource = HomeChannelListA3.PicInfo; // ColumnVideo3.DataBind(); // ColumnOtherL3.DataSource = HomeChannelListA3.TextInfoL; // ColumnOtherL3.DataBind(); // ColumnOtherR3.DataSource = HomeChannelListA3.TextInfoR; // ColumnOtherR3.DataBind(); string ChannelListATitle3 = ConfigurationManager.AppSettings["HomeChannelListA_Title_3"]; // ListATitle3.Text = ChannelListATitle3; // ListALink3.NavigateUrl = "level2.aspx?alias=" + ChannelListAliasA3; string ChannelListAliasA4 = ConfigurationManager.AppSettings["HomeChannelListA_CategoryAlias_4"]; WebModules.HomeChannelListA HomeChannelListA4 = new WebModules.HomeChannelListA(ChannelListAliasA4); // ColumnShowSort4.DataSource = HomeChannelListA4.SubSortTable; // ColumnShowSort4.DataBind(); // ColumnVideo4.DataSource = HomeChannelListA4.PicInfo; // ColumnVideo4.DataBind(); //ColumnOtherL4.DataSource = HomeChannelListA4.TextInfoL; //ColumnOtherL4.DataBind(); // ColumnOtherR4.DataSource = HomeChannelListA4.TextInfoR; // ColumnOtherR4.DataBind(); string ChannelListATitle4 = ConfigurationManager.AppSettings["HomeChannelListA_Title_4"]; // ListATitle4.Text = ChannelListATitle4; // ListALink4.NavigateUrl = "level2.aspx?alias=" + ChannelListAliasA4; //右侧列表 string ChannelListAliasB2 = ConfigurationManager.AppSettings["HomeChannelListB_CategoryAlias_2"]; WebModules.HomeChannelListB HomeChannelListB2 = new WebModules.HomeChannelListB(ChannelListAliasB2, 1, 8); //VerticalShowVideo2.DataSource = HomeChannelListB2.PicInfo; // VerticalShowVideo2.DataBind(); // VerticalShowList2.DataSource = HomeChannelListB2.TextInfo; // VerticalShowList2.DataBind(); string ChannelListBTitle2 = ConfigurationManager.AppSettings["HomeChannelListB_Title_2"]; // ListBTitle2.Text = ChannelListBTitle2; // ListBLink2.NavigateUrl = "level2.aspx?alias=" + ChannelListAliasB2; string ChannelListAliasB3 = ConfigurationManager.AppSettings["HomeChannelListB_CategoryAlias_3"]; WebModules.HomeChannelListB HomeChannelListB3 = new WebModules.HomeChannelListB(ChannelListAliasB3, 1, 4); //VerticalShowVideo3.DataSource = HomeChannelListB3.PicInfo; // VerticalShowVideo3.DataBind(); // VerticalShowList3.DataSource = HomeChannelListB3.TextInfo; // VerticalShowList3.DataBind(); string ChannelListBTitle3 = ConfigurationManager.AppSettings["HomeChannelListB_Title_3"]; // ListBTitle3.Text = ChannelListBTitle3; // ListBLink3.NavigateUrl = "level2.aspx?alias=" + ChannelListAliasB3; //右侧名家 string ChannelListAliasBS1 = ConfigurationManager.AppSettings["HomeChannelListBS_CategoryAlias_1"]; WebModules.HomeChannelListBS HomeChannelListBS1 = new WebModules.HomeChannelListBS(ChannelListAliasBS1, 2); // VerticalShowVideo1.DataSource = HomeChannelListBS1.PicInfo; // VerticalShowVideo1.DataBind(); string ChannelListBSTitle1 = ConfigurationManager.AppSettings["HomeChannelListBS_Title_1"]; // ListBTitle1.Text = ChannelListBSTitle1; string FameAlias = ConfigurationManager.AppSettings["ChannelFame"]; // ListBLink1.NavigateUrl = "level2.aspx?alias=" + FameAlias; //右侧公开课 string ChannelListAliasBS2 = ConfigurationManager.AppSettings["ChannelClass"]; //WebModules.HomeChannelListBS HomeChannelListBS2 = new WebModules.HomeChannelListBS(ChannelListAliasBS2, 2); //VerticalShowVideo4.DataSource = HomeChannelListBS2.PicInfo; //VerticalShowVideo4.DataBind(); //LeftList string Lv2ClassLeftListAlias = DataQuery.GetChannelAliasByName(ChannelListAliasBS2, "国内985大学"); DataTable Lv2ClassLeftList1Items = DataQuery.GetSubCategories(Lv2ClassLeftListAlias, "6"); // TabIndex2List1.DataSource = Lv2ClassLeftList1Items; // TabIndex2List1.DataBind(); //LeftList Lv2ClassLeftListAlias = DataQuery.GetChannelAliasByName(ChannelListAliasBS2, "国外大学"); DataTable Lv2ClassLeftList2Items = DataQuery.GetSubCategories(Lv2ClassLeftListAlias, "6"); // TabIndex2List2.DataSource = Lv2ClassLeftList2Items; // TabIndex2List2.DataBind(); //下方列表 string SkillListAlias = ConfigurationManager.AppSettings["HomeChannelListC_CategoryAlias"]; DataTable SkillCategoryInfo = DataQuery.GetSubCategoriesNote(DataQuery.GetChannelAliasByName(SkillListAlias, "栏目"), "8"); SkillTabs.DataSource = SkillCategoryInfo; SkillTabs.DataBind(); TabIndex1Box.DataSource = SkillCategoryInfo; TabIndex1Box.DataBind(); SkillNote.DataSource = SkillCategoryInfo; SkillNote.DataBind(); string ChannelListAliasD = ConfigurationManager.AppSettings["HomeChannelListD_CategoryAlias"]; WebModules.HomeChannelListC HomeChannelListC2 = new WebModules.HomeChannelListC(ChannelListAliasD); TrainList.DataSource = HomeChannelListC2.CategoryInfo; TrainList.DataBind(); // TEST //GridView1.DataSource = HomeChannelListA1.TextInfoL; //GridView1.DataBind(); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Cache.SetCacheability(HttpCacheability.NoCache); context.Response.Cache.SetLastModified(DateTime.Now); context.Response.Cache.SetExpires(DateTime.Now.AddHours(2)); //context.Response.Write("Hello World"); //Request StreamReader sr = new StreamReader(HttpContext.Current.Request.InputStream); string strReq = sr.ReadToEnd(); //Test //JObject Req = new JObject( // new JProperty("ChannelAlias", "gxchannel1") // ); //string strReq = Req.ToString(); #region Index if (HttpContext.Current.Request["method"] == "index") { if (context.Cache["index"] == null) //判断是否存在缓存 { ZjspccmEntities DB = new ZjspccmEntities(); JObject rss = new JObject(); // JObject JCategoryGroup = JObject.FromObject(new { front = new { // sort = //(from c in DB.Categories.ToArray() // join cn in DB.CategoryNodePositions.ToArray() // on c.CategoryGUID equals cn.CategoryGUID // orderby cn.XIndex ascending // where cn.CategoryPath.Contains("ca07a19943b846a58c8884222d3ed8e7") // && cn.XIndex == 5 // select new // { // title = c.CategoryName, // id = c.CategoryGUID // }).Take(4), list = (from c in DB.Categories.ToArray() join cn in DB.CategoryNodePositions.ToArray() on c.CategoryGUID equals cn.CategoryGUID where cn.CategoryPath.Contains("14073c0fbafe492aa2726a2034b1d454") && CheckChild(c.CategoryGUID) == false orderby c.CreateTime descending select new { title = c.CategoryName, id = c.CategoryGUID, PicUrl = GetGroupPicUrl(c.CategoryGUID) }).Take(5) }, economic = new { // sort = //(from c in DB.Categories.ToArray() // join cn in DB.CategoryNodePositions.ToArray() // on c.CategoryGUID equals cn.CategoryGUID // orderby cn.XIndex ascending // where cn.CategoryPath.Contains("f884244d69204739b7fe09b9129141b2") // && cn.XIndex == 6 // select new // { // title = c.CategoryName, // id = c.CategoryGUID // }).Take(4), list = (from a in DB.ArticleCurrents.ToArray() join aoc in DB.ArticleCurrentOfCategoryTops.ToArray() on a.ArticleGUID equals aoc.ArticleGUID join cn in DB.CategoryNodePositions.ToArray() on aoc.CategoryGUID equals cn.CategoryGUID orderby a.CreateTime descending where aoc.CategoryGUID.Contains("f884244d69204739b7fe09b9129141b2") select new { title = a.Title, id = a.ArticleGUID, author = a.Author }).Take(12) }, manageClass = new { // sort = //(from c in DB.Categories.ToArray() // join cn in DB.CategoryNodePositions.ToArray() // on c.CategoryGUID equals cn.CategoryGUID // orderby cn.XIndex ascending // where cn.CategoryPath.Contains("758f3c84f2f440ad89ecc50635629488") // && cn.XIndex == 6 // select new // { // title = c.CategoryName, // id = c.CategoryGUID // }).Take(4), list = (from a in DB.ArticleCurrents.ToArray() join aoc in DB.ArticleCurrentOfCategoryTops.ToArray() on a.ArticleGUID equals aoc.ArticleGUID join cn in DB.CategoryNodePositions.ToArray() on aoc.CategoryGUID equals cn.CategoryGUID orderby a.CreateTime descending where aoc.CategoryGUID.Contains("758f3c84f2f440ad89ecc50635629488") select new { title = a.Title, id = a.ArticleGUID, author = a.Author }).Take(12) }, attainment = new { // sort = //(from c in DB.Categories.ToArray() // join cn in DB.CategoryNodePositions.ToArray() // on c.CategoryGUID equals cn.CategoryGUID // orderby cn.XIndex ascending // where cn.CategoryPath.Contains("31f8803471b4430bbd533752a9f41b86") // && cn.XIndex == 6 // select new // { // title = c.CategoryName, // id = c.CategoryGUID // }).Take(4), list = (from a in DB.ArticleCurrents.ToArray() join aoc in DB.ArticleCurrentOfCategoryTops.ToArray() on a.ArticleGUID equals aoc.ArticleGUID join cn in DB.CategoryNodePositions.ToArray() on aoc.CategoryGUID equals cn.CategoryGUID orderby a.CreateTime descending where aoc.CategoryGUID.Contains("31f8803471b4430bbd533752a9f41b86") select new { title = a.Title, id = a.ArticleGUID, author = a.Author, PicUrl = DataQuery.GetCoursePicPath(a.ArticleGUID, "/", "001.jpg") }).Take(9) }, teacherOnline = new JArray( (from a in DB.ArticleCurrents.ToArray() join aoc in DB.ArticleCurrentOfCategoryAlls.ToArray() on a.ArticleGUID equals aoc.ArticleGUID orderby a.CreateTime descending where aoc.CategoryGUID.Equals("4e927be1671642ea8c00d4ec789fa72c") select new JObject( new JProperty("id", a.ArticleGUID), new JProperty("title", a.Title), new JProperty("author", a.Author), new JProperty("position", a.Area), new JProperty("date", a.CreateTime.ToString("yyyy-MM-dd")), new JProperty("img", DataQuery.GetCoursePicPath(a.ArticleGUID, "/", "001.jpg")) ) ).Take(2) ), organition = new JArray( (from a in DB.ArticleCurrents.ToArray() join aoc in DB.ArticleCurrentOfCategoryTops.ToArray() on a.ArticleGUID equals aoc.ArticleGUID orderby a.CreateTime descending where aoc.CategoryGUID.Equals("0cb86341b1514ac6ba3552f9716cd0c8") select new JObject( new JProperty("id", a.ArticleGUID), new JProperty("title", a.Title), new JProperty("author", a.Author), new JProperty("position", a.Area), new JProperty("date", a.CreateTime.ToString("yyyy-MM-dd")), new JProperty("img", DataQuery.GetCoursePicPath(a.ArticleGUID, "/", "001.jpg")) ) ).Take(2) ) }); // rss.Merge(JCategoryGroup, new JsonMergeSettings { MergeArrayHandling = MergeArrayHandling.Concat } ); context.Cache.Add("index", rss.ToString(), null, DateTime.Now.AddHours(3), TimeSpan.Zero, CacheItemPriority.Normal, null); } else { } context.Response.Write(context.Cache["index"]); } #endregion Index #region MainTree else if (HttpContext.Current.Request["method"] == "MainTree") { HttpRequest Request = context.Request; string ParentId = Request.QueryString["id"].ToString(); JArray categories = new JArray(); // string sql = "select YIndex from CategoryNodePosition where CategoryGuid= '" + ParentId + "'"; DataSet ds = new DataSet(); ds = DataQuery.SelectRows(ds, sql, "zjspccmConnectionString"); int Yindex = Convert.ToInt16(ds.Tables[0].Rows[0][0].ToString()) + 1; // sql = @"select c.CategoryName,c.CategoryGUID,c.Note,cn.CategoryPath from Category c join CategoryNodePosition cn on c.CategoryGUID=cn.CategoryGUID where cn.CategoryPath like '%" + ParentId + "%' and YIndex=" + Yindex + "order by XIndex"; ds = new DataSet(); ds = DataQuery.SelectRows(ds, sql, "zjspccmConnectionString"); // foreach (DataRow dr in ds.Tables[0].Rows) { CategoryNode node = new CategoryNode(dr["CategoryGUID"].ToString(), dr["CategoryAlias"].ToString(), dr["CategoryName"].ToString(), dr["Note"].ToString()); categories.Add(AddChild(node)); } // context.Response.Write(categories.ToString()); } #endregion MainTree #region GruopTree else if (HttpContext.Current.Request["method"] == "GroupTree") { HttpRequest Request = context.Request; string ParentId = Request.QueryString["id"].ToString(); JArray categories = new JArray(); // string sql = "select YIndex from CategoryNodePosition where CategoryGuid= '" + ParentId + "'"; DataSet ds = new DataSet(); ds = DataQuery.SelectRows(ds, sql, "zjspccmConnectionString"); int Yindex = Convert.ToInt16(ds.Tables[0].Rows[0][0].ToString()) + 1; // sql = @"select c.CategoryName,c.CategoryGUID,c.Note,cn.CategoryPath from Category c join CategoryNodePosition cn on c.CategoryGUID=cn.CategoryGUID where cn.CategoryPath like '%" + ParentId + "%' and YIndex=" + Yindex + "order by XIndex"; ds = new DataSet(); ds = DataQuery.SelectRows(ds, sql, "zjspccmConnectionString"); // foreach (DataRow dr in ds.Tables[0].Rows) { CategoryNode node = new CategoryNode(dr["CategoryGUID"].ToString(), dr["CategoryAlias"].ToString(), dr["CategoryName"].ToString(), dr["Note"].ToString()); categories.Add(AddGroupChild(node)); } // context.Response.Write(categories.ToString()); } #endregion GruopTree #region Course else if (HttpContext.Current.Request["method"] == "course") { HttpRequest Request = context.Request; string id = Request.QueryString["id"].ToString(); string order = context.Request.Params["orderNum"].ToString(); ZjspccmEntities DB = new ZjspccmEntities(); JArray JCourse; if (order == "descending") { JCourse = new JArray( from a in DB.ArticleCurrents.ToArray() join aoc in DB.ArticleCurrentOfCategoryAlls.ToArray() on a.ArticleGUID equals aoc.ArticleGUID join cn in DB.CategoryNodePositions.ToArray() on aoc.CategoryGUID equals cn.CategoryGUID where cn.CategoryPath.Contains(id) //where aoc.CategoryGUID.Equals(id) orderby a.CreateTime descending select new JObject( new JProperty("id", a.ArticleGUID), new JProperty("title", a.Title), new JProperty("pic", DataQuery.GetCoursePicPath(a.ArticleGUID, "/", "001.jpg")), new JProperty("teacher", a.Author), new JProperty("length", a.PageCount), new JProperty("postion", a.Area), new JProperty("date", a.CreateTime.ToShortDateString()) ) ); } else { JCourse = new JArray( from a in DB.ArticleCurrents.ToArray() join aoc in DB.ArticleCurrentOfCategories.ToArray() on a.ArticleGUID equals aoc.ArticleGUID join cn in DB.CategoryNodePositions.ToArray() on aoc.CategoryGUID equals cn.CategoryGUID where cn.CategoryPath.Contains(id) //where aoc.CategoryGUID.Equals(id) orderby a.CreateTime ascending select new JObject( new JProperty("id", a.ArticleGUID), new JProperty("title", a.Title), new JProperty("pic", DataQuery.GetCoursePicPath(a.ArticleGUID, "/", "001.jpg")), new JProperty("teacher", a.Author), new JProperty("length", a.PageCount), new JProperty("postion", a.Area), new JProperty("date", a.CreateTime.ToShortDateString()) ) ); } context.Response.Write(JCourse.ToString()); } #endregion Course #region GruopCourse else if (HttpContext.Current.Request["method"] == "GroupCourse") { HttpRequest Request = context.Request; string id = Request.QueryString["id"].ToString(); string sql = "select YIndex from CategoryNodePosition where CategoryGuid= '" + id + "'"; DataSet ds = new DataSet(); ds = DataQuery.SelectRows(ds, sql, "zjspccmConnectionString"); int Yindex = Convert.ToInt16(ds.Tables[0].Rows[0][0].ToString()) + 1; sql = "select top 1 CategoryGUID from CategoryNodePosition where CategoryPath like '%" + id + "%' and YIndex =" + Yindex; DataSet ds2 = new DataSet(); ds2 = DataQuery.SelectRows(ds2, sql, "zjspccmConnectionString"); string FirstChildGuid = ds2.Tables[0].Rows[0][0].ToString(); ZjspccmEntities DB = new ZjspccmEntities(); JArray JCourse = new JArray( from c in DB.Categories.ToArray() join cn in DB.CategoryNodePositions.ToArray() on c.CategoryGUID equals cn.CategoryGUID where cn.CategoryPath.Contains(id) && cn.YIndex == Yindex && !CheckChild(c.CategoryGUID) orderby c.CreateTime descending select new JObject( new JProperty("id", c.CategoryGUID), new JProperty("title", c.CategoryName), new JProperty("pic", GetGroupPicUrl(c.CategoryGUID)), new JProperty("list", new JArray( from a in DB.ArticleCurrents.ToArray() join aoc in DB.ArticleCurrentOfCategories.ToArray() on a.ArticleGUID equals aoc.ArticleGUID where aoc.CategoryGUID == c.CategoryGUID orderby a.CreateTime descending select new JObject( new JProperty("id", a.ArticleGUID), new JProperty("title", a.Title), new JProperty("teacher", a.Author), new JProperty("length", a.PageCount), new JProperty("postion", a.Area), new JProperty("date", a.CreateTime) ) ) ) ) ); context.Response.Write(JCourse.ToString()); } #endregion GruopCourse else { } }