예제 #1
0
        public void CommitChanges(bool silent = false)
        {
            BusinessDomain.DataAccessProvider.AddUpdatePayment(this);

            if (!silent)
            {
                BusinessDomain.OnPaymentCommited(this);
            }
        }
예제 #2
0
        public void CommitAdvance()
        {
            bool isNew = id < 0;

            using (DbTransaction transaction = new DbTransaction(BusinessDomain.DataAccessProvider)) {
                transaction.SnapshotObject(this);
                if (isNew)
                {
                    mode          = PaymentMode.Paid;
                    userId        = BusinessDomain.LoggedUser.Id;
                    operationType = (int)Data.OperationType.AdvancePayment;
                    sign          = 1;
                    locationId    = Location.DefaultId;
                }

                BusinessDomain.DataAccessProvider.AddAdvancePayment(this);

                if (isNew && Type.BaseType == BasePaymentType.Cash)
                {
                    CashBookEntry cashBookEntry = new CashBookEntry(this)
                    {
                        OperationNumber     = OperationId,
                        PartnerName         = PartnerName,
                        TurnoverType        = TurnoverType.IncomeAdvance,
                        DescriptionTemplate = Translator.GetString("Advance Payment No. {0}, {1}")
                    };
                    cashBookEntry.CommitChanges();
                }
                transaction.Complete();
            }

            if (isNew)
            {
                BusinessDomain.OnPaymentCommited(this);
            }
        }