private void SubmitButton_Click(object sender, EventArgs e) { try { string nameTextBoxValue = this.NameTextBox.Text; decimal amountTextBoxValue = Convert.ToDecimal(this.AmountTextBox.Text); int? budgetComboBoxValue = null; if (this.BudgetComboBox.Text != "none") { budgetComboBoxValue = Convert.ToInt16(this.BudgetComboBox.Text.Split('.')[0]); } DateTime dateDateTimePickerValue = this.DateDateTimePicker.Value; string categoryComboBoxValue = this.CategoryComboBox.Text == "none" ? null : this.CategoryComboBox.Text; Database.Transaction newTransactionValues = new Database.Transaction(); newTransactionValues.Amount = amountTextBoxValue; newTransactionValues.Name = nameTextBoxValue; newTransactionValues.BudgetId = budgetComboBoxValue; newTransactionValues.Id = DatabaseHelpers.GetCurrentTransactionId(true); DatabaseHelpers.Transactions.Add(newTransactionValues); this.Close(); } catch (Exception ex) { this.label6.Visible = true; } }
static void Main() { DatabaseHelpers.GetMockUsers(); DatabaseHelpers.GetMockTransactions(); DatabaseHelpers.GetMockTransactions(); DatabaseHelpers.GetMockTransactions(); DatabaseHelpers.GetMockTransactions(); DatabaseHelpers.GetMockTransactions(); DatabaseHelpers.GetMockBudgets(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Login()); }
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; } }