public async Task <bool> DeleteEmployeeTrainingsAsync(EmployeeTrainingsEntity employeeTrainingsEntity)
 {
     _logger.LogInformation("Performing Delete operation for Employee Trainings.");
     _logger.LogDebug("Delete operation - Payload employeeTrainingsEntity = " + employeeTrainingsEntity);
     try
     {
         return(await _baseRepository.DeleteEntityContribAsync(employeeTrainingsEntity));
     }
     catch (Exception ex)
     {
         _logger.LogCritical("Exception Occured while performing delete trainings operation." + ex);
         throw;
     }
 }
        public async Task <int> AddEmployeeTrainings(EmployeeTrainingsEntity employeeTrainingsEntity)
        {
            _logger.LogInformation("Performing Add operation for Employee Trainings");
            _logger.LogDebug("Add operation - Payload employeeTrainingsEntity = " + employeeTrainingsEntity);
            try
            {
                int id = await _baseRepository.AddEntityContribAsync(employeeTrainingsEntity);

                return(id);
            }
            catch (Exception ex)
            {
                _logger.LogCritical("Exeption occured while performing Add employees Trainings operation." + ex);
                throw;
            }
        }
Example #3
0
        private async Task <EmployeeTrainingsEntity> GetEmployeeTrainingsEntity(int id)
        {
            try
            {
                EmployeeTrainingsEntity employeeTrainingsEntity = await _employeeTrainingsRepository.GetEmployeeTrainingsByPrimaryKeyId(id);

                if (employeeTrainingsEntity == null)
                {
                    _logger.LogError("Record Not found and Null is returned whilst calling GetEmployeeTrainingsByPrimaryKeyId method from DeleteEmployeeTrainings having id - " + id);
                }
                return(employeeTrainingsEntity);
            }
            catch (Exception ex)
            {
                _logger.LogError($"Exception occured whilst calling a GetEmployeeTrainingsByPrimaryKeyId operation from DeleteEmployeeTrainings for id = {id} -->" + ex);
                throw;
            }
        }
        public async Task <IEnumerable <EmployeeTrainingsEntity> > GetAllEmployeesByTrainingsIdAsync(EmployeeTrainingsEntity employeeTrainingsEntity)
        {
            _logger.LogInformation("### Calling base repository method ### ");
            string sQuery = "Select * from EmployeeTraining et, Training t where t.id=et.TrainingId and VacationTypeId=@VacationTypeId and TrainingId=@TrainingId and DateFrom>=@DateFrom and DateTo<=@DateTo";

            return(await _baseRepository.GetAllEntitiesAsync(sQuery, employeeTrainingsEntity));
        }