public bool Save()
        {
            if (string.IsNullOrEmpty(_txbAmount.Text))
            {
                string caption = MultiLanguageStrings.GetString("SweetBaseForm", "error");
                string message = MultiLanguageStrings.GetString(Ressource.ElemMvtUserControl, "manualEntryInvalidAmount.Text");
                MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            _amount = ServicesHelper.ConvertStringToNullableDecimal(_txbAmount.Text);

            _GetAccounts();
            _CheckExchangeRate();
            _GetBranches();

            Booking booking = new Booking
            {
                Description   = txbDescription.Text,
                Amount        = _amount.Value,
                DebitAccount  = _debitAccount,
                CreditAccount = _creditAccount,
                Date          = TimeProvider.Now,
                Currency      = (Currency)cbCurrencies.SelectedItem,
                ExchangeRate  = _exchangeRate.Rate,
                Branch        = _branch,
                User          = User.CurrentUser
            };

            ServicesProvider.GetInstance().GetAccountingServices().BookManualEntry(booking, User.CurrentUser);
            ServicesProvider.GetInstance().GetEventProcessorServices().LogUser(OUserEvents.UserManualEntryEvent, txbDescription.Text, User.CurrentUser.Id);

            _deleteIsPossible = false;

            return(true);
        }
Beispiel #2
0
 private void buttonSave_Click(object sender, System.EventArgs e)
 {
     _followUp.Year              = (int)numericUpDownYear.Value;
     _followUp.Jobs1             = (int)numericUpDownJobs1.Value;
     _followUp.Jobs2             = (int)numericUpDownJobs2.Value;
     _followUp.CA                = ServicesHelper.ConvertStringToNullableDecimal(tBCA.Text);
     _followUp.PersonalSituation = comboBoxPersonalSituation.Text;
     _followUp.Activity          = comboBoxActivity.Text;
     _followUp.Comment           = tBComment.Text;
     Close();
 }
 public void TestConvertStringToNullableDecimalWhenStringIsEmpty()
 {
     Assert.IsTrue(!ServicesHelper.ConvertStringToNullableDecimal(String.Empty).HasValue);
 }