Пример #1
0
        public void BuscarTest()
        {
            Prestamo prestamo;

            prestamo = PrestamoBLL.Buscar(1);
            Assert.AreEqual(prestamo, prestamo);
        }
Пример #2
0
        public static bool Guardar(Moras mora)
        {
            bool     guardado = false;
            Contexto contexto = new Contexto();

            try
            {
                if (contexto.Moras.Add(mora) != null)
                {
                    guardado = contexto.SaveChanges() > 0;
                }

                List <MorasDetalle> DetallesModif = mora.DetalleMora;
                foreach (MorasDetalle mr in DetallesModif)
                {
                    Prestamo prestamo = PrestamoBLL.Buscar(mr.PrestamoId);
                    prestamo.Mora += mr.Valor;
                    PrestamoBLL.Guardar(prestamo);
                }
            }
            catch (System.Exception)
            {
                throw;
            }
            finally
            {
                contexto.Dispose();
            }

            return(guardado);
        }
Пример #3
0
        private void EliminarButton_Click(object sender, EventArgs e)
        {
            MyerrorProvider.Clear();
            int      id       = Convert.ToInt32(PrestamoidnumericUpDown.Value);
            Prestamo prestamo = PrestamoBLL.Buscar(id);

            id = Convert.ToInt32(PrestamoidnumericUpDown.Value);
            if (prestamo != null)
            {
                if (PrestamoBLL.Eliminar(id))
                {
                    MessageBox.Show("Eliminado", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Limpiar();
                    LlenaCombox();
                }
                else
                {
                    MyerrorProvider.SetError(PrestamoidnumericUpDown, "No se puede eliminar registro que no existe");
                }
            }
            else
            {
                MessageBox.Show("No existe!!", "Falló", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #4
0
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            var prestamo = PrestamoBLL.Buscar(Utiidades.ToInt(PrestamoIdTextBox.Text));

            if (prestamo != null)
            {
                this.prestamo    = prestamo;
                this.DataContext = this.prestamo;
            }
        }
Пример #5
0
        private void GuardarButton_Click(object sender, EventArgs e)
        {
            Prestamo prestamo;
            bool     Paso = false;

            LlenaCombox();
            if (Validar())
            {
                MessageBox.Show("Favor revisar todos los campos!!", "Validación!!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                SuperErrorProvider.Clear();
                return;
            }
            else
            {
                prestamo = LlenaClase();

                if (prestamoidnumericUpDown.Value == 0)
                {
                    Paso = PrestamoBLL.Guardar(prestamo);
                    MessageBox.Show("Guardado!!", "Exito",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                    LlenaCombox();
                    PrestamoDetalleDataGridView.DataSource = null;
                }
                else
                {
                    int      id   = Convert.ToInt32(prestamoidnumericUpDown.Value);
                    Prestamo pres = PrestamoBLL.Buscar(id);

                    if (pres != null)
                    {
                        Paso = PrestamoBLL.Modificar(prestamo);
                        MessageBox.Show("Modificado!!", "Exito",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Id no existe", "Falló",
                                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }

                if (Paso)
                {
                    NuevoButton.PerformClick();
                }
                else
                {
                    MessageBox.Show("No se pudo guardar!!", "Fallo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Пример #6
0
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            var encontrado = PrestamoBLL.Buscar(Convert.ToInt32(PrestamoIDTextBox.Text));

            if (encontrado != null)
            {
                prestamo = encontrado;
            }
            else
            {
                Limpiar();
            }
            this.DataContext = prestamo;
        }
Пример #7
0
        public void BuscarTest()
        {
            Prestamos prestamos = new Prestamos();
            bool      paso      = false;

            prestamos = PrestamoBLL.Buscar(1);

            if (prestamos != null)
            {
                paso = true;
            }

            Assert.AreEqual(paso, true);
        }
Пример #8
0
        private void buscarButton_Click(object sender, RoutedEventArgs e)
        {
            var cliente = PrestamoBLL.Buscar(int.Parse(Prestamoid.Text));

            if (cliente != null)
            {
                this.cliente = cliente;
            }
            else
            {
                this.cliente = new Entidades.Prestamo();
            }

            this.DataContext = this.cliente;
        }
        public void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            var prestamo = PrestamoBLL.Buscar(Convert.ToInt32(PrestamoIdTextBox.Text));

            if (prestamo != null)
            {
                this.prestamo = prestamo;
            }
            else
            {
                this.prestamo = new Prestamo();
                MessageBox.Show("El prestamo referido con el id ingresado no existe en la base de datos.", "Fallo", MessageBoxButton.OK, MessageBoxImage.Warning);
            }

            this.DataContext = prestamo;
        }
Пример #10
0
        private void BuscarButton_Click(object sender, EventArgs e)
        {
            int      id       = Convert.ToInt32(prestamoidnumericUpDown.Value);
            Prestamo prestamo = PrestamoBLL.Buscar(id);

            if (prestamo == null)
            {
                MessageBox.Show("No se encontró!!!", "Falló",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                MessageBox.Show("Encontrado !!", "Exito!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                LlenaCampo(prestamo);
                // Llenarvalores();
            }
        }
        public void BuscarBoton_Click(object sender, RoutedEventArgs e)
        {
            var prestamo = PrestamoBLL.Buscar(Utilities.ToInt(PrestamoIDTextBox.Text));

            if (prestamo != null)
            {
                this.prestamo = prestamo;
            }
            else
            {
                this.prestamo = new Prestamos();
                MessageBox.Show("No se encontró ningún registro", "Sin coincidencias",
                                MessageBoxButton.OK, MessageBoxImage.Information);
            }

            this.DataContext = this.prestamo;
        }
Пример #12
0
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            var prestamo = PrestamoBLL.Buscar(Convert.ToInt32(PrestamoIdTextBox.Text));

            if (prestamo != null)
            {
                this.prestamo = prestamo;
            }
            else
            {
                this.prestamo = new Prestamos();
                MessageBox.Show("No se ha Encontrado", "Error",
                                MessageBoxButton.OK, MessageBoxImage.Warning);
            }

            this.DataContext = this.prestamo;
            // Buscar2Button_Click(sender, e);
        }
Пример #13
0
        public static bool Modificar(Moras mora)
        {
            bool     modificado = false;
            Contexto contexto   = new Contexto();

            try
            {
                contexto.Database.ExecuteSqlRaw($"Delete from MorasDetalle where MoraId = {mora.MoraId}");

                foreach (var anterior in mora.DetalleMora)
                {
                    contexto.Entry(anterior).State = EntityState.Added;
                }

                List <MorasDetalle> Detalles = Buscar(mora.MoraId).DetalleMora;
                foreach (MorasDetalle mr in Detalles)
                {
                    Prestamo prestamo = PrestamoBLL.Buscar(mr.PrestamoId);
                    prestamo.Mora -= mr.Valor;
                    PrestamoBLL.Guardar(prestamo);
                }

                List <MorasDetalle> DetallesModif = mora.DetalleMora;
                foreach (MorasDetalle mr in DetallesModif)
                {
                    Prestamo prestamo = PrestamoBLL.Buscar(mr.PrestamoId);
                    prestamo.Mora += mr.Valor;
                    PrestamoBLL.Guardar(prestamo);
                }

                contexto.Entry(mora).State = EntityState.Modified;
                modificado = contexto.SaveChanges() > 0;
            }
            catch (System.Exception)
            {
                throw;
            }
            finally
            {
                contexto.Dispose();
            }

            return(modificado);
        }
Пример #14
0
        private void BuscarPrestamobutton_Click(object sender, EventArgs e)
        {
            int      id;
            Prestamo prestamo = new Prestamo();

            id = Convert.ToInt32(PrestamoIdnumericUpDown1.Value);



            if (id > 0)
            {
                prestamo = PrestamoBLL.Buscar(id);
            }

            if (prestamo != null)
            {
                LlenaCampoPretsamo(prestamo);
            }
        }
 public void EliminarButton_Click(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrWhiteSpace(PrestamoIdTextBox.Text) || PrestamoBLL.Buscar(Convert.ToInt32(PrestamoIdTextBox.Text)) == null)
     {
         MessageBox.Show("El prestamo no pudo ser eliminado, porque no existe o el id ingresado esta vacío.", "Fallo", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
     else
     {
         if (PrestamoBLL.Eliminar(Convert.ToInt32(PrestamoIdTextBox.Text)))
         {
             Limpiar();
             MessageBox.Show("El prestamo fue eliminado exitosamente.", "Exito", MessageBoxButton.OK, MessageBoxImage.Exclamation);
         }
         else
         {
             MessageBox.Show("El prestamo no pudo ser eliminado.", "Fallo", MessageBoxButton.OK, MessageBoxImage.Warning);
         }
     }
 }
Пример #16
0
        private void BuscarButton_Click(object render, RoutedEventArgs e)
        {
            Contexto context = new Contexto();

            var found = PrestamoBLL.Buscar(Convert.ToInt32(IdTextBox.Text));


            if (found != null)
            {
                this.prestamo = found;
            }
            else
            {
                this.prestamo = new Prestamos();
                MessageBox.Show("No encontrado, por favor confirme que sea un id valido e intente de nuevo ", "", MessageBoxButton.OK);
            }


            this.DataContext = this.prestamo;
        }
Пример #17
0
        protected void EliminarButton_Click(object sender, EventArgs e)
        {
            PrestamoBLL repositorio        = new PrestamoBLL();
            RepositorioBase <Prestamo> dep = new RepositorioBase <Prestamo>();


            int id        = Utilities.Utils.ToInt(PrestamoIDTextbox.Text);
            var depositos = repositorio.Buscar(id);


            if (depositos == null)
            {
                Utilities.Utils.ShowToastr(this, "El Prestamo no existe", "Error", "error");
            }

            else
            {
                repositorio.Eliminar(id);

                Utilities.Utils.ShowToastr(this, "Elimino Correctamente", "Exito", "Exito");
                Limpiar();
            }
        }
Пример #18
0
        protected void GuardarButton_Click(object sender, EventArgs e)
        {
            if (Convert.ToInt32(CuentaDropDownList.SelectedValue) == 0)
            {
                return;
            }

            if (CuotasGridView.Rows.Count == 0)
            {
                Utilities.Utils.ShowToastr(this, "No se encuentra el ID", "Error", "error");
                return;
            }


            PrestamoBLL repositorio = new PrestamoBLL();
            Prestamo    prestamo    = LlenaClase();

            RepositorioBase <Cuentas> cuentas = new RepositorioBase <Cuentas>();

            var validar = cuentas.Buscar(Utilities.Utils.ToInt(CuentaDropDownList.SelectedValue));

            bool paso = false;


            if (validar != null)
            {
                if (Page.IsValid)
                {
                    if (prestamo.PrestamoID == 0)
                    {
                        paso = repositorio.Guardar(prestamo);
                    }

                    else
                    {
                        var verificar = repositorio.Buscar(Utilities.Utils.ToInt(PrestamoIDTextbox.Text));
                        if (verificar != null)
                        {
                            paso = repositorio.Modificar(prestamo);
                        }
                        else
                        {
                            Utilities.Utils.ShowToastr(this, "No se encuentra el ID", "Error", "error");
                            return;
                        }
                    }

                    if (paso)

                    {
                        Utilities.Utils.ShowToastr(this, "Cuenta Registrada", "Exito", "Exito");
                    }

                    else

                    {
                        Utilities.Utils.ShowToastr(this, "No se pudo Guardar", "Error", "error");
                    }
                    Limpiar();
                    return;
                }
            }
            else
            {
                Utilities.Utils.ShowToastr(this, "El numero de cuenta no existe", "Error", "Error");
                return;
            }
        }
Пример #19
0
 public ActionResult <Prestamos> Get(int id)
 {
     return(PrestamoBLL.Buscar(id));
 }
Пример #20
0
        public void BuscarTest()
        {
            var paso = PrestamoBLL.Buscar(1);

            Assert.AreEqual(paso, paso);
        }
 public void BuscarTest()
 {
     Assert.IsNotNull(PrestamoBLL.Buscar(1));
 }
Пример #22
0
        public void BuscarTest()
        {
            var encontrado = PrestamoBLL.Buscar(1);

            Assert.IsNotNull(encontrado);
        }
Пример #23
0
        private bool ExisteEnLaBaseDeDatos()
        {
            Prestamo prestamo = PrestamoBLL.Buscar((int)Convert.ToInt32(PrestamoIdTextBox.Text));

            return(prestamo != null);
        }
Пример #24
0
        public void BuscarTest()
        {
            var encontrado = PrestamoBLL.Buscar(prestamo.PrestamoId);

            Assert.IsNotNull(encontrado, "No encontrado");
        }
Пример #25
0
        private bool ExisteEnLaBaseDeDatos()
        {
            Prestamo prestamo = PrestamoBLL.Buscar((int)PrestamoidnumericUpDown.Value);

            return(prestamo != null);
        }