public async Task RemoveFromBrigade(int id) { BrigadeForTodayBll brigadeForTodayBll = await GetId(id); brigadeForTodayBll.EndTime = DateTime.Now; brigadeForTodayBll.EarlyTermination = false; await _employeeRate.EndDayRateCalculation(brigadeForTodayBll); await Update(brigadeForTodayBll); }
private async Task AdninRegistr(int?admin, int status) { BrigadeForTodayBll brigadeForToday = new BrigadeForTodayBll(); brigadeForToday.Date = DateTime.Now; brigadeForToday.IdCarWashWorkers = admin; brigadeForToday.EarlyTermination = true; brigadeForToday.StatusId = status; brigadeForToday brigade = Mapper.Map <BrigadeForTodayBll, brigadeForToday>(brigadeForToday); _unitOfWork.BrigadeForTodayUnitOfWork.Insert(brigade); await _unitOfWork.Save(); }
public async Task EndDayRateCalculation(BrigadeForTodayBll brigadeForToday) { var employeeRate = new DAL.EmployeeRate(); int dateStart = brigadeForToday.Date.Value.Hour; int workingHours = brigadeForToday.EndTime.Value.Hour - dateStart; double hourlyRate = (double)brigadeForToday.StatusId.Value / 12; employeeRate.brigadeForTodayId = brigadeForToday.id; employeeRate.numberHoursWorked = workingHours; employeeRate.hourlyRate = hourlyRate; employeeRate.wage = OpeningHours(workingHours, hourlyRate); _unitOfWork.EmployeeRateUnitOfWork.Insert(employeeRate); await _unitOfWork.Save(); }
public async Task Update(BrigadeForTodayBll elementToUpdate) { _unitOfWork.BrigadeForTodayUnitOfWork.Update(TransformAnEntity(elementToUpdate)); await _unitOfWork.Save(); }
public Task Insert(BrigadeForTodayBll element) => throw new NotImplementedException();
public brigadeForToday TransformAnEntity(BrigadeForTodayBll entity) => Mapper.Map <BrigadeForTodayBll, brigadeForToday>(entity);