/// <summary> /// Save the entity /// </summary> /// <param name="useTransaction">Specify if transactions should be used</param> /// <returns></returns> public int Save(bool useTransaction) { try { //If the coonection is already enlisted in a transaction use parent transaction if (IsInTransaction()) { useTransaction = false; } if (useTransaction) { BeginTransaction(); } int newId = ApplicationConstants.INT_NULL_VALUE; OnPreSave(); if (!ValidateOperation()) { throw new NotImplementedException(ApplicationMessages.EXCEPTION_IMPLEMENT_SETENTITY); } if (State == EntityState.Deleted) { DeleteChildren(); dbEntity.DeleteObject(this); } if (State == EntityState.New) { newId = dbEntity.InsertObject(this); SaveChildren(); } if (State == EntityState.Modified) { dbEntity.UpdateObject(this); SaveChildren(); } OnPostSave(); if (useTransaction) { CommitTransaction(); } return(newId); } catch (Exception exc) { if (useTransaction) { RollbackTransaction(); } throw new IndException(exc); } }
public int InsertCostCenterTest(ICostCenter costCenter, DBGenericEntity dbGenericEntity) { costCenter.Id = dbGenericEntity.InsertObject(costCenter); return(costCenter.Id); }
private int InsertInitialBudgetTest(IInitialBudget initialBudget, DBGenericEntity dbGenericEntity) { initialBudget.Id = dbGenericEntity.InsertObject(initialBudget); return(initialBudget.Id); }
public int InsertProjectTest(IProject project, DBGenericEntity dbGenericEntity) { project.Id = dbGenericEntity.InsertObject(project); return(project.Id); }
public int InsertWorkPackageTest(IWorkPackage workPackage, DBGenericEntity dbGenericEntity) { workPackage.Id = dbGenericEntity.InsertObject(workPackage); return(workPackage.Id); }
private int InsertRevisedBudgetTest(IRevisedBudget revisedBudget, DBGenericEntity dbGenericEntity) { revisedBudget.Id = dbGenericEntity.InsertObject(revisedBudget); return(revisedBudget.Id); }