Пример #1
0
        public async Task <object> ExportAllEmployees(Guid businessID, string fileType)
        {
            var checkBusinessId = await _commonLogic.CheckBusinessID(businessID);

            if (checkBusinessId)
            {
                return(await _employeeLogic.ExportAllEmployees(businessID, fileType));
            }
            return(_commonValidation.BusinessIdNotExists(businessID));
        }
        public async Task <object> AddIncrements(Guid businessID, [FromBody] IncrementsModel incrementsModel)
        {
            var checkBusinessId = await _commonLogic.CheckBusinessID(businessID);

            if (checkBusinessId)
            {
                var errors = _incrementsValidation.ValidateIncrementsData(incrementsModel);
                if (errors != null)
                {
                    return(errors);
                }

                var response = await _incrementsLogic.AddIncrements(businessID, incrementsModel);

                if (response == null)
                {
                    return(_incrementsValidation.IncrementsAddedSuccess());
                }
                return(_commonValidation.TheseEmployeesIdsNotFound(response));
            }
            return(_commonValidation.BusinessIdNotExists(businessID));
        }
Пример #3
0
        public async Task <Object> AddEmployeeSalary(Guid businessID, [FromBody] SalaryModel salaryModel)
        {
            var checkBusinessID = await _commonlogic.CheckBusinessID(businessID);  //check that this business is available

            if (checkBusinessID)
            {
                var checkEmployeeID = await _commonlogic.CheckEmployeeID(businessID, salaryModel.EmployeeID); //check that this employee id is available in above business

                if (checkEmployeeID)
                {
                    var checkIfSalaryIsAlreadyAssigned = await _salaryLogic.CheckIfEmployeeHasAlreaySaleryAssigned(businessID, salaryModel.EmployeeID); //checking if salery is already assigned to this employee

                    if (checkIfSalaryIsAlreadyAssigned)
                    {
                        return(_salaryValidation.SalaryAlreadyAssigned(salaryModel.EmployeeID));
                    }

                    //insertion starts here
                    var errors = _salaryValidation.ValidateSalaryData(salaryModel);
                    if (errors != null)
                    {
                        return(errors);
                    }
                    bool response = await _salaryLogic.AddEmployeeSalary(businessID, salaryModel);

                    if (response)
                    {
                        return(_salaryValidation.SalaryAddedSuccess());
                    }

                    return(_salaryValidation.SalaryAddedFailed());
                }
                return(_commonValidation.EmployeeIdNotExists(salaryModel.EmployeeID));
            }

            return(_commonValidation.BusinessIdNotExists(businessID));
        }
        public async Task <object> AddAttendance(Guid businessID, [FromBody] AttendanceModel attendanceModel)
        {
            var checkBusinessId = await commonLogic.CheckBusinessID(businessID);

            if (checkBusinessId)
            {
                var checkEmployeeId = await commonLogic.CheckEmployeeID(businessID, attendanceModel.EmployeeID);

                if (checkEmployeeId)
                {
                    var result = await attendanceLogic.AddAttendance(businessID, attendanceModel);

                    if (result)
                    {
                        return(attendanceValidation.AttendanceAddedSuccess());
                    }

                    return(attendanceValidation.AttendanceAdditionFailed());
                }

                return(commonValidation.EmployeeIdNotExists(attendanceModel.EmployeeID));
            }
            return(commonValidation.BusinessIdNotExists(businessID));
        }
        public async Task <object> AddDeduction(Guid businessID, [FromBody] DeductionModel deductionModel)
        {
            var checkBusinessId = await _commonLogic.CheckBusinessID(businessID);

            if (checkBusinessId)
            {
                var errors = _deductionValidation.ValidateDeductionData(deductionModel);
                if (errors != null)
                {
                    return(errors);
                }

                var response = await _deductionLogic.AddDeduction(businessID, deductionModel);

                if (response == null)
                {
                    return(_deductionValidation.DeductionAddedSuccess());
                }


                return(_commonValidation.TheseEmployeesIdsNotFound(response));
            }
            return(_commonValidation.BusinessIdNotExists(businessID));
        }
        public async Task <object> AddBusinessUser(Guid businessID, Guid userID)
        {
            var checkBusinessId = await _commonLogic.CheckBusinessID(businessID);

            if (checkBusinessId)
            {
                bool checkUserId = await _commonLogic.CheckUserID(userID);

                if (checkUserId)
                {
                    var response = await _businessUsersLogic.AddBusinessUser(businessID, userID);

                    if (response)
                    {
                        return(_businessUsersValidation.BusinessUserAddedSuccess());
                    }
                    return(_businessUsersValidation.BusinessUserAddedFailed());
                }
                return(_commonValidation.UserIdNotExists(userID));
            }
            return(_commonValidation.BusinessIdNotExists(businessID));
        }