Beispiel #1
0
        void limpiar()
        {
            TxtFechaCaducidad.Clear();
            TxtNombre.Clear();
            TxtCosto.Clear();
            TxtPrecioMin.Clear();
            TxtprecioVenta.Clear();
            TxtIva.Clear();
            TxtStock.Clear();
            TxtStockMin.Clear();
            TxtDescripcion.Clear();

            cbidPromocio.Visible   = false;
            lblselecpromo.Visible  = false;
            cbpromocion.DataSource = null;
            cbProveedor.DataSource = null;
            CbMedida.DataSource    = null;
            CbFamilia.DataSource   = null;
            TxtCodigoBarra.Clear();
        }
Beispiel #2
0
 bool validartxt()
 {
     try
     {
         if (cbidPromocio.SelectedText != null)
         {
             if (TxtCodigoBarra.Text != "")
             {
                 if (TxtNombre.Text != "")
                 {
                     if (TxtDescripcion.Text != "")
                     {
                         if (TxtStock.Text != "" && TxtStock.Text != "0")
                         {
                             if (TxtStockMin.Text != "" && TxtStockMin.Text != "0")
                             {
                                 if (TxtCosto.Text != "")
                                 {
                                     if (TxtPrecioMin.Text != "")
                                     {
                                         if (TxtprecioVenta.Text != "")
                                         {
                                             if (TxtIva.Text != "")
                                             {
                                                 if (CbMedida.SelectedValue != null)
                                                 {
                                                     if (CbFamilia.SelectedValue != null)
                                                     {
                                                         if (cbpromocion.SelectedText != null)
                                                         {
                                                             if (cbProveedor.SelectedValue != null)
                                                             {
                                                                 if (CbEstatus.SelectedText != null)
                                                                 {
                                                                     if (TxtFechaCaducidad.Text != null)
                                                                     {
                                                                         return(true);
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                             else
                                             {
                                                 TxtIva.Focus();
                                             }
                                         }
                                         else
                                         {
                                             TxtprecioVenta.Focus();
                                         }
                                     }
                                     else
                                     {
                                         TxtPrecioMin.Focus();
                                     }
                                 }
                                 else
                                 {
                                     TxtCosto.Focus();
                                 }
                             }
                             else
                             {
                                 TxtStockMin.Focus();
                             }
                         }
                         else
                         {
                             TxtStock.Focus();
                         }
                     }
                     else
                     {
                         TxtDescripcion.Focus();
                     }
                 }
                 else
                 {
                     TxtNombre.Focus();
                 }
             }
             else
             {
                 TxtCodigoBarra.Focus();
             }
         }
     }
     catch (Exception e)
     {
         MessageBox.Show("Error consulte con su administrador error:" + e.ToString(), "Error");
     }
     return(false);
 }
Beispiel #3
0
        void Registrar()
        {
            bool f = false;

            try
            {
                if (validartxt())
                {
                    if (p.validarNombre(TxtNombre.Text) != true)
                    {
                        if (p.TrueCodigoBarraRegistrado(TxtCodigoBarra.Text) != true)
                        {
                            p.Codigo      = TxtCodigoBarra.Text;
                            p.Nombre      = TxtNombre.Text;
                            p.Descripcion = TxtDescripcion.Text;
                            p.IdProveedor = Convert.ToInt32(cbProveedor.SelectedValue.ToString());
                            p.Stock       = Convert.ToInt32(TxtStock.Text);
                            p.StockMin    = Convert.ToInt32(TxtStockMin.Text);
                            p.Costo       = Convert.ToDouble(TxtCosto.Text);
                            p.Precio      = Convert.ToDouble(TxtprecioVenta.Text);
                            p.IVA         = Convert.ToDouble(TxtIva.Text);
                            p.Promocion   = cbpromocion.SelectedItem.ToString();
                            if (cbidPromocio.Visible)
                            {
                                p.IdPromocion = Convert.ToInt32(cbidPromocio.SelectedValue.ToString());
                            }
                            else
                            {
                                p.IdPromocion = null;
                            }

                            p.PrecioMin = Convert.ToDouble(TxtprecioVenta.Text);
                            p.IdUnidad  = Convert.ToInt32(CbMedida.SelectedValue.ToString());
                            p.IdFamilia = Convert.ToInt32(CbFamilia.SelectedValue.ToString());
                            p.Estatus   = CbEstatus.SelectedText.ToString();
                            try
                            {
                                p.FechaCaducidad = Convert.ToString(TxtFechaCaducidad.Text);
                                f = true;
                            }
                            catch (Exception e) {
                                MessageBox.Show("Introdusca una fecha correcta", "Mensaje");
                                TxtFechaCaducidad.Focus();
                                f = false;
                            }

                            if (f)
                            {
                                p.RegistrarProducto();
                                cargargridprincipal();
                                MessageBox.Show("Producto Registrado correctamente");
                                limpiar();
                            }
                        }
                        else
                        {
                            MessageBox.Show("El codigo de barra ya fue registrado intente con otro", "Mensaje");
                            TxtCodigoBarra.Focus();
                        }
                    }
                    else
                    {
                        MessageBox.Show("EL NOMBRE de este producto ya existe", "Mensaje");
                        TxtNombre.Focus();
                    }
                }
                else
                {
                    MessageBox.Show("Para continuar Llene los campos requerido, los que se marcan con *", "Mensaje");
                }
            }
            catch (Exception e) {
                MessageBox.Show("Error consulte con su administrador error:" + e.ToString(), "Error");
            }
        }