Ejemplo n.º 1
0
 public async Task <bool> DeleteEmployeeLeavesAsync(EmployeeLeavesEntity employeeLeavesEntity)
 {
     _logger.LogInformation("Performing Delete operation for Employee Leaves");
     _logger.LogDebug("Delete operation - Payload EmployeeLeavesDateDTO = " + employeeLeavesEntity);
     try
     {
         return(await _baseRepository.DeleteEntityContribAsync(employeeLeavesEntity));
     }
     catch (Exception ex)
     {
         _logger.LogCritical("Exception Occured while performing delete operation." + ex);
         throw;
     }
 }
Ejemplo n.º 2
0
        public async Task <int> AddEmployeeLeaves(EmployeeLeavesEntity employeeLeavesEntity)
        {
            _logger.LogInformation("Performing Add operation for Employee Leaves");
            _logger.LogDebug("Add operation - Payload employeeLeavesEntity = " + employeeLeavesEntity);
            try
            {
                int id = await _baseRepository.AddEntityContribAsync(employeeLeavesEntity);

                return(id);
            }
            catch (Exception ex)
            {
                _logger.LogCritical("Exeption occured while performing Add employees operation." + ex);
                throw;
            }
        }
        private async Task <EmployeeLeavesEntity> GetEmployeeLeavesEntity(int id)
        {
            try
            {
                EmployeeLeavesEntity employeeLeavesEntity = await _employeeLeavesRepository.GetEmployeeLeavesByPrimaryKeyId(id);

                if (employeeLeavesEntity == null)
                {
                    _logger.LogError("Record Not found and Null is returned whilst calling GetEmployeeLeavesByPrimaryKeyId method from DeleteEmployeeLeaves having id - " + id);
                }
                return(employeeLeavesEntity);
            }
            catch (Exception ex)
            {
                _logger.LogError($"Exception occured whilst calling a GetEmployeeLeavesByPrimaryKeyId operation from DeleteEmployeeLeaves for id = {id} -->" + ex);
                throw;
            }
        }
Ejemplo n.º 4
0
        public async Task <IEnumerable <EmployeeLeavesEntity> > GetEmployeeLeavesAllByDateAsync(EmployeeLeavesEntity employeeLeavesEntity)
        {
            _logger.LogInformation("### Calling base repository method ### ");
            string sQuery = "Select * from Vacation.dbo.EmployeeVacation WHERE VacationTypeId=@VacationTypeId and DateFrom>=@DateFrom and DateTo<=@DateTo";

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