Ejemplo de uso de los controles MS CUI

Aqui va un poco de código de la aplicacion que actualmente estoy haciendo, en la cual estoy incorporando los controles de MS CUI, usando como base de datos MySQL y no XML como el ejemplo que trae la documentación.

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim intIDMedico As Integer
Dim intIDPaciente As Integer
Dim odsPacientes As Data.DataSet
Dim odsDireccion As Data.DataSet
Dim dsPacientes As New Pacientes
Dim dsDireccion As New Direcciones
Dim opcionGenero As String
If Not Request.Cookies("IDMedico") Is Nothing Then
intIDMedico = Server.HtmlEncode(Request.Cookies("IDMedico").Value)
End If
If Not Request.QueryString("ID") Is Nothing Then
intIDPaciente = Request.QueryString("ID")
Response.Cookies("IDPaciente").Value = intIDPaciente
Else
If Not Request.Cookies("IDPaciente") Is Nothing Then
intIDPaciente = Server.HtmlEncode(Request.Cookies("IDPaciente").Value)
End If

End If

odsAntecedentes.SelectParameters("intIDPaciente").DefaultValue = intIDPaciente
odsPacientes = dsPacientes.obtenerPorIDPaciente(intIDPaciente)

'Llenar datos del paciente
opcionGenero = odsPacientes.Tables(0).Rows(0).Item("Genero").ToString
If opcionGenero = "F" Then
PatientBanner1.Gender = NhsCui.Toolkit.PatientGender.Female
PatientBanner1.PatientImage = "/images/generic-female.gif"
ImageButtonModificar.ImageUrl = "~/images/pacientes/modificarPacientesFem.gif"

Else
PatientBanner1.Gender = NhsCui.Toolkit.PatientGender.Male
PatientBanner1.PatientImage = "/images/generic-male.gif"
ImageButtonModificar.ImageUrl = "~/images/pacientes/modificarPacientesMas.gif"
End If
If Not IsDBNull(odsPacientes.Tables(0).Rows(0).Item("Foto")) Then
PatientBanner1.PatientImage = "/images/pacientes/" & odsPacientes.Tables(0).Rows(0).Item("Foto")
End If
PatientBanner1.GivenName = odsPacientes.Tables(0).Rows(0).Item("Nombre").ToString
PatientBanner1.FamilyName = odsPacientes.Tables(0).Rows(0).Item("ApellidoPaterno").ToString & " " & odsPacientes.Tables(0).Rows(0).Item("ApellidoMaterno").ToString
PatientBanner1.DateOfBirth = odsPacientes.Tables(0).Rows(0).Item("FechaNacimiento").ToString
PatientBanner1.Identifier = odsPacientes.Tables(0).Rows(0).Item("NumeroIdentificacion").ToString
PatientBanner1.Title = odsPacientes.Tables(0).Rows(0).Item("Titulo").ToString
PatientBanner1.MobilePhoneNumber = odsPacientes.Tables(0).Rows(0).Item("TelefonoCelular").ToString
PatientBanner1.WorkPhoneNumber = odsPacientes.Tables(0).Rows(0).Item("Telefono2").ToString
PatientBanner1.HomePhoneNumber = odsPacientes.Tables(0).Rows(0).Item("Telefono").ToString
PatientBanner1.EmailAddress = odsPacientes.Tables(0).Rows(0).Item("Email").ToString

End Sub




 La verdad es que el control trabaja relindo (dirian los Args), tengo un par de archivos que estan haciendo las conexiones a MySQL mediante objetos. Todo esto con VB, y no en C# como todo el mundo:

Imports Microsoft.VisualBasic
Imports System.Web
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Data
Imports MySql.Data.MySqlClient
Imports System
Imports System.Configuration

Public Class Pacientes

Imports System.Data.SqlClient

Public Function obtenerPorIDPaciente(ByVal IDPaciente As Integer) As DataSet
Dim conn As New MySqlConnection
Dim myCommand As New MySqlCommand
Dim myAdapter As New MySqlDataAdapter
Dim myData As New DataSet
Dim SQL As String
Dim opcion As Boolean

SQL = "SELECT * FROM pacientes WHERE IDPaciente=" & IDPaciente.ToString
conn.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings("emConnectionString").ConnectionString

Try
conn.Open()

Try
myCommand.Connection = conn
myCommand.CommandText = SQL

myAdapter.SelectCommand = myCommand
myAdapter.Fill(myData)

If (myData Is DBNull.Value) Then
opcion = True
Else
opcion = False
End If

Catch myerror As MySqlException
'Response.Write("There was an error reading from the database: " & myerror.Message)
End Try
Catch myerror As MySqlException
'Response.Write("Error connecting to the database: " & myerror.Message)
Finally
'If conn.State <> ConnectionState.Closed Then

'End If
conn.Close()
End Try
Return myData
End FunctionPublic Class Pacientes

End Class



 


La pantalla se ve de lujo (eso digo yo):


expediaMedicus - Datos Generales del Paciente

Comentarios

Entradas más populares de este blog

Yahoo! UI (yui) TabView como menu horizontal.

Truco: usar Firefox en el portal IDSE del IMSS

Visual Web Express Edition con MS Access Membership