public void Select_Card(string cardnum) { listView1.Items.Clear(); string query = "select Card_No from card_list"; if (CreateNewCard.OpenConnection()) { try { MySqlCommand cmd = new MySqlCommand(query, CreateNewCard.conn); MySqlDataReader dataReader = cmd.ExecuteReader(); while (dataReader.Read()) { if (EncryptDecrypt.DecryptString(dataReader[0].ToString(), CreateNewCard.salt) == cardnum) { CardInsert.encrcardnum = dataReader[0].ToString(); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { CreateNewCard.CloseConnection(); } listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); } }
public void Populate_ListView(string myquery) { listView1.Items.Clear(); ListViewItem iItem; string query = myquery; if (CreateNewCard.OpenConnection()) { try { MySqlCommand cmd = new MySqlCommand(query, CreateNewCard.conn); MySqlDataReader dataReader = cmd.ExecuteReader(); while (dataReader.Read()) { iItem = new ListViewItem(EncryptDecrypt.DecryptString(dataReader[0].ToString(), CreateNewCard.salt)); listView1.Items.Add(iItem); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { CreateNewCard.CloseConnection(); } listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); } }
public void getpin() { string query = "select PIN from card_list where Card_No ='" + CardInsert.encrcardnum + "'"; if (CreateNewCard.OpenConnection()) { try { MySqlCommand cmd = new MySqlCommand(query, CreateNewCard.conn); MySqlDataReader dataReader = cmd.ExecuteReader(); while (dataReader.Read()) { PINCode = EncryptDecrypt.DecryptString(dataReader[0].ToString(), CreateNewCard.salt); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { CreateNewCard.CloseConnection(); } } }
private void call(string cardnum) { string query = "Select Card_NO from card_list where Card_NO = '" + EncryptDecrypt.EncryptString(cardnum, salt) + "'"; if (OpenConnection()) { try { MySqlCommand command = new MySqlCommand(query, conn); MySqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { cardnumdb = EncryptDecrypt.DecryptString(reader.GetString("Card_NO"), salt); } } catch (MySqlException ex) { MessageBox.Show(ex.Message); } finally { CloseConnection(); } } }
public void Card_Data() { string query = "SELECT Card_No from card_list"; if (CreateNewCard.OpenConnection()) { try { MySqlCommand command = new MySqlCommand(query, CreateNewCard.conn); MySqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { Card.Items.Add(EncryptDecrypt.DecryptString(reader[0].ToString(), CreateNewCard.salt)); } } catch (MySqlException ex) { MessageBox.Show(ex.Message); } finally { CreateNewCard.CloseConnection(); } } }
public void Select_account(string cardnum) { string query = "select * from useraccounts"; if (CreateNewCard.OpenConnection()) { try { MySqlCommand cmd = new MySqlCommand(query, CreateNewCard.conn); MySqlDataReader dataReader = cmd.ExecuteReader(); while (dataReader.Read()) { if (EncryptDecrypt.DecryptString(dataReader[0].ToString(), CreateNewCard.salt) == cardnum) { encrusername = dataReader[0].ToString(); username = EncryptDecrypt.DecryptString(dataReader[0].ToString(), CreateNewCard.salt); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { CreateNewCard.CloseConnection(); } } query = "select password,lockdate from useraccounts where username ='******'"; if (CreateNewCard.OpenConnection()) { try { MySqlCommand cmd = new MySqlCommand(query, CreateNewCard.conn); MySqlDataReader dataReader = cmd.ExecuteReader(); while (dataReader.Read()) { password = EncryptDecrypt.DecryptString(dataReader[0].ToString(), CreateNewCard.salt); if (dataReader[1].ToString() != "") { lockdate = DateTime.Parse(EncryptDecrypt.DecryptString(dataReader[1].ToString(), CreateNewCard.salt)); } else { lockdate = DateTime.Now; } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { CreateNewCard.CloseConnection(); } } }
public void Select_Reward(string rewardname) { string query = "select rewards from rewards"; if (CreateNewCard.OpenConnection()) { try { MySqlCommand cmd = new MySqlCommand(query, CreateNewCard.conn); MySqlDataReader dataReader = cmd.ExecuteReader(); while (dataReader.Read()) { if (EncryptDecrypt.DecryptString(dataReader[0].ToString(), CreateNewCard.salt) == rewardname) { RewardEditor.encrrewardname = dataReader[0].ToString(); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { CreateNewCard.CloseConnection(); } listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); } query = "select * from rewards where rewards ='" + RewardEditor.encrrewardname + "'"; if (CreateNewCard.OpenConnection()) { try { MySqlCommand cmd = new MySqlCommand(query, CreateNewCard.conn); MySqlDataReader dataReader = cmd.ExecuteReader(); while (dataReader.Read()) { RewardEditor.rewardname = EncryptDecrypt.DecryptString(dataReader[0].ToString(), CreateNewCard.salt); RewardEditor.pointsrequired = EncryptDecrypt.DecryptString(dataReader[1].ToString(), CreateNewCard.salt); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { CreateNewCard.CloseConnection(); } listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); } }
public void Populate_ListView(string myquery) { listView1.Items.Clear(); ListViewItem iItem; string query = myquery; if (CreateNewCard.OpenConnection()) { try { MySqlCommand cmd = new MySqlCommand(query, CreateNewCard.conn); MySqlDataReader dataReader = cmd.ExecuteReader(); while (dataReader.Read()) { if (EncryptDecrypt.DecryptString(dataReader[3].ToString(), CreateNewCard.salt) == "True" && DateTime.Compare(DateTime.Now, DateTime.ParseExact("30/" + EncryptDecrypt.DecryptString(dataReader[4].ToString(), CreateNewCard .salt), "dd/MM/yy", System.Globalization.CultureInfo.InvariantCulture)) <= 0) { iItem = new ListViewItem(EncryptDecrypt.DecryptString(dataReader[0].ToString(), CreateNewCard.salt)); fullname = EncryptDecrypt.DecryptString(dataReader[1].ToString(), CreateNewCard.salt) + " " + EncryptDecrypt.DecryptString(dataReader[2].ToString(), CreateNewCard.salt); expiry = EncryptDecrypt.DecryptString(dataReader[4].ToString(), CreateNewCard.salt); iItem.SubItems.Add(fullname); iItem.SubItems.Add(expiry); listView1.Items.Add(iItem); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { CreateNewCard.CloseConnection(); } listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); } }
private void button2_Click(object sender, EventArgs e) { textBox1.Text = EncryptDecrypt.DecryptString(textBox2.Text, CreateNewCard.salt); textBox2.Text = ""; }