示例#1
0
        private void RegistraEntrega()
        {
            try
            {
                AsociadoMantenimiento        asociadoM     = new AsociadoMantenimiento();
                List <SIGEEA_DetFacAsociado> listaDetalles = new List <SIGEEA_DetFacAsociado>();

                SIGEEA_FacAsociado factura = new SIGEEA_FacAsociado();
                factura.Estado_FacAsociado     = true;
                factura.FecEntrega_FacAsociado = DateTime.Now;
                factura.FK_Id_Asociado         = asociado.PK_Id_Asociado;
                factura.Numero_FacAsociado     = asociadoM.ObtenerNumeroFacturaEntrega();


                foreach (uc_IngresoProducto ip in stpContenedor.Children)
                {
                    SIGEEA_DetFacAsociado fac = new SIGEEA_DetFacAsociado();
                    fac.CanTotal_DetFacAsociado = ip.getCantidad();
                    fac.FK_Id_Lote             = ip.getLote();
                    fac.Mercado_DetFacAsociado = ip.getMercado();
                    fac.FK_Id_PreProCompra     = ip.getProducto();//Se le asigna la PK del producto, en la función de registrar de AsociadoMantenimiento se hace el cambio necesario.
                    listaDetalles.Add(fac);
                }
                asociadoM.RegistraEntrega(factura, listaDetalles);
                MessageBox.Show("Entrega registrada con éxito.", "SIGEEA", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                wnwFacturaEntrega ventana = new wnwFacturaEntrega(factura.PK_Id_FacAsociado, asociado.Codigo_Asociado);
                ventana.ShowDialog();
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error al registrar: " + ex.Message, "SIGEEA", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private void RegistraEntrega()
        {
            try
            {
                    AsociadoMantenimiento asociadoM = new AsociadoMantenimiento();
                    List<SIGEEA_DetFacAsociado> listaDetalles = new List<SIGEEA_DetFacAsociado>();

                    SIGEEA_FacAsociado factura = new SIGEEA_FacAsociado();
                    factura.Estado_FacAsociado = true;
                    factura.FecEntrega_FacAsociado = DateTime.Now;
                    factura.FK_Id_Asociado = asociado.PK_Id_Asociado;


                    foreach (uc_IngresoProducto ip in stpContenedor.Children)
                    {
                        SIGEEA_DetFacAsociado fac = new SIGEEA_DetFacAsociado();
                        fac.CanTotal_DetFacAsociado = ip.getCantidad();
                        fac.FK_Id_Lote = ip.getLote();
                        fac.Mercado_DetFacAsociado = ip.getMercado();
                        fac.FK_Id_PreProCompra = ip.getProducto();//Se le asigna la PK del producto, en la función de registrar de AsociadoMantenimiento se hace el cambio necesario.
                        listaDetalles.Add(fac);
                    }
                    asociadoM.RegistraEntrega(factura, listaDetalles);
                    MessageBox.Show("Entrega registrada con éxito.", "SIGEEA", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    wnwFacturaEntrega ventana = new wnwFacturaEntrega(factura.PK_Id_FacAsociado);
                    ventana.ShowDialog();
                    this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error al registrar: " + ex.Message, "SIGEEA", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }