Пример #1
0
        private void FrmMainMenu_Load(object sender, EventArgs e)
        {
            double totalIncome = 0, totalExpense = 0;
            double thisMonthIncome = 0, thisMonthExpense = 0;

            try
            {
                using (var transdao = new TransactionDAO())
                {
                    TransactionList = transdao.GetAllTransactionDataByID(user.ID.ToString());

                    listNonDetail = transdao.GetAllTransactionHeaderByID(user.ID.ToString());
                }



                foreach (var item in listNonDetail)
                {
                    if (item.Date.Month == DateTime.Today.Month)
                    {
                        thisMonthIncome  += item.Income;
                        thisMonthExpense += item.Expense;
                    }
                    totalIncome  += item.Income;
                    totalExpense += item.Expense;
                }


                lblIncome.Text  = "Income   :  Rp. " + thisMonthIncome.ToString("n0") + ",00-";
                lblExpense.Text = "Expense  :  Rp. " + thisMonthExpense.ToString("n0") + ",00-";
                lblTotal.Text   = "Account Balance : Rp. " + (totalIncome - totalExpense).ToString("n0") + ",00-";

                coBoxMonth.SelectedIndex = 1;
                coBoxMonth.SelectedIndex = 0;
                this.dgvData.Columns[0].DataPropertyName = "Date";
                this.dgvData.Columns[1].DataPropertyName = "Income";
                this.dgvData.Columns[2].DataPropertyName = "Expense";
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }