public DataSet GetAllFormats() { string query = "SELECT* FROM Formats";//This query is parameterized so that the user input will be checked only as one of the fields in the table. OleDbCommand command = new OleDbCommand(query); DataSet ds = new GeneralService().GetDataset(command, "Formats"); ds.Tables["Formats"].PrimaryKey = new DataColumn[] { ds.Tables["Formats"].Columns["formatId"] }; return(ds); }
public DataSet GetSelectedUserCard() { int count = 0; string query = "SELECT* FROM UserCards WHERE "; OleDbCommand command = new OleDbCommand(); if (userCard.userName != "") { query += "userName like @user_name"; count++; command.Parameters.AddWithValue("@user_name", userCard.userName + "%"); } if (userCard.userCard != -1) { if (count > 0) { query += " AND "; } query += "userCard=@user_card"; count++; command.Parameters.AddWithValue("@user_card", userCard.userCard); } if (userCard.userAmount != -1) { if (count > 0) { query += " AND "; } query += "cardAmount=@amount"; count++; command.Parameters.AddWithValue("@amount", userCard.userAmount); } DataSet ds = null; if (count > 0) { command.CommandText = query; ds = new GeneralService().GetDataset(command, "UserCards"); } return(ds); }
public DataSet GetSelectedDecks(string minDate, string maxDate) { int count = 0; string query = "SELECT* FROM Decks WHERE "; //WHERE cardName like @card_name AND cardAbility like @card_ability AND cardManaCost=@mana_cost AND cardRarity=@card_rarity"; OleDbCommand command = new OleDbCommand(); if (deckDetails.deckName != "None") { query += "deckName=@deck_name"; count++; command.Parameters.AddWithValue("@deck_name", deckDetails.deckName); } if (deckDetails.deckFormat != -1) { if (count > 0) { query += " AND "; } query += "deckFormat=@deck_format"; count++; command.Parameters.AddWithValue("@deck_format", deckDetails.deckFormat); } if (maxDate != "" && minDate != "") { if (count > 0) { query += " AND "; } query += "deckCreationDate between @min_date And @max_date"; count++; command.Parameters.AddWithValue("@min_date", minDate); command.Parameters.AddWithValue("@max_date", maxDate); } else if (maxDate != "") { if (count > 0) { query += " AND "; } query += "deckCreationDate<=@max_date"; count++; command.Parameters.AddWithValue("@max_date", maxDate); } else if (minDate != "") { if (count > 0) { query += " AND "; } query += "deckCreationDate>=@min_date"; count++; command.Parameters.AddWithValue("@min_date", minDate); } DataSet ds = null; if (count > 0) { command.CommandText = query; ds = new GeneralService().GetDataset(command, "Decks"); } return(ds); }