Removed queueing option from battle video page.

This commit is contained in:
Greg Edwards
2014-05-20 12:13:46 -04:00
parent 20ca0cc3a2
commit 1d931ff91b
3 changed files with 42 additions and 51 deletions

View File

@@ -2,22 +2,25 @@
<%@ Register TagPrefix="pf" Namespace="PkmnFoundations.GTS" Assembly="PkmnFoundations.GTS" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cpHead" runat="server">
<pf:HeaderColour CssClass="bv" runat="server" />
<pf:HeaderColour ID="HeaderColour1" CssClass="bv" runat="server" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMain" runat="server">
<h1>Battle videos</h1>
<p>Please enter your battle video's ID (eg. 12-34567-89012) into this form to have it backed up
onto Foundations GTS.</p>
<p>Since the official Battle Video server has gone offline, you can no longer queue
your battle videos for retrieval. You can still type your battle video ID into one
of the below forms to check if I have it backed up. If not, you can try
<a href="https://www.pokecheck.org/?p=search&vid=">Pokécheck</a>. If its not there,
your video is gone. If its still on your game cartridge, you will be able to
reupload it to fGTS under a new ID once I launch the battle video server. Stay tuned.</p>
<form id="theForm" runat="server">
<div>
<h2>Generation IV (Platinum, Heart Gold, Soul Silver)</h2>
<asp:TextBox ID="txtBattleVideo4" runat="server" />
<asp:Button ID="btnSend4" Text="Send" OnClick="btnSend4_Click" runat="server" />
<asp:Button ID="btnSend4" Text="Check" OnClick="btnSend4_Click" runat="server" />
<asp:Literal ID="litMessage4" runat="server" />
</div>
<div class="stats">
<asp:Literal ID="litQueued4" runat="server" />
videos queued,
<asp:Literal ID="litTotal4" runat="server" />
videos saved in total.
</div>
@@ -25,14 +28,12 @@ videos saved in total.
<div>
<h2>Generation V (Black, White, Black 2, White 2)</h2>
<asp:TextBox ID="txtBattleVideo5" runat="server" />
<asp:Button ID="btnSend5" Text="Send" OnClick="btnSend5_Click" runat="server" />
<asp:Button ID="btnSend5" Text="Check" OnClick="btnSend5_Click" runat="server" />
<asp:Literal ID="litMessage5" runat="server" />
<div class="stats">
<asp:Literal ID="litQueued5" runat="server" />
videos queued,
<asp:Literal ID="litTotal5" runat="server" />
videos saved in total.
</div>
</div>
<asp:Literal ID="litMessage" runat="server" />
</form>
</asp:Content>

View File

@@ -14,16 +14,14 @@ namespace PkmnFoundations.GTS
{
protected void Page_Load(object sender, EventArgs e)
{
litMessage.Text = "";
litMessage4.Text = "";
litMessage5.Text = "";
using (MySqlConnection db = CreateConnection())
{
db.Open();
litQueued4.Text = HttpUtility.HtmlEncode(db.ExecuteScalar("SELECT Count(*) FROM BattleVideoCrawlQueue WHERE Complete = 0"));
litTotal4.Text = HttpUtility.HtmlEncode(db.ExecuteScalar("SELECT Count(*) FROM BattleVideoCrawlQueue WHERE Complete = 1"));
litQueued5.Text = HttpUtility.HtmlEncode(db.ExecuteScalar("SELECT Count(*) FROM BattleVideoCrawlQueue5 WHERE Complete = 0"));
litTotal5.Text = HttpUtility.HtmlEncode(db.ExecuteScalar("SELECT Count(*) FROM BattleVideoCrawlQueue5 WHERE Complete = 1"));
db.Close();
@@ -36,7 +34,7 @@ namespace PkmnFoundations.GTS
UInt64.TryParse(txtBattleVideo4.Text.Replace('-', ' ').Replace(" ", ""), out id);
if (id == 0)
{
litMessage.Text = "The battle video ID could not be read. Please enter a battle video ID in the format, xx-xxxxx-xxxxx, and try again.";
litMessage4.Text = "The battle video ID could not be read. Please enter a battle video ID in the format, xx-xxxxx-xxxxx, and try again.";
return;
}
@@ -50,19 +48,15 @@ namespace PkmnFoundations.GTS
private void QueueVideoId4(MySqlConnection db, ulong id)
{
using (MySqlTransaction tran = db.BeginTransaction())
long count = (long)db.ExecuteScalar("SELECT Count(*) FROM BattleVideoCrawlQueue " +
"WHERE SerialNumber = @serial_number AND Complete = 1",
new MySqlParameter("@serial_number", id));
if (count > 0)
{
long count = (long)tran.ExecuteScalar("SELECT Count(*) FROM BattleVideoCrawlQueue WHERE SerialNumber = @serial_number", new MySqlParameter("@serial_number", id));
if (count > 0)
{
tran.Rollback();
litMessage.Text = "The battle video is already queued for retrieval.";
return;
}
tran.ExecuteNonQuery("INSERT INTO BattleVideoCrawlQueue (SerialNumber, `Timestamp`) VALUES (@serial_number, NOW())", new MySqlParameter("@serial_number", id));
tran.Commit();
litMessage.Text = "The battle video has been queued for retrieval.";
litMessage4.Text = "This battle video has been saved.";
return;
}
litMessage4.Text = "This battle video is lost.";
}
protected void btnSend5_Click(object sender, EventArgs e)
@@ -71,7 +65,7 @@ namespace PkmnFoundations.GTS
UInt64.TryParse(txtBattleVideo5.Text.Replace('-', ' ').Replace(" ", ""), out id);
if (id == 0)
{
litMessage.Text = "The battle video ID could not be read. Please enter a battle video ID in the format, xx-xxxxx-xxxxx, and try again.";
litMessage5.Text = "The battle video ID could not be read. Please enter a battle video ID in the format, xx-xxxxx-xxxxx, and try again.";
return;
}
@@ -85,19 +79,15 @@ namespace PkmnFoundations.GTS
private void QueueVideoId5(MySqlConnection db, ulong id)
{
using (MySqlTransaction tran = db.BeginTransaction())
long count = (long)db.ExecuteScalar("SELECT Count(*) FROM BattleVideoCrawlQueue5 " +
"WHERE SerialNumber = @serial_number AND Complete = 1",
new MySqlParameter("@serial_number", id));
if (count > 0)
{
long count = (long)tran.ExecuteScalar("SELECT Count(*) FROM BattleVideoCrawlQueue5 WHERE SerialNumber = @serial_number", new MySqlParameter("@serial_number", id));
if (count > 0)
{
tran.Rollback();
litMessage.Text = "The battle video is already queued for retrieval.";
return;
}
tran.ExecuteNonQuery("INSERT INTO BattleVideoCrawlQueue5 (SerialNumber, `Timestamp`) VALUES (@serial_number, NOW())", new MySqlParameter("@serial_number", id));
tran.Commit();
litMessage.Text = "The battle video has been queued for retrieval.";
litMessage5.Text = "This battle video has been saved.";
return;
}
litMessage5.Text = "This battle video is lost.";
}
public static MySqlConnection CreateConnection()

View File

@@ -12,6 +12,15 @@ namespace PkmnFoundations.GTS {
public partial class BattleVideo {
/// <summary>
/// HeaderColour1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::PkmnFoundations.GTS.HeaderColour HeaderColour1;
/// <summary>
/// theForm control.
/// </summary>
@@ -40,13 +49,13 @@ namespace PkmnFoundations.GTS {
protected global::System.Web.UI.WebControls.Button btnSend4;
/// <summary>
/// litQueued4 control.
/// litMessage4 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.Literal litQueued4;
protected global::System.Web.UI.WebControls.Literal litMessage4;
/// <summary>
/// litTotal4 control.
@@ -76,13 +85,13 @@ namespace PkmnFoundations.GTS {
protected global::System.Web.UI.WebControls.Button btnSend5;
/// <summary>
/// litQueued5 control.
/// litMessage5 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.Literal litQueued5;
protected global::System.Web.UI.WebControls.Literal litMessage5;
/// <summary>
/// litTotal5 control.
@@ -92,14 +101,5 @@ namespace PkmnFoundations.GTS {
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litTotal5;
/// <summary>
/// litMessage 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.Literal litMessage;
}
}