private void PopulateGridView()
        {
            String fiscalYear = (String)Session["FiscalYear"];

            StoredProcedures sp = new StoredProcedures();
            TextBox tb = new TextBox();
            DataSet ds = sp.GetExpenduters(fiscalYear);

            MiscellaneousExpensesGridView.DataSource = ds.Tables[3];
            MiscellaneousExpensesGridView.DataBind();

            if (ds.Tables[0].Rows.Count == 0)
            {
                Session["ChreckExpenduters"] = false;
                InstractionalCompensationPanel.Visible = false;

                InfoPanel.Visible = true;
                BenefitsRateLink.Visible = false;
                SaveButton.Visible = false;
            }
            else
            {
                Session["ChreckExpenduters"] = true;
                InfoPanel.Visible = false;
                InstractionalCompensationPanel.Visible = true;
                BenefitsRateLink.Visible = true;
                SaveButton.Visible = true;

                DisplayTotals(fiscalYear);

                InstractionalCompensationGridView.DataSource = ds.Tables[0];
                InstractionalCompensationGridView.DataBind();
                NonInstractionalCompensationGridView.DataSource = ds.Tables[1];
                NonInstractionalCompensationGridView.DataBind();
                NonCompensationGridView.DataSource = ds.Tables[2];
                NonCompensationGridView.DataBind();

                for (int row = 0; row < InstractionalCompensationGridView.Rows.Count; row++)
                {
                    tb = (TextBox)InstractionalCompensationGridView.Rows[row].FindControl("BudgetTextBox");
                    tb.Text = ds.Tables[0].Rows[row][3].ToString();

                    if (ds.Tables[0].Rows[row][4].ToString() != "")
                    {
                        double rate = double.Parse(ds.Tables[0].Rows[row][4].ToString()) * 100;

                        tb = (TextBox)InstractionalCompensationGridView.Rows[row].FindControl("FringeBenefitRateTextBox");
                        tb.Text = ds.Tables[0].Rows[row][4].ToString();

                        rate.ToString();
                    }
                }

                for (int row = 0; row < NonInstractionalCompensationGridView.Rows.Count; row++)
                {
                    tb = (TextBox)NonInstractionalCompensationGridView.Rows[row].FindControl("BudgetTextBox");
                    tb.Text = ds.Tables[1].Rows[row][3].ToString();

                    if (ds.Tables[1].Rows[row][4].ToString() != "")
                    {
                        double rate = double.Parse(ds.Tables[1].Rows[row][4].ToString()) * 100;

                        tb = (TextBox)NonInstractionalCompensationGridView.Rows[row].FindControl("FringeBenefitRateTextBox");
                        tb.Text = rate.ToString();
                    }

                }
                for (int row = 0; row < NonCompensationGridView.Rows.Count; row++)
                {

                    tb = (TextBox)NonCompensationGridView.Rows[row].FindControl("BudgetTextBox");
                    tb.Text = ds.Tables[2].Rows[row][3].ToString();

                }

            }

            for (int row = 0; row < MiscellaneousExpensesGridView.Rows.Count; row++)
            {

                tb = (TextBox)MiscellaneousExpensesGridView.Rows[row].FindControl("BudgetTextBox");
                tb.Text = ds.Tables[3].Rows[row][3].ToString();

            }
        }
        private void PopulateMiscellaneous()
        {
            String fiscalYear = (String)Session["FiscalYear"];

            StoredProcedures sp = new StoredProcedures();
            TextBox tb = new TextBox();
            DataSet ds = sp.GetExpenduters(fiscalYear);

            MiscellaneousExpensesGridView.DataSource = ds.Tables[3];
            MiscellaneousExpensesGridView.DataBind();

            for (int row = 0; row < MiscellaneousExpensesGridView.Rows.Count; row++)
            {

                tb = (TextBox)MiscellaneousExpensesGridView.Rows[row].FindControl("BudgetTextBox");
                tb.Text = ds.Tables[3].Rows[row][3].ToString();

            }
        }
Exemplo n.º 3
0
        protected void PopulateExpendatures()
        {
            string fiscalYear = (string)ViewState["MostRecentFiscalYear"];
            DataSet ds = new DataSet();

            if (ViewState["Expendatures"] != null)
            {
                ds = (DataSet)ViewState["Expendatures"];
            }
            else
            {
                StoredProcedures sp = new StoredProcedures();
                ds = sp.GetExpenduters(fiscalYear);

                ViewState["Expendatures"] = ds;
            }

            DataTable dt = new DataTable();

            if ( RadioButtonList1.SelectedIndex == 0 )
            {
                dt = ds.Tables[0];

                AddedExpendaturesGridView.Columns[2].Visible = true;
            }
            else if (RadioButtonList1.SelectedIndex == 1)
            {
                dt = ds.Tables[1];

                AddedExpendaturesGridView.Columns[2].Visible = true;

            }
            else if (RadioButtonList1.SelectedIndex == 2)
            {
                dt = ds.Tables[2];

                AddedExpendaturesGridView.Columns[2].Visible = false;
            }
            else
            {
                dt = ds.Tables[3];

                AddedExpendaturesGridView.Columns[2].Visible = false;
            }

            AddedExpendaturesGridView.DataSource = dt;
            AddedExpendaturesGridView.DataBind();
        }