コード例 #1
0
        public VentanaBodega(Usuario usuario)
        {
            InitializeComponent();
            this.usuario              = usuario;
            btn_agregar.Enabled       = false;
            btn_modificarProd.Enabled = false;
            groupBox1.Enabled         = false;

            NegProveedor negprov = new NegProveedor();
            string       error;

            cmb_proveedor.Items.Clear();
            cmb_proveedor.Items.Insert(0, "Seleccione");
            cmb_proveedor.DropDownStyle = ComboBoxStyle.DropDownList;
            this.listaDeproveedores     = negprov.listarLosProveedores(out error);
            if (String.IsNullOrEmpty(error) == false)
            {
                this.listaDeproveedores = null;
                MessageBox.Show(error);
            }
            else
            {
                foreach (Proveedor prov in listaDeproveedores)
                {
                    cmb_proveedor.Items.Add(prov._nombreProveedor);
                }
            }
        }
コード例 #2
0
        private void btn_buscarSerie_Click(object sender, EventArgs e)
        {
            Productos productoBuscado = new Productos();

            productoBuscado._serie = txt_buscarSerie.Text;
            string       error1;
            NegProductos negUsuario1 = new NegProductos();

            productoBuscado = negUsuario1.datosProductos(productoBuscado, out error1);
            if (error1.Equals(""))
            {
                groupBox1.Enabled         = true;
                gbx_buscarSerie.Enabled   = false;
                btn_modificarProd.Enabled = true;
                this.txt_serie.Text       = txt_buscarSerie.Text;
                this.txt_nombre.Text      = productoBuscado._nombre;
                this.txt_descripcion.Text = productoBuscado._descripcion;
                if (productoBuscado._estadoProducto == true)
                {
                    chkb_activo.Checked = true;
                }
                else
                {
                    chkb_activo.Checked = false;
                }
                this.txt_stock.Text     = string.Concat(productoBuscado._stock);
                this.txt_stockMin.Text  = string.Concat(productoBuscado._stockMinimo);
                this.txt_ubicacion.Text = productoBuscado._ubicacion;
                this.txt_Compra.Text    = string.Concat(productoBuscado._valorCompra);
                NegProveedor negprov = new NegProveedor();
                string       error;
                cmb_proveedor.Items.Clear();
                cmb_proveedor.Items.Insert(0, "Seleccione");
                cmb_proveedor.DropDownStyle = ComboBoxStyle.DropDownList;
                this.listaDeproveedores     = negprov.listarLosProveedores(out error);
                if (String.IsNullOrEmpty(error) == false)
                {
                    this.listaDeproveedores = null;
                    MessageBox.Show(error);
                }

                else
                {
                    foreach (Proveedor prov in listaDeproveedores)
                    {
                        cmb_proveedor.Items.Add(prov._nombreProveedor);
                    }
                    cmb_proveedor.SelectedIndex = productoBuscado._proveedor;
                }
            }
            else
            {
                MessageBox.Show(error1, "Sin Producto", MessageBoxButtons.OK, MessageBoxIcon.Error);
                if (error1.Equals("No hay datos del Producto"))
                {
                    MessageBox.Show("Rellene el formulario para agregar nuevo Producto", "Agregar Productoo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    groupBox1.Enabled       = true;
                    gbx_buscarSerie.Enabled = false;
                    btn_agregar.Enabled     = true;
                    this.txt_serie.Text     = txt_buscarSerie.Text;
                    txt_buscarSerie.Text    = "";
                    NegProveedor negprov = new NegProveedor();
                    string       error;
                    cmb_proveedor.Items.Clear();
                    cmb_proveedor.Items.Insert(0, "Seleccione");
                    cmb_proveedor.SelectedIndex = 0;
                    cmb_proveedor.DropDownStyle = ComboBoxStyle.DropDownList;
                    this.listaDeproveedores     = negprov.listarLosProveedores(out error);
                    if (String.IsNullOrEmpty(error) == false)
                    {
                        this.listaDeproveedores = null;
                        MessageBox.Show(error);
                    }

                    else
                    {
                        foreach (Proveedor prov in listaDeproveedores)
                        {
                            cmb_proveedor.Items.Add(prov._nombreProveedor);
                        }
                    }
                }
            }
        }