Exemplo n.º 1
0
    //导出数据
    protected void Button1_Click(object sender, EventArgs e)
    {
        string employname1 = employname.Value;
        string employcode1 = employcode.Value;
        string EndTime1    = EndTime.Value;
        string StartTime1  = StartTime.Value;

        if (employname1 == "")
        {
            employname1 = "0";
        }
        if (employcode1 == "")
        {
            employcode1 = "0";
        }

        if (StartTime1 == "")
        {
            StartTime1 = "0";
        }
        if (EndTime1 == "")
        {
            EndTime1 = "0";
        }
        TeModel   tm = new TeModel();
        DataTable dt = tm.EmployeeInfoout(employname1, employcode1, StartTime1, EndTime1);

        System.DateTime currentTime = new System.DateTime();
        currentTime = System.DateTime.Now;
        string now = currentTime.ToString("yyyyMMdd");

        CreateExcel(dt, "application/ms-excel", "员工工作量统计" + now);
    }