Ejemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            DEPOSITO deposito = db.DEPOSITO.Find(id);

            db.DEPOSITO.Remove(deposito);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        void Guardar()
        {
            if (autoPaciente.SelectedItem == null)
            {
                MessageBox.Show("Selecciona a un paciente");
            }
            else
            {
                if (txtMonto.Text == "")
                {
                    MessageBox.Show("Ingresa el monto");
                }
                else
                {
                    if (txtConcepto.Text == "")
                    {
                        MessageBox.Show("Ingresa el concepto");
                    }
                    else
                    {
                        dynamic paciente = autoPaciente.SelectedItem;
                        int     idc      = paciente.ID_CUENTA;
                        var     cue      = BaseDatos.GetBaseDatos().CUENTAS.Find(idc);

                        if (Decimal.Parse(txtMonto.Text) <= cue.SALDO)
                        {
                            DEPOSITO d = new DEPOSITO
                            {
                                MONTO          = Decimal.Parse(txtMonto.Text),
                                CONCEPTO       = txtConcepto.Text,
                                USUARIOID      = idUsuario,
                                CUENTAID       = idc,
                                FECHA_CREACION = fr
                            };

                            BaseDatos.GetBaseDatos().DEPOSITOS.Add(d);
                            BaseDatos.GetBaseDatos().SaveChanges();


                            cue.SALDO = ((cue.SALDO) - (Decimal.Parse(txtMonto.Text)));
                            if (cue.SALDO == 0)
                            {
                                cue.PACIENTE.PERSONA.ESTADOPERSONA = "Inactivo";
                            }
                            BaseDatos.GetBaseDatos().SaveChanges();
                            MessageBox.Show("Registro exitoso");
                            Limpiar();
                        }
                        else
                        {
                            MessageBox.Show("El monto no pede ser mayor al saldo, Saldo: " + cue.SALDO);
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
 public ActionResult Edit(DEPOSITO deposito)
 {
     if (ModelState.IsValid)
     {
         db.Entry(deposito).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(deposito));
 }
Ejemplo n.º 4
0
        public ActionResult Edit(int id = 0)
        {
            DEPOSITO deposito = db.DEPOSITO.Find(id);

            if (deposito == null)
            {
                return(HttpNotFound());
            }
            return(View(deposito));
        }
Ejemplo n.º 5
0
        public ActionResult Create(DEPOSITO deposito)
        {
            if (ModelState.IsValid)
            {
                db.DEPOSITO.Add(deposito);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(deposito));
        }