Esempio n. 1
0
        /// <summary>
        /// Handles the load event of the form
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmHistory_Load(object sender, EventArgs e)
        {
            this.Location = new Point(0, 0);

            try
            {
                //Call to the AccountFormat method of the BusinessRules class within the Utility project to set the label mask
                string accountNumberLabelMask = BusinessRules.AccountFormat(constructorData.BankAccount.Description);
                accountNumberMaskedLabel.Mask = accountNumberLabelMask;

                var query = from transResults in db.Transactions
                            join typeResults in db.TransactionTypes
                            on transResults.TransactionTypeId equals typeResults.TransactionTypeId
                            where transResults.BankAccountId == constructorData.BankAccount.BankAccountId
                            select new {
                    transResults.DateCreated,
                    typeResults.Description,
                    transResults.Deposit,
                    transResults.Withdrawal,
                    transResults.Notes
                };

                transactionBindingSource.DataSource = query.ToList();
                transactionDataGridView.Columns[0].DefaultCellStyle.Format = "d";
                transactionDataGridView.Columns[2].DefaultCellStyle.Format = "c";
                transactionDataGridView.Columns[3].DefaultCellStyle.Format = "c";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }