예제 #1
0
        //Metodo CRUD DELETE
        public bool Eliminar(UnidadBLL unidadBLL)
        {
            SqlCommand sqlCommand = new SqlCommand("DELETE FROM Unidad WHERE ID = @ID"); //Creamos el comando

            sqlCommand.Parameters.Add("@ID", SqlDbType.Int).Value = unidadBLL.ID;        //Agregamos los parametros
            return(conexion.EjecutarComandoSinRetornoDatos(sqlCommand));                 //Ejecutamos el comando
        }
예제 #2
0
        public FormUnidades()
        {
            unidadDAL = new UnidadDAL(); //Se crean el cliente para la base
            unidadBLL = new UnidadBLL(); //Se crea el molde para uso y llenado

            InitializeComponent();
            btnEditar.Visible      = false;
            buttoneliminar.Visible = false;
            LlenarGrid();
            //dataGridView1.Rows.Insert(0, "1", "AEO-159-54", "Volador", "3.5", "417029762", "El águila 564564161");
        }
예제 #3
0
        private UnidadBLL RecuperarInformacion()
        {
            UnidadBLL unidadBLL = new UnidadBLL();

            unidadBLL.Placa         = txtPlacas.Text;
            unidadBLL.Modelo        = txtModelo.Text;
            unidadBLL.Seguro        = txtseguro.Text;
            unidadBLL.Capacidad     = txtcapacidad.Text;
            unidadBLL.numeroDeSerie = txtnoserie.Text;
            unidadBLL.Operador      = txtOperador.Text;
            unidadBLL.Telefono      = txtTelefono.Text;
            unidadBLL.ID            = IDAux;
            return(unidadBLL);
        }
예제 #4
0
        //Metodo CRUD CREATE
        public bool Agregar(UnidadBLL unidadBLL)
        {
            SqlCommand sqlCommand = new SqlCommand("INSERT INTO Unidad(placa, modelo, seguro, capacidad, numero_serie, operador, telefono) VALUES(@placa,@modelo,@seguro,@capacidad,@numero_serie,@operador,@telefono) "); //Creamos el comando

            sqlCommand.Parameters.Add("@placa", SqlDbType.VarChar).Value        = unidadBLL.Placa;                                                                                                                         //Agregamos los parametros
            sqlCommand.Parameters.Add("@modelo", SqlDbType.VarChar).Value       = unidadBLL.Modelo;
            sqlCommand.Parameters.Add("@seguro", SqlDbType.VarChar).Value       = unidadBLL.Seguro;
            sqlCommand.Parameters.Add("@capacidad", SqlDbType.VarChar).Value    = unidadBLL.Capacidad;
            sqlCommand.Parameters.Add("@numero_serie", SqlDbType.VarChar).Value = unidadBLL.numeroDeSerie;
            sqlCommand.Parameters.Add("@operador", SqlDbType.VarChar).Value     = unidadBLL.Operador;
            sqlCommand.Parameters.Add("@telefono", SqlDbType.VarChar).Value     = unidadBLL.Telefono;
            return(conexion.EjecutarComandoSinRetornoDatos(sqlCommand));//Ejecutamos el comando

            //return conexion.EjecutarComandoSinRetornoDatos("INSERT INTO Cliente(Empresa, Direccion, RFC, Contacto, Giro) VALUES('"+clienteBLL.Empresa+ "', '" + clienteBLL.Direccion + "', '" + clienteBLL.RFC + "', '" + clienteBLL.Contacto + "', '" + clienteBLL.Giro + "')");
        }
예제 #5
0
        //Metodo CRUD UPDATE
        public bool Modificar(UnidadBLL unidadBLL)
        {
            SqlCommand sqlCommand = new SqlCommand("UPDATE Unidad SET placa=@placa, seguro=@seguro, capacidad=@capacidad, numero_serie=@numero_serie, operador=@operador, telefono=@telefono WHERE ID=@ID"); //Creamos el comando

            sqlCommand.Parameters.Add("@placa", SqlDbType.VarChar).Value        = unidadBLL.Placa;                                                                                                           //Agregamos los parametros
            sqlCommand.Parameters.Add("@seguro", SqlDbType.VarChar).Value       = unidadBLL.Seguro;
            sqlCommand.Parameters.Add("@capacidad", SqlDbType.VarChar).Value    = unidadBLL.Capacidad;
            sqlCommand.Parameters.Add("@numero_serie", SqlDbType.VarChar).Value = unidadBLL.numeroDeSerie;
            sqlCommand.Parameters.Add("@operador", SqlDbType.VarChar).Value     = unidadBLL.Operador;
            sqlCommand.Parameters.Add("@modelo", SqlDbType.VarChar).Value       = unidadBLL.Modelo;
            sqlCommand.Parameters.Add("@telefono", SqlDbType.VarChar).Value     = unidadBLL.Telefono;
            sqlCommand.Parameters.Add("@ID", SqlDbType.Int).Value = unidadBLL.ID;

            //MessageBox.Show(" "+clienteBLL.ID +clienteBLL.Empresa+clienteBLL.Direccion);

            return(conexion.EjecutarComandoSinRetornoDatos(sqlCommand));//Ejecutamos el comando
        }