private void EliminarButton_Click(object sender, RoutedEventArgs e)
        {
            Marcas existe = MarcasBLL.Buscar(marcas.MarcaId);

            if (marcas.MarcaId == 1)
            {
                MessageBox.Show("No puede eliminar el Admin",
                                "Mensaje", MessageBoxButton.OK);
                return;
            }
            if (marcas == null)
            {
                MessageBox.Show("Primero seleccione un Usuario",
                                "Error", MessageBoxButton.OK);
                return;
            }
            else
            {
                MessageBoxResult opcion =
                    MessageBox.Show("Estas seguro de que desear eliminar a " + marcas.Nombres + "?",
                                    "Marcas", MessageBoxButton.YesNo);
                if (opcion.Equals(MessageBoxResult.Yes))
                {
                    if (MarcasBLL.Delete(marcas.MarcaId))
                    {
                        Limpiar();
                        MarcasBLL.Eliminar(marcas.MarcaId);
                        MessageBox.Show("Ha sido eliminado exitosamente", "Exito",
                                        MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                }
            }
        }
Exemple #2
0
        public void BuscarTest()
        {
            Marcas marca = new Marcas();
            bool   paso  = false;

            marca = MarcasBLL.Buscar(1);

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

            Assert.AreEqual(paso, true);
        }
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            var marcas = MarcasBLL.Buscar(Utilidades.ToInt(MarcaIdTextBox.Text));

            if (marcas != null)
            {
                this.Marcas = marcas;
            }
            else
            {
                this.Marcas = new Marcas();
            }

            this.DataContext = this.Marcas;
        }
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            Marcas encontrado = MarcasBLL.Buscar(marcas.MarcaId);

            edit = true;
            if (encontrado != null)
            {
                marcas           = encontrado;
                this.DataContext = marcas;
            }
            else
            {
                Limpiar();
                MessageBox.Show("No existe en la base de datos", "Mensaje",
                                MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Exemple #5
0
        private void ReportBody()
        {
            fontStyle = FontFactory.GetFont("Calibri", 9f, 1);
            var _fontStyle = FontFactory.GetFont("Calibri", 9f, 0);

            #region Table Header
            pdfCell = new PdfPCell(new Phrase("ID", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.LightGray;
            pdfPTable.AddCell(pdfCell);

            pdfCell = new PdfPCell(new Phrase("Descripcion", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.LightGray;
            pdfPTable.AddCell(pdfCell);


            pdfCell = new PdfPCell(new Phrase("Marca", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.LightGray;
            pdfPTable.AddCell(pdfCell);


            pdfCell = new PdfPCell(new Phrase("Unidad", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.LightGray;
            pdfPTable.AddCell(pdfCell);

            pdfCell = new PdfPCell(new Phrase("Inventario", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.LightGray;
            pdfPTable.AddCell(pdfCell);

            pdfCell = new PdfPCell(new Phrase("Precio unitario", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.LightGray;
            pdfPTable.AddCell(pdfCell);

            pdfCell = new PdfPCell(new Phrase("Valor inventario", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.LightGray;
            pdfPTable.AddCell(pdfCell);

            pdfPTable.CompleteRow();
            #endregion

            #region Table Body
            int    num        = 0;
            double inventario = 0;
            foreach (var item in lista)
            {
                inventario += item.ValorInventario;
                num++;
                pdfCell = new PdfPCell(new Phrase(item.ProductoId.ToString(), _fontStyle));
                pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                pdfCell.BackgroundColor     = BaseColor.White;
                pdfPTable.AddCell(pdfCell);

                pdfCell = new PdfPCell(new Phrase(item.Descripción, _fontStyle));
                pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                pdfCell.BackgroundColor     = BaseColor.White;
                pdfPTable.AddCell(pdfCell);


                pdfCell = new PdfPCell(new Phrase(MarcasBLL.Buscar(item.MarcaId).Descripcion.ToString(), _fontStyle));
                pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                pdfCell.BackgroundColor     = BaseColor.White;
                pdfPTable.AddCell(pdfCell);


                pdfCell = new PdfPCell(new Phrase(item.Unidad, _fontStyle));
                pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                pdfCell.BackgroundColor     = BaseColor.White;
                pdfPTable.AddCell(pdfCell);

                pdfCell = new PdfPCell(new Phrase(item.Inventario.ToString(), _fontStyle));
                pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                pdfCell.BackgroundColor     = BaseColor.White;
                pdfPTable.AddCell(pdfCell);

                pdfCell = new PdfPCell(new Phrase(item.PrecioUnitario.ToString(), _fontStyle));
                pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                pdfCell.BackgroundColor     = BaseColor.White;
                pdfPTable.AddCell(pdfCell);

                pdfCell = new PdfPCell(new Phrase(item.ValorInventario.ToString(), _fontStyle));
                pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                pdfCell.BackgroundColor     = BaseColor.White;
                pdfPTable.AddCell(pdfCell);

                pdfPTable.CompleteRow();
            }

            pdfCell = new PdfPCell(new Phrase(num++.ToString(), fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.White;
            pdfCell.Border = 0;
            pdfPTable.AddCell(pdfCell);

            pdfCell = new PdfPCell(new Phrase(" ", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.White;
            pdfCell.Border = 0;
            pdfPTable.AddCell(pdfCell);

            pdfCell = new PdfPCell(new Phrase(" ", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.White;
            pdfCell.Border = 0;
            pdfPTable.AddCell(pdfCell);

            pdfCell = new PdfPCell(new Phrase(" ", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.White;
            pdfCell.Border = 0;
            pdfPTable.AddCell(pdfCell);

            pdfCell = new PdfPCell(new Phrase(" ", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.White;
            pdfCell.Border = 0;
            pdfPTable.AddCell(pdfCell);

            pdfCell = new PdfPCell(new Phrase(" ", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.White;
            pdfCell.Border = 0;
            pdfPTable.AddCell(pdfCell);

            pdfCell = new PdfPCell(new Phrase(inventario.ToString(), fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.White;
            pdfCell.Border = 0;

            pdfPTable.AddCell(pdfCell);

            pdfPTable.CompleteRow();
            #endregion
        }
        private void ReportBody()
        {
            fontStyle = FontFactory.GetFont("Calibri", 9f, 1);
            var _fontStyle = FontFactory.GetFont("Calibri", 9f, 0);

            #region Table Header
            pdfCell = new PdfPCell(new Phrase("No.     ", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.LightGray;
            pdfPTable.AddCell(pdfCell);

            pdfCell = new PdfPCell(new Phrase("Descripcion", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.LightGray;
            pdfPTable.AddCell(pdfCell);


            pdfCell = new PdfPCell(new Phrase("Marca", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.LightGray;
            pdfPTable.AddCell(pdfCell);


            pdfCell = new PdfPCell(new Phrase("Cantidad", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.LightGray;
            pdfPTable.AddCell(pdfCell);

            pdfCell = new PdfPCell(new Phrase("Precio", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.LightGray;
            pdfPTable.AddCell(pdfCell);

            pdfCell = new PdfPCell(new Phrase("Importe", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.LightGray;
            pdfPTable.AddCell(pdfCell);

            pdfPTable.CompleteRow();
            #endregion

            #region Table Body
            int num = 0;

            foreach (var item in venta.VentasDetalle)
            {
                num++;
                pdfCell = new PdfPCell(new Phrase(num.ToString(), _fontStyle));
                pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                pdfCell.BackgroundColor     = BaseColor.White;
                pdfPTable.AddCell(pdfCell);

                pdfCell = new PdfPCell(new Phrase(ProductosBLL.Buscar(item.ProductoId).Descripción, _fontStyle));
                pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                pdfCell.BackgroundColor     = BaseColor.White;
                pdfPTable.AddCell(pdfCell);

                pdfCell = new PdfPCell(new Phrase(MarcasBLL.Buscar(ProductosBLL.Buscar(item.ProductoId).MarcaId).Descripcion.ToString(), _fontStyle));
                pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                pdfCell.BackgroundColor     = BaseColor.White;
                pdfPTable.AddCell(pdfCell);

                pdfCell = new PdfPCell(new Phrase(item.Cantidad.ToString(), _fontStyle));
                pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                pdfCell.BackgroundColor     = BaseColor.White;
                pdfPTable.AddCell(pdfCell);

                pdfCell = new PdfPCell(new Phrase(item.Precio.ToString(), _fontStyle));
                pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                pdfCell.BackgroundColor     = BaseColor.White;
                pdfPTable.AddCell(pdfCell);

                pdfCell = new PdfPCell(new Phrase((item.Precio * item.Cantidad).ToString(), _fontStyle));
                pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                pdfCell.BackgroundColor     = BaseColor.White;
                pdfPTable.AddCell(pdfCell);

                pdfPTable.CompleteRow();
            }
            TableRows("", "", fontStyle, "");
            TableRows("", "", fontStyle, "");
            TableRows("", "", fontStyle, "");
            TableRows("", "", fontStyle, "");
            Totales("Total: ", venta.Total.ToString(), "Total General: ", venta.TotalGeneral.ToString(), _fontStyle);
            Totales("ITBIS: ", venta.ITBIS.ToString(), "", "", _fontStyle);
            Totales("Descuentos: ", venta.Descuentos.ToString(), "", "", _fontStyle);

            TableRows("", "", fontStyle, "");
            TableRows("", "", fontStyle, "");

            if (UsuariosBLL.Buscar(venta.UsuarioId) != null)
            {
                Totales("Despachado por:", (UsuariosBLL.Buscar(venta.UsuarioId).Nombre + " " + UsuariosBLL.Buscar(venta.UsuarioId).Apellido), "Cliente: ", ClientesBLL.Buscar(venta.ClienteId).Nombre + " " + ClientesBLL.Buscar(venta.ClienteId).Apellido, _fontStyle);/*+ UsuariosBLL.Buscar(venta.UsuarioId).Nombre + " " + UsuariosBLL.Buscar(venta.UsuarioId).Apellido, fontStyle, ""*/
            }
            else
            {
                Totales("Despachado por:", (UsuariosBLL.Buscar(usuariologueadoId).Nombre + " " + UsuariosBLL.Buscar(usuariologueadoId).Apellido), "Cliente: ", ClientesBLL.Buscar(venta.ClienteId).Nombre + " " + ClientesBLL.Buscar(venta.ClienteId).Apellido, _fontStyle);
            }
            #endregion
        }