Ejemplo n.º 1
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            Alert.Visible = false;
            Error.Visible = false;
            String fiscalYear = (String)Session["FiscalYear"];
            Utils utils = new Utils();
            UpdateDatabase updtDB = new UpdateDatabase();
            RetrieveFromDB rtrv = new RetrieveFromDB();
            Boolean val = utils.CheckFiscalYear("Expendutures", fiscalYear);

            TextBox tb = new TextBox();
            ArrayList instractCompExpendures = new ArrayList();
            ArrayList nonInstractCompExpendures = new ArrayList();
            ArrayList nonCompExpendures = new ArrayList();

            for (int row = 0; row < InstractionalCompensationGridView.Rows.Count; row++)
            {
                ExpendutersObject instractComp = new ExpendutersObject();

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

                String accountNumber = InstractionalCompensationGridView.Rows[row].Cells[1].Text;

                tb = (TextBox)InstractionalCompensationGridView.Rows[row].FindControl("BudgetTextBox");

                String budget = tb.Text;

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

                String fringeBenefitRate = String.Empty;
                if (tb.Text != "")
                {
                    fringeBenefitRate = (double.Parse(tb.Text) / 100).ToString();
                }
                else
                {
                   fringeBenefitRate = tb.Text;
                }

                if (val != true)
                {
                    updtDB.InsertCompensationExpenduters("Instractional", fiscalYear, expenseType, accountNumber, budget, fringeBenefitRate);
                }
                else
                {
                    updtDB.UpdateCompensationExpenduters("Instractional", fiscalYear, expenseType, accountNumber, budget, fringeBenefitRate);
                }

            }

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

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

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

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

                String fringeBenefitRate = "";
                if (tb.Text != "")
                {
                    fringeBenefitRate = (double.Parse(tb.Text) / 100).ToString();

                }
                else
                {

                   fringeBenefitRate = tb.Text;
                }

                if (val != true)
                {
                    updtDB.InsertCompensationExpenduters("NonInstractional", fiscalYear, expenseType, accountNumber, budget, fringeBenefitRate);
                }
                else
                {
                    updtDB.UpdateCompensationExpenduters("NonInstractional", fiscalYear, expenseType, accountNumber, budget, fringeBenefitRate);
                }

            }

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

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

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

                if (val != true)
                {
                    updtDB.InsertNonCompensationExpenduters(fiscalYear, expenseType, accountNumber, budget);
                }
                else
                {
                    updtDB.UpdateNonCompensationExpenduters(fiscalYear, expenseType, accountNumber, budget);
                }

            }
            DisplayTotals(fiscalYear);
        }
Ejemplo n.º 2
0
        protected void ReportApply_Click(object sender, EventArgs e)
        {
            UpdateDatabase updateDB1 = new UpdateDatabase();

            updateDB1.DeleteExpendetures();

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

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

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

                    if (account >= 6500 && account <= 6701)
                    {
                        UpdateDatabase updtDB = new UpdateDatabase();
                        String expenseType = row[0].ToString();
                        String budget = row[3].ToString();
                        updtDB.InsertCompensationExpenduters("NonInstractional", fiscalYear, expenseType, account.ToString(), budget, "0");

                    }
                }

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

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

                    if (account >= 6001 && account < 6500)
                    {
                        UpdateDatabase updtDB = new UpdateDatabase();
                        String expenseType = row[0].ToString();
                        String budget = row[3].ToString();
                        updtDB.InsertCompensationExpenduters("Instractional", fiscalYear, expenseType, account.ToString(), budget, "0");

                    }
                }

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

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

                    if (account >= 7001 && account != 7902)
                    {
                        UpdateDatabase updtDB = new UpdateDatabase();
                        String expenseType = row[0].ToString();
                        String budget = row[3].ToString();
                        updtDB.InsertNonCompensationExpenduters(fiscalYear, expenseType, account.ToString(), budget);

                    }
                }

            }
             PopulateGridView();
        }