//protected void CreateFiscalYearButton_Click(object sender, EventArgs e)
        //{
        //    ArrayList fiscalYearData = (ArrayList)Session["FiscalYearData"];
        //    String fiscalYear = fiscalYearData[0].ToString();
        //    ArrayList chg = (ArrayList)fiscalYearData[1];
        //    StoredProcedures sp = new StoredProcedures();
        //    DataTable tbl = (DataTable)Session["CostDriversTbl"];
        //    foreach (DataRow row in tbl.Rows)
        //    {
        //        sp.InsertAllocatedCosts(fiscalYear, row[0].ToString(), row[1].ToString(), row[2].ToString(), row[3].ToString(), row[4].ToString(), row[5].ToString());
        //    }
        //    if (Session["FiscalYear"] == null)
        //    {
        //        sp.RevenueSummaryInsert(fiscalYear);
        //    }
        //    else
        //    {
        //        sp.UpdateRevenueExpenseSummary(fiscalYear);
        //    }
        //}
        protected void SaveCostDriverButton_Click(object sender, EventArgs e)
        {
            Alert.Visible = false;
            Error.Visible = false;
            DataTable costDriversTbl = (DataTable)Session["CostDriversTbl"];
            TextBox tbox = new TextBox();
            String fiscalYear = (String)Session["FiscalYear"];

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

                StoredProcedures sp = new StoredProcedures();

                String costDriver = SelectCostDriverDropDownList.SelectedValue;
                String metricType = SubmitCostDriverGridView.Rows[row].Cells[0].Text;
                tbox = (TextBox)SubmitCostDriverGridView.Rows[row].Cells[1].FindControl("PercentageTextBox");
                String rate = String.Empty;

                if (tbox.Text != "")
                {

                    rate = (Double.Parse(tbox.Text) / 100).ToString();

                }
                else
                {
                    rate = tbox.Text;
                }

                tbox = (TextBox)SubmitCostDriverGridView.Rows[row].Cells[2].FindControl("TotalMetricTextBox");
                String totalMetric = tbox.Text;
                tbox = (TextBox)SubmitCostDriverGridView.Rows[row].Cells[3].FindControl("MetricsTextBox");
                String metrics = tbox.Text;
                String costToAllocate = CostToAllocateTextBox.Text;

                sp.InsertAllocatedCosts(fiscalYear, costDriver, metricType, rate, totalMetric, metrics, costToAllocate);
            }

             StoredProcedures sp2 = new StoredProcedures();
             sp2.UpdateRevenueExpenseSummary(fiscalYear);

             AddedCostDrivers();
        }