Exemplo n.º 1
0
        /// <summary>
        ///     Sets the data bindings of the form,
        ///     including the selected value of the combo boxes, and events
        /// </summary>
        private void SetDataBindings()
        {
            //Simple control bindings
            txtAmount.Text = currentExpense.Amount.ToString();
            txtDetail.Text = currentExpense.Comments;
            dtPick.Value   = currentExpense.Date;

            //Expense category bindings
            cmbCategory.DataSource    = _expenseCategoryService.GetAll();
            cmbCategory.DisplayMember = "NAME";
            cmbCategory.ValueMember   = "ID";
            cmbCategory.SelectedIndex = cmbCategory.FindString(currentExpense.Category.Name);

            //Payment Method bindings
            cmbPayment.DataSource    = _paymentMethodService.GetAll();
            cmbPayment.DisplayMember = "NAME";
            cmbPayment.ValueMember   = "ID";
            cmbPayment.SelectedIndex = cmbPayment.FindString(currentExpense.Method.Name);

            //Event Bindings
            // This is to keep events from firing until all the data bindings are fully set
            cmbCategory.SelectedIndexChanged += cmbCategory_SelectedIndexChanged;
            cmbPayment.SelectedIndexChanged  += cmbPayment_SelectedIndexChanged;
            txtAmount.TextChanged            += txtAmount_TextChanged;
            txtDetail.TextChanged            += txtDetail_TextChanged;
            dtPick.ValueChanged += dtPick_ValueChanged;
        }
Exemplo n.º 2
0
        private void SetDataBindings()
        {
            // Sets up the combo box of the income categories
            cmbCategory.DataSource =
                _expenseCategoryService.GetAll();
            cmbCategory.DisplayMember = "NAME";
            cmbCategory.ValueMember   = "ID";

            // Sets up the combo box with the payment methods
            cmbPayment.DataSource =
                _paymentMethodService.GetAll();
            cmbPayment.DisplayMember = "NAME";
            cmbPayment.ValueMember   = "ID";
        }
Exemplo n.º 3
0
        /// <summary>
        ///     Connects the combo boxes on the form with the data from the cache
        ///     and sets the date time pickers with data bindings to keep them
        ///     from crossing over
        /// </summary>
        /// <param name="sender">Standard sender object</param>
        /// <param name="e">Standard event object</param>
        private void RecurringExpenseInput_Load(object sender, EventArgs e)
        {
            // Sets up the combo box of the income categories
            cmbCategory.DataSource =
                _expenseCategoryService.GetAll();
            cmbCategory.DisplayMember = "NAME";
            cmbCategory.ValueMember   = "ID";

            // Sets up the combo box with the payment methods
            cmbPayment.DataSource =
                _paymentMethodService.GetAll();
            cmbPayment.DisplayMember = "NAME";
            cmbPayment.ValueMember   = "ID";

            // Sets up the date time pickers with data bindings to keep the dates from
            // crossing over in the wrong direction
            dtpStartDate.DataBindings.Add("MaxDate", dtpEndDate, "Value");
            dtpEndDate.DataBindings.Add("MinDate", dtpStartDate, "Value");
        }
 public ActionResult GetAll()
 {
     ex.GetAll();
     return(View());
 }