private List <PosteForTrackingDto> GetPostesForTracking(List <VPlanGlobal> vPlanGlobal, int idPlan, bool isBalanceSheet)
        {
            List <Poste> postes = _posteRepository.GetAll();
            List <PosteForTrackingDto> postesForTracking = new List <PosteForTrackingDto>();

            foreach (var poste in postes)
            {
                PosteForTrackingDto posteForTracking = new PosteForTrackingDto();
                posteForTracking.Poste = _mapper.Map <SelectDto>(poste);

                var vByPoste = vPlanGlobal.Where(x => x.IdPoste == poste.Id).ToList();
                //recherche des planPoste et affectation au planTrackingDto
                posteForTracking.PlanPostes = GetPlanPostesForTracking(vByPoste, idPlan, poste.Id);

                if (vByPoste.Count > 0)
                {
                    PlanTrackingAmountStoreDto planTrackingAmountStore = GetplanTrackingAmountStore(vByPoste, isBalanceSheet);

                    posteForTracking.AmountPreview = Math.Round(planTrackingAmountStore.AmountPreview, 2);
                    posteForTracking.AmountReal    = Math.Round(planTrackingAmountStore.AmountReal, 2);
                    posteForTracking.GaugeValue    = CalculatePercentage(planTrackingAmountStore.AmountReal, planTrackingAmountStore.AmountPreview);
                }
                postesForTracking.Add(posteForTracking);
            }
            return(postesForTracking);
        }
Exemple #2
0
        public List <SelectDto> GetAllSelect()
        {
            var postes = _posteRepository.GetAll();

            return(_mapper.Map <List <SelectDto> >(postes));
        }