com.eshop.www.Web/manager/handler/help.ashx

(开头部分) 8KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<%@ WebHandler Language="C#" Class="help" %>

using System;
using System.Web;
using com.eshop.www.BLL;
using com.eshop.www.Model;
using System.Data.OleDb;
using System.Data;
using com.eshop.www.Tools;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Data.Common;


public class help : IHttpHandler
{
    
    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/plain";
        string action  = context.Request.Form["action"];
        if (action == "export")
            Export();
        else
            Import();
            
    }
    private void Export()
    {
        //大批量导出的方法,用oledb和excel组件均太慢,采用流写入文件。
        string fileName = HttpContext.Current.Request.Form["fileName"];
        string destPath = HttpContext.Current.Server.MapPath("../export/") + fileName + ".xls";
        string temp = HttpContext.Current.Server.MapPath("../export/temp.txt");

        NewsCategoryBusiness newsCategoryBusiness = new NewsCategoryBusiness();
        Database database = DatabaseFactory.CreateDatabase();
        string ids = GetIds(3);
        string sql = "select title,summary,content,keywords,category_id from news_content where is_delete=0 and category_id in ("+ids+")";
        DbCommand cmd = database.GetSqlStringCommand(sql);
        string title = string.Empty;
        string summary = string.Empty;
        string content = string.Empty;
        string keywords = string.Empty; 
        int categoryId = 0;
        string categoryName = string.Empty;
        System.Text.StringBuilder excelstr = new System.Text.StringBuilder();
        //下面是excel标题,
        excelstr.Append("<tr height=19 style='height:14.25pt'>");
        excelstr.Append("<td height=19 width=72 style='height:14.25pt;width:54pt'>标题</td>");
        excelstr.Append("<td width=72 style='width:54pt'>摘要</td>");
        excelstr.Append("<td width=72 style='width:54pt'>内容</td>");
        excelstr.Append("<td width=72 style='width:54pt'>关键字</td>");
        excelstr.Append("<td width=72 style='width:54pt'>目录</td>");
        excelstr.Append("</tr>");
        using (IDataReader reader = database.ExecuteReader(cmd))
        {
            while (reader.Read())
            {
                title = reader["title"].ToString();
                summary = reader["summary"].ToString();
                content = reader["content"].ToString();
                keywords = reader["keywords"].ToString();
后面还有 140 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。