Exemplo n.º 1
0
        protected void GuardarButton_Click(object sender, EventArgs e)
        {
            Pagos pago;
            bool  paso = false;

            pago = LlenaClase();


            if (PagoIdNumericUpDown.Text == 0.ToString())
            {
                paso = PagosBLL.Guardar(pago);
            }
            else
            {
                if (!ExisteEnLaBaseDeDatos())
                {
                    Utilitarios.Utils.ShowToastr(this.Page, "Este Pago no existe en la base de datos", "Error", "error");
                    return;
                }
                paso = PagosBLL.Modificar(pago);
            }

            if (paso)
            {
                Utilitarios.Utils.ShowToastr(this.Page, " Se ha Guardado", "Exito", "success");
            }
            else
            {
                Utilitarios.Utils.ShowToastr(this.Page, "Se profujo un error al guardar", "Error", "error");
            }
            Limpiar();
        }
Exemplo n.º 2
0
        protected void GuardarButton_Click(object sender, EventArgs e)
        {
            Pagos P    = new Pagos();
            bool  paso = false;


            P = LlenaClase();

            if (Utils.ToInt(IDTextBox.Text) == 0)
            {
                paso = PagosBLL.Guardar(P);
                Response.Redirect(Request.RawUrl);
            }
            else
            {
                if (!ExisteEnLaBaseDeDatos())
                {
                    MostrarMensaje(TiposMensaje.Error, "Error al guardar.");
                    return;
                }
                paso = PagosBLL.Modificar(P);
                Response.Redirect(Request.RawUrl);
            }

            if (paso)
            {
                MostrarMensaje(TiposMensaje.Success, "Exito al guardar.");
                return;
            }
            else
            {
                MostrarMensaje(TiposMensaje.Error, "Error al guardar.");
            }
        }
Exemplo n.º 3
0
        private void ConsultarButton_Click(object sender, RoutedEventArgs e)
        {
            var lista = new List <Pagos>();

            if (CriterioTextBox.Text.Trim().Length > 0)
            {
                switch (FiltroComboBox.SelectedIndex)
                {
                case 0:    //todo
                    lista = PagosBLL.GetList(x => true);
                    break;

                case 1:    //ID
                    int id = Convert.ToInt32(CriterioTextBox.Text);
                    lista = PagosBLL.GetList(x => x.PagoId == id);
                    break;

                case 2:    //Fecha
                    DateTime fecha = Convert.ToDateTime(CriterioTextBox.Text);
                    lista = PagosBLL.GetList(x => x.Fecha == fecha);
                    break;
                }
            }
            else
            {
                lista = PagosBLL.GetList(x => true);
            }

            ConsultarDataGrig.ItemsSource = null;
            ConsultarDataGrig.ItemsSource = lista;
        }
Exemplo n.º 4
0
        private Pagos LlenarCampos()
        {
            int Id = 0;

            Id = Decimal.ToInt32(IDnumericUpDownP.Value);
            Pagos pago = PagosBLL.Buscar(Id);

            if (pago == null)
            {
                MessageBox.Show("No se encontro el pago");
            }
            else
            {
                FechaTimePickerP.Text             = pago.Fecha;
                IdEstudiantesnumericUpDownP.Value = pago.IdEstudiante;
                MontotextBox.Text          = Convert.ToString(pago.Monto);
                PagotextBoxP.Text          = Convert.ToString(pago.Pago);
                BalancetextBox.Text        = Convert.ToString(pago.Balance);
                ObservacionestextBoxP.Text = pago.Observaciones;
                Estudiantes estudiantes = EstudianteBLL.Buscar(pago.IdEstudiante);
                Nombrelabel.Text = estudiantes.Nombres;
            }

            return(pago);
        }
Exemplo n.º 5
0
        private void Eliminar_button_Click(object sender, EventArgs e)
        {
            ErrorProvider.Clear();
            int id;

            int.TryParse(PagoId_numericUpDown.Text, out id);
            Pagos Pago = PagosBLL.Buscar(id);

            try
            {
                if (PagosBLL.Eliminar(id))
                {
                    Recontar(Pago);
                    Limpiar();
                    MessageBox.Show("Eliminado", "Exito!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("No se puede eliminar este Pago", "Fallo!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("No se pudo eliminar");
            }
        }
Exemplo n.º 6
0
        private void btConsulta_Click(object sender, EventArgs e)
        {
            Expression <Func <Pagos, bool> > filtro = c => true;

            int id;

            switch (FiltroComboBox.SelectedIndex)
            {
            case 0:
                filtro = c => true;
                break;

            case 1:    //Filtrando por ID del Pago.
                id     = Convert.ToInt32(CriterioTextBox.Text);
                filtro = c => c.PagoID == id;
                break;

            case 2:    //Filtrando por Nombre del Productor.
                filtro = c => c.productores.Nombres.Contains(CriterioTextBox.Text);
                break;
            }

            Listado = PagosBLL.GetList(filtro);
            ConsultaDataGridView.DataSource = Listado;
        }
Exemplo n.º 7
0
        public void GetListTest()
        {
            List <Pagos> lista = new List <Pagos>();

            lista = PagosBLL.GetList(l => true);
            Assert.IsNotNull(lista);
        }
Exemplo n.º 8
0
        private void buttonGuardar_Click(object sender, EventArgs e)
        {
            if (UtilidadesFormularios.Validar(maskedTextBoxMonto))
            {
                int id = 0;
                int.TryParse(maskedTextBoxPagoId.Text, out id);
                Pago pago = new Pago(id, double.Parse(maskedTextBoxMonto.Text), dateTimePicker1.Value, int.Parse(maskedTextBoxId.Text));

                if (PagosBLL.Guardar(pago))
                {
                    if (dataGridView1.Rows.Count == 0)
                    {
                        dataGridView1.Rows.Add();
                        DataGridViewRow row = (DataGridViewRow)dataGridView1.Rows[0];
                        row.Cells[0].Value       = PagosBLL.pagoReturned.PagoId;
                        row.Cells[1].Value       = PagosBLL.pagoReturned.Fecha;
                        row.Cells[2].Value       = PagosBLL.pagoReturned.Monto;
                        maskedTextBoxPagoId.Text = PagosBLL.pagoReturned.PagoId.ToString();
                    }
                    else
                    {
                        DataGridViewRow row = (DataGridViewRow)dataGridView1.Rows[0].Clone();
                        row.Cells[0].Value = PagosBLL.pagoReturned.PagoId;
                        row.Cells[1].Value = PagosBLL.pagoReturned.Fecha;
                        row.Cells[2].Value = PagosBLL.pagoReturned.Monto;
                        dataGridView1.Rows.Add(row);
                        maskedTextBoxPagoId.Text = PagosBLL.pagoReturned.PagoId.ToString();
                    }
                }
            }
        }
Exemplo n.º 9
0
        private void Guardarbutton_Click(object sender, EventArgs e)
        {
            Pagos pago      = new Pagos();
            bool  realizado = false;

            if (!Validar())
            {
                return;
            }

            pago = LlenaClase();


            if (IDnumericUpDown.Value == 0)
            {
                realizado = PagosBLL.Guardar(pago);
            }

            if (!Existe())
            {
                MessageBox.Show("NO SE PUEDE MODIFICAR UN PAGO INEXISTENTE", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            realizado = PagosBLL.Modificar(pago);

            if (realizado)
            {
                Limpiar();
                MessageBox.Show("GUARDADO EXITOSAMENTE", "GUARDADO", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("NO SE PUDO GUARDAR", "NO GUARDADO", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 10
0
        private void Eliminarbutton_Click(object sender, EventArgs e)
        {
            if (isAdministrador())
            {
                errorProvider.Clear();

                int id;
                int.TryParse(IDnumericUpDown.Text, out id);

                Limpiar();

                if (PagosBLL.Eliminar(id))
                {
                    MessageBox.Show("Eliminado correctamente", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    errorProvider.SetError(IDnumericUpDown, "No se puede eliminar un pago inexistente");
                }
            }
            else
            {
                MessageBox.Show("Debe tener permisos de administrador" +
                                "para realizar ésta acción", "Permiso Denegado", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 11
0
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            Pagos pago = PagosBLL.Buscar(contenedor.pagos.PagoId);

            if (pago != null)
            {
                contenedor.pagos = pago;
                llenarDataGrid();
                obtenerListado();
                UsuarioLabel.Content = obtenerNombreUsuario(contenedor.pagos.UsuarioId);

                Ventas venta = VentasBLL.Buscar(Convert.ToInt32(VentaComboBox.SelectedItem));
                BalanceLabel.Content = Convert.ToString(venta.Balance);

                ClientesComboBox.IsEnabled = false;
                VentaComboBox.IsEnabled    = false;

                reCargar();
            }
            else
            {
                limpiar();
                MessageBox.Show("Pago no encontrado");
            }
        }
Exemplo n.º 12
0
        private void ConsultarButton_Click(object sender, RoutedEventArgs e)
        {
            var listado = new List <Pagos>();

            if (CriterioTextBox.Text.Trim().Length > 0)
            {
                switch (FiltroComboBox.SelectedIndex)
                {
                case 0:
                    try
                    {
                        listado = PagosBLL.GetList(u => u.PagoId == Utilidades.ToInt(CriterioTextBox.Text));
                    }
                    catch (FormatException)
                    {
                        MessageBox.Show("Debes ingresar un Critero valido para aplicar este filtro.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                    break;

                case 1:
                    try
                    {
                        listado = PagosBLL.GetList(u => u.VentaId == int.Parse(CriterioTextBox.Text));
                    }
                    catch (FormatException)
                    {
                        MessageBox.Show("Debes ingresar un Critero valido para aplicar este filtro.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                    break;

                case 2:
                    try
                    {
                        listado = PagosBLL.GetList(u => u.UsuarioId == int.Parse(CriterioTextBox.Text));
                    }
                    catch (FormatException)
                    {
                        MessageBox.Show("Debes ingresar un Critero valido para aplicar este filtro.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                    break;

                case 3:
                    try
                    {
                        listado = PagosBLL.GetList(u => u.Monto == int.Parse(CriterioTextBox.Text));
                    }
                    catch (FormatException)
                    {
                        MessageBox.Show("Debes ingresar un Critero valido para aplicar este filtro.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                    break;
                }
            }
            else
            {
                listado = PagosBLL.GetList(c => true);
            }
            DatosDataGrid.ItemsSource = null;
            DatosDataGrid.ItemsSource = listado;
        }
        private void EliminarButton_Click(object sender, RoutedEventArgs e)
        {
            Ventas AnteriorVenta = VentasBLL.Buscar(contenedor.ventas.VentaId);

            if (AnteriorVenta == null)
            {
                MessageBox.Show("No se Puede Eliminar un venta que no existe");
                return;
            }

            List <Pagos> pagos = PagosBLL.GetList(p => true);

            foreach (var item in pagos)
            {
                if (item.PagoDetalle[0].VentaId == contenedor.ventas.VentaId)
                {
                    MessageBox.Show("No se puede eliminar esta ya que tiene un pago");
                    return;
                }
            }

            if (VentasBLL.Eliminar(contenedor.ventas.VentaId))
            {
                ContratosBLL.RestablecerCantidadPendiente(contenedor.ventas.VentaDetalle[0].ContratoId);
                Limpiar();
                MessageBox.Show("Eliminado");
            }
            else
            {
                MessageBox.Show("No se Puede Eliminar Una Venta Que no Existe");
            }
        }
Exemplo n.º 14
0
        public void VentaDisponibleTest()
        {
            Pagos pago = PagosBLL.Buscar(1);

            bool paso = PagosBLL.VentaDisponible(pago);

            Assert.IsTrue(paso);
        }
Exemplo n.º 15
0
        protected void ButtonBuscar_Click1(object sender, EventArgs e)
        {
            PrestamoGridView.DataBind();
            Expression <Func <Pagos, bool> > filtro = x => true;
            PagosBLL facturacion = new PagosBLL();

            int id;

            DateTime desde = Convert.ToDateTime(DesdeTextBox.Text);
            DateTime hasta = Convert.ToDateTime(HastaTextBox.Text);

            switch (TipodeFiltro.SelectedIndex)
            {
            case 0:    //ID

                id = Utilities.Utils.ToInt(TextCriterio.Text);
                if (FechaCheckBox.Checked == true)
                {
                    filtro = x => x.PagoID == id && (x.Fecha >= desde && x.Fecha <= hasta);
                }
                else
                {
                    filtro = c => c.PagoID == id;
                }

                if (PagosBLL.GetList(filtro).Count() == 0)
                {
                    Utilities.Utils.ShowToastr(this, " Prestamo ID No Existe", "Fallido", "success");
                    return;
                }

                break;



            case 1:    //Todos

                if (FechaCheckBox.Checked == true)
                {
                    filtro = x => true && (x.Fecha >= desde && x.Fecha <= hasta);
                }
                else
                {
                    filtro = x => true;
                }

                if (PagosBLL.GetList(filtro).Count() == 0)
                {
                    Utilities.Utils.ShowToastr(this, "No existen Dichas Cuentas", "Fallido", "success");
                }
                break;
            }

            PrestamoGridView.DataSource = PagosBLL.GetList(filtro);
            PrestamoGridView.DataBind();
        }
Exemplo n.º 16
0
        private bool ValidarBuscar()
        {
            if (PagosBLL.Buscar(String(BuscarTextBox.Text)) == null)
            {
                base.Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('No Existe');</script>");
                return(false);
            }

            return(true);
        }
Exemplo n.º 17
0
 protected void BuscarButton_Click(object sender, EventArgs e)
 {
     if (IdTextBox.Text == "")
     {
         Utilidades.ShowToastr(this, "Debes Llenar el Campo Id  ", "Advertencia", "Warning");
     }
     else
     {
         BuscarPagos(PagosBLL.Buscar(Utilidades.TOINT(IdTextBox.Text)));
     }
 }
 protected void BuscarButton_Click(object sender, EventArgs e)
 {
     if (IdTextBox.Text == "")
     {
         base.Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('Debes llenar el campo Id para realizar la busqueda!');</script>");
     }
     else
     {
         BuscarPagos(PagosBLL.Buscar(String(IdTextBox.Text)));
     }
 }
Exemplo n.º 19
0
        public void GuardarTest()
        {
            PagosDetalle        pagosDetalle = new PagosDetalle(1, DateTime.Now, 5000, 5200);
            List <PagosDetalle> list         = new List <PagosDetalle>();

            list.Add(pagosDetalle);
            Pagos pagos     = new Pagos(1, 1, 1, 1, 5200, list);
            bool  realizado = PagosBLL.Guardar(pagos);

            Assert.AreEqual(true, realizado);
        }
Exemplo n.º 20
0
 private void EliminarbuttonP_Click_1(object sender, EventArgs e)
 {
     if (PagosBLL.eliminar((int)IDnumericUpDownP.Value))
     {
         LimpiarTextBox();
         MessageBox.Show("Se elimino correctamente el pago");
     }
     else
     {
         MessageBox.Show("No se pudo eliminar el pago");
     }
 }
Exemplo n.º 21
0
        private void buttonBuscar_Click(object sender, EventArgs e)
        {
            if (UtilidadesFormularios.Validar(maskedTextBoxPagoId))
            {
                int id = int.Parse(maskedTextBoxPagoId.Text);

                if (PagosBLL.Buscar(x => x.PagoId == id, false))
                {
                    maskedTextBoxMonto.Text = PagosBLL.pagoReturned.Monto.ToString();
                    dateTimePicker1.Value   = PagosBLL.pagoReturned.Fecha;
                }
            }
        }
Exemplo n.º 22
0
 public void BuscarPagos(Entidades.Pagos p)
 {
     if (PagosBLL.Buscar(Utilidades.TOINT(IdTextBox.Text)) == null)
     {
         Utilidades.ShowToastr(this, "No Existe", "Que Mal", "Error");
     }
     else
     {
         ConceptoTextBox.Text = p.Concepto;
         p.Fecha           = Convert.ToDateTime(FechaTextBox.Text);
         MontoTextBox.Text = Convert.ToString(p.Monto);
     }
 }
 public void BuscarPagos(Entidades.Pagos p)
 {
     if (PagosBLL.Buscar(String(IdTextBox.Text)) == null)
     {
         base.Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('No Existe');</script>");
     }
     else
     {
         VendedorIdTextBox.Text = Convert.ToString(p.VendedorId);
         ConceptoTextBox.Text   = p.Concepto;
         p.Fecha           = Convert.ToDateTime(FechaTextBox.Text);
         MontoTextBox.Text = Convert.ToString(p.Monto);
     }
 }
        private void GuardarbuttonP_Click(object sender, EventArgs e)
        {
            Pagos pago = LlenaClase();

            if (PagosBLL.Guardar(pago))
            {
                VaciarCampos();
                MessageBox.Show("Se guardo el pago con exito!");
            }
            else
            {
                MessageBox.Show("No se puede guardar el pago!");
            }
        }
Exemplo n.º 25
0
 private void EliminarButton_Click(object sender, RoutedEventArgs e)
 {
     {
         if (PagosBLL.Eliminar(Utilidades.ToInt(PagoIdTextBox.Text)))
         {
             Limpiar();
             MessageBox.Show("Registro de Pago Eliminado", "Éxito", MessageBoxButton.OK, MessageBoxImage.Information);
         }
         else
         {
             MessageBox.Show("No se pudo eliminar el registro", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
 }
Exemplo n.º 26
0
        private void Consultabutton_Click(object sender, EventArgs e)
        {
            if (SetError(2))
            {
                MessageBox.Show("Debe introducir porque filtro va a consultar", "Falló",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            int id;

            switch (TipocomboBox.SelectedIndex)
            {
            //ID
            case 0:
                LimpiarError();
                if (SetError(1))
                {
                    MessageBox.Show("Introduce un numero");
                    return;
                }
                id      = int.Parse(CriteriotextBox.Text);
                filtrar = t => t.PagoID == id && (t.Fecha.Day >= DesdedateTimePicker.Value.Day) && (t.Fecha.Month >= DesdedateTimePicker.Value.Month) && (t.Fecha.Year >= DesdedateTimePicker.Value.Year) &&
                          (t.Fecha.Day <= HastadateTimePicker.Value.Day) && (t.Fecha.Month <= HastadateTimePicker.Value.Month) && (t.Fecha.Year <= HastadateTimePicker.Value.Year);
                break;

            //Listar Todo
            case 1:

                filtrar = t => true;
                break;
            }

            pagos = PagosBLL.GetList(filtrar);

            ConsultadataGridView.DataSource = pagos;

            if (FechaCheckBox.Checked == true)
            {
                pagos = PagosBLL.GetList(filtrar).Where(x => x.Fecha.Date >= DesdedateTimePicker.Value.Date && x.Fecha.Date <= HastadateTimePicker.Value.Date).ToList();
                ConsultadataGridView.DataSource = null;
                ConsultadataGridView.DataSource = pagos;
            }
            else
            {
                pagos = PagosBLL.GetList(filtrar);
                ConsultadataGridView.DataSource = null;
                ConsultadataGridView.DataSource = pagos;
            }
        }
Exemplo n.º 27
0
 private void buttonEliminar_Click(object sender, EventArgs e)
 {
     if (UtilidadesFormularios.Validar(maskedTextBoxPagoId))
     {
         int id = int.Parse(maskedTextBoxPagoId.Text);
         PagosBLL.Buscar(x => x.PagoId == id, false);
         if (PagosBLL.Eliminar(PagosBLL.pagoReturned))
         {
             VerificarPagos();
             UtilidadesFormularios.Limpiar(null, new List <MaskedTextBox> {
                 maskedTextBoxMonto, maskedTextBoxPagoId
             }, null);
         }
     }
 }
 protected void GuardarButton_Click(object sender, EventArgs e)
 {
     if (VendedorIdTextBox.Text == "" || ConceptoTextBox.Text == "" || MontoTextBox.Text == "")
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('Debes Llenar Todos los Campos');</script>");
     }
     else
     {
         Entidades.Pagos p = new Entidades.Pagos();
         LlenarClase(p);
         PagosBLL.Insertar(p);
         Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('Proceso Completado');</script>");
         Limpiar();
     }
 }
Exemplo n.º 29
0
 protected void GuardarButton_Click(object sender, EventArgs e)
 {
     if (ConceptoTextBox.Text == "" || MontoTextBox.Text == "")
     {
         Utilidades.ShowToastr(this, "Completar Campos (*)  ", "Advertencia", "Warning");
     }
     else
     {
         Entidades.Pagos p = new Entidades.Pagos();
         LlenarClase(p);
         PagosBLL.Insertar(p);
         Utilidades.ShowToastr(this, "Guardado con Exitos", "Exito", "success");
         Limpiar();
     }
 }
        public void ModificarTest()
        {
            Pagos pagos = new Pagos();

            pagos.PagoId            = 1;
            pagos.ClienteId         = 1;
            pagos.Total             = 1000.0m;
            pagos.UsuarioId         = 1;
            pagos.FechaModificacion = DateTime.Now;
            pagos.PagoDetalle.Add(new PagosDetalle(0, 1, 800.0m, 400.0m));
            pagos.PagoDetalle.Add(new PagosDetalle(0, 1, 200.0m, 200.0m));

            bool paso = PagosBLL.Modificar(pagos);

            Assert.IsTrue(paso);
        }