private void Buscar() { if (txtOrdenCompra.Text != "") { try { if (!string.IsNullOrEmpty(servidor) && !string.IsNullOrEmpty(baseDatos)) { string conexion = string.Format( @"Initial Catalog={0};Data Source={1};User ID=usrsoporte;Password=usrsoporte", baseDatos, servidor); var recepcionProductoPl = new RecepcionProductoPL(); recepcionProductoCompra = new RecepcionProductoInfo(); recepcionProductoCompra.FolioOrdenCompra = txtOrdenCompra.Text; recepcionProductoCompra = recepcionProductoPl.ObtenerRecepcionVista(recepcionProductoCompra, organizacionId, conexion); if (recepcionProductoCompra != null) { txtProveedor.Text = recepcionProductoCompra.Proveedor.Descripcion; txtFecha.Text = recepcionProductoCompra.FechaSolicitud.ToShortDateString() .ToString(CultureInfo.InvariantCulture); gbDatos.IsEnabled = true; dgRecepcionCompra.ItemsSource = new List <RecepcionProductoDetalleInfo>(); dgRecepcionCompra.ItemsSource = recepcionProductoCompra.ListaRecepcionProductoDetalle; } else { gbDatos.IsEnabled = false; renglon = -1; LimpiarCampos(); recepcionProducto = new RecepcionProductoInfo(); recepcionProducto.ListaRecepcionProductoDetalle = new List <RecepcionProductoDetalleInfo>(); recepcionProductoCompra = new RecepcionProductoInfo(); recepcionProductoCompra.ListaRecepcionProductoDetalle = new List <RecepcionProductoDetalleInfo>(); dgRecepcionCompra.ItemsSource = new List <RecepcionProductoDetalleInfo>(); dgRecepcion.ItemsSource = new List <RecepcionProductoDetalleInfo>(); SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.RecepcionProducto_CompraInvalida, MessageBoxButton.OK, MessageImage.Stop); txtOrdenCompra.Focus(); } } else { renglon = -1; LimpiarCampos(); recepcionProducto = new RecepcionProductoInfo(); recepcionProducto.ListaRecepcionProductoDetalle = new List <RecepcionProductoDetalleInfo>(); recepcionProductoCompra = new RecepcionProductoInfo(); recepcionProductoCompra.ListaRecepcionProductoDetalle = new List <RecepcionProductoDetalleInfo>(); dgRecepcionCompra.ItemsSource = new List <RecepcionProductoDetalleInfo>(); dgRecepcion.ItemsSource = new List <RecepcionProductoDetalleInfo>(); SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.RecepcionProducto_msgErrorAlObtenerParametros, MessageBoxButton.OK, MessageImage.Stop); txtOrdenCompra.Focus(); } } catch (Exception ex) { Logger.Error(ex); } } else { SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.RecepcionProducto_IngresarFolioOrdenCompra, MessageBoxButton.OK, MessageImage.Stop); txtOrdenCompra.Focus(); } }
private void BtnGuardar_OnClick(object sender, RoutedEventArgs e) { try { if (!string.IsNullOrEmpty(txtOrdenCompra.Text)) { if (recepcionProducto.ListaRecepcionProductoDetalle != null) { if (recepcionProducto.ListaRecepcionProductoDetalle.Count > 0) { var recepcionProductoPl = new RecepcionProductoPL(); recepcionProducto.Almacen = new AlmacenInfo() { AlmacenID = int.Parse(txtAlmacenGeneral.Text), Organizacion = new OrganizacionInfo() { OrganizacionID = organizacionId } }; recepcionProducto.FolioOrdenCompra = txtOrdenCompra.Text; recepcionProducto.FechaSolicitud = recepcionProductoCompra.FechaSolicitud; var proveedorPl = new ProveedorPL(); recepcionProducto.Proveedor = proveedorPl.ObtenerPorCodigoSAP(new ProveedorInfo() { CodigoSAP = skAyudaProveedor.Clave }); recepcionProducto.Factura = txtFactura.Text; recepcionProducto.UsuarioCreacion = new UsuarioInfo() { UsuarioID = usuarioId }; recepcionProducto.Observaciones = txtObservaciones.Text; MemoryStream retorno = recepcionProductoPl.Guardar(recepcionProducto); if (retorno != null) { SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.RecepcionProducto_msgDatosGuardados, MessageBoxButton.OK, MessageImage.Correct); var exportarPoliza = new ExportarPoliza(); exportarPoliza.ImprimirPoliza(retorno, string.Format("{0} {1}", "Poliza de Entrada Compra Materia Prima Folio", txtOrdenCompra.Text)); LimpiarTodo(); } else { SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.RecepcionProducto_msgOcurrioErrorGuardar, MessageBoxButton.OK, MessageImage.Stop); } } else { SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.RecepcionProducto_msgIngresarProductos, MessageBoxButton.OK, MessageImage.Stop); } } else { SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.RecepcionProducto_msgIngresarProductos, MessageBoxButton.OK, MessageImage.Stop); } } else { SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.RecepcionProducto_IngresarFolioOrdenCompra, MessageBoxButton.OK, MessageImage.Stop); txtOrdenCompra.Focus(); } } catch (ExcepcionServicio ex) { SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], ex.Message, MessageBoxButton.OK, MessageImage.Stop); } catch (ExcepcionGenerica ex) { Logger.Error(ex); } catch (Exception ex) { Logger.Error(ex); } }