Example #1
0
        private bool ValidateIsArchivedCheckBox()
        {
            CheckBox ctrl         = isArchivedCheckBox;
            string   errorMessage = "";

            if (ctrl.Checked)
            {
                using (var core = new StandardBusinessLayer(DataCache))
                {
                    core.Connect();
                    //decimal amount = core.CalculateAccountBalance((int)accountComboBox.SelectedValue);
                    decimal amount = DataCache.CalculateAccountBalance((int)accountComboBox.SelectedValue);
                    if (decimal.Compare(amount, 0) != 0)
                    {
                        errorMessage = "Ett konto kan bara arkiveras om dess saldo är noll.";
                    }
                }
            }

            if (errorMessage == "")
            {
                errorProvider.SetError(ctrl, "");
                return(true);
            }
            else
            {
                errorProvider.SetError(ctrl, errorMessage);
                return(false);
            }
        }
Example #2
0
        private void CalculateBalance()
        {
            using (var core = new StandardBusinessLayer(DataCache)) {
                core.Connect();

                //decimal balance = core.CalculateAccountBalance((int)accountComboBox.ComboBox.SelectedValue);
                decimal balance = DataCache.CalculateAccountBalance((int)accountComboBox.ComboBox.SelectedValue);
                balanceToolStripStatusLabel.Text = "Saldo: " + balance.ToString(CurrentApplication.MoneyDisplayFormat) + " kr";
            }
        }