private async void _createTransactions(DateTime selectedTime) { NormalTransactionRepository normalTransactionRepository = new NormalTransactionRepository(); List <Transaction> listOfTransaction = await Task.Run(() => normalTransactionRepository.GetTransactionFromDate(selectedTime, UserSession.UserData.Id)); _totalIncome = 0; _totalExpense = 0; _transactionPanel.BackColor = SystemColors.ControlLight; _transactionPanel.Location = new Point(430, 140); _transactionPanel.Name = "transactionPanel"; _transactionPanel.Size = new Size(_width, _height); _transactionPanel.AutoScroll = true; this.Controls.Add(_transactionPanel); _transactionPanel.Controls.Clear(); Label lblTrasactionHeading = new Label { AutoSize = true, BackColor = Color.Transparent, Font = new Font("Times New Roman", 16.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))), Location = new Point(10, 10), Size = new Size(155, 33), Text = "Transactions" }; _transactionPanel.Controls.Add(lblTrasactionHeading); Panel line = new Panel { BackColor = Color.Black, Location = new Point(10, 40), Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top, Size = new Size(_transactionPanel.Width - 20, 2) }; _transactionPanel.Controls.Add(line); int count = 1; foreach (Transaction transaction in listOfTransaction) { Panel eachTransaction = new Panel { Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right, BackColor = Color.White, Size = new Size(290, 80), Location = new Point(10, count * 55) }; _transactionPanel.Controls.Add(eachTransaction); Label lblTransactionName = new Label { Font = new Font("Times New Roman", 18F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))), AutoSize = true, Anchor = AnchorStyles.Left | AnchorStyles.Top, Location = new Point(5, 20), Size = new Size(100, 100), Text = transaction.Name }; eachTransaction.Controls.Add(lblTransactionName); Label lblTransactionType = new Label { Font = new Font("Times New Roman", 10F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))), AutoSize = true, Anchor = AnchorStyles.Left | AnchorStyles.Top, Location = new Point(10, 50), Size = new Size(100, 100), Text = transaction.Type }; eachTransaction.Controls.Add(lblTransactionType); Label lblAmount = new Label { Font = new Font("Times New Roman", 22F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))), AutoSize = true, Anchor = AnchorStyles.Right | AnchorStyles.Top, Location = new Point(200, 25), Size = new Size(100, 100), Text = "£" + transaction.Amount }; eachTransaction.Controls.Add(lblAmount); if (transaction.Type.Equals("Expense")) { _totalExpense += transaction.Amount; lblAmount.ForeColor = Color.FromArgb(244, 67, 54); lblTransactionType.ForeColor = Color.FromArgb(244, 67, 54); } else { _totalIncome += transaction.Amount; lblAmount.ForeColor = Color.FromArgb(0, 121, 107); lblTransactionType.ForeColor = Color.FromArgb(0, 121, 107); } LblTotalExpense.Text = "£" + _totalExpense; LblTotalIncome.Text = "£" + _totalIncome; count++; } }
private async void _loadTodaysReport() { _transactionList = await Task.Run(() => normalTransactionRepository.GetTransactionFromDate(DateTime.Now, UserSession.UserData.Id)); _loadData(ListViewToday, _transactionList); }
private async void _getTransactionForDate(DateTime selectedDate) { NormalTransactionRepository normalTransactionRepository = new NormalTransactionRepository(); List <Transaction> transactionList = await Task.Run(() => normalTransactionRepository.GetTransactionFromDate(selectedDate, UserSession.UserData.Id)); }