public void CommitChanges(bool silent = false) { BusinessDomain.DataAccessProvider.AddUpdatePayment(this); if (!silent) { BusinessDomain.OnPaymentCommited(this); } }
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); } }