コード例 #1
0
        public PaymentsPage()
        {
            InitializeComponent();

            controller = new PaymentsController();

            controller.Control();

            LinkedList <Payment> payments;

            if (controller.HasPayments())
            {
                payments = controller.GetPayments();
                LinkedList <string> members = controller.GetMembers();

                foreach (string member in members)
                {
                    comboBox.Items.Add(member);
                }

                comboBox.SelectedItem = comboBox.Items[0];
            }

            comboBox_paid.Items.Add("Yes");
            comboBox_paid.Items.Add("No");

            if (comboBox.Items.Count == 0)
            {
                textBox_description.Enabled = false;
                comboBox_paid.Enabled       = false;
                button_change.Enabled       = false;
            }
            else
            {
                comboBox.SelectedIndex = 0;

                payments = controller.GetPayments();

                textBox_amount.Text      = payments.First.Value.Amount.ToString();
                datetime_due_date.Value  = payments.First.Value.DueDate;
                textBox_description.Text = payments.First.Value.Description;
                comboBox_paid.Text       = payments.First.Value.IsPaid ? "Yes" : "No";

                payment = payments.First.Value;
            }
        }