Пример #1
0
        private void SubmitButton_Click(object sender, EventArgs e)
        {
            try
            {
                string  nameTextBoxValue   = this.NameTextBox.Text;
                decimal amountTextBoxValue = Convert.ToDecimal(this.AmountTextBox.Text);

                Database.Budget newBudgetValues = (from budget in DatabaseHelpers.Budgets where budget.Id == currentBudget select budget).Single();

                int listLocation = DatabaseHelpers.Budgets.IndexOf(newBudgetValues);

                newBudgetValues.AmountAllocated = amountTextBoxValue;
                newBudgetValues.Name            = nameTextBoxValue;

                DatabaseHelpers.Budgets[listLocation] = newBudgetValues;

                this.Close();
            }
            catch (Exception ex)
            {
                this.label6.Visible = true;
            }
        }
Пример #2
0
        private void SubmitButton_Click(object sender, EventArgs e)
        {
            try
            {
                string  nameTextBoxValue   = this.NameTextBox.Text;
                decimal amountTextBoxValue = Convert.ToDecimal(this.AmountTextBox.Text);

                Database.Budget newBudgetValues = new Database.Budget();


                newBudgetValues.AmountAllocated = amountTextBoxValue;
                newBudgetValues.Name            = nameTextBoxValue;
                newBudgetValues.Id     = DatabaseHelpers.GetCurrentBudgetId(true);
                newBudgetValues.UserId = currentUserId;

                DatabaseHelpers.Budgets.Add(newBudgetValues);

                this.Close();
            }
            catch (Exception ex)
            {
                this.label6.Visible = true;
            }
        }