protected void SaveButton_Click(object sender, EventArgs e)
        {
            String fiscalYear = (String)Session["FiscalYear"];
            TextBox tb = new TextBox();
            StoredProcedures sp = new StoredProcedures();

            for (int row = 0; row < InstractionalCompensationGridView.Rows.Count; row++)
            {
                String expenseType = InstractionalCompensationGridView.Rows[row].Cells[0].Text;

                tb = (TextBox)InstractionalCompensationGridView.Rows[row].FindControl("BudgetTextBox");
                double budget = double.Parse(tb.Text);

                tb = (TextBox)InstractionalCompensationGridView.Rows[row].FindControl("FringeBenefitRateTextBox");
                double fringeBenefitRate = double.Parse(tb.Text) / 100;

                sp.UpdateCompensationExpenduters("Instractional", fiscalYear, expenseType, budget, fringeBenefitRate);
                RatesApplyButton.Visible = false;
            }

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

                String expenseType = NonInstractionalCompensationGridView.Rows[row].Cells[0].Text;

                tb = (TextBox)NonInstractionalCompensationGridView.Rows[row].FindControl("BudgetTextBox");
                double budget = double.Parse(tb.Text);

                tb = (TextBox)NonInstractionalCompensationGridView.Rows[row].FindControl("FringeBenefitRateTextBox");

                double fringeBenefitRate = double.Parse(tb.Text) / 100;

                sp.UpdateCompensationExpenduters("NonInstractional", fiscalYear, expenseType, budget, fringeBenefitRate);

            }

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

                String expenseType = NonCompensationGridView.Rows[row].Cells[0].Text;

                tb = (TextBox)NonCompensationGridView.Rows[row].FindControl("BudgetTextBox");
                double budget = double.Parse(tb.Text);

                sp.UpdateNonCompensationExpenduters("NonCompensation", fiscalYear, expenseType, budget);

            }

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

                String expenseType = MiscellaneousExpensesGridView.Rows[row].Cells[0].Text;

                tb = (TextBox)MiscellaneousExpensesGridView.Rows[row].FindControl("BudgetTextBox");
                double budget = double.Parse(tb.Text);

                sp.UpdateNonCompensationExpenduters("Miscellaneous", fiscalYear, expenseType, budget);

            }
            DisplayTotals(fiscalYear);

            sp.UpdateRevenueExpenseSummary(fiscalYear);
        }
Example #2
0
        protected void NonCompensationExpensesGridView_RowUpdating(Object sender, System.Web.UI.WebControls.GridViewUpdateEventArgs e)
        {
            TextBox TBox;
            Double budget;

            String expenseType = NonCompensationExpensesGridView.Rows[e.RowIndex].Cells[0].Text;
            TBox = (TextBox)NonCompensationExpensesGridView.Rows[e.RowIndex].Cells[1].Controls[0];
            budget = Double.Parse(TBox.Text);

            StoredProcedures sp = new StoredProcedures();
            sp.UpdateNonCompensationExpenduters("NonCompensation", FinancialYearDropDownList.SelectedValue, expenseType, budget);

            sp.UpdateRevenueExpenseSummary(FinancialYearDropDownList.SelectedValue);

            DisplayRevenueExpenseSummaryReport();
            DisplayDirectExpenses();
            NonCompensationExpensesGridView.EditIndex = -1;
            DisplayNonCompensationExpenses();
            //FocusAnchor.Focus();
        }
        protected void ReportApply_Click(object sender, EventArgs e)
        {
            StoredProcedures sp = new StoredProcedures();

                ExpendutersTotalsPanel.Visible = false;

                String fiscalYear = (String)Session["FiscalYear"];
                DataSet result = Utils.getDataSetFromExcel(ReportFileUpload, Server);
                sp.DeleteExpendetures(fiscalYear);

                if (result != null)
                {
                    foreach (DataRow row in result.Tables[0].Rows)
                    {
                        int account = 0;

                        if (row[0].ToString() != String.Empty)
                        {

                           int.TryParse(row[0].ToString().Substring(0, 4), out account);
                        }

                        if (account >= 6500 && account <= 6701)
                        {

                            String expenseType = row[0].ToString();

                            double budget = double.Parse(row[3].ToString());

                            sp.UpdateCompensationExpenduters("NonInstractional", fiscalYear, expenseType, budget, 0);

                        }
                    }

                    foreach (DataRow row in result.Tables[0].Rows)
                    {
                        int account = 0;

                        if (row[0].ToString() != String.Empty)
                        {
                            int.TryParse(row[0].ToString().Substring(0, 4), out account);
                        }

                        if (account >= 6001 && account < 6500)
                        {

                            String expenseType = row[0].ToString();

                            double budget = double.Parse(row[3].ToString());

                            sp.UpdateCompensationExpenduters("Instractional", fiscalYear, expenseType, budget, 0);

                        }
                    }

                    foreach (DataRow row in result.Tables[0].Rows)
                    {
                        int account = 0;

                        if (row[0].ToString() != String.Empty)
                        {
                            int.TryParse(row[0].ToString().Substring(0, 4), out account);
                        }

                        if (account >= 7001 && account != 7902)
                        {

                            String expenseType = row[0].ToString();
                            double budget = double.Parse(row[3].ToString());

                            sp.UpdateNonCompensationExpenduters("NonCompensation", fiscalYear, expenseType, budget);

                        }
                    }

                }
                PopulateGridView();
        }