예제 #1
0
        private void SelectComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            BillsProcessor processor = new BillsProcessor();

            billsForLabel = processor.GetBillsForLabel(SelectComboBox.Text);

            currentlyShownBill = billsForLabel[0];
            currentlySelectedIndexWithinLabel = 0;

            PopulateControlsForBill(currentlyShownBill);
        }
예제 #2
0
        private void DoPaymentButton_Click(object sender, EventArgs e)
        {
            BillsProcessor processor = new BillsProcessor();

            if (processor.MarkBillAsPaid(currentlyShownBill.Id))
            {
                MakePaidLabelGreen();
                processor.CreateNextBillInstance(currentlyShownBill.Label);
                PopulateLabelsDropDown(); //Refresh list of bills for the label
            }
        }
예제 #3
0
        private void PopulateLabelsDropDown()
        {
            BillsProcessor processor = new BillsProcessor();

            SelectComboBox.BeginUpdate();
            SelectComboBox.Items.Clear();
            SelectComboBox.Items.AddRange(processor.GetBillsLabels(true));
            SelectComboBox.EndUpdate();
            if (SelectComboBox.Items != null && SelectComboBox.Items.Count > 0)
            {
                SelectComboBox.SelectedIndex = 0;
            }
        }
예제 #4
0
        private void PopulateControlsForBill(Bill entry)
        {
            this.SuspendLayout();
            DescriptionTextBox.Text = entry.Label;
            PaymentDateTextBox.Text = entry.PaymentDate;
            BillsProcessor processor = new BillsProcessor();

            NextPaymentDateTextBox.Text = processor.GetNextPaymentDate(entry.PaymentDate, entry.Frequency);
            ValueTextBox.Text           = entry.Value.ToString();
            FrequencyTextBox.Text       = entry.Frequency.ToString();
            SetPaidLabel();
            this.ResumeLayout();
        }
예제 #5
0
        private void PaymentDateButton_Click(object sender, EventArgs e)
        {
            string editedValue = CollectEditedValue(EditorType.Date);

            if (!string.IsNullOrWhiteSpace(editedValue))
            {
                currentlyShownBill.PaymentDate = editedValue;
                UpdateCurrentlyShownBillFields();
                PaymentDateTextBox.Text = currentlyShownBill.PaymentDate;
                BillsProcessor processor = new BillsProcessor();
                NextPaymentDateTextBox.Text = processor.GetNextPaymentDate(currentlyShownBill.PaymentDate, currentlyShownBill.Frequency);
            }
        }
예제 #6
0
        private void ShowWarningsIfNeeded()
        {
            BillsProcessor processor = new BillsProcessor();

            Bill[] unpaidBills    = processor.GetUnpaidBills();
            Bill[] incommingBills = processor.GetIncommingBills();
            if (unpaidBills.Length > 0 ||
                incommingBills.Length > 0)
            {
                WarningsList warningsDialog = new WarningsList();
                warningsDialog.InitializeEntriesLists(unpaidBills, incommingBills);
                warningsDialog.ShowDialog();
            }
        }
예제 #7
0
        private void buttonFind_Click(object sender, EventArgs e)
        {
            FoundBills = new Bill[0];
            //Do the search
            BillsProcessor processor = new BillsProcessor();

            if (radioButtonForLabel.Checked)
            {
                FoundBills = processor.FindBills(textBoxLabel.Text, checkBoxPaid.Checked);
            }
            else
            {
                FoundBills = processor.FindBills(dateTimePicker.Value.ToShortDateString(), radioButtonNewer.Checked, checkBoxPaid.Checked);
            }

            DialogResult = DialogResult.OK;
        }
예제 #8
0
        private void UpdateCurrentlyShownBillFields()
        {
            BillsProcessor processor = new BillsProcessor();

            processor.UpdateBill(currentlyShownBill);
        }