Exemplo n.º 1
0
    public void BindGv()
    {
        this.ViewState["Jixie"] = EReport.GetJixieAnalysis(this.prjId, this.txtName.Text.Trim());
        DataTable dataTable = this.ViewState["Jixie"] as DataTable;

        if (dataTable.Rows.Count != 0)
        {
            string[] array = new string[8];
            array[0] = dataTable.Compute("SUM(MonthTotalBud)", string.Empty).ToString();
            array[1] = dataTable.Compute("SUM(MonthTotalAcc)", string.Empty).ToString();
            array[2] = dataTable.Compute("SUM(MonthChazhi)", string.Empty).ToString();
            if (System.Convert.ToDecimal(array[0]) != 0m)
            {
                array[3] = (System.Convert.ToDecimal(array[2]) / System.Convert.ToDecimal(array[0])).ToString("P2");
            }
            else
            {
                array[3] = "0.00%";
            }
            array[4] = dataTable.Compute("SUM(TotalBud)", string.Empty).ToString();
            array[5] = dataTable.Compute("SUM(TotalAcc)", string.Empty).ToString();
            array[6] = dataTable.Compute("SUM(Chazhi)", string.Empty).ToString();
            if (System.Convert.ToDecimal(array[4]) != 0m)
            {
                array[7] = (System.Convert.ToDecimal(array[6]) / System.Convert.ToDecimal(array[4])).ToString("P2");
            }
            else
            {
                array[7] = "0.00%";
            }
            this.ViewState["Total"] = array;
        }
        this.AspNetPager1.RecordCount = dataTable.Rows.Count;
        this.AspNetPager1.PageSize    = NBasePage.pagesize;
        this.gvCost.DataSource        = EReport.GetPageDataTable(dataTable, this.AspNetPager1.CurrentPageIndex, this.AspNetPager1.PageSize);
        this.gvCost.DataBind();
    }