Ir al contenido principal

Entradas

Mostrando entradas de diciembre, 2012

28/12/2012 LP III

Crear una BD con el nombre BDLPIII y hacer el siguiente modelo de BD 1. Crear un unidad persistente asociando a nuestra base de datos 2. Creamos las clases entidades desde la BD  3. Creamos un Controlador para las Entidades =================================================================== 4. En el index.jsp dentro del cuerpo del documento ira el codigo de nuestro formulario de Logeo < h1 > Autenticacion Segura - Sistema de Venta Licores </ h1 > < form action = " ServletControl " method = " POST " > < table border = " 1 " > < tbody > < tr > < td > Codigo </ td > < td > < input type = " text " name = " txtCodigo " value = " " /> </ td > </ tr > < tr >

26/12/2012 Usnado Isolated Storage en WP 7

Ejemplo para la siguiente pantalla: Descargar código del siguiente Link  Descarga codigo fuente Imports System . IO . IsolatedStorage Imports System . IO Partial Public Class MainPage Inherits PhoneApplicationPage Dim miAlmacen As IsolatedStorageFile = IsolatedStorageFile . GetUserStoreForApplication Dim directorio As String Dim archivo As String Dim fileStream As IsolatedStorageFileStream ' Constructor Public Sub New ( ) InitializeComponent ( ) End Sub Private Sub btnDirectorio_Click ( sender As System . Object , e As System . Windows . RoutedEventArgs ) Handles btnDirectorio . Click directorio = txtDirectorio . Text miAlmacen . CreateDirectory ( directorio ) End Sub Private Sub btnFile_Click ( sender As System . Object , e As System . Windows . RoutedEventArgs ) Handles btnFile . Click archivo = txtFile . Text fileStream = New

21/12/2012 LPIII

public class Persona {     private String codigo;     private String nombres;     private String edad;     public Persona() {     }     public Persona(String codigo, String nombres, String edad) {         this.codigo = codigo;         this.nombres = nombres;         this.edad = edad;     }     public String escribirXML(){         StringBuilder xml = new StringBuilder();         xml.append("<persona>");         xml.append("<atributos cod='" + this.codigo + "'");         xml.append(" nom='" + this.nombres + "'");         xml.append(" eda='" + this.edad + "'");         xml.append(" />");         xml.append("</persona>");         return xml.toString();     } } En el cliente .NET lo leerimos de la siguiente forma. DENTRO DEL EVENTO CLICK DEL BOTON         Dim servicio As New WSOperacionesClient         Dim xmlPersona As String   

Usando INotifyPropertyChanged para un Contedenor en WP 7

Imports System.ComponentModel Public Class NotifySumar     Implements INotifyPropertyChanged     Public Event propiedadChanged As PropertyChangedEventHandler Implements ComponentModel.INotifyPropertyChanged.PropertyChanged     Private Property _num1 As Integer     Private Property _num2 As Integer     Public Property Num1() As String         Get             Return _num1         End Get         Set(ByVal value As String)             _num1 = value             RaiseEvent propiedadChanged(Me, New PropertyChangedEventArgs(" resultadoOperacion "))         End Set     End Property     Public Property Num2() As String         Get             Return _num2         End Get         Set(ByVal value As String)             _num2 = value             RaiseEvent propiedadChanged(Me, New PropertyChangedEventArgs(" resultadoOperacion "))         End Set     End Property     Public Sub INotifyPropertyChanged(ByVal propertyName As String)         RaiseEvent

Ejemplo event ws WP7

   Private Sub btnIngresar_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles btnIngresar.Click         'Dim usu As String = txtusu.Text         'Dim cla As String = txtcla.Password         'If usu = "luis" And cla = "123" Then         '    NavigationService.Navigate(New Uri("/Perfil.xaml?user=" & usu, UriKind.Relative))         'Else         '    MessageBox.Show("Error al Ingresar", "Error", MessageBoxButton.OK)         'End If         Dim servicio As New Service1SoapClient()         servicio.validarUsuarioAsync("", "")         AddHandler servicio.validarUsuarioCompleted, AddressOf Me.validar_usuarioCompleted     End Sub     Sub validar_usuarioCompleted(ByVal sender As Object, ByVal e As validarUsuarioCompletedEventArgs)         Dim resultado As String = e.Result     End Sub

Ejemplo SQL con .NET

1. Agregamos en el Web.Config el siguiente Key <connectionStrings>       <add name="SQLServerConnection" connectionString="data source=.\SQL2005; Initial Catalog=NOMBRE_BDR; User id=sa; password=sa" providerName="System.Data.SqlClient"/>        </connectionStrings> 2. Para recuperar la cadena de conexion hacemos la siguiente linea, dentro del metodo que lo usara  ConnectionStringSettings ConnectionStringSettings = ConfigurationManager.ConnectionStrings["SQLServerConnection"]; String CadenaConexion = ConnectionStringSettings.ConnectionString;            3. agregamos el siguiente fragmento de codigo para hacer uso de un Procedimiento almacenado, ejemplo si tiene 3 parametros de entrada nuestro SP:             SqlParameter[] par = new SqlParameter[3];             par[0] = new SqlParameter("@PAR1", System.Data.SqlDbType.VarChar, 20);             par[0].Value = VALOR1;             par[1] = new SqlParameter(&q