private void SuplidorIdComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Suplidores suplidor = SuplidoresBLL.Buscar(Convert.ToInt32(SuplidorIdComboBox.SelectedValue));

            NombreSuplidoraLabel.Content  = suplidor.NombreRepresentante;
            CompaniaSuplidorLabel.Content = suplidor.Compania;
        }
        public void BuscarTest()
        {
            Suplidores s = new Suplidores();

            s = SuplidoresBLL.Buscar(2);

            Assert.AreEqual(s, s);
        }
Example #3
0
        public void BuscarTest()
        {
            Suplidores suplidor = SuplidoresBLL.Buscar(1);

            //Assert.IsTrue(suplidor != null);

            Assert.IsTrue(true);
        }
Example #4
0
        public void BuscarTest()
        {
            bool paso = true;

            var suplidores = SuplidoresBLL.Buscar(1);

            if (suplidores != null)
            {
                paso = true;
                Assert.AreEqual(paso, true);
            }
        }
Example #5
0
        public void BuscarTest()
        {
            Suplidores suplidor = new Suplidores();
            bool       paso     = false;

            suplidor = SuplidoresBLL.Buscar(1);

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

            Assert.AreEqual(paso, true);
        }
Example #6
0
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            Suplidores encontrado = SuplidoresBLL.Buscar(Convert.ToInt32(SuplidoresComboBox.SelectedValue));

            if (encontrado != null)
            {
                this.suplidor    = encontrado;
                this.DataContext = null;
                this.DataContext = suplidor;
            }
            else
            {
                Limpiar();
                MessageBox.Show("El suplidor no existe", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            Suplidores supidordaAnterior = SuplidoresBLL.Buscar(suplidor.SuplidorId);

            if (supidordaAnterior != null)
            {
                suplidor             = supidordaAnterior;
                UsuarioLabel.Content = obtenerNombreUsuario(suplidor.UsuarioId);
                Recargar();
            }
            else
            {
                Limpiar();
                MessageBox.Show("Suplidor no encontrado");
            }
        }
Example #8
0
        private void BuscarButton_Click(object sender, EventArgs e)
        {
            int        id         = Convert.ToInt32(SuplidorIdNumericUpDown.Value);
            Suplidores suplidores = SuplidoresBLL.Buscar(id);

            if (suplidores != null)
            {
                NombreEmpresaTextBox.Text = suplidores.NombreEmpresa;
                RNCTextBox.Text           = suplidores.NombreEmpresa;
                DireccionTextBox.Text     = suplidores.Direccion;
                TelefonoTextBox.Text      = suplidores.Telefono;
            }
            else
            {
                MessageBox.Show("No existente", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #9
0
        private void EliminarButton_Click(object sender, RoutedEventArgs e)
        {
            Suplidores existe = SuplidoresBLL.Buscar(suplidor.SuplidorId);

            if (existe == null)
            {
                MessageBox.Show("No existe el suplidor en la base de datos", "Fallo",
                                MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            else
            {
                SuplidoresBLL.Eliminar(suplidor.SuplidorId);
                MessageBox.Show("Eliminado", "Exito",
                                MessageBoxButton.OK, MessageBoxImage.Information);
                Limpiar();
            }
        }
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            var suplidor = SuplidoresBLL.Buscar(int.Parse(SuplidorIdTextBox.Text));

            if (suplidor != null)
            {
                this.suplidor = suplidor;
            }
            else
            {
                this.suplidor = new Entidades.Suplidores();
                MessageBox.Show("La Categoria no existe", "Fallo",
                                MessageBoxButton.OK, MessageBoxImage.Information);
                Limpiar();
            }

            //Limpiar();
            this.DataContext = this.suplidor;
        }
        private void EliminarButton_Click(object sender, RoutedEventArgs e)
        {
            Suplidores AnteriorSuplidor = SuplidoresBLL.Buscar(suplidor.SuplidorId);

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

            if (SuplidoresBLL.Eliminar(suplidor.SuplidorId))
            {
                MessageBox.Show("Eliminado");
                Limpiar();
            }
            else
            {
                MessageBox.Show("No se puede eliminar un contrato que no existe");
            }
        }
        //Evento que buscara un registro.
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            if (!Regex.IsMatch(SuplidorIdTextBox.Text, "^[1-9]+$"))
            {
                MessageBox.Show("El Suplidor Id solo puede ser de carácter numérico.", "Campo Suplidor Id.",
                                MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            var encontrado = SuplidoresBLL.Buscar(int.Parse(SuplidorIdTextBox.Text));

            if (encontrado != null)
            {
                Suplidor         = encontrado;
                this.DataContext = Suplidor;
            }
            else
            {
                MessageBox.Show("Puede ser que el suplidor no este registrado en la base de datos.", "No se encontro el Suplidor.", MessageBoxButton.OK,
                                MessageBoxImage.Information);
            }
        }
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                int        id;
                Suplidores supplier = new Suplidores();
                int.TryParse(SuplidorIdTextBox.Text, out id);
                Limpiar();
                supplier = SuplidoresBLL.Buscar(id);

                if (supplier != null)
                {
                    LlenaCampo(supplier);
                }
                else
                {
                    MessageBox.Show(" No Encontrado !!!", "Informacion", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Error en base de datos intente de nuevo", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private bool ExisteEnLaBaseDeDatos()
        {
            Suplidores SuplidorAnterior = SuplidoresBLL.Buscar(suplidor.SuplidorId);

            return(SuplidorAnterior != null);
        }
        public void BuscarTest()
        {
            Suplidores suplidor = SuplidoresBLL.Buscar(1);

            Assert.IsNotNull(suplidor);
        }
Example #16
0
        private bool Existe()
        {
            Suplidores esValido = SuplidoresBLL.Buscar(suplidor.SuplidorId);

            return(esValido != null);
        }
Example #17
0
        private bool ExisteEnLaBaseDeDatos()
        {
            Suplidores suplidores = SuplidoresBLL.Buscar((int)SuplidorIdNumericUpDown.Value);

            return(suplidores != null);
        }
        private bool Existe()
        {
            Suplidores suplidores = SuplidoresBLL.Buscar(suplidor.SuplidorId);

            return(suplidores != null);
        }
        private bool ExisteEnDB()
        {
            Suplidores suplidores = SuplidoresBLL.Buscar(Convert.ToInt32(SuplidorIdTextBox.Text));

            return(suplidores != null);
        }
Example #20
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("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("Costo", 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 inv.Productos)
            {
                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.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.costo.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.costo * item.Inventario).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: ", inv.TotalInventario.ToString(), "", "", _fontStyle);
            TableRows("", "", fontStyle, "");
            TableRows("", "", fontStyle, "");

            if (SuplidoresBLL.Buscar(inv.SuplidorId) != null)
            {
                Totales("Usuario: ", (UsuariosBLL.Buscar(inv.UsuarioId).Nombre + " " + UsuariosBLL.Buscar(inv.UsuarioId).Apellido), "Suplidor: ", SuplidoresBLL.Buscar(inv.SuplidorId).Nombre, _fontStyle);/*+ UsuariosBLL.Buscar(venta.UsuarioId).Nombre + " " + UsuariosBLL.Buscar(venta.UsuarioId).Apellido, fontStyle, ""*/
            }
            else
            {
                Totales("Despachado por:", (UsuariosBLL.Buscar(usuariologueadoId).Nombre + " " + UsuariosBLL.Buscar(usuariologueadoId).Apellido), "Suplidor: ", SuplidoresBLL.Buscar(inv.SuplidorId).Nombre, _fontStyle);
            }
            #endregion
        }
Example #21
0
 public void BuscarTest()
 {
     Assert.IsTrue(SuplidoresBLL.Buscar(1) != null);
 }
        //Este metodo válida los campos del WPF.
        public bool válidar()
        {
            //válida que haya un Id válido en el campo SuplidorId.
            if (!Regex.IsMatch(SuplidorIdTextBox.Text, "^[1-9]+$"))
            {
                MessageBox.Show("El Suplidor Id solo puede ser de carácter numérico.", "Campo Suplidor Id.",
                                MessageBoxButton.OK, MessageBoxImage.Warning);
                return(false);
            }

            //Ayudara con la válidacion de la linea 147 y 164.
            var suplidor = SuplidoresBLL.Buscar(int.Parse(SuplidorIdTextBox.Text));

            //válida que no hayan campos vacíos.
            if (SuplidorIdTextBox.Text.Length == 0 || NombresTextBox.Text.Length == 0 || TelefonoTextBox.Text.Length == 0 ||
                EmailTextBox.Text.Length == 0)
            {
                MessageBox.Show("Asegúrese de haber llenado todos los campos.", "Campos vacíos",
                                MessageBoxButton.OK, MessageBoxImage.Information);
                return(false);
            }

            //válida la dirreccion de correo electrónico.
            if (!Regex.IsMatch(EmailTextBox.Text, "\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*"))
            {
                MessageBox.Show("La direccón de correo electrónico que ha introducido no es válida.", "Campo Email.",
                                MessageBoxButton.OK, MessageBoxImage.Information);
                return(false);
            }

            //válida que se le haya colocado el prefijo al telefo no (ejemplo: +1).
            if (!Regex.IsMatch(TelefonoTextBox.Text, @"^(\+[0-9]{1,12})$"))
            {
                MessageBox.Show("Asegúrese de haber colocado el prefijo telefonico correspondiente.", "Número de teléfono no válido.",
                                MessageBoxButton.OK, MessageBoxImage.Information);
                return(false);
            }

            //válidando la longitud del telefono.
            if (TelefonoTextBox.Text.Length < 8)
            {
                MessageBox.Show("El número de teléfono no cumple con una longitud válida.", "Longitud no válida.",
                                MessageBoxButton.OK, MessageBoxImage.Error);
                return(false);
            }

            //válidando que no se repita el mismo telefono en diferentes registros.
            if (suplidor != null)
            {
                if (SuplidoresBLL.ExisteTelefono(TelefonoTextBox.Text) && suplidor.Nombres != NombresTextBox.Text)
                {
                    MessageBox.Show("Asegúrese que haya ingresado correctamente el número de teléfono.", $"El teléfono \"{TelefonoTextBox.Text}\" ya existe.",
                                    MessageBoxButton.OK, MessageBoxImage.Information);
                    return(false);
                }
            }
            else if (SuplidoresBLL.ExisteTelefono(TelefonoTextBox.Text))
            {
                MessageBox.Show("Asegúrese que haya ingresado correctamente el número de teléfono.", $"El teléfono \"{TelefonoTextBox.Text}\" ya existe.",
                                MessageBoxButton.OK, MessageBoxImage.Information);
                return(false);
            }

            //válidando que no se repita el mismo correo en diferentes registros.
            if (suplidor != null)
            {
                if (SuplidoresBLL.ExisteEmail(EmailTextBox.Text) && suplidor.Nombres != NombresTextBox.Text)
                {
                    MessageBox.Show("Asegúrese de haber ingresado correctamente la dirección de correo electrónico.", $"El Email \"{EmailTextBox.Text}\" ya existe.",
                                    MessageBoxButton.OK, MessageBoxImage.Information);
                    return(false);
                }
            }
            else if (SuplidoresBLL.ExisteEmail(EmailTextBox.Text))
            {
                MessageBox.Show("Asegúrese de haber ingresado correctamente el número de teléfono.", $"El teléfono \"{EmailTextBox.Text}\" ya existe.",
                                MessageBoxButton.OK, MessageBoxImage.Information);
                return(false);
            }


            return(true);
        }
Example #23
0
        private string ObtenerNombre(int id)
        {
            Suplidores suplidor = SuplidoresBLL.Buscar(id);

            return(suplidor.Nombres);
        }
        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("Suplidor", fontStyle));
            pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            pdfCell.BackgroundColor     = BaseColor.LightGray;
            pdfPTable.AddCell(pdfCell);


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


            pdfCell = new PdfPCell(new Phrase("Total 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 TotalInv = 0;



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

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


                pdfCell = new PdfPCell(new Phrase(item.Fecha.ToString("dd/MM/yyyy"), _fontStyle));
                pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                pdfCell.BackgroundColor     = BaseColor.White;
                pdfPTable.AddCell(pdfCell);


                pdfCell = new PdfPCell(new Phrase(item.TotalInventario.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(TotalInv.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
        }