Beispiel #1
0
    private void bindGv()
    {
        this.ViewState["Cost"] = EReport.GetBudTaskCost(this.txtCode.Text.Trim(), this.txtName.Text.Trim(), base.UserCode, this.hfldIsWBSRelevance.Value);
        DataTable dataTable = this.ViewState["Cost"] as DataTable;

        this.AspNetPager1.RecordCount = dataTable.Rows.Count;
        this.AspNetPager1.PageSize    = NBasePage.pagesize;
        if (dataTable.Rows.Count != 0)
        {
            string[] array = new string[12];
            array[0] = dataTable.Compute("SUM(MonthRealitybud)", string.Empty).ToString();
            array[1] = dataTable.Compute("SUM(Monthbud)", string.Empty).ToString();
            array[2] = dataTable.Compute("SUM(MonthReality)", string.Empty).ToString();
            array[3] = dataTable.Compute("SUM(Monthacc)", string.Empty).ToString();
            array[4] = dataTable.Compute("SUM(MonthChazhi)", string.Empty).ToString();
            if (System.Convert.ToDecimal(array[0]) + System.Convert.ToDecimal(array[1]) != 0m)
            {
                decimal d = System.Convert.ToDecimal(array[4]) / (System.Convert.ToDecimal(array[0]) + System.Convert.ToDecimal(array[1]));
                array[5] = (decimal.Floor(d * 10000m) / 100m).ToString() + "%";
            }
            else
            {
                array[5] = "0.00%";
            }
            array[6]  = dataTable.Compute("SUM(Target)", string.Empty).ToString();
            array[7]  = dataTable.Compute("SUM(IndirBud)", string.Empty).ToString();
            array[8]  = dataTable.Compute("SUM(Reality)", string.Empty).ToString();
            array[9]  = dataTable.Compute("SUM(IndirAcc)", string.Empty).ToString();
            array[10] = dataTable.Compute("SUM(Chazhi)", string.Empty).ToString();
            if (System.Convert.ToDecimal(array[6]) + System.Convert.ToDecimal(array[7]) != 0m)
            {
                decimal d2 = System.Convert.ToDecimal(array[10]) / (System.Convert.ToDecimal(array[6]) + System.Convert.ToDecimal(array[7]));
                array[11] = (decimal.Floor(d2 * 10000m) / 100m).ToString() + "%";
            }
            else
            {
                array[11] = "0.00%";
            }
            this.ViewState["Total"] = array;
        }
        this.gvCost.DataSource   = EReport.GetPageDataTable(dataTable, this.AspNetPager1.CurrentPageIndex, this.AspNetPager1.PageSize);
        this.gvCost.DataKeyNames = new string[]
        {
            "PrjGuid"
        };
        this.gvCost.DataBind();
    }