Ejemplo n.º 1
0
        public void LogError(Exception ex)
        {
            LogEvent log = new LogEvent();

            //log.LogEventType = LogEventType.Error;
            log.LogEventType      = "Error";
            log.ChangedByUserId   = this.GetCurrentUserId();
            log.ChangedByUserName = this.GetCurrentUserName();
            log.Date = DateTime.Now;

            Type entityType = ex.GetType();

            log.EntityType = entityType.Name;
            log.EntityId   = "Error";

            var tempEx = ex;

            while (tempEx.StackTrace == null && ex.InnerException != null)
            {
                tempEx = tempEx.InnerException;
            }
            log.StackTrace = tempEx.StackTrace;

            while (tempEx.InnerException != null)
            {
                tempEx = tempEx.InnerException;
            }

            log.ErrorMessage = tempEx.Message;

            repo.UndoChanges();
            repo.Create <LogEvent>(log);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a/an GroupPrivilege.
 /// </summary>
 /// <param name="entity"></param>
 /// <returns>Returns the GroupPrivilege that was created in the database.</returns>
 public GroupPrivilege CreateGroupPrivilege(GroupPrivilege entity)
 {
     try
     {
         return(repo.Create <GroupPrivilege>(entity));
     }
     catch (Exception ex)
     {
         repo.LogError(ex);
         throw ex;
     }
 }
 /// <summary>
 /// Creates a/an OrganizationPrivilege.
 /// </summary>
 /// <param name="entity"></param>
 /// <returns>Returns the OrganizationPrivilege that was created in the database.</returns>
 public OrganizationPrivilege CreateOrganizationPrivilege(OrganizationPrivilege entity)
 {
     try
     {
         return repo.Create<OrganizationPrivilege>(entity);
     }
     catch (Exception ex)
     {
         repo.LogError(ex);
         throw ex;
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Creates a/an User.
 /// </summary>
 /// <param name="entity"></param>
 /// <returns>Returns the User that was created in the database.</returns>
 public User CreateUser(User entity)
 {
     try
     {
         return(repo.Create <User>(entity));
     }
     catch (Exception ex)
     {
         repo.LogError(ex);
         throw ex;
     }
 }
 /// <summary>
 /// Creates a/an UserPrivilege.
 /// </summary>
 /// <param name="entity"></param>
 /// <returns>Returns the UserPrivilege that was created in the database.</returns>
 public UserPrivilege CreateUserPrivilege(UserPrivilege entity)
 {
     try
     {
         return(repo.Create <UserPrivilege>(entity));
     }
     catch (Exception ex)
     {
         repo.LogError(ex);
         throw ex;
     }
 }
 /// <summary>
 /// Creates a/an LogEvent.
 /// </summary>
 /// <param name="entity"></param>
 /// <returns>Returns the LogEvent that was created in the database.</returns>
 public LogEvent CreateLogEvent(LogEvent entity)
 {
     try
     {
         return(repo.Create <LogEvent>(entity));
     }
     catch (Exception ex)
     {
         repo.LogError(ex);
         throw ex;
     }
 }
 /// <summary>
 /// Creates a/an Group.
 /// </summary>
 /// <param name="entity"></param>
 /// <returns>Returns the Group that was created in the database.</returns>
 public Group CreateGroup(Group entity)
 {
     try
     {
         return(repo.Create <Group>(entity));
     }
     catch (Exception ex)
     {
         repo.LogError(ex);
         throw ex;
     }
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Creates a/an Organization.
 /// </summary>
 /// <param name="entity"></param>
 /// <returns>Returns the Organization that was created in the database.</returns>
 public Organization CreateOrganization(Organization entity)
 {
     try
     {
         return(repo.Create <Organization>(entity));
     }
     catch (Exception ex)
     {
         repo.LogError(ex);
         throw ex;
     }
 }
 /// <summary>
 /// Creates a/an Application.
 /// </summary>
 /// <param name="entity"></param>
 /// <returns>Returns the Application that was created in the database.</returns>
 public Application CreateApplication(Application entity)
 {
     try
     {
         return(repo.Create <Application>(entity));
     }
     catch (Exception ex)
     {
         repo.LogError(ex);
         throw ex;
     }
 }