Пример #1
0
        private void ConsultarButton_Click(object sender, RoutedEventArgs e)
        {
            var listado = new List <Prestamo>();

            if (string.IsNullOrWhiteSpace(CriterioTextBox.Text))
            {
                listado = PrestamoBLL.GetList();
            }
            else
            {
                switch (FiltroComboBox.SelectedIndex)
                {
                case 0:
                    listado = PrestamoBLL.GetList(e => e.PrestamoId == Convert.ToInt32(CriterioTextBox.Text));
                    break;

                case 1:
                    listado = PrestamoBLL.GetList(e => e.PersonaId == Convert.ToInt32(CriterioTextBox.Text));
                    break;
                }
            }

            listado = PrestamoBLL.GetList(c => c.FechaPrestamo.Date >= DesdeDataPicker.SelectedDate && c.FechaPrestamo <= HastaDataPicker.SelectedDate);

            DatosDataGrid.ItemsSource = null;
            DatosDataGrid.ItemsSource = listado;
        }
Пример #2
0
        private void GuardarButton_Click(object sender, RoutedEventArgs e)
        {
            if (!Validar())
            {
                return;
            }
            var pers = PersonaBLL.Buscar(Convert.ToInt32(PersonaComboBox.SelectedValue));

            if (pers != null)
            {
                BalanceTextBox.Text = Convert.ToString(pers.Balance);
                decimal nuevoBalance = Convert.ToDecimal(BalanceTextBox.Text) + Convert.ToDecimal(MontoTextBox.Text);
                pers.Balance = nuevoBalance;
                PersonaBLL.Guardar(pers);
                this.DataContext = prestamo;
                var paso = PrestamoBLL.Guardar(this.prestamo);
                if (paso)
                {
                    Limpiar();
                    MessageBox.Show("Transaccion exitosa!", "Exito",
                                    MessageBoxButton.OK, MessageBoxImage.Information);
                }
                else
                {
                    MessageBox.Show("Transaccion Fallida", "Fallo",
                                    MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            else
            {
                MessageBox.Show("Transaccion Fallida, Persona no encontrada", "Fallo",
                                MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Пример #3
0
        public void GetListTest()
        {
            List <Prestamo> lista = new List <Prestamo>();

            lista = PrestamoBLL.GetList(l => true);
            Assert.IsNotNull(lista);
        }
        public void GetListTest()
        {
            var lista = new List <Prestamos>();

            lista = PrestamoBLL.GetList(p => true);
            Assert.IsNotNull(lista);
        }
Пример #5
0
        private void EliminarButton_Click(object sender, RoutedEventArgs e)
        {
            var pers = PersonaBLL.Buscar(Convert.ToInt32(PersonaComboBox.SelectedValue));

            if (pers != null)
            {
                BalanceTextBox.Text = Convert.ToString(pers.Balance);
                decimal nuevoBalance = Convert.ToDecimal(BalanceTextBox.Text) - Convert.ToDecimal(MontoTextBox.Text);
                pers.Balance = nuevoBalance;
                PersonaBLL.Guardar(pers);
                this.DataContext = prestamo;
                if (PrestamoBLL.Eliminar(Convert.ToInt32(PrestamoIdTextBox.Text)))
                {
                    Limpiar();
                    MessageBox.Show("Registro Eliminado con exito", "Exito",
                                    MessageBoxButton.OK, MessageBoxImage.Information);
                }
                else
                {
                    MessageBox.Show("No se pudo Eliminar", "Fallo",
                                    MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            else
            {
                MessageBox.Show("Transaccion Fallida Persona no encontrada", "Fallo",
                                MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Пример #6
0
        public void GuardarTest()
        {
            Prestamo prestamo = new Prestamo(0, DateTime.Now, 1, "Deuda", 10000, 0);
            bool     paso     = PrestamoBLL.Guardar(prestamo);

            Assert.AreEqual(paso, true);
        }
Пример #7
0
        public void EliminarTest()
        {
            bool paso;

            paso = PrestamoBLL.Eliminar(1);
            Assert.AreEqual(paso, true);
        }
Пример #8
0
        public void ModificarTest()
        {
            Prestamo prestamo = new Prestamo(1, DateTime.Now, 1, "Deuda", 2000, 0);
            bool     paso     = PrestamoBLL.Modificar(prestamo);

            Assert.AreEqual(paso, true);
        }
Пример #9
0
        public void GetListTest()
        {
            List <Prestamo> persona = new List <Prestamo>();

            persona = PrestamoBLL.GetList(p => true);
            Assert.IsNotNull(persona);
        }
Пример #10
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);
        }
Пример #11
0
        public void BuscarTest()
        {
            Prestamo prestamo;

            prestamo = PrestamoBLL.Buscar(1);
            Assert.AreEqual(prestamo, prestamo);
        }
        private void ConsultarButton_Click(object sender, RoutedEventArgs e)
        {
            var listado = new List <Prestamo>();

            if (CriterioTextBox.Text.Trim().Length > 0)
            {
                switch (FiltroComboBox.SelectedIndex)
                {
                case 0:
                    listado = PrestamoBLL.GetList(p => p.PrestamoID == this.ToInt(CriterioTextBox.Text));
                    break;

                case 1:
                    listado = PrestamoBLL.GetList(p => p.PersonaID == this.ToInt(CriterioTextBox.Text));
                    break;
                }
            }
            else
            {
                listado = PrestamoBLL.GetList(c => true);
            }

            DatosDataGrid.ItemsSource = null;
            DatosDataGrid.ItemsSource = listado;
        }
Пример #13
0
        private void CalcularButton_Click(object sender, RoutedEventArgs e)
        {
            if (!Validar())
            {
                return;
            }


            Prestamo prestamo = new Prestamo();
            bool     paso     = false;

            if (Convert.ToInt32(PrestamoIdTextBox) == 0)
            {
                paso = PrestamoBLL.Calcular(prestamo);
            }
            else
            {
                if (!ExisteEnLaBaseDeDatos())
                {
                    MessageBox.Show("No se puede modificar Prestamo que no existe", "Fallo");
                    return;
                }
                paso = PrestamoBLL.Modificar(prestamo);
            }

            if (paso)
            {
                Limpiar();
                MessageBox.Show("Guardado!!", "Exito", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                MessageBox.Show("No fue posible guardar!!", "Exito", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Пример #14
0
        public void ModificarTest()
        {
            decimal  BalanceActual;
            Persona  persona;
            bool     paso;
            Prestamo prestamo = new Prestamo();

            prestamo.PrestamoId = 1;
            prestamo.Fecha      = DateTime.Now;
            prestamo.PersonaId  = 1;
            prestamo.Concepto   = "Prestamo Detalle";
            prestamo.Monto      = 50000;
            prestamo.Balance    = prestamo.Monto;
            paso = PrestamoBLL.Guardar(prestamo);

            persona       = PersonaBLL.Buscar(prestamo.PersonaId);
            BalanceActual = persona.Balance;

            if (5000 < BalanceActual)
            {
                paso = true;
            }
            else
            {
                paso = false;
            }

            Assert.AreEqual(paso, true);
        }
Пример #15
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);
            }
        }
Пример #16
0
        public void GetPrestamosTest()
        {
            var lista = new List <Prestamo>();

            lista = PrestamoBLL.GetList(p => true);

            Assert.AreEqual(lista, lista);
        }
Пример #17
0
 public rMora()
 {
     InitializeComponent();
     PrestamosComboBox.ItemsSource       = PrestamoBLL.GetList();
     PrestamosComboBox.SelectedValuePath = "PrestamoId";
     PrestamosComboBox.DisplayMemberPath = "PrestamoId";
     Limpiar();
 }
Пример #18
0
        public void GetListTest()
        {
            var Lista = new List <Prestamos>();

            Lista = PrestamoBLL.GetList(p => true);

            Assert.AreEqual(Lista, Lista);
        }
Пример #19
0
 public rMoras()
 {
     InitializeComponent();
     PrestamoIdComboBox.ItemsSource       = PrestamoBLL.GetList(p => true);
     PrestamoIdComboBox.SelectedValuePath = "PrestamosId";
     PrestamoIdComboBox.DisplayMemberPath = "PrestamoId";
     this.DataContext = moras;
 }
 public rMoras()
 {
     InitializeComponent();
     PrestamoIDComboBox.ItemsSource       = PrestamoBLL.GetList();
     PrestamoIDComboBox.SelectedValuePath = "PrestamoID";
     PrestamoIDComboBox.DisplayMemberPath = "PrestamoID";
     this.DataContext    = moras;
     MorasIDTextBox.Text = "0";
 }
Пример #21
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;
            }
        }
Пример #22
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);
                }
            }
        }
Пример #23
0
        public void GuardarTest()
        {
            PrestamosDetalle        pagosDetalle = new PrestamosDetalle(1, 1, "Menu", DateTime.Now);
            List <PrestamosDetalle> list         = new List <PrestamosDetalle>();

            list.Add(pagosDetalle);
            Prestamo prestamo  = new Prestamo(1, 1, null, 1, DateTime.Now, DateTime.Now, list);
            bool     realizado = PrestamoBLL.Guardar(prestamo);

            Assert.AreEqual(true, realizado);
        }
Пример #24
0
 private void EliminarButton_Click(object sender, RoutedEventArgs e)
 {
     if (PrestamoBLL.Eliminar(Utilidades.ToInt(MoraIdTextBox.Text)))
     {
         Limpiar();
         MessageBox.Show("Registro eliminado!", "Exito", MessageBoxButton.OK, MessageBoxImage.Information);
     }
     else
     {
         MessageBox.Show("No fue posible eliminar", "Fallo", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Пример #25
0
        public rMoras()
        {
            InitializeComponent();
            mora             = new Moras();
            this.DataContext = mora;

            DetallesDataGrid.ItemsSource = new List <MorasDetalle>();

            PrestamoComboBox.ItemsSource       = PrestamoBLL.GetList();
            PrestamoComboBox.SelectedValuePath = "PrestamoId";
            PrestamoComboBox.DisplayMemberPath = "Concepto";
        }
Пример #26
0
 private void DeleteButton_Click(object render, RoutedEventArgs e)
 {
     if (PrestamoBLL.Delete(Convert.ToInt32(PrestamoIdTextBox.Text)))
     {
         Limpiar();
         MessageBox.Show("Eliminado", "Exito", MessageBoxButton.OK);
     }
     else
     {
         MessageBox.Show("Error al eliminar", "Error", MessageBoxButton.OK);
     }
 }
Пример #27
0
 private void EliminarButton_Click(object render, RoutedEventArgs e)
 {
     if (PrestamoBLL.Eliminar(Convert.ToInt32(IdTextBox.Text)))
     {
         Limpiar();
         MessageBox.Show("Eliminado");
     }
     else
     {
         MessageBox.Show("Error ");
     }
 }
Пример #28
0
        public void GuardarTest()
        {
            Prestamo prestamo = new Prestamo();

            prestamo.prestamoId = 0;
            prestamo.fecha      = DateTime.Now;
            prestamo.concepto   = "Comida";
            prestamo.monto      = 100;
            prestamo.balance    = 100;
            bool paso = PrestamoBLL.Guardar(prestamo);

            Assert.AreEqual(paso, true);
        }
 public void EliminarBoton_Click(object sender, RoutedEventArgs e)
 {
     if (PrestamoBLL.Eliminar(Utilities.ToInt(PrestamoIDTextBox.Text)))
     {
         Limpiar();
         MessageBox.Show("Registro borrado", "Borrado exitoso",
                         MessageBoxButton.OK, MessageBoxImage.Information);
     }
     else
     {
         MessageBox.Show("Error", "Hubo un error al borrar",
                         MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Пример #30
0
        private void GuardarButton_Click(object sender, RoutedEventArgs e)
        {
            var paso = PrestamoBLL.Guardar(prestamo);

            if (paso)
            {
                MessageBox.Show("Guardo Correctamente!");
                Limpiar();
            }
            else
            {
                MessageBox.Show("Lo sentimos no se pudo guardar!");
            }
        }