using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using BLL.DAL;
namespace GKXX
{
public partial class index : PageBase
{
resourceDAL rd = new resourceDAL();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GetFLASH();
tegongbind();
hotbind();
ttbind();
jpbeikebind();
schoolbind();
newsbind();
haotibind();
}
}
private void GetFLASH()
{
string hidImg = "";
string hidUrl = "";
string hidTitle = "";
StringBuilder sb = new StringBuilder();
page_flashDAL pd = new page_flashDAL();
DataSet ds = pd.GetList("pageid='1' order by res_up_time desc");
if (ds.Tables[0].Rows.Count > 0)
{
foreach (DataRow row in ds.Tables[0].Rows)
{
hidImg += "http://swf.gkxx.com" + row["imageurl"].ToString() + "|";
hidUrl += row["linkurl"].ToString() + "|";
hidTitle += row["title"].ToString() + "|";
}
}
ViewState["flashImg"] = hidImg.TrimEnd('|');
ViewState["imgUrl"] = hidUrl.TrimEnd('|');
ViewState["flash_title"] = hidTitle.TrimEnd('|');
}
//校长访谈
private void tegongbind()
{
page_bk_ggDAL gd = new page_bk_ggDAL();
DataSet ds = gd.GetList(10, "pageid=1 and bkid=1", "res_up_time desc");
repbind(Reptegong, ds);
}
//高考热点
private void hotbind()
{
DataSet ds = rd.GetListSmaill(10, "ishot=1", "res_up_time desc");
repbind(rephot, ds);
}
//大推荐
protected string GetBigTj(int bkid, int top)
{
StringBuilder sb = new StringBuilder();
page_tjDAL tj = new page_tjDAL();
string big = tj.GetBig(top, bkid);
sb.Append(big);
return sb.ToString();
}
//小推荐
protected string GetSmallTj(int bkid, int top)
{
StringBuilder sb = new StringBuilder();
page_tjDAL tj = new page_tjDAL();
DataSet ds = tj.GetList(top, "pageid='1' and bkid='" + bkid + "' and isbig=0", "res_up_time desc");
if (ds.Tables[0].Rows.Count > 0)
{
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
sb.Append("<li>" + ds.Tables[0].Rows[i]["c_html"].ToString() + "</li>");
}
}
return sb.ToString();
}
//高一,高二,高三试题小标题
private void ttbind()
{
DataSet ds = rd.GetListSmaill(5, "res_type=11 and res_grade=3 and isgood=1", "res_up_time desc");
repbind(Reptt3, ds);
ds = rd.GetListSmaill(5, "res_type=11 and res_grade=2 and isgood=1", "res_up_time desc");
repbind(Reptt2, ds);
ds = rd.GetListSmaill(5, "res_type=11 and res_grade=1 and isgood=1", "res_up_time desc");
repbind(Reptt1, ds);
}
//精品资源每一个小标题
private void jpbeikebind()
{
DataSet ds = rd.GetListSmaill(7, "res_type=12 and istj=1 and res_class=4", "res_up_time desc");
repbind(repjpkejian, ds);
ds = rd.GetListSmaill(7, "res_type=12 and istj=1 and res_class=6", "res_up_time desc");
repbind(repjpjiaoan, ds);
ds = rd.GetListSmaill(7, "res_type=12 and istj=1 and res_class=7", "res_up_time desc");
repbind(repjpxuean, ds);
ds = rd.GetListSmaill(7, "res_type=12 and istj=1 and res_class=8", "res_up_time desc");
repbind(repjptongbu, ds);
ds = rd.GetListSmaill(7, "res_type=12 and istj=1 and res_class=9", "res_up_time desc");
repbind(repjpsucai, ds);
ds = rd.GetListSmaill(7, "res_type=12 and istj=1 and res_class=10", "res_up_time desc");
repbind(repjplunwen, ds);
}
//名校展示,名校校长
private void schoolbind()
{
FamousSchoolDAL fsd = new FamousSchoolDAL();
DataSet ds = fsd.GetList(20, "is_tj=1", "addtime desc");
repbind(repimgschool, ds);
ds = fsd.GetList(42, "", "addtime desc");
repbind(repschool, ds);
ChancellorDAL cd = new ChancellorDAL();
ds = cd.GetList(3, "", "addtime desc");
repbind(repxiaozhang, ds);
}
//校长专栏,教学总结,高考政策,学习方法,更小类标题
private void newsbind()
{
DataSet ds = rd.GetListSmaill(7, "res_type=3 and res_class=13", "res_up_time desc");
repbind(repzhuanlan, ds);
ds = rd.GetListSmaill(7, "res_type=3 and res_class=17", "res_up_time desc");
repbind(repzongjie, ds);
ds = rd.GetListSmaill(7, "res_type=3 and res_class=1", "res_up_time desc");
repbind(repzhengce, ds);
ds = rd.GetListSmaill(7, "res_type=3 and res_class=2", "res_up_time desc");
repbind(repfangfa, ds);
}
//不可错过的考题
private void haotibind()
{
DataSet ds = rd.GetListSmaill(11, "istj=1 and res_type=11", "res_up_time desc");
repbind(rephaoti, ds);
}
//合作链接
protected string GetLinks()
{
StringBuilder sb = new StringBuilder();
linksDAL ld = new linksDAL();
DataSet ds = ld.GetList("pageid=1");
if (ds.Tables[0].Rows.Count > 0)
{
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
sb.Append("<a href='" + ds.Tables[0].Rows[i]["linkurl"].ToString() + "' target=\"_blank\">" + ds.Tables[0].Rows[i]["linkname"].ToString() + "</a>");
}
}
return sb.ToString();
}
#region 循环出首页备课导航
protected string GetBeikeUrl()
{
StringBuilder sb = new StringBuilder();
resource_beikeDAL bd = new resource_beikeDAL();
DataSet ds = bd.GetList("parentid=0");
if (ds.Tables[0].Rows.Count > 0)
{
for (int i = 1; i <= ds.Tables[0].Rows.Count; i++)
{
if (i == 1)
{
sb.Append(" <div class=\"navtxt\" id=\"xk_navtxt" + i.ToString() + "\">\n");
}
else
{
sb.Append(" <div class=\"navtxt\" id=\"xk_navtxt" + i.ToString() + "\" style=\"display:none;\">\n");
}
int sid = int.Parse(ds.Tables[0].Rows[i - 1]["id"].ToString());
sb.Append(Getbanben(sid));
sid = resource_subjectDAL.GetSubID(sid);
//sb.Append(GetTopic(sid));
sb.Append(shitiType(sid));
sb.Append("</div>\n");
}
}
return sb.ToString();
}
private string Getbanben(int parentid)//版本
{
StringBuilder sb = new StringBuilder();
resource_beikeDAL bd = new resource_beikeDAL();
DataSet ds = bd.GetList("parentid=" + parentid + "");
if (ds.Tables[0].Rows.Count > 0)
{
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
int tid = int.Parse(ds.Tables[0].Rows[i]["id"].ToString());
string typename = ds.Tables[0].Rows[i]["typename"].ToString();
sb.Append("<div class=\"nlist\">\n");
sb.Append("<div class=\"banben\"><a href=\"/beike/banben_" + tid + ".html\" target=\"_blank\">" + typename + "</a></div><div class=\"gradenav\">" + GetGrade(tid) + "</div>");
sb.Append("</div>\n");
}
}
return sb.ToString();
}
private string GetGrade(int parentid)
{
StringBuilder sb = new StringBuilder();
resource_beikeDAL bd = new resource_beikeDAL();
DataSet ds = bd.GetList("parentid=" + parentid + "");
if (ds.Tables[0].Rows.Count > 0)
{
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
int gid = int.Parse(ds.Tables[0].Rows[i]["id"].ToString());
string typename = ds.Tables[0].Rows[i]["typename"].ToString();
sb.Append("<div class=\"gradetxt\"><span><a href=\"/beike/grade_" + gid + ".html\" target=\"_blank\">" + Text.Left(typename, 12) + "</a></span> \n");
sb.Append(GetResType(gid));
sb.Append("</div>");
}
}
return sb.ToString();
}
private string GetResType(int parentid)
{
StringBuilder sb = new StringBuilder();
resource_child_dboDAL cd = new resource_child_dboDAL();
DataSet ds = cd.GetList(5, "chlid_type=1", "id");
if (ds.Tables[0].Rows.Count > 0)
{
string typename = "";
int id = 0;
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
typename = ds.Tables[0].Rows[i]["child_name"].ToString();
id = int.Parse(ds.Tables[0].Rows[i]["id"].ToString());
sb.Append("<a href=\"/beike/List_" + parentid + "_" + id + "_1.html\" target=\"_blank\">" + Text.Left(typename, 4) + "</a>");
}
}
return sb.ToString();
}
private string GetTopic(int sid)
{
string subname = BLL.DAL.resource_subjectDAL.GetTypeName(sid);
StringBuilder sb = new StringBuilder();
resource_topicDAL td = new resource_topicDAL();
DataSet ds = td.GetList("sid='" + sid + "'");
if (ds.Tables[0].Rows.Count > 0)
{
sb.Append("<div class=\"navcon_zt\">");
//sb.Append(" <hr />");
sb.Append("<p class='zt_title'>" + subname + "专题</p><p>");
//sb.Append("<div class=\"nlist\"><ul><li>");
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
int topicid = int.Parse(ds.Tables[0].Rows[i]["id"].ToString());
string typename = ds.Tables[0].Rows[i]["typename"].ToString();
sb.Append("<a href='/topiclist.aspx?topicid=" + topicid + "' target='_blank'>" + typename + "</a>");
}
//sb.Append("</li></ul></div></div>");
sb.Append("</p></div>");
}
return sb.ToString();
}
private string shitiType(int sid)
{
StringBuilder sb = new StringBuilder();
resource_typeDAL td = new resource_typeDAL();
DataSet ds = td.GetList("parentid='1'");
if (ds.Tables[0].Rows.Count > 0)
{
sb.Append("<div class=\"navcon_zt\">");
//sb.Append("<hr />");
sb.Append("<p class='zt_title'>试题分类</p><p>");
//sb.Append("<div class=\"nlist\"><ul><li>");
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
int id = int.Parse(ds.Tables[0].Rows[i]["id"].ToString());
string typename = ds.Tables[0].Rows[i]["word"].ToString();
sb.Append("<a href='search/search.html?t=1&s=" + sid + "&c=" + id + "' target='_blank'>" + typename + "</a>");
}
// sb.Append("</li></ul></div></div>");
sb.Append("</p></div>");
}
return sb.ToString();
}
#endregion
private void repbind(Repeater rep, DataSet ds)
{
if (ds.Tables[0].Rows.Count > 0)
{
rep.DataSource = ds;
rep.DataBind();
}
}
}
}