예제 #1
0
        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);
        }
예제 #2
0
        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();
        }
예제 #4
0
 public async Task Update(BrigadeForTodayBll elementToUpdate)
 {
     _unitOfWork.BrigadeForTodayUnitOfWork.Update(TransformAnEntity(elementToUpdate));
     await _unitOfWork.Save();
 }
예제 #5
0
 public Task Insert(BrigadeForTodayBll element) =>
 throw new NotImplementedException();
예제 #6
0
 public brigadeForToday TransformAnEntity(BrigadeForTodayBll entity) =>
 Mapper.Map <BrigadeForTodayBll, brigadeForToday>(entity);