public DataView()
        {
            InitializeComponent();
            DataContext = this;

            var app = Application.Current as App;

            _loanController        = app.LoanController;
            _transactionController = app.TransactionController;

            Data = new ObservableCollection <UserControl>(TransactionConverter
                                                          .ConvertTransactionListToTransactionViewList(_transactionController
                                                                                                       .GetAll()
                                                                                                       .ToList()));

            LoanConverter
            .ConvertLoanListToLoanViewList(_loanController
                                           .GetAll()
                                           .ToList())
            .ToList()
            .ForEach(Data.Add);
        }
Example #2
0
        public LoanSupportRequests GetAllLoans(int?from, int?amount)
        {
            IList <DbParameter> parameters = new List <DbParameter>()
            {
                new MySqlParameter("@fromRow", from),
                new MySqlParameter("@amount", amount)
            };
            string limitStatement = string.Empty;

            if (from != null && amount != null)
            {
                limitStatement += $" Limit @fromRow, @amount ";
            }
            string sql = $"SELECT * FROM {Tables.LoanSupportRequest.TableName};";

            DataTable table = _dbContext.GetDataTable(sql, parameters);

            if (table != null)
            {
                return(LoanConverter.TableToLoan(table));
            }
            return(new LoanSupportRequests());
        }
 private void UpdateDataView(Loan loan) => _dataView.Data.Add(LoanConverter.ConvertLoanToLoanView(loan));