loops to 48

This commit is contained in:
Jake Visser 2017-07-12 22:33:36 -07:00
parent cac883391f
commit ef35773c8e
2 changed files with 40 additions and 6 deletions

View file

@ -60,9 +60,9 @@ CREATE TABLE [dbo].[qcbadge](
[45] [bit] DEFAULT 0 NOT NULL,
[46] [bit] DEFAULT 0 NOT NULL,
[47] [bit] DEFAULT 0 NOT NULL,
[48] [bit] DEFAULT 0 NOT NULL,
[49] [bit] DEFAULT 0 NOT NULL,
[curr] [int] DEFAULT NULL,
[lastseen] [datetime] NULL
PRIMARY KEY CLUSTERED
(
[badgeid] ASC

View file

@ -18,9 +18,9 @@ namespace qcbadge.Helpers
public bool[] selectGlobalView()
{
//System.Diagnostics.Debug.WriteLine("Got to selectGlobalView");
bool[] rtn = new bool[50];
bool[] rtn = new bool[48];
for (int i = 0; i < 50; i++)
for (int i = 0; i < 48; i++)
{
//System.Diagnostics.Debug.WriteLine("Into loop " + i);
@ -75,9 +75,9 @@ namespace qcbadge.Helpers
public bool[] selectIndervidualView(int badgeid)
{
bool[] rtn = new bool[50];
bool[] rtn = new bool[48];
for (int i = 0; i < 50; i++)
for (int i = 0; i < 48; i++)
{
//System.Diagnostics.Debug.WriteLine("Into loop " + i);
@ -130,5 +130,39 @@ namespace qcbadge.Helpers
return rtn;
}
public void updateBadge(String code, string email, string custcode, string paycode, string qrcode)
{
try
{
SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
builder.DataSource = DataSource;
builder.UserID = UserID;
builder.Password = Password;
builder.InitialCatalog = db;
using (SqlConnection connection = new SqlConnection(builder.ConnectionString))
{
connection.Open();
StringBuilder sb = new StringBuilder();
sb.Append("UPDATE " + table + " SET codeused = 1, email = '" + email + "', custcode = '" + custcode + "', paycode = '" + paycode + "', qrcode = '" + qrcode + "', datepayed = CURRENT_TIMESTAMP WHERE [requestcode] = '" + code + "';");
String sql = sb.ToString();
using (SqlCommand command = new SqlCommand(sql, connection))
{
int rowsAffected = command.ExecuteNonQuery();
}
}
}
catch (SqlException e)
{
Console.WriteLine(e.ToString());
}
}
}
}