CASOS DE USO
Grafica 10 48 : modelo por capa
7.5 REQUERIMIENTOS MÍNIMOS DEL HARDWARE Y SOFTWARE PARA EL DESARROLLO DE LA APLICACIÓN
7.5.4 F unción de acceso a la búsqueda.
Una vez cargada la aplicación en el interpretador, nos debemos ubicar el botón de ejecución, grafica 11, en ese momento se debe ejecutando la pantalla de la aplicación de búsqueda:
• El usuario debe visualizar la pantalla de búsqueda.
• En el momento en el que el usuario inicia el proceso de búsqueda, la pantalla principal debe arrojar datos, sino, presentará en pantalla un error, dicha funcionalidad a un control se utiliza la siguiente sentencia:
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">
<title>Error en la aplicación</title> </head>
<body>
<form id="form1" runat="server"> <div>
<h3>Error en la Aplicacion</h3> <input type="button" value="Volver" onclick="javascript:history.go(-1);" /> </div>
</form> </body> </html>
• Cuando se procede a realizar la búsqueda y esta nos presenta su contenido, dicho evento al iniciar valida el código de la interacción de la capa de negocios.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebBuscadores._Default" %>
<%@ Register src="~/VistaAutomatico.ascx" TagName="Automatico" TagPrefix="au1" %>
<%@ Register src="~/BusquedaAvanzada.ascx" TagName="Busqueda" TagPrefix="bus" %>
<%@ Register Assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<link type="text/css" href="../../Resources/estiloBuscador.css" rel="Stylesheet" />
<link type="text/css" href="../../Resources/jquery-ui-1.8.2.custom.css" rel="Stylesheet" />
<script type="text/javascript" src="../../Resources/jquery-1.3.2- vsdoc.js"></script>
<script type="text/javascript" src="../../Resources/jquery- 1.3.2.js"></script>
<script type="text/javascript" src="../../Resources/ui.core.js"></script> <script type="text/javascript"
src="../../Resources/ui.draggable.js"></script> <script type="text/javascript"
src="../../Resources/ui.resizable.js"></script>
<script type="text/javascript" src="../../Resources/ui.dialog.js"></script> <script type="text/javascript"
src="../../Resources/effects.core.js"></script> <script type="text/javascript"
src="../../Resources/effects.highlight.js"></script> <script type="text/javascript"
src="../../Resources/bgiframe/jquery.bgiframe.js"></script> <script type="text/javascript"
src="../../Resources/jquery.blockUI.js"></script>
<script type="text/javascript" >
var valor = 0;
$(function(){
$('#lnkBusqueda').click(function(){ ValidarBuscadores();
if(valor<2) {
//alert("Debe seleccionar al menos 2 buscadores"); }
else {
$('#dialogoBusqueda').dialog('open'); }
});
$('#ckAutomatico').click(function(){ ValidarBuscadores();
if(valor<2) {
$(this).attr('checked',false);//alert("Debe seleccionar al menos 2 buscadores");
} else {
ObtenerTemasAutos();
$('#dialogoAutomatico').dialog('open'); } }); $('#dialogoAutomatico').dialog({
resizable:true, autoOpen: false, width: 500, modal: true, closeOnEscape : false, //close : SaveAddInfClose, }); $('#dialogoBusqueda').dialog({ bgiframe: true, resizable:true, autoOpen: false, width: 600, modal: true, closeOnEscape : false, //close : SaveAddInfClose, }); }); function ValidarBuscadores() {
var yahoo= $('#yahoo').attr('checked'); if(yahoo== true)
valor= valor + 1;
var google= $('#google').attr('checked'); if(google== true)
valor= valor + 1;
var altavista= $('#altavista').attr('checked'); if(altavista== true)
valor= valor + 1;
var lycos= $('#lycos').attr('checked'); if(lycos== true)
valor= valor + 1;
var bing= $('#bing').attr('checked'); if(bing== true)
valor= valor + 1;
if(valor < 2) {
alert("Se debe seleccionar al menos 2 buscadores"); valor = 0; return false; } else { return true; } } function ObtenerTemasAutos() { $.ajax({
//cache: false,
url:"Default.aspx/ObtenerAutomaticos", data: "{}",
contentType: "application/json; charset=utf-8", dataType: "json",
success: function(response) { var temas = (typeof response.d) == 'string' ?
eval('(' + response.d + ')') : response.d;
$('#tbAutomaticos').empty();
$('#tbAutomaticos').append('<tr><td></td><td><b>Tema</b></td><td></td></tr> ');
for (var i = 0; i < temas.length; i++) { $('#tbAutomaticos').append('<tr>' + '<td><input type="Radio" id="'+temas[i]+'" /></td>' + '<td>' + temas[i] + '</td>' + '<td><input type="button"
id="'+temas[i]+'" value="Eliminar" class="ButtonL"/></td>' + '</tr>');
} },
error: function(result) {
alert('error'+result); }
}); }
</script>
<title>Buscar Información</title> </head>
<body>
<form id="form1" runat="server" > <div class="bannerCentral">
<div class="bannerDer" > <p></p>
<p></p>
<img src="Resources/google.jpg" alt="google" width="95%" height="60px"/>
<p></p> <p></p>
<img src="Resources/yahoo.gif" alt="yahoo" width="95%" height="60px"/>
<p></p>
<p></p>
<img src="Resources/altavista_logo.gif" alt="altavista" width="95%" height="60px"/>
<img src="Resources/lycos.jpg"alt="lycos" width="95%" height="60px" />
<p></p> <p></p>
<img src="Resources/bing.jpg"alt="bing" width="95%" height="60px"/> </div>
<div class="bannerIzq"> <p></p>
<p></p>
<img src="Resources/altavista_logo.gif" alt="altavista" width="95%" height="60px"/>
<p></p> <p></p>
<img src="Resources/lycos.jpg"alt="lycos" width="95%" height="60px" />
<p></p> <p></p>
<img src="Resources/bing.jpg"alt="bing" width="95%" height="60px"/> <p></p>
<p></p>
<img src="Resources/google.jpg" alt="google" width="95%" height="60px"/>
<p></p> <p></p>
<img src="Resources/yahoo.gif" alt="yahoo" width="95%" height="60px"/>
</div>
<div class="bannerMedio" >
<div align="center" style="background-color:Black"> <fieldset class="fieldset">
<legend><font color="#336699" size="6">Aplicacion</font></legend>
<p align="center" class="colorTitulo">Ingrese aquí la cadena de TEXTO</p>
<table class="tableDatos"> <tr>
<td>
<label for="BUSCAR">Buscar:</label> </td>
<td align="left" >
<asp:TextBox ID="txtBuscar" runat="server" Width="265px"></asp:TextBox>
</td>
<td align="left" >
<a href="#" id="lnkBusqueda" class="color" >Búsqueda Avanzada</a>
</td>
</tr> </table>
<p></p>
<div style="font-size:larger;" class="tableDatos"> <asp:CheckBox Text="Google" runat="server" ID="google"/> <asp:CheckBox Text="Yahoo" runat="server" ID="yahoo"/> <asp:CheckBox Text="Altavista" runat="server"
ID="altavista"/> </div> <p></p>
<asp:CheckBox Text="Bing" runat="server" ID="bing"/> </div>
<p></p>
<div style="font-size:larger" class="tableDatos"> <asp:Button ID="btnBuscar" Text="Buscar" Width="100"
Height="35" BackColor="AliceBlue" runat="server" onclick="btnBuscar_Click" OnClientClick="return ValidarBuscadores();" /> <asp:CheckBox runat="server" Text="Automático"
id="ckAutomatico"/> </div> </fieldset> </div> </div> </div> </form>
<div id="dialogoAutomatico" style="display:none;font-size:smaller" title="Automático" >
<au1:Automatico ID="VistaAutomatico" runat="server" /> </div>
<div id="dialogoBusqueda" style="display:none;font-size:smaller" title="Búsqueda Avanzada" >
<bus:Busqueda ID="BusquedaAvanzada" runat="server" /> </div>
</body>
</html>
En este método se realiza la comunicación respectiva con el manejador de la base de datos de Asp, ya que cada uno de estos será almacenado para su posterior presentación.