Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            var       CEntities = new Entities.Productos();
            Productos adProc    = new Productos();

            adProc.IdType           = int.Parse(numericUpDown1.Text);
            adProc.IdColor          = int.Parse(numericUpDown5.Text);
            adProc.IdBrand          = int.Parse(numericUpDown2.Text);
            adProc.IdProvider       = int.Parse(numericUpDown3.Text);
            adProc.IdCatalog        = int.Parse(numericUpDown4.Text);
            adProc.Title            = textBox1.Text;
            adProc.Nombre           = textBox7.Text;
            adProc.Description      = textBox6.Text;
            adProc.Observations     = textBox5.Text;
            adProc.PriceDistributor = Decimal.Parse(textBox3.Text);
            adProc.PriceClient      = Decimal.Parse(textBox4.Text);
            adProc.PriceMember      = Decimal.Parse(textBox2.Text);
            adProc.IsEnabled        = bool.Parse(textBox9.Text);

            adProc.Keywords   = textBox8.Text;
            adProc.DateUpdate = Convert.ToDateTime(dateTimePicker1.Text);
            var buss = new Bussines.BProducts();

            buss.Insertar(adProc);
        }
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 = "";
        }