private void OnBalanceChanges(BalanceChangesEventArgs e)
 {
     if (BalanceChanges != null)
     {
         BalanceChanges(this, e);
     }
 }
        private void delete_Click(object sender, EventArgs e)
        {
            int row     = this.liDGV.CurrentRow.Index;
            int transID = Convert.ToInt32(this.liDGV[LineItem.TRANSACTION_ID_NAME, row].Value);

            this.regDataSet.myDeleteTransaction(transID);

            BalanceChangesEventArgs arg = new BalanceChangesEventArgs(this.regDataSet.myGetChanges());

            this.OnBalanceChanges(arg);
        }
        ////////////////////////////////////////////////////////////////////////////////////////////
        //   Functions Private
        ////////////////////////////////////////////////////////////////////////////////////////////
        private void saveLineEdits()
        {
            // Save any changes that might be happening
            if (this.dirtyLineID != NO_DIRTY_LINE)
            {
                LineItem.endEdit();
                this.regDataSet.mySaveSingleLineEdits(this.dirtyLineID);

                BalanceChangesEventArgs arg = new BalanceChangesEventArgs(this.regDataSet.myGetChanges());
                this.OnBalanceChanges(arg);

                this.dirtyLineID = NO_DIRTY_LINE;
            }
        }
        private void duplicate_Click(object sender, EventArgs e)
        {
            int      row     = this.liDGV.CurrentRow.Index;
            int      transID = Convert.ToInt32(this.liDGV[LineItem.TRANSACTION_ID_NAME, row].Value);
            DateTime oldDate = Convert.ToDateTime(this.liDGV[LineItem.DATE_NAME, row].Value);

            DateSelector.DateSelector date = new FamilyFinance2.Forms.DateSelector.DateSelector(oldDate);
            date.ShowDialog();

            if (date.WasDatePicked())
            {
                this.regDataSet.myDuplicateTransaction(transID, date.GetDataPicked());

                BalanceChangesEventArgs arg = new BalanceChangesEventArgs(this.regDataSet.myGetChanges());
                this.OnBalanceChanges(arg);
            }
        }
        private void dgv_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            int row = e.RowIndex;
            int col = e.ColumnIndex;

            if (col < 0 || row < 0)
            {
                return;
            }

            string colName = Current.DGV.Columns[col].Name;

            if (colName == LineItem.COMPLETE_NAME && Current.DGV == this.liDGV)
            {
                string cellValue = Current.DGV[col, row].Value.ToString();

                if (cellValue == LineState.PENDING)
                {
                    Current.DGV[col, row].Value = LineState.CLEARED;
                }

                else if (cellValue == LineState.CLEARED)
                {
                    Current.DGV[col, row].Value = LineState.RECONSILED;
                }

                else
                {
                    Current.DGV[col, row].Value = LineState.PENDING;
                }
            }
            else if (Current.DGV == this.liDGV)
            {
                this.saveLineEdits();

                int transID = Convert.ToInt32(Current.DGV[LineItem.TRANSACTION_ID_NAME, row].Value);
                int lineID  = Convert.ToInt32(Current.DGV[LineItem.LINE_ID_NAME, row].Value);

                TransactionForm tf = new TransactionForm(transID, lineID);
                tf.ShowDialog();
                this.regDataSet.myGetTransactionEdits(transID);

                BalanceChangesEventArgs arg = new BalanceChangesEventArgs(tf.myGetChanges());
                this.OnBalanceChanges(arg);
            }
            else if (Current.DGV == this.envDGV)
            {
                this.saveLineEdits();

                int transID = Convert.ToInt32(Current.DGV[EnvLine.TRANSACTION_ID_NAME, row].Value);
                int lineID  = Convert.ToInt32(Current.DGV[EnvLine.LINE_ID_NAME, row].Value);
                int eLineID = Convert.ToInt32(Current.DGV[EnvLine.E_LINE_ID_NAME, e.RowIndex].Value);

                TransactionForm tf = new TransactionForm(transID, lineID, eLineID);
                tf.ShowDialog();
                this.reloadLines(); // <-- get rid of this.

                BalanceChangesEventArgs arg = new BalanceChangesEventArgs(tf.myGetChanges());
                this.OnBalanceChanges(arg);
            }
        }
Esempio n. 6
0
 private void multiDGV_BalanceChanges(object sender, BalanceChangesEventArgs e)
 {
     accountTLV.updateBalance(e.AEChanges);
 }