示例#1
0
        public static int agregar(csRepuesto Repuesto)
        {
            int iretorno = 0;

            MySqlCommand cmdInsertar = new MySqlCommand(string.Format("insert into tab_repuesto (descripcion_repto, marca_repto, precio_repto, existencia_repto, idproveedor_repto) values ('{0}', '{1}','{2}','{3}','{4}')", Repuesto.gdesRep, Repuesto.gMarcaRep, Repuesto.gPrecioRep, Repuesto.gExistRep, Repuesto.gIdProvRep), csconectar.conectarse());

            iretorno = cmdInsertar.ExecuteNonQuery();
            return iretorno;
        }
示例#2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (dgvBusRep.SelectedRows.Count == 1)
     {
         int iidRep = Convert.ToInt32(dgvBusRep.CurrentRow.Cells[0].Value);
         gSelectRep = csBuscarDatos.obtener_Rep(iidRep);
         this.Close();
     }
     else
     {
         MessageBox.Show("Debe Seleccionar una Fila.");
     }
 }
示例#3
0
        public static List<csRepuesto> buscar_Rep(int pId_Rep, string pDesRep)
        {
            //PARA DESPLEGAR LOS REGISTROS EN EL DATAGRID

            List<csRepuesto> lista = new List<csRepuesto>();

            MySqlCommand cmdBusqueda = new MySqlCommand(string.Format("select * from tab_repuesto where id_repto = '{0}' or descripcion_repto like '%{1}%'", pId_Rep, pDesRep), csconectar.conectarse());
            MySqlDataReader leer = cmdBusqueda.ExecuteReader();

            while (leer.Read())
            {
                csRepuesto obRepuesto = new csRepuesto();
                obRepuesto.gIdRep = leer.GetInt32(0);
                obRepuesto.gdesRep = leer.GetString(1);
                obRepuesto.gMarcaRep = leer.GetString(2);
                obRepuesto.gPrecioRep = leer.GetInt32(3);
                obRepuesto.gExistRep = leer.GetInt32(4);
                obRepuesto.gIdProvRep = leer.GetInt32(5);

                lista.Add(obRepuesto);
            }

            return lista;
        }
示例#4
0
        public static csRepuesto obtener_Rep(int pIdRep)
        {
            //ENVIA LOS DATOS AL FORMULARIO
            csRepuesto obSelectRep = new csRepuesto();
            //MySqlConnection conn = csconectar.conectarse();

            MySqlCommand cmdObtener = new MySqlCommand(string.Format("select * from tab_repuesto where id_repto = '{0}'", pIdRep), csconectar.conectarse());

            MySqlDataReader leer = cmdObtener.ExecuteReader();

            while (leer.Read())
            {

                obSelectRep.gIdRep = leer.GetInt32(0);
                obSelectRep.gdesRep = leer.GetString(1);
                obSelectRep.gMarcaRep = leer.GetString(2);
                obSelectRep.gPrecioRep = leer.GetInt32(3);
                obSelectRep.gExistRep = leer.GetInt32(4);
                obSelectRep.gIdProvRep = leer.GetInt32(5);

            }

            csconectar.conectarse().Close();
            return obSelectRep;
        }