private void SubmitClicked(object obj) { // has a date been picked? if (Date != null) { // are the inputs valid? if (!Sanitizer.InvalidNewExpense(Amount, Date.Value) && !Category.Equals(DefaultCatMessage)) { // strip the desscription of all non alpha-numeric characters string sanitizedDescription = Sanitizer.GetSanitizedDescription(Description); if (sanitizedDescription.Length > 100) { currentUser.NewUserIncome.Add(new NewIncome(currentUser.UserID, Double.Parse(string.Format("{0:N2}", Double.Parse(Amount))), Date.Value, Category, sanitizedDescription.Substring(0, 100))); } else { currentUser.NewUserIncome.Add(new NewIncome(currentUser.UserID, Double.Parse(string.Format("{0:N2}", Double.Parse(Amount))), Date.Value, Category, sanitizedDescription)); } MessageBox.Show("Record entered successfully!", "Success"); ClearInput(); } else { MessageBox.Show("Invalid input! Be sure to check all entries.", "Invalid Input"); } } else { MessageBox.Show("Invalid input! Be sure to check all entries.", "Invalid Input"); } }