Beispiel #1
0
        public void Save(AccountTransaction accountTransaction)
        {
            using (var core = new StandardBusinessLayer(this))
            {
                core.Connect();

                bool newTransaction = accountTransaction.No == 0;
                core.Save(accountTransaction);

                if (newTransaction)
                {
                    AccountTransactions.Add(accountTransaction);
                }
                else
                {
                    for (int i = 0; i < AccountTransactions.Count(); i++)
                    {
                        if (AccountTransactions[i].No == accountTransaction.No)
                        {
                            AccountTransactions[i] = accountTransaction;
                            break;
                        }
                    }
                }

                FillVerification(Verifications.First(v => v.No == accountTransaction.VerificationNo));
            }
        }
Beispiel #2
0
        public void Save(Verification verification)
        {
            using (var core = new StandardBusinessLayer(this))
            {
                core.Connect();

                bool newVerification = verification.No == 0;
                core.Save(verification);

                FillVerification(verification);

                if (newVerification)
                {
                    Verifications.Add(verification);
                }
                else
                {
                    for (int i = 0; i < Verifications.Count(); i++)
                    {
                        if (Verifications[i].No == verification.No)
                        {
                            Verifications[i] = verification;
                            break;
                        }
                    }

                    for (int i = 0; i < AccountTransactions.Count(); i++)
                    {
                        if (AccountTransactions[i].VerificationNo == verification.No)
                        {
                            AccountTransactions[i].SetTransactionTime(verification.Date);
                            AccountTransactions[i].SetAccountingDate(verification.AccountingDate);
                            break;
                        }
                    }
                    for (int i = 0; i < CashBookTransactions.Count(); i++)
                    {
                        if (CashBookTransactions[i].VerificationNo == verification.No)
                        {
                            CashBookTransactions[i].SetTransactionTime(verification.Date);
                            CashBookTransactions[i].SetAccountingDate(verification.AccountingDate);
                            break;
                        }
                    }
                }
            }
        }