Exemple #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            Images image = new Images();

            image.Descripcion = richTextBox2.Text;
            image.DateUpdate  = DateTime.Now;
            image.idProducto  = ID;
            if (textBox3.Text == "0")
            {
                image.isEnabled = false;
            }
            else if (textBox3.Text == "1")
            {
                image.isEnabled = true;
            }
            else
            {
                MessageBox.Show("Ingrese un 0 si es descontinuado y 1 si esta en existencia.");
            }
            MemoryStream a = new MemoryStream();

            pictureBox1.Image.Save(a, System.Drawing.Imaging.ImageFormat.Jpeg);
            image.Image = a.ToArray();
            var capBussines = new Shoes_Bussines.CapaNegocio();
            var estado      = capBussines.InsertarImagen(image);

            if (estado == true)
            {
                MessageBox.Show("Se ha insertado su imagen");
            }
            else
            {
                MessageBox.Show("No se ha podido insertar la imagen, compruebe la extension.");
            }
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            var       capEntities     = new Entities.Productos();
            var       capBussines     = new Shoes_Bussines.CapaNegocio();
            Productos agregarProducto = new Productos();

            agregarProducto.idType             = int.Parse(numericUpDown1.Text);
            agregarProducto.idColor            = int.Parse(numericUpDown2.Text);
            agregarProducto.idBrand            = int.Parse(numericUpDown3.Text);
            agregarProducto.idProvider         = int.Parse(numericUpDown4.Text);
            agregarProducto.idCatalog          = int.Parse(numericUpDown5.Text);
            agregarProducto.Tittle             = textBox1.Text;
            agregarProducto.Nombre             = textBox2.Text;
            agregarProducto.Descripcion        = textBox3.Text;
            agregarProducto.Observaciones      = textBox4.Text;
            agregarProducto.PrecioDistribuidor = decimal.Parse(textBox5.Text);
            agregarProducto.PrecioCliente      = int.Parse(textBox6.Text);
            agregarProducto.PrecioMiembro      = int.Parse(textBox7.Text);
            if (textBox8.Text == "0")
            {
                agregarProducto.IsEnabled = false;
                label16.Hide();
            }
            else if (textBox8.Text == "1")
            {
                agregarProducto.IsEnabled = true;
                label16.Hide();
            }
            else
            {
                label16.Text = "Ingrese un 0 si es descontinuado y 1 si esta en existencia.";
            }
            agregarProducto.Keywords   = textBox9.Text;
            agregarProducto.DateUpdate = dateTimePicker1.Value.Date;
            var estado = capBussines.InsertIntoTable(agregarProducto);

            if (estado == true)
            {
                label17.Text = "El producto se ha insertado correctamente";
            }
            else
            {
                label17.Text = "No se ha insertado el producto, no le falta algun campo por llenar?";
            }
            textBox1.Clear();
            textBox2.Clear();
            textBox3.Clear();
            textBox4.Clear();
            textBox5.Clear();
            textBox6.Clear();
            textBox7.Clear();
            textBox8.Clear();
            textBox9.Clear();
            label17.Text = "";
        }
Exemple #3
0
        private void button4_Click(object sender, EventArgs e)
        {
            var capBussines = new Shoes_Bussines.CapaNegocio();
            var nombre      = textBox2.Text;
            var id          = int.Parse(textBox1.Text);
            var estado      = capBussines.DisabledProduct(id, nombre);

            if (estado == true)
            {
                MessageBox.Show("El producto ha sido deshabilitado");
            }
            else
            {
                MessageBox.Show("A ocurrido un error al intentar deshabilitar el producto");
            }
        }
Exemple #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            int id;

            button4.Visible = true;
            var  capaBussines = new Shoes_Bussines.CapaNegocio();
            var  nombre       = textBox2.Text;
            bool res          = int.TryParse(textBox1.Text, out id);
            var  lista        = capaBussines.GetProduct(id, nombre);

            if (lista.Count == 0)
            {
                MessageBox.Show("El producto fue borrado de la bd o nunca existio.");
            }
            dataGridView1.Rows.Clear();
            foreach (var item in lista)
            {
                if (item.IsEnabled == false)
                {
                    MessageBox.Show("El producto esta descontinuado.");
                }
                else
                {
                    DataGridViewRow row = new DataGridViewRow();
                    row.Cells.Add(new DataGridViewTextBoxCell {
                        Value = item.id
                    });
                    row.Cells.Add(new DataGridViewTextBoxCell {
                        Value = item.Nombre
                    });
                    row.Cells.Add(new DataGridViewTextBoxCell {
                        Value = item.Tittle
                    });
                    row.Cells.Add(new DataGridViewTextBoxCell {
                        Value = item.Descripcion
                    });
                    row.Cells.Add(new DataGridViewTextBoxCell {
                        Value = item.PrecioCliente
                    });
                    dataGridView1.Rows.Add(row);
                }
            }
        }
Exemple #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            var       capBussines = new Shoes_Bussines.CapaNegocio();
            Productos p           = new Productos();

            p.id     = int.Parse(textBox2.Text);
            p.Nombre = textBox1.Text;
            var Color = comboBox1.Text;

            if (Color == "Azul")
            {
                p.idColor = 1;
            }
            else if (Color == "Rojo")
            {
                p.idColor = 2;
            }
            else if (Color == "Verde")
            {
                p.idColor = 3;
            }
            else if (Color == "Negro")
            {
                p.idColor = 4;
            }
            else if (Color == "Blanco")
            {
                p.idColor = 5;
            }
            p.Descripcion = richTextBox1.Text;
            var estado = capBussines.UpdateProduct(p);

            if (estado == false)
            {
                MessageBox.Show("No se actualizo el producto");
            }
            else
            {
                MessageBox.Show("El producto ha sido actualizado");
            }
        }
Exemple #6
0
        private void Form3_Load(object sender, EventArgs e)
        {
            var capBussines = new Shoes_Bussines.CapaNegocio();
            var listColors  = capBussines.ObtenerColores();

            textBox2.Text = ID.ToString();
            foreach (var item in listColors)
            {
                comboBox1.Items.Add(item.Name);
            }
            var listSizes = capBussines.ObtenerTallas();

            foreach (var item in listSizes)
            {
                comboBox2.Items.Add(item.Code);
            }
            var images = capBussines.ObtenerImagenes(ID);

            foreach (var item in images)
            {
                MemoryStream ms = new MemoryStream(item.Image);
                PictureBox   p  = new PictureBox()
                {
                    Image       = new Bitmap(ms),
                    BorderStyle = BorderStyle.Fixed3D,
                    Height      = 500,
                    Width       = 900,
                    Top         = Height * flowLayoutPanel1.Controls.Count
                };
                flowLayoutPanel1.Controls.Add(p);
            }
            label7.Visible       = false;
            label8.Visible       = false;
            richTextBox2.Visible = false;
            textBox3.Visible     = false;
            button3.Visible      = false;
        }