Ejemplo n.º 1
0
 private void TxtProducto_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         producto = productoController.SelectOne(TxtProducto.Text);
         if (producto != null)
         {
             TxtProducto.Text = producto.ProductoId;
             TxtDescrip.Text  = producto.Descripcion;
             TxtLote.Text     = producto.ProductoId;
             TxtLote.Focus();
             return;
         }
         using (var form = new FrmBusqueda(TxtProducto.Text, (int)Ambiente.TipoBusqueda.Productos))
         {
             if (form.ShowDialog() == DialogResult.OK)
             {
                 producto         = form.Producto;
                 TxtProducto.Text = producto.ProductoId;
                 TxtDescrip.Text  = producto.Descripcion;
                 TxtLote.Text     = producto.ProductoId;
                 TxtLote.Focus();
             }
         }
     }
 }
Ejemplo n.º 2
0
        private void TxtProducto_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (conceptoMovInv == null)
                {
                    Ambiente.Mensaje("Operacion abortada, seleccione el tipo de movimiento");
                    return;
                }


                producto = productoController.SelectOne(TxtProducto.Text);
                if (producto != null)
                {
                    TxtProducto.Text = producto.ProductoId;
                    TxtDescrip.Text  = producto.Descripcion;

                    if (producto.TieneLote && conceptoMovInv.Es.Equals("S"))
                    {
                        TxtLote.Enabled = true;
                        TxtLote.Text    = producto.ProductoId;
                        TxtLote.Focus();
                    }
                    else if (producto.TieneLote && conceptoMovInv.Es.Equals("E"))
                    {
                        TxtLote.Enabled = false;
                        TxtLote.Text    = "";
                        NCantidad.Focus();
                    }
                    return;
                }
                using (var form = new FrmBusqueda(TxtProducto.Text, (int)Ambiente.TipoBusqueda.Productos))
                {
                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        producto         = form.Producto;
                        TxtProducto.Text = producto.ProductoId;
                        TxtDescrip.Text  = producto.Descripcion;

                        if (producto.TieneLote && conceptoMovInv.Es.Equals("S"))
                        {
                            TxtLote.Enabled = true;
                            TxtLote.Text    = producto.ProductoId;
                            TxtLote.Focus();
                        }
                        else if (producto.TieneLote && conceptoMovInv.Es.Equals("E"))
                        {
                            TxtLote.Enabled = false;
                            TxtLote.Text    = "";
                            NCantidad.Focus();
                        }
                        return;
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private bool ValidarCamposObligatorios()
        {
            if (Contexto.OrganizacionDestino == null || Contexto.OrganizacionDestino.OrganizacionID == 0)
            {
                SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal],
                                  Properties.Resources.TraspasoGanadoGordo_MensajeDebeSeleccionarDestino,
                                  MessageBoxButton.OK, MessageImage.Warning);
                skAyudaOrganizacion.AsignarFoco();
                return(false);
            }

            if (string.IsNullOrWhiteSpace(Contexto.CorralInfo.Codigo))
            {
                SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal],
                                  Properties.Resources.TraspasoGanadoGordo_MensajeDebeIngresarCampoCorral,
                                  MessageBoxButton.OK, MessageImage.Warning);
                TxtCorral.Focus();
                return(false);
            }

            if (string.IsNullOrWhiteSpace(Contexto.LoteInfo.Lote))
            {
                SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal],
                                  Properties.Resources.TraspasoGanadoGordo_MensajeDebeIngresarCampoLote,
                                  MessageBoxButton.OK, MessageImage.Warning);
                TxtLote.Focus();
                return(false);
            }

            if (CboSexo.SelectedIndex == -1)
            {
                SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal],
                                  Properties.Resources.TraspasoGanadoGordo_MensajeDebeSeleccionarCampoSexo,
                                  MessageBoxButton.OK, MessageImage.Warning);
                CboSexo.Focus();
                return(false);
            }

            if (CboTipoGanado.SelectedIndex == -1)
            {
                SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal],
                                  Properties.Resources.TraspasoGanadoGordo_MensajeDebeSeleccionarTipoGanado,
                                  MessageBoxButton.OK, MessageImage.Warning);
                CboTipoGanado.Focus();
                return(false);
            }

            if (Contexto.TipoGanado == null || Contexto.TipoGanado.PesoSalida == 0)
            {
                SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal],
                                  Properties.Resources.TraspasoGanadoGordo_MensajeDebeIngresarPesoProyectado,
                                  MessageBoxButton.OK, MessageImage.Warning);
                TxtPesoProyectado.Focus();
                return(false);
            }

            if (Contexto.LoteProyecion == null || Contexto.LoteProyecion.GananciaDiaria == 0)
            {
                SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal],
                                  Properties.Resources.TraspasoGanadoGordo_MensajeDebeIngresarGananciaDiaria,
                                  MessageBoxButton.OK, MessageImage.Warning);
                TxtGananciaDiaria.Focus();
                return(false);
            }

            if (Contexto.DiasEngorda == 0)
            {
                SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal],
                                  Properties.Resources.TraspasoGanadoGordo_MensajeDebeIngresarDiasEngorda,
                                  MessageBoxButton.OK, MessageImage.Warning);
                TxtDiasEngorda.Focus();
                return(false);
            }

            if (CboFormula.SelectedIndex == -1)
            {
                SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal],
                                  Properties.Resources.TraspasoGanadoGordo_MensajeDebeSeleccionarCampoFormulas,
                                  MessageBoxButton.OK, MessageImage.Warning);
                CboFormula.Focus();
                return(false);
            }

            if (Contexto.DiasFormula == 0)
            {
                SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal],
                                  Properties.Resources.TraspasoGanadoGordo_MensajeDebeIngresarDiasFormula,
                                  MessageBoxButton.OK, MessageImage.Warning);
                TxtCabezas.Focus();
                return(false);
            }

            if (Contexto.LoteInfo.Cabezas == 0)
            {
                SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal],
                                  Properties.Resources.TraspasoGanadoGordo_MensajeDebeIngresarCabezas,
                                  MessageBoxButton.OK, MessageImage.Warning);
                TxtCabezas.Focus();
                return(false);
            }

            if (!Contexto.TraspasoGanado && !Contexto.SacrificioGanado)
            {
                SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal],
                                  Properties.Resources.TraspasoGanadoGordo_MensajeSeleccionarTipoTraspaso,
                                  MessageBoxButton.OK, MessageImage.Warning);
                return(false);
            }

            if (Contexto.CabezasEnvio == 0)
            {
                SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal],
                                  Properties.Resources.TraspasoGanadoGordo_MensajeCabezasEnvioIgualCero,
                                  MessageBoxButton.OK, MessageImage.Warning);
                TxtCabezasEnvio.Focus();
                return(false);
            }

            if (Contexto.CabezasEnvio > Contexto.LoteInfo.Cabezas)
            {
                SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal],
                                  Properties.Resources.TraspasoGanadoGordo_MensajeCabezasEnvioMayorCabezas,
                                  MessageBoxButton.OK, MessageImage.Warning);
                Contexto.CabezasEnvio = 0;
                TxtCabezasEnvio.Focus();
                return(false);
            }
            return(true);
        }