public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; Cultural.BLL.Department departBll = new Cultural.BLL.Department(); context.Response.ContentType = "text/plain"; string paraFID = context.Request["FID"]; //读取参数PageSize if (paraFID != null && paraFID.Trim() == "DL") //列表界面 { int paraIndex = context.Request["Index"] == null ? 1 : int.Parse(context.Request["Index"]); //读取参数PageSize int paraSize = context.Request["PageSize"] == null ? 10 : int.Parse(context.Request["PageSize"]); //读取参数PageSize string paraBoardID = context.Request["BoardID"] == null ? "0" : context.Request["BoardID"].ToString(); //读取参数 DepartInfo departInfo = new DepartInfo(); departInfo.DepartList = departBll.DataTableToList(departBll.GetListByPage(string.Format(" BoardID={0} and Status!='0' ", paraBoardID), " Weight desc,DepartID asc ", (paraIndex - 1) * paraSize, paraIndex * paraSize).Tables[0]); departInfo.TotalNum = departBll.GetRecordCount(string.Format(" BoardID={0} and Status!='0' ", paraBoardID)); context.Response.Write(JsonHelper.Serialize(departInfo)); } if (paraFID != null && paraFID.Trim() == "DownL") //列表界面 { int paraIndex = context.Request["Index"] == null ? 1 : int.Parse(context.Request["Index"]); //读取参数PageSize int paraSize = context.Request["PageSize"] == null ? 10 : int.Parse(context.Request["PageSize"]); //读取参数PageSize string paraBoardID = context.Request["BoardID"] == null ? "0" : context.Request["BoardID"].ToString(); //读取参数 DownLoadInfo downLoadInfo = new DownLoadInfo(); Cultural.BLL.DownCenter dcBll = new Cultural.BLL.DownCenter(); downLoadInfo.DownCenterList = dcBll.DataTableToList(dcBll.GetListByPage(string.Format(" BoardID={0} and Status!='0' ", paraBoardID), " PubTime desc ", (paraIndex - 1) * paraSize, paraIndex * paraSize).Tables[0]); foreach (Cultural.Model.DownCenter dc in downLoadInfo.DownCenterList) { dc.PubTime = dc.PubTime.Substring(0, 10); } downLoadInfo.TotalNum = dcBll.GetRecordCount(string.Format(" BoardID={0} and Status!='0' ", paraBoardID)); context.Response.Write(JsonHelper.Serialize(downLoadInfo)); } if (paraFID != null && paraFID.Trim() == "DownD") //详细界面 { int paraIndex = context.Request["InfoID"] == null ? 0 : int.Parse(context.Request["InfoID"]); //读取参数InfoID Cultural.Model.DownCenter downLoad = new Cultural.Model.DownCenter(); Cultural.BLL.DownCenter dcBll = new Cultural.BLL.DownCenter(); downLoad = dcBll.GetModel(paraIndex); DownLoadInfo downLoadInfo = new DownLoadInfo(); downLoadInfo.DownCenterList = new List <Cultural.Model.DownCenter>(); downLoadInfo.DownCenterList.Add(downLoad); Cultural.BLL.Board boardBll = new Cultural.BLL.Board(); Cultural.Model.Board board = new Cultural.Model.Board(); board = boardBll.GetModel(int.Parse(downLoad.BoardID.ToString())); downLoadInfo.BName = board.BoardName; context.Response.Write(JsonHelper.Serialize(downLoadInfo)); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { id = GetBIDByQueryStr(Request.QueryString["BName"]); boardIDInfo.Value = id; try { if (id != null && id.ToString().Trim() != "") { //取得该id的板块信息 Cultural.Model.Board board = new Cultural.Model.Board(); board = boardBll.GetModel(int.Parse(id)); if (board != null) { if (board.ParentID == 0)//为第一级板块 { //一级板块名赋值 ParentBName = board.BoardName; //取得所有子级板块 List <Cultural.Model.Board> boardList = new List <Cultural.Model.Board>(); boardList = boardBll.GetModelList(string.Format(" ParentID ={0} and Status!='0' ", board.BoardID)); //如果有子版块 if (boardList.Count > 0) { //给页面子版块赋值 repBoardList.DataSource = boardList; repBoardList.DataBind(); //显示第一个板块的Infomation boardIDInfo.Value = boardList[0].BoardID.ToString(); DataSet infoData = new DataSet(); infoData = departBll.GetListByPage(string.Format(" BoardID={0} and Status!=0", boardList[0].BoardID), " Weight desc,DepartID asc ", 1, 15); boardInfoNum.Value = departBll.GetRecordCount(string.Format(" BoardID={0} and Status!=0", boardList[0].BoardID)).ToString(); repDepartList.DataSource = infoData; repDepartList.DataBind(); } else // 如果没有子版块 { //给页面子版块赋值null repBoardList.DataSource = null; repBoardList.DataBind(); //显示第一个板块的Infomation DataSet infoData = new DataSet(); infoData = departBll.GetListByPage(string.Format(" BoardID={0} and Status!=0", board.BoardID), " Weight desc,DepartID asc ", 1, 15); boardInfoNum.Value = departBll.GetRecordCount(string.Format(" BoardID={0} and Status!=0", board.BoardID)).ToString(); repDepartList.DataSource = infoData; repDepartList.DataBind(); } } else //非一级板块 { repDepartList.DataSource = null; repDepartList.DataBind(); } } else { ParentBName = Request.QueryString["BName"]; Maticsoft.Common.MessageBox.Show(this.Page, "可能原因:\\n 1.网络错误\\n 2.暂时无数据\\n 请重试!"); } } else { ParentBName = Request.QueryString["BName"]; Maticsoft.Common.MessageBox.Show(this.Page, "可能原因:\\n 1.网络错误\\n 2.暂时无数据\\n 请重试!"); } repAnnounce.DataSource = infoBll.GetListByPage(string.Format(" BoardID={0} and Status!='0' ", htBID["公告"] == "" ? "0" : htBID["公告"]), " Weight desc,PubTime desc ", 0, 9); repAnnounce.DataBind(); repRelaxInfo.DataSource = infoBll.GetListByPage(string.Format(" (BoardID ={0} or BoardID in(select BoardID from Board where ParentID ={1}) ) and Status!='0' ", htBID["闲情偶寄"] == "" ? "0" : htBID["闲情偶寄"], htBID["闲情偶寄"] == "" ? "0" : htBID["闲情偶寄"]), " Weight desc,PubTime desc ", 0, 8); repRelaxInfo.DataBind(); } catch (Exception ex) { ParentBName = Request.QueryString["BName"]; Maticsoft.Common.MessageBox.Show(this.Page, "可能原因:\\n 1.网络错误\\n 2.暂时无数据\\n 请重试!" + ex.Message); } } }