WELOA.Web/admin/login_staffupload.aspx.cs

(开头部分) 8KB

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LSBLL;
using System.Data;
using System.IO;
using WELOA.Model;
using System.Text.RegularExpressions;
using System.Web.Security;
using System.Text;

namespace Web.admin
{
    public partial class login_staffupload : System.Web.UI.Page
    {
        private LS_xls xlsBLL = new LS_xls();

        
        protected void btExcel_Click(object sender, EventArgs e)
        {
            DataSet ds = (DataSet)this.Session["paper"];
            this.Session.Remove("paper");
            string path = base.Server.MapPath(@"\") + "temp";
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            string filePath = string.Concat(new object[] { path, @"\", DateTime.Now.ToString("yyyyMMddHHmmss"), new Random().Next(0x270f), ".xls" });
            try
            {
                if (this.xlsBLL.Write_xls(ds, filePath).nException > 0)
                {
                    this.Page.ClientScript.RegisterStartupScript(base.GetType(), "", "<script>alert('系统出现异常1,请联系管理员处理。')</script>");
                }
                else
                {
                    using (FileStream stream = new FileStream(filePath, FileMode.OpenOrCreate))
                    {
                        base.Response.Clear();
                        base.Response.Buffer = true;
                        base.Response.Charset = "GB2312";
                        base.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode("错误员工数据列表", Encoding.UTF8) + ".xls");
                        base.Response.ContentEncoding = Encoding.GetEncoding("GB2312");
                        base.Response.ContentType = "application/ms-excel";
                        byte[] buffer = new byte[stream.Length - 1];
                        stream.Read(buffer, 0, ((int)stream.Length) - 1);
                        base.Response.BinaryWrite(buffer);
                        base.Response.Flush();
                        base.Response.End();
                        stream.Close();
                        stream.Dispose();
                    }
                }
            }
            catch
            {
                this.Page.ClientScript.RegisterStartupScript(base.GetType(), "", "<script>alert('导出失败。')</script>");
后面还有 133 行代码,解锁后查看完整代码

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

AI 解读

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

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