public AccountViewModel(Account account) { using (var db = new ClientsEntities()) { var client = db.GetClientById(account.ClientID); _surname = client?.Surname; _name = client?.Name; _patronimic = client?.Patronimic; var depositType = db.GetDepositTypeById(account.DepositTypeID); _depositType = depositType.Name; _accountNumber = account.AccountNumber; _moneyAmount = account.MoneyAmount.ToString(); _startDate = account.StartDate; _endDate = account.EndDate; _daysCount = account.DaysCount.ToString(); _percents = depositType.Percents.ToString(); _currency = db.GetCurrencyById(account.CurrencyID); _isPercentage = (account.PercentAccountID == null) ? "Да" : "Нет"; if (account.PercentAccountID != null) { var percentAcc = db.GetAccountById(account.PercentAccountID.Value); _percentMoney = percentAcc.MoneyAmount.ToString(); } _isClosed = account.IsClosed ? "Закрыт" : "Открыт"; } }
private void PrintCheque() { using (var db = new ClientsEntities()) { var currency = db.GetCurrencyById(_account.CurrencyID); var acc = db.GetAccountById(_account.AccountID); MessageBox.Show("Дата: " + DateTime.Now + "; Номер карты: " + _card.Number + "; Сумма на счёте: " + acc.MoneyAmount + "; Денег снято: " + cash + currency + "."); } }