Exemple #1
0
        /// <summary>
        /// calculate coefficients for a specific measureset/measure/month and change the state of the dossiers
        /// </summary>
        private void CalculateCoefficients(int fpiId)
        {
            var fpi      = Get(fpiId);
            var dossiers = dossierRepo.GetBy(fpi.MeasuresetId, fpi.MeasureId, fpi.Month, (int)DossierStates.HasIndicators).ToArray();

            if (dossiers.Count() == 0)
            {
                return;
            }
            var measure = u.Get <Measure>(fpi.MeasureId);

            using (var t = new TransactionScope())
            {
                if (!measure.NoContest)
                {
                    var indicatorValues   = ivr.GetBy(fpi.Id).ToArray();
                    var coefficients      = u.GetWhere <Coefficient>(new { dossiers.First().FieldsetId }).ToList();
                    var coefficientValues = ecoCalc.CalculateCoefficientValues(indicatorValues, dossiers, coefficients);
                    coefficientValues.All(o => u.InsertNoIdentity(o) == 1);
                }

                dossiers.All(o => dossierRepo.ChangeState(o.Id, DossierStates.HasCoefficients) == 1);
                t.Complete();
            }
        }
Exemple #2
0
 private void SaveFieldValues(IEnumerable <FieldValue> fieldValues, int dossierId)
 {
     (!fieldValues.All(o => u.InsertNoIdentity(o) == 1)).B("nu pot salva valorile");
     dossierRepo.ChangeState(dossierId, DossierStates.HasFieldValues);
 }