Пример #1
0
        public object Contract(int id)
        {
            var c       = u.Get <Contract>(id);
            var dossier = u.Get <Dossier>(c.DossierId);
            var fvi     = u.Get <FarmerVersionInfo>(dossier.FarmerVersionId.Value);
            var measure = u.Get <Measure>(dossier.MeasureId);
            var a       = u.GetWhere <AddressInfo>(new { fvi.FarmerId, EndDate = DBNull.Value }).FirstOrDefault();

            return(new
            {
                Nr = c.Id,
                Data = c.Date.Value.ToShortDateString(),
                Masura = measure.Name,
                Titlu = measure.Description,
                Adresa = a.Display(),
                Beneficiar = fvi.Name,
                Reprezentant =
                    !string.IsNullOrWhiteSpace(dossier.AdminFirstName)
                                   ? dossier.AdminFirstName + " " + dossier.AdminLastName
                                   : dossier.RepresentativeFirstName + " " + dossier.RepresentativeLastName,
                FunctiaDe = !string.IsNullOrWhiteSpace(dossier.AdminFirstName) ? "în funcţia de Director" : " în calitate de reprezentant legal în baza procurii ",
                Cd = c.Account,
                CodBancar = c.BankCode,
                Cf = fvi.FiscalCode,
                Sprijin = dossier.AmountPayed.ToString("0.00"),
                Sprijinw = NumberToWords.Do(dossier.AmountPayed),
                Invest = dossier.InvestmentValue.ToString("0.00"),
                Investw = NumberToWords.Do(dossier.InvestmentValue),
                Functia = !string.IsNullOrWhiteSpace(dossier.AdminFirstName) ? "Director" : "Reprezentant legal",
                SprijinNr = c.SupportNr,
                Filiala = c.BankName,
            });
        }
Пример #2
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();
            }
        }
Пример #3
0
        /// <summary>
        /// calculate indicator values
        /// save indicator values
        /// change the state
        /// </summary>
        private void SaveIndicators(int dossierId)
        {
            var dossier     = dossierRepo.Get(dossierId);
            var fieldValues = u.GetWhere <FieldValue>(new { dossierId }).ToList();

            using (var scope = new TransactionScope())
            {
                var indicators      = u.GetWhere <Indicator>(new { dossier.FieldsetId }).ToList();
                var indicatorValues = ecoCalc.CalculateIndicatorValues(dossier, fieldValues, indicators);

                if (!indicatorValues.All(o => u.InsertNoIdentity(o) == 1))
                {
                    throw new AsmsEx("nu pot salva valorile indicatorilor");
                }

                dossierRepo.ChangeState(dossierId, DossierStates.HasIndicators);
                scope.Complete();
            }
        }
Пример #4
0
 public ActionResult ItemByContract(int id)
 {
     return(View("item", u.GetWhere <Capo>(new { ContractNr = id }).SingleOrDefault()));
 }
Пример #5
0
 public IEnumerable <Agreement> GetByContractId(int contractId)
 {
     return(u.GetWhere <Agreement>(new { contractId }));
 }
Пример #6
0
 public Fieldset GetActive()
 {
     return(u.GetWhere <Fieldset>(new { stateId = (int)FieldsetStates.Active }).FirstOrDefault());
 }