private void btnGuardar_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                CreateBC obj = new CreateBC();
                obj.Create( rectificacion);
            }
            catch(Exception ex)
            {
                ModernDialog.ShowMessage("Hubo un problema al intentar guardar el registro, revisa que todos los campos esten llenados correctamente", "Error", MessageBoxButton.OK);
            }

            NuevoReg();
        }
        private void btnGuardar_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                CreateBC obj = new CreateBC();
                Empleado emp = listEmpleado.SelectedValue as Empleado;
                salida.IdEmpleado = emp.IdEmpleado;
                salida.Nota = txtNota.Text;
                salida.Fecha = txtFecha.SelectedDate.Value;
                obj.Create(salida);
            }
            catch (Exception ex)
            {
                ModernDialog.ShowMessage("Hubo un problema al intentar guardar el registro, revisa que todos los campos esten llenados correctamente", "Error", MessageBoxButton.OK);
            }

            NuevoReg();
        }
        private void listArticulo_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            Articulo art = listArticulo.SelectedValue as Articulo;
            art.Cantidad = art.Cantidad - Convert.ToInt32(btnCantidad.Text);
            UpdateBC objUpdate = new UpdateBC();

            objUpdate.Update(art, art.IdArticulo);

            CreateBC objCreate = new CreateBC();
            SalidaArticulo salida2 = new SalidaArticulo();
            salida2.IdSalida = salida.IdSalida;
            salida2.IdArticulo = art.IdArticulo;
            salida2.Cantidad = Convert.ToInt32(btnCantidad.Text);

            objCreate.Create(salida2);
            Update();
        }
        private void btnAgregarEntrada_Click(object sender, RoutedEventArgs e)
        {
            Pages.AgregarEntrada dialog = new Pages.AgregarEntrada();

            dialog.Title = "Agregar";
            dialog.Content = new Pages.AgregarArticulo();
            dialog.ResizeMode = ResizeMode.CanResize;
            dialog.UpdateLayout();
            dialog.ShowDialog();

            

            if (agregar) 
            {
                Entrada nuevaEntrada = new Entrada();
                nuevaEntrada = ArticuloNuevo;
                CreateBC objCreate = new CreateBC();
                objCreate.Create(nuevaEntrada);

                ReadBC objReader = new ReadBC();
                EntradaArticulos = objReader.ReadEntradaArticulo();
                this.DataContext = EntradaArticulos;
                agregar = false;
            }
            else 
            {
            
            }
            
        }
        private void listPendiente_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (sender != null)
            {
                PendienteArticulo register = listPendienteArticulo.SelectedValue as PendienteArticulo;

                ReadOneBC objReadOne = new ReadOneBC();
                DeleteBC objDelete = new DeleteBC();
                CreateBC objCreate = new CreateBC();
                UpdateBC objUpdate = new UpdateBC();

                Articulo art = objReadOne.ReadOneArticulo(register.IdArticulo);
                art.Cantidad = art.Cantidad + register.Cantidad;
                objUpdate.Update(art, art.IdArticulo);

                objDelete.DeletePendiente(register.IdPendiente);

                Entrada entr = new Entrada();
                entr.IdArticulo = register.IdArticulo;
                entr.IdFactura = register.IdFactura;
                entr.Cantidad = register.Cantidad;
                objCreate.Create(entr);

                Update();
            }
        }
        private void listEntrada_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (sender != null)
            {
                EntradaArticulo register = listEntradaArticulo.SelectedValue as EntradaArticulo;

                ReadOneBC objReadOne = new ReadOneBC();
                DeleteBC objDelete = new DeleteBC();
                CreateBC objCreate = new CreateBC();
                UpdateBC objUpdate = new UpdateBC();

                Articulo art = objReadOne.ReadOneArticulo(register.IdArticulo);
                art.Cantidad = art.Cantidad - register.Cantidad;
                objUpdate.Update(art, art.IdArticulo);

                Pendiente pend = new Pendiente();
                pend.IdArticulo = register.IdArticulo;
                pend.IdFactura = register.IdFactura;
                pend.Cantidad = register.Cantidad;
                objCreate.Create(pend);

                objDelete.DeleteEntrada(register.IdEntrada);

                Update();
            }
        }