Beispiel #1
0
        /// <summary>
        /// Create a new DebtNegotiator
        /// </summary>
        /// <returns></returns>
        public override Guid Create(DebtNegotiator record)
        {
            DataModel            dataModel            = new DataModel();
            Guid                 entityId             = Guid.Empty;
            TypeRow              typeRow              = null;
            DataModelTransaction dataModelTransaction = DataModelTransaction.Current;

            if (record.TypeId != null && record.TypeId != Guid.Empty)
            {
                typeRow = DataModel.Type.TypeKey.Find(record.TypeId.Value);
            }
            else
            {
                typeRow = DataModel.Type.TypeKeyExternalId0.Find("DEBT NEGOTIATOR");
            }

            if (typeRow != null)
            {
                DebtClassPersistence debtClassPersistence = new DebtClassPersistence();
                typeRow.AcquireReaderLock(dataModelTransaction);
                record.TypeId = typeRow.TypeId;
                typeRow.ReleaseLock(dataModelTransaction.TransactionId);

                entityId = debtClassPersistence.Create(record);

                dataModel.CreateDebtNegotiator(entityId);
            }

            return(entityId);
        }