Horribly scrubby GTS web search.

This commit is contained in:
Greg Edwards
2015-03-25 19:58:47 -04:00
parent b21bca37f9
commit 626e143516
7 changed files with 241 additions and 8 deletions

View File

@@ -0,0 +1,5 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="PokemonPicker.ascx.cs" Inherits="PkmnFoundations.Web.controls.PokemonPicker" %>
<%-- todo: implement ajax pokemon picker --%>
(todo)<br />
<asp:TextBox ID="txtSpecies" runat="server" />

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace PkmnFoundations.Web.controls
{
public partial class PokemonPicker : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
public String Value
{
get
{
return txtSpecies.Text;
}
set
{
txtSpecies.Text = value;
}
}
}
}

View File

@@ -0,0 +1,24 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace PkmnFoundations.Web.controls {
public partial class PokemonPicker {
/// <summary>
/// txtSpecies control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtSpecies;
}
}

View File

@@ -1,5 +1,6 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/masters/MasterPage.master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="PkmnFoundations.GTS.AllPokemon" %>
<%@ Register TagPrefix="pf" Namespace="PkmnFoundations.Web" Assembly="PkmnFoundations.Web" %>
<%@ Register TagPrefix="pf" TagName="PokemonPicker" Src="~/controls/PokemonPicker.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cpHead" runat="server">
<pf:HeaderColour ID="HeaderColour1" CssClass="gts" runat="server" />
@@ -7,7 +8,69 @@
<asp:Content ID="Content2" ContentPlaceHolderID="cpMain" runat="server">
<h1>Generation IV</h1>
<form id="theForm" runat="server">
<div class="gtsBox">
Please enter your search terms:
<table class="formtbl">
<tr>
<th>Species</th>
<th>Level</th>
<th>Gender</th>
<th>Version</th>
<td></td>
</tr>
<tr>
<td>
<pf:PokemonPicker ID="ppSpecies" runat="server" />
</td>
<td>
<asp:TextBox ID="txtLevelMin" type="number" min="1" max="100" Text="1" runat="server" />
to
<asp:TextBox ID="txtLevelMax" type="number" min="1" max="100" Text="100" runat="server" />
</td>
<td>
<asp:RadioButtonList ID="rbGender" runat="server">
<asp:ListItem Text="Male" Value="1" />
<asp:ListItem Text="Female" Value="2" />
<asp:ListItem Text="Any" Value="3" Selected="True" />
</asp:RadioButtonList>
</td>
<td>
<asp:RadioButton ID="rbGen4" GroupName="grpGeneration" Checked="true" runat="server" />
<asp:Label ID="lblGen4" AssociatedControlID="rbGen4" runat="server">
<asp:Image ImageUrl="~/images/ver-icon/10.png" CssClass="sprite"
Width="32" Height="32" AlternateText="Diamond" runat="server" />
<asp:Image ImageUrl="~/images/ver-icon/11.png" CssClass="sprite"
Width="32" Height="32" AlternateText="Pearl" runat="server" />
<asp:Image ImageUrl="~/images/ver-icon/12.png" CssClass="sprite"
Width="32" Height="32" AlternateText="Platinum" runat="server" />
<asp:Image ImageUrl="~/images/ver-icon/7.png" CssClass="sprite"
Width="32" Height="32" AlternateText="Heart Gold" runat="server" />
<asp:Image ImageUrl="~/images/ver-icon/8.png" CssClass="sprite"
Width="32" Height="32" AlternateText="Soul Silver" runat="server" />
</asp:Label>
<br />
<asp:RadioButton ID="rbGen5" GroupName="grpGeneration" runat="server" />
<asp:Label ID="lblGen5" AssociatedControlID="rbGen5" runat="server">
<asp:Image ImageUrl="~/images/ver-icon/21.png" CssClass="sprite"
Width="32" Height="32" AlternateText="Black" runat="server" />
<asp:Image ImageUrl="~/images/ver-icon/20.png" CssClass="sprite"
Width="32" Height="32" AlternateText="White" runat="server" />
<asp:Image ImageUrl="~/images/ver-icon/23.png" CssClass="sprite"
Width="32" Height="32" AlternateText="Black 2" runat="server" />
<asp:Image ImageUrl="~/images/ver-icon/22.png" CssClass="sprite"
Width="32" Height="32" AlternateText="White 2" runat="server" />
</asp:Label>
</td>
<td>
<asp:Button ID="btnSearch" Text="Search" runat="server" />
</td>
</tr>
</table>
</div>
</form>
<asp:Repeater ID="rptPokemon4" runat="server">
<HeaderTemplate>
@@ -38,7 +101,7 @@
</asp:Repeater>
<h1>Generation V</h1>
<asp:Repeater ID="rptPokemon5" runat="server">
<HeaderTemplate>

View File

@@ -18,13 +18,27 @@ namespace PkmnFoundations.GTS
{
m_pokedex = (Pokedex.Pokedex)Application["pkmncfPokedex"];
GtsRecord4[] records4 = Database.Instance.GtsSearch4(0, 0, Genders.Either, 0, 0, 0, -1);
rptPokemon4.DataSource = records4;
rptPokemon4.DataBind();
int species; Int32.TryParse(ppSpecies.Value, out species);
int minLevel = Convert.ToInt32(txtLevelMin.Text);
int maxLevel = Convert.ToInt32(txtLevelMax.Text);
Genders gender = (Genders)Convert.ToInt32(rbGender.SelectedValue);
GtsRecord5[] records5 = Database.Instance.GtsSearch5(0, 0, Genders.Either, 0, 0, 0, -1);
rptPokemon5.DataSource = records5;
rptPokemon5.DataBind();
if (rbGen4.Checked)
{
GtsRecord4[] records4 = Database.Instance.GtsSearch4(0, (ushort)species, gender, (byte)minLevel, (byte)maxLevel, 0, -1);
rptPokemon4.DataSource = records4;
rptPokemon4.DataBind();
rptPokemon4.Visible = true;
rptPokemon5.Visible = false;
}
else if (rbGen5.Checked)
{
GtsRecord5[] records5 = Database.Instance.GtsSearch5(0, (ushort)species, gender, (byte)minLevel, (byte)maxLevel, 0, -1);
rptPokemon5.DataSource = records5;
rptPokemon5.DataBind();
rptPokemon4.Visible = false;
rptPokemon5.Visible = true;
}
}
private Pokedex.Pokedex m_pokedex;

View File

@@ -21,6 +21,96 @@ namespace PkmnFoundations.GTS {
/// </remarks>
protected global::PkmnFoundations.Web.HeaderColour HeaderColour1;
/// <summary>
/// theForm control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm theForm;
/// <summary>
/// ppSpecies control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::PkmnFoundations.Web.controls.PokemonPicker ppSpecies;
/// <summary>
/// txtLevelMin control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtLevelMin;
/// <summary>
/// txtLevelMax control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtLevelMax;
/// <summary>
/// rbGender control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.RadioButtonList rbGender;
/// <summary>
/// rbGen4 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.RadioButton rbGen4;
/// <summary>
/// lblGen4 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblGen4;
/// <summary>
/// rbGen5 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.RadioButton rbGen5;
/// <summary>
/// lblGen5 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblGen5;
/// <summary>
/// btnSearch control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnSearch;
/// <summary>
/// rptPokemon4 control.
/// </summary>

View File

@@ -67,6 +67,7 @@
<Content Include="admin\AddMusical.aspx" />
<Content Include="battlevideo\Default.aspx" />
<Content Include="controls\LabelTextBox.ascx" />
<Content Include="controls\PokemonPicker.ascx" />
<Content Include="css\form.css" />
<Content Include="css\login.css" />
<Content Include="css\main.css" />
@@ -3515,6 +3516,13 @@
<Compile Include="controls\LabelTextBox.ascx.designer.cs">
<DependentUpon>LabelTextBox.ascx</DependentUpon>
</Compile>
<Compile Include="controls\PokemonPicker.ascx.cs">
<DependentUpon>PokemonPicker.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="controls\PokemonPicker.ascx.designer.cs">
<DependentUpon>PokemonPicker.ascx</DependentUpon>
</Compile>
<Compile Include="Default.aspx.cs">
<DependentUpon>Default.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>