Пример #1
0
        public Expense(User user, Building apartment, MainScreen mainView) : this()  // will be used for regular expenses
        {
            this.user                 = user;
            this.mainView             = mainView;
            expensesList.Visible      = true;
            otherExpensesList.Visible = false;

            otherExpensesList.Location = expensesList.Location;
            this.apartment             = apartment;
            this.setYears(mainView.getYears());
            this.setMonths(mainView.getMonths());
            controller = new ExpenseModule(CONNECTION_DETAILS.CONNECITION_STRING, "");
            controller.getAllExpense(this.expenses, this.apartment, monthComboBox.SelectedItem.ToString(), Convert.ToInt32(yearComboBox.SelectedItem));
            foreach (ExpenseCard exp in expenses)
            {
                exp.setView(this.mainView);
                if (exp.GetExpenseDetails().GetExpenseType() == ExpenseType.Regular)
                {
                    expensesList.Controls.Add(exp);
                    if (exp.GetExpenseDetails().GetExpenseStatus() == ExpenseStatus.Paid)
                    {
                        exp.SendToBack();
                    }
                    else
                    {
                        exp.BringToFront();
                    }
                }

                else
                {
                    otherExpensesList.Controls.Add(exp);
                    if (exp.GetExpenseDetails().GetExpenseStatus() == ExpenseStatus.Paid)
                    {
                        exp.SendToBack();
                    }
                    else
                    {
                        exp.BringToFront();
                    }
                }
            }
        }
Пример #2
0
        private void monthComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            /*  foreach (ExpenseCard exp in expenses)
             * {
             *    if (exp.GetExpenseDetails().getMonth().ToUpper() == monthComboBox.SelectedItem.ToString().ToUpper())
             *        exp.Show();
             *
             *    else
             *        exp.Hide();
             * }*/

            controller = new ExpenseModule(CONNECTION_DETAILS.CONNECITION_STRING, "");
            controller.getAllExpense(this.expenses, this.apartment, monthComboBox.SelectedItem.ToString(), Convert.ToInt32(yearComboBox.SelectedItem));
            foreach (ExpenseCard exp in expenses)
            {
                exp.setView(this.mainView);
                if (exp.GetExpenseDetails().GetExpenseType() == ExpenseType.Regular)
                {
                    expensesList.Controls.Add(exp);
                    if (exp.GetExpenseDetails().GetExpenseStatus() == ExpenseStatus.Paid)
                    {
                        exp.SendToBack();
                    }
                    else
                    {
                        exp.BringToFront();
                    }
                }

                else
                {
                    otherExpensesList.Controls.Add(exp);
                    if (exp.GetExpenseDetails().GetExpenseStatus() == ExpenseStatus.Paid)
                    {
                        exp.SendToBack();
                    }
                    else
                    {
                        exp.BringToFront();
                    }
                }
            }
        }