private void dataDuesGrid_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            int[] indexes = new int[dataDuesGrid.ColumnCount];
            for (int i = 0; i < dataDuesGrid.ColumnCount; i++)
            {
                indexes[i] = i;
            }

            if (indexes.Contains(e.ColumnIndex) == true && e.RowIndex != -1)
            {
                if (dataDuesGrid.Rows[e.RowIndex].Cells["Id"].Value != null)
                {
                    currentDue = Program.currentSelectedAccount.Dues.Find(d =>
                                                                          string.Compare(d.Id, dataDuesGrid.Rows[e.RowIndex].Cells["Id"].Value.ToString()) == 0);
                }
                else
                {
                    currentDue = null;
                }
            }
            else
            {
                currentDue = null;
            }
        }
예제 #2
0
        public void ShowEditFormLogic(Model.Due due)
        {
            ClearComponentRessources(dueComponentPanel);
            form = new FormAddOrEditDueComponent(due);
            ChangeComponent(dueComponentPanel, form);

            isFormActive     = true;
            isDataGridActive = false;
        }
예제 #3
0
        /// <summary>
        /// Permet d'éditer une échéance.
        /// </summary>
        /// <param name="due">Echéance à éditer.</param>
        /// <param name="Name">Nom de l'échéance.</param>
        /// <param name="Amount">Montant de l'échéance.</param>
        /// <param name="PaymentType">Type de paiement.</param>
        /// <param name="OperationType">Type d'opération.</param>
        /// <param name="Day">Jours de récurrence.</param>
        /// <param name="category">Catégorie.</param>
        public static void EditDue(Model.Due due, string Name, float Amount, paymentType PaymentType,
                                   operationType OperationType, int Day, Category category)
        {
            due.Name          = Name;
            due.Amount        = Amount;
            due.PaymentType   = PaymentType;
            due.OperationType = OperationType;
            due.Day           = Day;
            due.category      = category;

            Program.ctx.Save();
        }
예제 #4
0
        public FormAddOrEditDueComponent(Model.Due due)
        {
            InitializeComponent();
            UpdateCbox();

            this.nameTxtBox.Text                = due.Name;
            this.amountTxtBox.Text              = due.Amount.ToString();
            this.dayTxtBox.Text                 = due.Day.ToString();
            this.categoryCbox.SelectedItem      = due.category.GetName();
            this.paymentTypeCbox.SelectedItem   = due.PaymentType;
            this.operationTypeCbox.SelectedItem = due.OperationType;
            mDue = due;
        }
        private void dataDuesGrid_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            int[] indexes = new int[dataDuesGrid.ColumnCount];
            for (int i = 0; i < dataDuesGrid.ColumnCount; i++)
            {
                indexes[i] = i;
            }

            if (indexes.Contains(e.ColumnIndex) == true && e.RowIndex != -1)
            {
                if (dataDuesGrid.Rows[e.RowIndex].Cells["Id"].Value != null)
                {
                    Program.SearchParent(this, "ViewDue").GetType().GetMethod("ShowEditFormLogic").Invoke(Program.SearchParent(this, "ViewDue"), new object[] { currentDue });
                }
            }
            else
            {
                currentDue = null;
            }
        }