public void PayAllEmployees(IEnumerable <OrderInfoViewBll> Salary) // IEnumerable<OrderInfoViewBll> Salary - del { var OrderCarWashWorkersWhere = Mapper.Map <IEnumerable <OrderCarWashWorkersBll> >(_unitOfWork.OrderCarWasWorkersUnitOFWork.GetWhere(x => x.CalculationStatus == false)); OrderCarWashWorkersBll CloseSalaryAll = new OrderCarWashWorkersBll(); CostsBll costs = new CostsBll(); foreach (var item in OrderCarWashWorkersWhere) { CloseSalaryAll.Id = item.Id; CloseSalaryAll.IdOrder = item.IdOrder; CloseSalaryAll.IdCarWashWorkers = item.IdCarWashWorkers; CloseSalaryAll.CalculationStatus = true; OrderCarWashWorkers orderCarWash = Mapper.Map <OrderCarWashWorkersBll, OrderCarWashWorkers>(CloseSalaryAll); _unitOfWork.OrderCarWasWorkersUnitOFWork.Update(orderCarWash); _unitOfWork.Save(); } //_costServices.AddCost(Salary.Sum(x => x.Expr1)); //costs.Type = 1; //costs.Name = "Выплата заработной платы для всех сотрудников"; //costs.expenses = Salary.Sum(x => x.Expr1); //costs.Date = DateTime.Now; //Costs teamSalary = Mapper.Map<CostsBll, Costs>(costs); //_unitOfWork.CostsUnitOfWork.Insert(teamSalary); //_unitOfWork.Save(); #region заполнение таблицы WageBll //List<WageBll> Wage = new List<WageBll>(); //foreach (var item in Salary) //{ // Wage.Add(new WageBll // { // IdCarWashWorkers = item.id, // CostsId = teamSalary.Id // }); //} //IEnumerable<Wage> wages = Mapper.Map<IEnumerable<WageBll>, IEnumerable<Wage>>(Wage); //_unitOfWork.WageUnitOfWork.Insert(wages.ToList()); //_unitOfWork.Save(); #endregion }
public void AddCost(double?Sum, string NameCarWashWorkers = null) { CostsBll costs = new CostsBll(); costs.Type = 1; costs.expenses = Sum; costs.Date = DateTime.Now; if (String.IsNullOrEmpty(NameCarWashWorkers)) { costs.Name = "Выплата заработной платы для всех сотрудников"; } else { costs.Name = $"Выплата заработной платы для {NameCarWashWorkers} "; } Costs teamSalary = Mapper.Map <CostsBll, Costs>(costs); _unitOfWork.CostsUnitOfWork.Insert(teamSalary); _unitOfWork.Save(); }