⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 newscategory.ashx

📁 news新闻系统. news新闻系统 news新闻系统
💻 ASHX
字号:
<%@ WebHandler Language="C#" Class="newscategory" %>

using System;
using System.Web;
using System.Data;
using News.BLL;
using System.Collections;
using Newtonsoft.Json;

public class newscategory : IHttpHandler {
    int page;   //页码
    int rows;   //行数
    int tableCount;   //数据行数
    int pageCount;      //多少页
    ArrayList arlRow = new ArrayList();     //  数据数组
    Hashtable htGrid = new Hashtable();     //数据hash  table   
    
    public void ProcessRequest (HttpContext context) {
        
        page = Convert.ToInt32(context.Request.QueryString["page"]);
        rows = Convert.ToInt32(context.Request.QueryString["rows"]);

        languageBLL bll = new languageBLL();
        //HttpCookie cookie = new HttpCookie();
        //string code = cookie["code"].ToString();
        string code = "cn";
        DataTable dt= bll.Select(code).Tables[0];
        
        tableCount = dt.Rows.Count;
        pageCount = tableCount == 0 || tableCount < rows ? 1 : tableCount / rows; //计算多少页
        htGrid.Add("total", pageCount);
        htGrid.Add("page", page);
        htGrid.Add("records", tableCount);
        GetType Get_type = new GetType();
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            System.Collections.ArrayList arlCell = new ArrayList();
            arlCell.Add(dt.Rows[i]["owner_id"].ToString());
            arlCell.Add(dt.Rows[i]["nameTitle"].ToString());
            arlCell.Add(dt.Rows[i]["SortOrder"].ToString());
            arlCell.Add(dt.Rows[i]["NewsCount"].ToString());
            arlCell.Add(Get_type.GetY_N(dt.Rows[i]["status"].ToString()));
            arlCell.Add(Get_type.Updatetime( Convert.ToDateTime( dt.Rows[i]["Updated"])));
            System.Collections.Hashtable ht = new System.Collections.Hashtable();
            ht.Add("owner_id", dt.Rows[i]["owner_id"].ToString());
            ht.Add("cell", arlCell);
            arlRow.Add(ht);
        }
        htGrid.Add("rows", arlRow);
        context.Response.Write(JavaScriptConvert.SerializeObject(htGrid));
        
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -