Esempio n. 1
0
        private void LoadCashFlowByCategory(string category)
        {
            List <CashFlow> cashFlows = new List <CashFlow>();

            switch (category)
            {
            case "Cash & Bank":
                cashFlows = cashFlowRepository.GetByCashAndBank(cbMonth.SelectedIndex + 1, DateTime.Now.Year);
                break;

            case "Income":
                cashFlows = cashFlowRepository.GetByIncome(cbMonth.SelectedIndex + 1, DateTime.Now.Year);
                break;

            case "Expense":
                cashFlows = cashFlowRepository.GetByExpense(cbMonth.SelectedIndex + 1, DateTime.Now.Year);
                break;

            case "Account Payable":
                cashFlows = cashFlowRepository.GetByAccountPayable(cbMonth.SelectedIndex + 1, DateTime.Now.Year);
                break;

            case "Account Receivable":
                cashFlows = cashFlowRepository.GetByAccountReceivable(cbMonth.SelectedIndex + 1, DateTime.Now.Year);
                break;

            case "Asset":
                cashFlows = cashFlowRepository.GetByAsset(cbMonth.SelectedIndex + 1, DateTime.Now.Year);
                break;
            }


            lvwCashFlow.Items.Clear();

            foreach (CashFlow cashFlow in cashFlows)
            {
                ListViewItem item = new ListViewItem(cashFlow.ID.ToString());

                item.SubItems.Add(cashFlow.Date.ToShortDateString());
                item.SubItems.Add(cashFlow.Description);
                item.SubItems.Add(cashFlow.Amount.ToString("N0"));

                lvwCashFlow.Items.Add(item);
            }
        }