public ActionResult ValutaLivello(decimal idValuta)
        {
            List <ValuteModel> libm = new List <ValuteModel>();
            var r = new List <SelectListItem>();
            List <ValuteModel> llm = new List <ValuteModel>();

            try
            {
                ListeValute();
                using (dtValute dtib = new dtValute())
                {
                    libm = dtib.getListValute(idValuta).OrderBy(a => a.idValuta).ToList();
                }
            }
            catch (Exception ex)
            {
                return(PartialView("ErrorPartial"));
            }
            //ViewBag.escludiAnnullati = escludiAnnullati;
            return(PartialView("Valute", libm));
        }
        decimal CaricaComboFunzioniTFR(decimal idValuta)
        {
            var r = new List <SelectListItem>();
            List <ValuteModel> llm = new List <ValuteModel>();

            using (dtValute dtl = new dtValute())
            {
                llm = dtl.getListValute().OrderBy(a => a.descrizioneValuta).ToList();
                if (llm != null && llm.Count > 0)
                {
                    r = (from t in llm
                         select new SelectListItem()
                    {
                        Text = t.descrizioneValuta,
                        Value = t.idValuta.ToString()
                    }).ToList();

                    if (idValuta == 0)
                    {
                        r.First().Selected = true;
                        idValuta = Convert.ToDecimal(r.First().Value);
                    }
                    else
                    {
                        var temp = r.Where(a => a.Value == idValuta.ToString()).ToList();
                        if (temp.Count == 0)
                        {
                            r.First().Selected = true;
                            idValuta = Convert.ToDecimal(r.First().Value);
                        }
                        else
                        {
                            r.Where(a => a.Value == idValuta.ToString()).First().Selected = true;
                        }
                    }
                }
                ViewBag.LivelliList = r;
            }
            return(idValuta);
        }
        public ActionResult EliminaValuta(decimal idValuta)
        {
            List <ValuteModel> libm = new List <ValuteModel>();

            try
            {
                using (dtValute dtib = new dtValute())
                {
                    dtib.DelValute(idValuta);
                }
                ListeValute();
                using (dtValute dtib = new dtValute())
                {
                    libm = dtib.getListValute(idValuta).OrderBy(a => a.descrizioneValuta).ToList();
                }
                return(PartialView("Valute", libm));
            }
            catch (Exception ex)
            {
                return(PartialView("ErrorPartial"));
            }
        }
        public ActionResult Valute(decimal idValuta = 0)
        {
            List <ValuteModel> libm = new List <ValuteModel>();
            var r = new List <SelectListItem>();
            List <ValuteModel> llm = new List <ValuteModel>();

            try
            {
                ListeValute();
                using (dtValute dtib = new dtValute())
                {
                    libm = dtib.getListValute(idValuta).OrderBy(a => a.idValuta).ToList();
                }
            }
            catch (Exception ex)
            {
                MsgErr msg = new MsgErr()
                {
                    msg = ex.Message
                };
                return(PartialView("ErrorPartial", msg));
            }
            return(PartialView(libm));
        }
        public ActionResult InserisciValuta(ValuteModel ibm)
        {
            var r = new List <SelectListItem>();
            List <ValuteModel> libm = new List <ValuteModel>();
            List <ValuteModel> llm  = new List <ValuteModel>();

            try
            {
                if (ModelState.IsValid)
                {
                    using (dtValute dtib = new dtValute())
                    {
                        dtib.SetValute(ibm);
                    }
                    ListeValute();
                    using (dtValute dtib = new dtValute())
                    {
                        libm = dtib.getListValute().OrderBy(a => a.idValuta).ToList();
                    }
                    return(PartialView("Valute", libm));
                }
                else
                {
                    using (dtValute dtl = new dtValute())
                    {
                        var lm = dtl.GetValute(ibm.idValuta);
                        ViewBag.descrizionevaluta = lm;
                    }
                    return(PartialView("NuoveValute", ibm));
                }
            }
            catch (Exception ex)
            {
                return(PartialView("ErrorPartial"));
            }
        }