public void Insert(EUser eUser) { using (TransactionScope scope = new TransactionScope()) { eUser.PasswordHash = CalculateHash(eUser); eUser.Validar(); dUser.Insert(eUser); if (dUser.ExistsPrimaryKey()) { Message = string.Format("El código de Usuario '{0}' ya existe en el Sistema, no se puede crear el registro.", eUser.CodeUser); throw new Exception(Message); } eUser.Audit.TypeEvent = "Insert"; bAudit.Insert(eUser.Audit); scope.Complete(); } }