Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Nombre,Descipcion")] Interes interes)
        {
            if (id != interes.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(interes);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InteresExists(interes.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(interes));
        }
Ejemplo n.º 2
0
 public InteresModelView()
 {
     interes           = new Interes();
     NavigationService = new NavigationService();
     Dodaj             = new RelayCommand(dodaj);
     Odbaci            = new RelayCommand(odbaci);
 }
Ejemplo n.º 3
0
        public async Task <IActionResult> PutInteres(int id, Interes interes)
        {
            if (id != interes.UsuarioId)
            {
                return(BadRequest());
            }

            context.Entry(interes).State = EntityState.Modified;

            try
            {
                await context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!InteresExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 4
0
        //public override double calcularMonto()
        //{
        //    double precioSinEnganche = lote.calcularSaldo();
        //    return lotificadoraInteres.calcularInteres(precioSinEnganche, tiempoDeFinanciamiento) - precioSinEnganche;
        //}

        public override double calcularMonto()
        {
            double precioSinEnganche = lote.calcularSaldo();
            var    interes           = new Interes(precioSinEnganche, tasaInteres, tiempoDeFinanciamiento);

            return(interes.CalcularInteres() - precioSinEnganche);
        }
Ejemplo n.º 5
0
        private void btnCalcular_Click(object sender, EventArgs e)
        {
            decimal monto   = txtMonto.Value;
            decimal interes = txtInteres.Value;

            txtResultado.Value     = Interes.CalcularCapital(monto, interes);
            panelResultado.Visible = true;
        }
Ejemplo n.º 6
0
        public ActionResult DeleteConfirmed(string id)
        {
            Interes interes = db.Interes.Find(id);

            db.Interes.Remove(interes);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 7
0
        private void btnCalcular_Click(object sender, EventArgs e)
        {
            decimal totalPeriodos = txtTotalPeriodos.Value;
            decimal frecuencia    = txtPeriodo.Value;

            txtResultado.Value     = Interes.CalcularTiempo(frecuencia, totalPeriodos);
            panelResultado.Visible = true;
        }
Ejemplo n.º 8
0
        private void btnCalcular_Click(object sender, EventArgs e)
        {
            decimal tasaEfectiva = txtTasaEfectiva.Value;
            var     periodo      = (Interes.Frecuencia)Enum.Parse(typeof(Interes.Frecuencia), cbPeriodos.SelectedItem.ToString());

            txtResultado.Value     = Interes.CalcularTasaNominal(periodo, tasaEfectiva);
            panelResultado.Visible = true;
        }
Ejemplo n.º 9
0
        private void btnCalcular_Click(object sender, EventArgs e)
        {
            decimal tiempo  = txtTiempo.Value;
            decimal periodo = txtPeriodo.Value;

            txtResultado.Value     = Interes.CalcularTotalPeriodos(periodo, tiempo);
            panelResultado.Visible = true;
        }
Ejemplo n.º 10
0
        private void btnCalcular_Click(object sender, EventArgs e)
        {
            decimal monto         = txtMonto.Value;
            decimal capital       = txtCapital.Value;
            decimal totalPeriodos = txtTotalPeriodos.Value;

            txtResultado.Value     = Interes.CalcularTasaEfectiva(monto, capital, totalPeriodos);
            panelResultado.Visible = true;
        }
Ejemplo n.º 11
0
        private void btnCalcular_Click(object sender, EventArgs e)
        {
            decimal interes       = txtInteres.Value;
            decimal tasaEfectiva  = txtTasaEfectiva.Value;
            decimal totalPeriodos = txtTotalPeriodos.Value;

            txtResultado.Value     = Interes.CalcularCapitalPorInteres(interes, tasaEfectiva, totalPeriodos);
            panelResultado.Visible = true;
        }
Ejemplo n.º 12
0
 public ActionResult Edit([Bind(Include = "id,Naziv")] Interes interes)
 {
     if (ModelState.IsValid)
     {
         db.Entry(interes).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(interes));
 }
Ejemplo n.º 13
0
        public ActionResult Create([Bind(Include = "id,Naziv")] Interes interes)
        {
            if (ModelState.IsValid)
            {
                db.Interes.Add(interes);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(interes));
        }
Ejemplo n.º 14
0
        public async Task <IActionResult> Create([Bind("ID,Nombre,Descipcion")] Interes interes)
        {
            if (ModelState.IsValid)
            {
                _context.Add(interes);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(interes));
        }
Ejemplo n.º 15
0
        public Credito CrearCredito()
        {
            lectura.CrearTitulo("Formulario - Registrar Credito");
            string  identificacion = lectura.LeerNumerico("Digite la identificacion del credito : ");
            Cliente cliente        = CrearCliente();
            Interes interes        = CrearInteres();
            Credito credito        = new Credito(identificacion, cliente, interes);

            credito.ValorTotal = interes.ValorInteres;
            return(credito);
        }
Ejemplo n.º 16
0
        private void btnCalcular_Click(object sender, EventArgs e)
        {
            decimal monto         = txtMonto.Value;
            decimal capital       = txtCapital.Value;
            decimal totalPeriodos = txtTotalPeriodos.Value;
            var     value         = Periodos[cbPeriodos.SelectedItem.ToString()].ToString();
            var     periodo       = (Interes.Frecuencia)Enum.Parse(typeof(Interes.Frecuencia), value);

            txtResultado.Value     = Interes.CalcularTasaNominal(periodo, monto, capital, totalPeriodos);
            panelResultado.Visible = true;
        }
Ejemplo n.º 17
0
 public InteresModel(Interes interes)
 {
     Vprasanje = interes.Vprasanje;
     PlesnaVloga = interes.Vloga;
     TangoIzkusnje = interes.TangoIzkusnje;
     GibalneIzkusnje = interes.GibalneIzkusnje;
     FirstName = interes.Ime;
     LastName = interes.Priimek;
     Email = interes.Email;
     Phone = interes.Gsm;
     Zaznamek = interes.Zaznamek;
 }
Ejemplo n.º 18
0
        public Interes CrearInteres()
        {
            string          tipo            = ObtenerTipoDeInteres("digite tipo de interes -> s para simple y -> c para compuesto : ");
            double          valorPrestado   = Convert.ToDouble(lectura.LeerNumerico("Valor Prestado : "));
            int             tiempo          = Convert.ToInt32(lectura.LeerNumerico("digite el tiempo de pago (Años): "));
            double          tasa            = Convert.ToDouble(lectura.Leer("digite la tasa de interes en porcentaje (%) solo valores enteros  :"));
            InteresFactoria interesFactoria = new InteresFactoria();
            Interes         interes         = interesFactoria.CrearInteres(tipo, valorPrestado, tiempo, tasa);

            interes.CalcularValorTotal();
            return(interes);
        }
Ejemplo n.º 19
0
        // GET: Interes/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Interes interes = db.Interes.Find(id);

            if (interes == null)
            {
                return(HttpNotFound());
            }
            return(View(interes));
        }
Ejemplo n.º 20
0
        public Credito MapearCredito(string linea)
        {
            Credito credito;

            string[] datos          = linea.Split(';');
            string   identificacion = datos[0];
            double   valorTotal     = Convert.ToDouble(datos[1]);
            Cliente  cliente        = MapearCliente(linea);
            Interes  interes        = MapearInteres(linea);

            credito            = new Credito(identificacion, cliente, interes);
            credito.ValorTotal = valorTotal;
            return(credito);
        }
Ejemplo n.º 21
0
        public Credito ObtenerCreditoModificado(Credito credito)
        {
            double          valorPrestado   = float.Parse(lectura.LeerNumerico("Digite El Nuevo Valor valor del credito a prestar : "));
            int             tiempo          = Convert.ToInt32(lectura.LeerNumerico("digite el nuevo tiempo de pago (Años): "));
            double          tasa            = Convert.ToDouble(lectura.Leer("digite la nueva tasa de interes en porcentaje (%) solo valores enteros  :"));
            string          tipo            = credito.Interes.Tipo;
            InteresFactoria interesFactoria = new InteresFactoria();
            Interes         interes         = interesFactoria.CrearInteres(tipo, valorPrestado, tiempo, tasa);
            string          identificaion   = credito.Identificacion;
            Credito         creditoAuxiliar = new Credito(identificaion, credito.Cliente, interes);

            creditoAuxiliar.ValorTotal = interes.ValorInteres;
            return(creditoAuxiliar);
        }
Ejemplo n.º 22
0
        private async void btnGuardar_Click(object sender, EventArgs e)
        {
            if (interesId > 0)
            {
                var interes = await _context.Interes.FindAsync(interesId);

                interes.Igual                 = txtIgual.Text == "Igual que" ? 0 : int.Parse(txtIgual.Text);
                interes.Mayor                 = txtMayor.Text == "Mayor que" ? 0 : int.Parse(txtMayor.Text);
                interes.Menor                 = txtMenor.Text == "Menor que" ? 0 : int.Parse(txtMenor.Text);
                interes.Nombre                = txtNombre.Text;
                interes.Porcentaje            = txtValor.Text == "Porcentaje" ? 0 : double.Parse(txtValor.Text);
                interes.Bodega                = txtBodega.Text == "Bodega" ? 0 : double.Parse(txtBodega.Text);
                interes.Activo                = chbActivo.Checked;
                _context.Entry(interes).State = EntityState.Modified;
            }
            else
            {
                if (!funciones.Validate(txtNombre, lblNombre))
                {
                    return;
                }
                if (!funciones.ValidateNum(txtValor, lblValor))
                {
                    return;
                }


                var interes = new Interes
                {
                    Igual      = txtIgual.Text == "Igual que" ? 0 : int.Parse(txtIgual.Text),
                    Mayor      = txtMayor.Text == "Mayor que" ? 0 : int.Parse(txtMayor.Text),
                    Menor      = txtMenor.Text == "Menor que" ? 0 : int.Parse(txtMenor.Text),
                    Bodega     = txtBodega.Text == "Bodega" ? 0 : double.Parse(txtBodega.Text),
                    Nombre     = txtNombre.Text,
                    Activo     = chbActivo.Checked,
                    Porcentaje = txtValor.Text == "Porcentaje" ? 0 : double.Parse(txtValor.Text),
                };

                _context.Interes.Add(interes);
            }

            await _context.SaveChangesAsync();

            await LoadData();

            interesId = 0;
            funciones.ResetForm(panelFormulario);
            MessageBox.Show("Datos guardados correctamente");
        }
Ejemplo n.º 23
0
        public void Calcular()
        {
            double precioTotal = this.Precio.GetValueOrDefault(0);
            double cuota       = 0;

            precioTotal += this.TarifaAddicional.GetValueOrDefault(0);
            precioTotal -= this.Descuento.GetValueOrDefault(0);
            precioTotal -= this.Prima.GetValueOrDefault(0);
            //A = P*(r(1+r)^n)/((1+r)^n -1)
            //P = Capital Principal
            //A = Pago Mensual
            //r = Tasa de Interes
            //n = Total de Meses
            double r = (Interes.GetValueOrDefault(0) / 100) / 12;
            double n = this.NumeroCuotas.GetValueOrDefault(0);

            cuota = precioTotal * ((r * Math.Pow(1 + r, n)) /
                                   (Math.Pow(1 + r, n) - 1));
            Resultado = "La cuota Mensual aproximada es de: " + cuota.ToString("#,###.00");
        }
Ejemplo n.º 24
0
        public async Task <ActionResult <Interes> > PostInteres(Interes interes)
        {
            context.Interes.Add(interes);
            try
            {
                await context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (InteresExists(interes.UsuarioId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetInteres", new { id = interes.UsuarioId }, interes));
        }
Ejemplo n.º 25
0
        public void Salida_Datos_Tabla()
        {
            int i = 1;

            do
            {
                Console.Write("{0}\t", pagos);

                pagos = pagos + 1;

                Console.Write("{0}\t", Dinero.ToString("0.00"));


                Interes = Interes_M * Prestamo;
                Console.Write("\t{0}\t", Interes.ToString("0.00"));


                Capital = Dinero - Interes;
                Console.Write(" \t{0}\t", Capital.ToString("0.00"));


                Prestamo = Prestamo - (Capital);

                if (Prestamo < 1)
                {
                    Console.Write(" \t{0} \t   ", Prestamo = 0);
                }
                else
                {
                    Console.Write(" \t{0}    ", Prestamo.ToString("0.00"));
                }


                Console.WriteLine();

                i++;
            } while (i <= Plazo);
            Console.WriteLine();
        }
Ejemplo n.º 26
0
 public bool Save()
 {
     try
     {
         DB = new Conexion();
         if (DB.ExecuteCMD(
                 "INSERT INTO CUOTAS (ID_Prestamo,Fecha,Monto,MontoMora,MontoInteres) " +
                 " VALUES (" + ID_Prestamo + ",'" + Fecha + "'," + Monto.ToString().Replace(",", ".") +
                 "," + Mora.ToString().Replace(",", ".") +
                 "," + Interes.ToString().Replace(",", ".") + ")"))
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Ejemplo n.º 27
0
        protected void btnListo_Click(object sender, EventArgs e)
        {
            //string idUsuario = "294f5ded-2707-4c3a-b1f5-e4a79a0212cc";
            using (ProyectoDonArEntities ent = new ProyectoDonArEntities())
            {
                foreach (RepeaterItem item in rptIntereses.Items)
                {
                    HtmlInputCheckBox chbInteres = (HtmlInputCheckBox)item.FindControl("chbInteres");
                    if (chbInteres.Checked)
                    {
                        Interes i = new Interes
                        {
                            idUsuario      = ent.AspNetUsers.Where(u => u.Email == HttpContext.Current.User.Identity.Name).First().Id,
                            idTipoProyecto = int.Parse(chbInteres.Value)
                        };
                        ent.Intereses.Add(i);
                    }
                }
                ent.SaveChanges();
            }

            ClientScript.RegisterClientScriptBlock(this.GetType(), "listo", "window.close();", true);
        }
Ejemplo n.º 28
0
 public void Interes(ref Interes interes)
 {
     interes.Vprasanje = Vprasanje;
     interes.Vloga = PlesnaVloga;
     interes.TangoIzkusnje = TangoIzkusnje;
     interes.GibalneIzkusnje = GibalneIzkusnje;
     interes.Ime = FirstName;
     interes.Priimek = LastName;
     interes.Email = Email;
     interes.Gsm = Phone;
     interes.Zaznamek = Zaznamek;
 }
Ejemplo n.º 29
0
        public virtual ActionResult ShraniInteres(InteresModel interes)
        {
            if (!ModelState.IsValid) return View("Interes", interes);
            if (interes.Email.Empty() && interes.Phone.Empty())
            {
                ModelState.AddModelError("Email", "Kam naj vam odgovorimo - na email ali telefon?");
                return View("Interes", interes);
            }
            if (interes.FirstName.Empty() && interes.LastName.Empty())
            {
                ModelState.AddModelError("Ime", "Razkrijte nam vsaj svoje ime");
                return View("Interes", interes);
            }

            if (interes.Email != null) interes.Email = interes.Email.Trim();

            Interes dbrec = new Interes();
            interes.Interes(ref dbrec);

            if (interes.Email.NotEmpty())
            {
                //var crmService = DependencyResolver.Current.GetService<ICrmService>();
                //var eml = crmService.Email(interes.Email);
                //eml.SetTag("vir", DependencyResolver.Current.GetService<ISettingsProvider>().Settings.Site);
                //eml.SetTag("jezik", System.Web.HttpContext.Current.Language().ToString());
                //crmService.ClearTagForEmail(eml, "status", "STOP");
                //crmService.ClearTagForEmail(eml, "status", "ERROR");
                //crmService.SaveChanges();

                using (WebClient client = new WebClient())
                {
                    try
                    {
                        client.Encoding = Encoding.UTF8;
                        client.Headers["User-Agent"] = "new-100tango";
                        string request = string.Format("{2}News/RegisterForNews?email={0}&tags={1}", interes.Email,
                            "vir.100TANGO.interes",
                            DependencyResolver.Current.GetService<ISettingsProvider>().Settings.SiteHome);
                        client.DownloadString(request);
                    }
                    catch (Exception exc)
                    {
                        if (System.Web.HttpContext.Current.UserIsAdmin())
                        {
                            _alerts.AddDanger(exc.Print(),true);
                        }
                    }
                }
            }

            solaService.Dodaj(dbrec);
            solaService.SaveChanges();

            return View("PotrdiInteres", interes);
        }
        //Ingresar Interes
        private void interesAgregar_btn_Click(object sender, RoutedEventArgs e)
        {
            if (interesNombre_txt.Text == "" || interesPorcentaje_txt.Text == "")
            {
                MessageBox.Show("Ingrese un nombre y porcentaje para el interes");
                return;
            }
            flags[0] = true;
            flags[1] = true;
            flags[2] = true;

            bool? aplicaObligatoria = null;
            bool? aplicaObligatoriaE = null;
            bool? aplicaVoluntaria = null;
            bool? aplicaVoluntariaE = null;

            Interes interes = new Interes();
            interes.Nombre = interesNombre_txt.Text;
            interes.Tasa = Convert.ToInt64(interesPorcentaje_txt.Text);
            if (!aplicaObligatoria.HasValue)
            {
                aplicaObligatoria = interesAplica2_chk.IsChecked;
            }
            interes.Aplica_obligatoria = (bool)aplicaObligatoria;

            if (!aplicaObligatoriaE.HasValue)
            {
                aplicaObligatoriaE = interesAplica3_chk.IsChecked;
            }
            interes.Aplica_obligatoria_especial = (bool)aplicaObligatoriaE;

            if (!aplicaVoluntaria.HasValue)
            {
                aplicaVoluntaria = interesAplica1_chk.IsChecked;
            }
            interes.Aplica_voluntaria = (bool)aplicaVoluntaria;

            if (!aplicaVoluntariaE.HasValue)
            {
                aplicaVoluntariaE = interesAplica4_chk.IsChecked;
            }
            interes.Aplica_voluntaria_arriba = (bool)aplicaVoluntariaE;
            if (interes.Aplica_voluntaria_arriba && interesAportacionAplica_txt.Text == "")
            {
                /*
                 * 
                 * 
                 * Mensaje de Error (Validacion que ponga el numero que aplica)
                 * 
                 * 
                 */
            }
            else
            {
                if (interesAportacionAplica_txt.Text == "")
                {
                    interes.Monto_voluntaria = 0;
                }
                else
                {
                    interes.Monto_voluntaria = Convert.ToInt64(interesAportacionAplica_txt.Text);
                }
            }

            habilitarCampos(false, "interes");
            interesAportacionAplica_txt.IsEnabled = false;

            Wrapper.AgregarPeticionCompleted += new EventHandler<ServiceReference.AgregarPeticionCompletedEventArgs>(Wrapper_AgregarPeticionCompleted);
            Wrapper.AgregarPeticionAsync(ServiceReference.peticion.ingresar_interes, MainPage.tc.InsertarInteres(interes, usuario));
        }
        //Modificar Interes
        private void interesModificar_btn_Click(object sender, RoutedEventArgs e)
        {
            if (interesViejo_txt.Text == "")
            {
                MessageBox.Show("Elija un Interes");
                return;
            }
            if (interesModificarNombre_txt.Text == "")
            {
                MessageBox.Show("Ingrese el nombre nuevo para el Interes");
                return;
            }
            if (interesModificarPorc_txt.Text == "")
            {
                MessageBox.Show("Ingrese un Porcentaje de Interes");
                return;
            }

            string viejo = interesViejo_txt.Text;
            bool? aplicaObligatoria = null;
            bool? aplicaObligatoriaE = null;
            bool? aplicaVoluntaria = null;
            bool? aplicaVoluntariaE = null;

            if (!aplicaObligatoria.HasValue)
            {
                aplicaObligatoria = modificarInteresAplica2_chk.IsChecked;
            }

            if (!aplicaObligatoriaE.HasValue)
            {
                aplicaObligatoriaE = modificarInteresAplica3_chk.IsChecked;
            }

            if (!aplicaVoluntaria.HasValue)
            {
                aplicaVoluntaria = modificarInteresAplica1_chk.IsChecked;
            }

            if (!aplicaVoluntariaE.HasValue)
            {
                aplicaVoluntariaE = modificarInteresAplica4_chk.IsChecked;
            }

            Interes interesNuevo = new Interes()
            {
                Nombre = interesModificarNombre_txt.Text,
                Tasa = Convert.ToInt64(interesModificarPorc_txt.Text),
                Aplica_obligatoria = (bool)aplicaObligatoria,
                Aplica_obligatoria_especial = (bool)aplicaObligatoriaE,
                Aplica_voluntaria = (bool)aplicaVoluntaria,
                Aplica_voluntaria_arriba = (bool)aplicaVoluntariaE
            };

            if (interesNuevo.Aplica_voluntaria_arriba && interesAportacionAplica_txt.Text == "")
            {
                interesAportacionAplica_txt.Text = "0";
                interesNuevo.Monto_voluntaria = Convert.ToInt64(interesAportacionAplica_txt.Text);
            }
            else
            {
                interesNuevo.Monto_voluntaria = 0;
            }

            flags[0] = true;
            flags[1] = true;
            flags[2] = true;
            habilitarCampos(false, "interes");
            Wrapper.AgregarPeticionCompleted += new EventHandler<ServiceReference.AgregarPeticionCompletedEventArgs>(Wrapper_AgregarPeticionCompleted);
            Wrapper.AgregarPeticionAsync(ServiceReference.peticion.modificarInteres, MainPage.tc.ModificarInteres(interesNuevo, viejo, usuario));
        }