private NOKEntity Insert(NOKEntity nok) { if (nok == null) { throw new ArgumentNullException("nok"); } string userName = IdentityUser.GetIdentityUserName(); int categoryID = _categoryDA.GetCategoryIDByCategoryKey((int)CategoryPersonKeyEnum.NOK); if (categoryID <= 0) { throw new Exception(Properties.Resources.ERROR_NoCategoryDefinedForNOKs); } using (TransactionScope scope = new TransactionScope()) { this.InnerInsert(nok, userName, categoryID); scope.Complete(); } this.ResetNOK(nok); LOPDLogger.Write(EntityNames.NOKEntityName, nok.ID, ActionType.Create); return(nok); }
private CustomerContactPersonEntity Insert(CustomerContactPersonEntity customerContactPerson) { if (customerContactPerson == null) { throw new ArgumentNullException("customerContactPerson"); } string userName = IdentityUser.GetIdentityUserName(); int categoryID = _categoryDA.GetCategoryIDByCategoryKey((int)CategoryPersonKeyEnum.CustContactPerson); if (categoryID <= 0) { throw new Exception(Properties.Resources.ERROR_NoCategoryDefinedForCustomerContactPersons); } using (TransactionScope scope = new TransactionScope()) { this.InnerInsert(customerContactPerson, userName, categoryID); scope.Complete(); } this.ResetCustomerContactPerson(customerContactPerson); LOPDLogger.Write(EntityNames.CustomerContactPersonEntityName, customerContactPerson.ID, ActionType.Create); return(customerContactPerson); }