Esempio n. 1
0
        private void myChangeEnvelopeID(ref TransactionDataSet.LineItemRow lineBeingChange, int newEnvelopeID)
        {
            int envCount;
            int eLineID;

            lineBeingChange.envelopeID = newEnvelopeID;

            // Now update the envelopeLine If there is only one with the new envelopeID;
            this.tDataSet.EnvelopeLine.myEnvelopeLineCount(lineBeingChange.id, out envCount, out eLineID);

            if (envCount == 1 && newEnvelopeID > SpclEnvelope.NULL)
            {
                this.tDataSet.EnvelopeLine.FindByid(eLineID).envelopeID = newEnvelopeID;
            }

            else if (envCount == 1 && newEnvelopeID == SpclEnvelope.NULL)
            {
                this.tDataSet.EnvelopeLine.FindByid(eLineID).Delete();
            }

            else if (envCount == 0 && newEnvelopeID > SpclEnvelope.NULL)
            {
                TransactionDataSet.EnvelopeLineRow eLine = this.tDataSet.EnvelopeLine.NewEnvelopeLineRow();

                eLine.lineItemID  = lineBeingChange.id;
                eLine.envelopeID  = newEnvelopeID;
                eLine.description = lineBeingChange.description;
                eLine.amount      = lineBeingChange.amount;

                this.tDataSet.EnvelopeLine.AddEnvelopeLineRow(eLine);
            }
        }
Esempio n. 2
0
        private void envLinesDGV_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
        {
            int subLineID = -1;

            // Defaults. Used for new lines.
            envLinesDGV.flagEnvelopeError  = false;
            envLinesDGV.flagNegativeAmount = false;

            // try to get the current row lineID
            try { subLineID = Convert.ToInt32(envLinesDGV["EnvelopeLineIDColumn", e.RowIndex].Value); }
            catch { return; }

            TransactionDataSet.EnvelopeLineRow thisSubLine = this.tDataSet.EnvelopeLine.FindByid(subLineID);

            // Set Flags
            if (thisSubLine != null)
            {
                if (thisSubLine.envelopeID == SpclEnvelope.NULL)
                {
                    envLinesDGV.flagEnvelopeError = true;
                }

                if (thisSubLine.amount < 0.00m)
                {
                    envLinesDGV.flagNegativeAmount = true;
                }
            }
        }
Esempio n. 3
0
        private void EnvelopeLine_TableNewRow(object sender, DataTableNewRowEventArgs e)
        {
            TransactionDataSet.EnvelopeLineRow eLine = e.Row as TransactionDataSet.EnvelopeLineRow;
            decimal lineAmount = this.tDataSet.LineItem.FindByid(this.CurrentLineID).amount;
            decimal envSum     = this.tDataSet.EnvelopeLine.myEnvelopeLineSum(this.CurrentLineID);
            decimal difference = lineAmount - envSum;

            eLine.lineItemID = this.CurrentLineID;
            eLine.amount     = difference;

            myResetValues();
        }
Esempio n. 4
0
        ////////////////////////////////////////////////////////////////////////////////////////////
        //   Private Duplicating a transaction
        ////////////////////////////////////////////////////////////////////////////////////////////
        private void myDuplicateTransaction(DateTime newDate)
        {
            LineItemRow temp = this.LineItem.NewLineItemRow();

            int newTransID = temp.transactionID;
            int transSize  = this.tDataSet.LineItem.Count;
            int envCount   = this.tDataSet.EnvelopeLine.Count;

            // Copy the lines from this transaction.
            for (int tIndex = 0; tIndex < transSize; tIndex++)
            {
                TransactionDataSet.LineItemRow origTLine = this.tDataSet.LineItem[tIndex];
                TransactionDataSet.LineItemRow newTLine  = this.tDataSet.LineItem.NewLineItemRow();

                newTLine.transactionID      = newTransID;
                newTLine.date               = newDate;
                newTLine.typeID             = origTLine.typeID;
                newTLine.accountID          = origTLine.accountID;
                newTLine.oppAccountID       = origTLine.oppAccountID;
                newTLine.description        = origTLine.description;
                newTLine.confirmationNumber = origTLine.confirmationNumber;
                newTLine.envelopeID         = origTLine.envelopeID;
                newTLine.complete           = LineState.PENDING;
                newTLine.amount             = origTLine.amount;
                newTLine.creditDebit        = origTLine.creditDebit;
                newTLine.lineError          = origTLine.lineError;

                this.tDataSet.LineItem.AddLineItemRow(newTLine);

                // Copy the envelopelines for this line.
                for (int envIndex = 0; envIndex < envCount; envIndex++)
                {
                    TransactionDataSet.EnvelopeLineRow origEnvRow = this.tDataSet.EnvelopeLine[envIndex];

                    if (origEnvRow.lineItemID == origTLine.id)
                    {
                        TransactionDataSet.EnvelopeLineRow newEnvRow = this.tDataSet.EnvelopeLine.NewEnvelopeLineRow();

                        newEnvRow.lineItemID  = newTLine.id;
                        newEnvRow.envelopeID  = origEnvRow.envelopeID;
                        newEnvRow.description = origEnvRow.description;
                        newEnvRow.amount      = origEnvRow.amount;

                        this.tDataSet.EnvelopeLine.AddEnvelopeLineRow(newEnvRow);
                    }
                }
            }

            // now copy back to the registry dataset
            for (int tIndex = transSize; tIndex < this.tDataSet.LineItem.Rows.Count; tIndex++)
            {
                TransactionDataSet.LineItemRow tLine = this.tDataSet.LineItem[tIndex];

                if (tLine.accountID == currentAccountID)
                {
                    LineItemRow rLine = this.LineItem.NewLineItemRow();

                    rLine.id                 = tLine.id;
                    rLine.transactionID      = tLine.transactionID;
                    rLine.date               = tLine.date;
                    rLine.typeID             = tLine.typeID;
                    rLine.accountID          = tLine.accountID;
                    rLine.oppAccountID       = tLine.oppAccountID;
                    rLine.description        = tLine.description;
                    rLine.confirmationNumber = tLine.confirmationNumber;
                    rLine.envelopeID         = tLine.envelopeID;
                    rLine.complete           = tLine.complete;
                    rLine.amount             = tLine.amount;
                    rLine.creditDebit        = tLine.creditDebit;
                    rLine.lineError          = tLine.lineError;

                    this.LineItem.AddLineItemRow(rLine);
                }
            }
        }