예제 #1
0
        void cargargrid(string consulta = "select top(50) CodigoM as [Marca], CodigoP as [Producto], CodigoT as Tipo, Cantidad,Precio as [Precio x Uni.],Fecha from ventas")
        {
            AccesoDatos aq = new AccesoDatos();
            DataTable   t  = aq.ObtenerTabla("ventas", consulta);

            for (int i = 0; i < t.Columns.Count; i++)
            {
                if (i == 2)
                {
                    gv.Columns.Add("Detalle Producto", "Detalle Producto");
                }

                gv.Columns.Add(t.Columns[i].ColumnName, t.Columns[i].ColumnName);
            }

            for (int i = 0; i < t.Rows.Count; i++)
            {
                gv.Rows.Add();
                Producto p = new Producto(t.Rows[i][0].ToString(), t.Rows[i][1].ToString());
                gv.Rows[i].Cells[0].Value = Marca.Nombre_Marca(t.Rows[i][0].ToString());
                gv.Rows[i].Cells[1].Value = p.get_NombreP();
                gv.Rows[i].Cells[2].Value = p.get_DetalleP();
                gv.Rows[i].Cells[3].Value = t.Rows[i][2].ToString();
                gv.Rows[i].Cells[4].Value = t.Rows[i][3].ToString();
                gv.Rows[i].Cells[5].Value = t.Rows[i][4].ToString();
                gv.Rows[i].Cells[6].Value = t.Rows[i][5].ToString();
            }
            gv.ReadOnly = true;
        }
예제 #2
0
 private void Ventas_salida_Load(object sender, EventArgs e)
 {
     marcat.Text   = Marca.Nombre_Marca(p.get_codigoM());
     nombret.Text  = p.get_NombreP();
     detallet.Text = p.get_DetalleP();
     v.codigoT     = p.get_CodigoT();
     v.precio      = float.Parse(p.get_precio());
 }
예제 #3
0
 void cargartext()
 {
     Marcat.Text  = Marca.Nombre_Marca(p.get_codigoM());
     Codigo.Text  = p.get_CodigoP();
     Nombre.Text  = p.get_NombreP();
     tipo.Text    = p.get_CodigoT();
     Detalle.Text = p.get_DetalleP();
     stock.Text   = p.get_stock().ToString();
     precio.Text  = p.get_precio();
 }
예제 #4
0
        private void Alta_producto_Load(object sender, EventArgs e)
        {
            p = new Producto(marca, textBox1.Text);
            if (p.validar_Existe() == -1)
            //validar que no exista ya el producto ?
            {
                if (p.get_codigoM() == "")
                {
                    //saber que marcas existen y cargarlas en el combobox.
                    DataTable t = Marca.Todas_Marcas();
                    for (int i = 0; i < t.Rows.Count; i++)
                    {
                        if (marca == t.Rows[i][0].ToString())
                        {
                            comboBox1.Items.Clear();
                            comboBox1.Items.Add(t.Rows[i][1].ToString());    // intentar asociar con el codigo x defecto a la marca.
                            comboBox1.SelectedIndex = comboBox1.Items.Count - 1;
                            // tipo.Items.Add(p.tipo_string());

                            i = t.Rows.Count;
                        }
                        else
                        {
                            comboBox1.Items.Add(t.Rows[i][1].ToString());
                        }
                    }
                    tipo.Items.Add("Perfumes");
                    tipo.Items.Add("Colores");
                    tipo.SelectedIndex = 0;
                }
                else
                {
                    if (p.get_CodigoP() != "")
                    {
                        comboBox1.Items.Add(Marca.Nombre_Marca(p.get_codigoM()));
                        comboBox1.SelectedIndex = 0;
                    }
                }
            }
            else
            {
                MessageBox.Show("Ya existe ese codigo de producto en esta marca.");
                this.Close();
            }
        }