Beispiel #1
0
        private void AgregarBitacota(BitacoraTraslado prod)
        {
            try
            {
                //conectionstring cadena de instrucciones para conectarse a la base de datos
                using (SqlConnection conn = new SqlConnection())
                {
                    conn.ConnectionString = Conectar.cnn;
                    conn.Open();

                    //sql stuctured querly
                    //insert into *NOMBRE DE LA TABLA* values(pasan los parametros y se manda la conexión)
                    SqlCommand insertCommand = new SqlCommand("INSERT INTO BitacoraTraslado VALUES (@IdCategoria,@IdPersonal," +
                                                              "@IdProductoBDInicio,@IdBodega,@FechaIngreso,@Cantidad,@IdProductoBDDestino," +
                                                              "@IdBodegaFinal,@FechaTraslado)", conn);
                    insertCommand.Parameters.Add(new SqlParameter("IdCategoria", prod.IdCategoria));
                    insertCommand.Parameters.Add(new SqlParameter("IdPersonal", prod.IdPersonal));
                    insertCommand.Parameters.Add(new SqlParameter("IdProductoBDInicio", prod.IdProductoBDInicio));
                    insertCommand.Parameters.Add(new SqlParameter("IdBodega", prod.IdBodega));
                    insertCommand.Parameters.Add(new SqlParameter("FechaIngreso", prod.FechaIngreso));
                    insertCommand.Parameters.Add(new SqlParameter("Cantidad", prod.Cantidad));
                    insertCommand.Parameters.Add(new SqlParameter("IdProductoBDDestino", prod.IdProductoBDDestino));
                    insertCommand.Parameters.Add(new SqlParameter("IdBodegaFinal", prod.IdBodegaFinal));
                    insertCommand.Parameters.Add(new SqlParameter("FechaTraslado", prod.FechaTraslado));
                    insertCommand.ExecuteScalar();
                    MessageBox.Show("PARA VER EL REPORTE DE TRASLADO DIRIJASE A LA PESTAÑA TRASLADO Y SELECCIONE REPORTE \n", " TRASLADO", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #2
0
        private void llenarbitacora()
        {
            var idpersonal = Convert.ToInt32(comboBox5.SelectedValue);

            int nombog      = 0;
            int devprod     = 0;
            int nombogfinal = 0;

            //validar combobox de acuerdo a la bodega
            if (comboBox3.Text == "Express Home")
            {
                nombogfinal = 11;
            }
            if (comboBox3.Text == "Super Casa")
            {
                nombogfinal = 12;
            }
            if (comboBox3.Text == "Super Ecomax")
            {
                nombogfinal = 13;
            }
            if (comboBox3.Text == "Todo en Casa")
            {
                nombogfinal = 14;
            }
            if (comboBox3.Text == "Rapishop")
            {
                nombogfinal = 15;
            }


            //validar combobox de acuerdo a la bodega inicial
            if (comboBox2.Text == "Express Home")
            {
                nombog = 11;
            }
            if (comboBox2.Text == "Super Casa")
            {
                nombog = 12;
            }
            if (comboBox2.Text == "Super Ecomax")
            {
                nombog = 13;
            }
            if (comboBox2.Text == "Todo en Casa")
            {
                nombog = 14;
            }
            if (comboBox2.Text == "Rapishop")
            {
                nombog = 15;
            }



            //validar datos de acuerdo a idmarca

            if (comboBox1.Text == "Granos")
            {
                devprod = 1;
            }
            if (comboBox1.Text == "Pastas")
            {
                devprod = 2;
            }
            if (comboBox1.Text == "Lacteos")
            {
                devprod = 3;
            }
            if (comboBox1.Text == "Bebidas")
            {
                devprod = 4;
            }
            if (comboBox1.Text == "Carniceria")
            {
                devprod = 5;
            }
            if (comboBox1.Text == "Higiene")
            {
                devprod = 6;
            }
            if (comboBox1.Text == "Librería")
            {
                devprod = 7;
            }
            if (comboBox1.Text == "Jardinería")
            {
                devprod = 8;
            }
            if (comboBox1.Text == "Mascotas")
            {
                devprod = 9;
            }
            if (comboBox1.Text == "Prod. Enlatados")
            {
                devprod = 11;
            }
            if (comboBox1.Text == "Especias")
            {
                devprod = 12;
            }
            if (comboBox1.Text == "Panaderia")
            {
                devprod = 13;
            }
            if (comboBox1.Text == "Ropa")
            {
                devprod = 14;
            }
            if (comboBox1.Text == "Accesorios")
            {
                devprod = 15;
            }
            if (comboBox1.Text == "Prod. Hogar")
            {
                devprod = 16;
            }
            if (comboBox1.Text == "Limpieza")
            {
                devprod = 17;
            }
            if (comboBox1.Text == "Herramientas")
            {
                devprod = 18;
            }
            if (comboBox1.Text == "Otro.")
            {
                devprod = 26;
            }


            var tras = new BitacoraTraslado()
            {
                IdCategoria         = devprod,
                IdPersonal          = idpersonal,
                IdProductoBDInicio  = int.Parse(txtidprod.Text),
                IdProductoBDDestino = int.Parse(textBox6.Text),
                IdBodega            = nombog,
                IdBodegaFinal       = nombogfinal,
                FechaIngreso        = Convert.ToDateTime(textBox7.Text),
                FechaTraslado       = Convert.ToDateTime(textBox8.Text),
                Cantidad            = int.Parse(txtingeresoproducto.Text)
            };

            AgregarBitacota(tras);
        }