Esempio n. 1
0
    protected void btnExportExcel_Click(object sender, System.EventArgs e)
    {
        int year = System.Convert.ToInt32(this.dropYear.SelectedValue);
        PCPettyCashService pCPettyCashService = new PCPettyCashService();
        DataTable          monthCash          = pCPettyCashService.GetMonthCash(year, this.userCode);

        for (int i = 0; i < monthCash.Rows.Count; i++)
        {
            DataRow dataRow = monthCash.Rows[i];
            dataRow["Matter"] = dataRow["Matter"].ToString().Replace("<br />", ";\t");
        }
        string[] headerName = new string[]
        {
            "序号",
            "日期",
            "事项",
            "借款金额"
        };
        string[] fieldName = new string[]
        {
            "No",
            "Date",
            "Matter",
            "Cash"
        };
        string[] totalField = new string[]
        {
            "Cash"
        };
        ExcelHelper.ExportExcel(monthCash, headerName, fieldName, totalField, this.lblTitle.Text + ".xls", base.Request.Browser.Browser);
    }
Esempio n. 2
0
    private void BindGvwMonthCash(int year, string userCode)
    {
        PCPettyCashService pCPettyCashService = new PCPettyCashService();

        this.gvwMonthCash.DataSource = pCPettyCashService.GetMonthCash(year, userCode);
        this.gvwMonthCash.DataBind();
    }