Beispiel #1
0
        private void editar(long id)
        {
            IDbCommand dbCommand = dbConnection.CreateCommand();

            dbCommand.CommandText = string.Format("select * from articulo where id={0}", id);

            IDataReader dataReader = dbCommand.ExecuteReader();

            dataReader.Read();

            entryNombre.Text       = (string)dataReader["nombre"];
            spinButtonPrecio.Value = Convert.ToDouble((decimal)dataReader["precio"]);

            dataReader.Close();

            saveAction.Activated += delegate {
                Console.WriteLine("saveAction.Activated");

                IDbCommand dbUpdateCommand = dbConnection.CreateCommand();
                dbUpdateCommand.CommandText = "update articulo set nombre=:nombre, precio=:precio where id=:id";

                DbCommandExtensions.AddParameter(dbUpdateCommand, "nombre", entryNombre.Text);
                DbCommandExtensions.AddParameter(dbUpdateCommand, "precio", Convert.ToDecimal(spinButtonPrecio.Value));
                DbCommandExtensions.AddParameter(dbUpdateCommand, "id", id);

                dbUpdateCommand.ExecuteNonQuery();

                Destroy();
            };
        }
Beispiel #2
0
        public IList <Paciente> BuscarPulicoAlvo()
        {
            using (var command = _conn.CreateCommand())
            {
                command.Parameters.Add(DbCommandExtensions.CreateParameter(command, "PO_CURSOR", null, ParameterDirection.Output, OracleDbType.RefCursor));
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "GDD.TESTE_TNH2";

                return(this.ToList(command).ToList());
            }
        }
Beispiel #3
0
        private void nuevo()
        {
            //inicializo los controles que quiera
            entryNombre.Text       = "Pon el nombre";
            spinButtonPrecio.Value = 1;

            saveAction.Activated += delegate {
                Console.WriteLine("saveAction.Activated");

                IDbCommand dbCommand = dbConnection.CreateCommand();
                dbCommand.CommandText = "insert into articulo (nombre, precio) values (:nombre, :precio)";

                DbCommandExtensions.AddParameter(dbCommand, "nombre", entryNombre.Text);
                DbCommandExtensions.AddParameter(dbCommand, "precio", Convert.ToDecimal(spinButtonPrecio.Value));

                dbCommand.ExecuteNonQuery();

                Destroy();
            };
        }
Beispiel #4
0
 public override void AdjustCommand(DbCommand command)
 {
     DbCommandExtensions.ApplyYeke(command);
     base.AdjustCommand(command);
 }