• 大小: 4.2MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-11-07
  • 语言: C#
  • 标签: c#  类库  序列化  asp.net  

资源简介

多年积累c#类库。xml操作类,时间操作类,导出Execel,随机数类,验证码,正则表达式,序列化,文件操作类。

资源截图

代码片段和文件信息

using System;
using System.Web.UI.WebControls;
using System.IO;
using System.Web.UI;

namespace DotNet.Utilities
{
    public class basePage :System.Web.UI.Page
    {
        public basePage()
        {
            //
            //TODO: 在此处添加构造函数逻辑
            //
        }

        public static string title = “标题“;
        public static string keywords = “关键字“;
        public static string description = “网站描述“;

        protected override void OnInit(EventArgs e)
        {
            if (Session[“admin“] == null || Session[“admin“].ToString().Trim() == ““)
            {
                Response.Redirect(“login.aspx“);
            }
            base.OnInit(e);
        }

        protected void ExportData(string strContent string FileName)
        {

            FileName = FileName + DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString();

            Response.Clear();
            Response.Charset = “gb2312“;
            Response.ContentType = “application/ms-excel“;
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            //this.Page.EnableViewState = false; 
            // 添加头信息,为“文件下载/另存为“对话框指定默认文件名 
            Response.AddHeader(“Content-Disposition“ “attachment; filename=“ + FileName + “.xls“);
            // 把文件流发送到客户端 
            Response.Write(“ta http-equiv=Content-Type content=\“text/html; charset=utf-8\“>“);
            Response.Write(strContent);
            Response.Write(““);
            // 停止页面的执行 
            //Response.End();
        }

        /// 
        /// 导出Excel
        /// 

        /// 
        public void ExportData(GridView obj)
        {
            try
            {
                string style = ““;
                if (obj.Rows.Count > 0)
                {
                    style = @“yle> .text { mso-number-format:\@; } ript> “;
                }
                else
                {
                    style = “no data.“;
                }

                Response.ClearContent();
                DateTime dt = DateTime.Now;
                string filename = dt.Year.ToString() + dt.Month.ToString() + dt.Day.ToString() + dt.Hour.ToString() + dt.Minute.ToString() + dt.Second.ToString();
                Response.AddHeader(“content-disposition“ “attachment; filename=ExportData“ + filename + “.xls“);
                Response.ContentType = “application/ms-excel“;
                Response.Charset = “GB2312“;
                Response.ContentEncoding = System.Text.Encoding.GetEncoding(“GB2312“);
                StringWriter sw = new StringWriter();
                HtmlTextWriter htw = new HtmlTextWriter(sw);
                obj.RenderControl(htw);
                Response.W

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-04-24 10:50  DotNet.Utilities\
     文件        3309  2011-10-26 11:11  DotNet.Utilities\basePage.cs
     文件        2268  2013-07-27 10:49  DotNet.Utilities\BindDataControl.cs
     目录           0  2013-04-24 10:50  DotNet.Utilities\CSV文件转换\
     文件        2585  2011-11-07 14:10  DotNet.Utilities\CSV文件转换\CsvHelper.cs
     目录           0  2013-04-24 10:50  DotNet.Utilities\Chart图形\
     文件       24430  2011-10-25 15:47  DotNet.Utilities\Chart图形\Assistant.cs
     文件       11544  2011-10-25 15:47  DotNet.Utilities\Chart图形\OWCChart11.cs
     文件        5123  2011-10-26 11:11  DotNet.Utilities\ConvertHelper.cs
     目录           0  2013-04-24 10:50  DotNet.Utilities\Cookie&Session&Cache\
     文件        2236  2011-11-07 14:01  DotNet.Utilities\Cookie&Session&Cache\CacheHelper.cs
     文件        2083  2011-10-25 15:47  DotNet.Utilities\Cookie&Session&Cache\CookieHelper.cs
     文件         980  2011-10-25 15:47  DotNet.Utilities\Cookie&Session&Cache\Sessionhelper.cs
     文件        3458  2011-11-07 14:38  DotNet.Utilities\Cookie&Session&Cache\Sessionhelper2.cs
     目录           0  2013-04-24 10:50  DotNet.Utilities\DEncrypt\
     文件        2984  2011-09-11 19:37  DotNet.Utilities\DEncrypt\DESEncrypt.cs
     文件        4492  2011-09-11 19:37  DotNet.Utilities\DEncrypt\DEncrypt.cs
     文件        2592  2011-09-11 19:17  DotNet.Utilities\DEncrypt\Encrypt.cs
     文件        1292  2011-09-11 19:14  DotNet.Utilities\DEncrypt\HashEncode.cs
     文件       16116  2011-10-26 10:36  DotNet.Utilities\DEncrypt\MySecurity.cs
     文件       11311  2011-09-11 19:16  DotNet.Utilities\DEncrypt\RSACryption.cs
     目录           0  2013-04-24 10:50  DotNet.Utilities\DLL\
     文件       15360  2011-10-25 15:17  DotNet.Utilities\DLL\COM.Excel.dll
     文件     1089536  2011-10-25 15:17  DotNet.Utilities\DLL\Excel.dll
     文件      200704  2011-11-07 14:39  DotNet.Utilities\DLL\ICSharpCode.SharpZipLib.dll
     文件      461416  2011-10-25 15:17  DotNet.Utilities\DLL\Microsoft.Office.Interop.Owc11.dll
     文件      186688  2011-10-25 15:17  DotNet.Utilities\DLL\Microsoft.Web.UI.WebControls.dll
     文件       20480  2011-10-25 15:17  DotNet.Utilities\DLL\OWC10Chart.dll
     文件     3526656  2011-11-07 14:26  DotNet.Utilities\DLL\itextsharp.dll
     文件        1230  2011-09-11 19:38  DotNet.Utilities\DataCache.cs
     文件        9978  2011-11-07 14:47  DotNet.Utilities\DotNet.Utilities.csproj
............此处省略152个文件信息

评论

共有 条评论