public int Delete(int nokID, int personID, out Int64 mainDBTimeStamp) { mainDBTimeStamp = 0; try { int result = 0; 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()) { //_customerDA.Update(customerID, userName); //mainDBTimeStamp = _customerDA.GetDBTimeStamp(customerID); result = _nokDA.Delete(nokID); if (_nokDA.GetNOKsFromPerson(personID) == 0) { _personCatRelDA.Delete(personID, categoryID); } scope.Complete(); } return(result); } catch (Exception ex) { if (ExceptionPolicy.HandleException(ex, ExceptionPolicies.Service)) { throw; } return(0); } }
private NOKEntity Update(NOKEntity nok) { if (nok == null) { throw new ArgumentNullException("nok"); } string userName = IdentityUser.GetIdentityUserName(); using (TransactionScope scope = new TransactionScope()) { if (nok.Person.EditStatus.Value == StatusEntityValue.Updated) { nok.Person = base.InnerUpdate(nok.Person, userName, true); } this.InnerUpdate(nok, userName); scope.Complete(); } this.ResetNOK(nok); LOPDLogger.Write(EntityNames.NOKEntityName, nok.ID, ActionType.Modify); return(nok); }
private CustomerContactPersonEntity Update(CustomerContactPersonEntity customerContactPerson) { if (customerContactPerson == null) { throw new ArgumentNullException("customerContactPerson"); } string userName = IdentityUser.GetIdentityUserName(); using (TransactionScope scope = new TransactionScope()) { if (customerContactPerson.Person.EditStatus.Value == StatusEntityValue.Updated) { customerContactPerson.Person = base.InnerUpdate(customerContactPerson.Person, userName, true); } //else //{ // customerContactPerson.Person = base.InnerUpdate(customerContactPerson.Person, userName, false); //} this.InnerUpdate(customerContactPerson, userName); scope.Complete(); } this.ResetCustomerContactPerson(customerContactPerson); LOPDLogger.Write(EntityNames.CustomerContactPersonEntityName, customerContactPerson.ID, ActionType.Modify); return(customerContactPerson); }
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); }