예제 #1
0
 public int UpdateJobRole(JobRoleObject jobRole)
 {
     try
     {
         if (jobRole == null)
         {
             return(-2);
         }
         var duplicates = _repository.Count(m => m.JobTitle.Trim().ToLower() == jobRole.JobTitle.Trim().ToLower() && (m.JobRoleId != jobRole.JobRoleId));
         if (duplicates > 0)
         {
             return(-3);
         }
         var jobRoleEntity = ModelCrossMapper.Map <JobRoleObject, JobRole>(jobRole);
         if (jobRoleEntity == null || jobRoleEntity.JobRoleId < 1)
         {
             return(-2);
         }
         _repository.Update(jobRoleEntity);
         _uoWork.SaveChanges();
         return(5);
     }
     catch (Exception ex)
     {
         ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message);
         return(-2);
     }
 }
예제 #2
0
 public long AddJobRole(JobRoleObject jobRole)
 {
     try
     {
         if (jobRole == null)
         {
             return(-2);
         }
         var duplicates = _repository.Count(m => m.JobTitle.Trim().ToLower() == jobRole.JobTitle.Trim().ToLower() && (m.JobRoleId != jobRole.JobRoleId));
         if (duplicates > 0)
         {
             return(-3);
         }
         var jobRoleEntity = ModelCrossMapper.Map <JobRoleObject, JobRole>(jobRole);
         if (jobRoleEntity == null || string.IsNullOrEmpty(jobRoleEntity.JobTitle))
         {
             return(-2);
         }
         var returnStatus = _repository.Add(jobRoleEntity);
         _uoWork.SaveChanges();
         return(returnStatus.JobRoleId);
     }
     catch (Exception ex)
     {
         ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message);
         return(0);
     }
 }
예제 #3
0
 public int UpdateJobRole(JobRoleObject jobRole)
 {
     try
     {
         return(_jobRoleRepository.UpdateJobRole(jobRole));
     }
     catch (Exception ex)
     {
         ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message);
         return(-2);
     }
 }
예제 #4
0
 public long AddJobRole(JobRoleObject jobRole)
 {
     try
     {
         return(_jobRoleRepository.AddJobRole(jobRole));
     }
     catch (Exception ex)
     {
         ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message);
         return(0);
     }
 }