private void button1_Click(object sender, EventArgs e) { Select_account(textBox1.Text); if (username == textBox1.Text && password == textBox2.Text) { if (DateTime.Compare(DateTime.Now, lockdate) >= 0) { CreateNewCard.Insert("update useraccounts set lockdate ='" + EncryptDecrypt.EncryptString(DateTime.Now.ToString("MM/dd/yy"), CreateNewCard.salt) + "' where username = '******'"); Form admin = new AdminMenu(); admin.Show(); this.Close(); } else { MessageBox.Show("Account Is Locked please wait till " + lockdate + " or Contact a System Administrator to Unlock you Account", "Account Locked"); } } else { if (tries == 0) { MessageBox.Show("Your Tries Have Exceeded Allowed Tries\nYour Account is Temporarily Locked till " + DateTime.Now.AddDays(7).ToString("MM/dd/yy"), "Account Locked", MessageBoxButtons.OK, MessageBoxIcon.Error); CreateNewCard.Insert("update useraccounts set lockdate ='" + EncryptDecrypt.EncryptString(DateTime.Now.AddDays(7).ToString("MM/dd/yy"), CreateNewCard.salt) + "' where username = '******'"); } else { MessageBox.Show("Your Password is Incorrect!\nYou Have " + tries + " Left", "Password Incorrect", MessageBoxButtons.OK, MessageBoxIcon.Warning); tries--; textBox1.Clear(); textBox2.Clear(); } } }
private void newcard_Click(object sender, EventArgs e) { Form newcard = new CreateNewCard(); newcard.Show(); Hide(); }
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(); } } }
private void button1_Click(object sender, EventArgs e) { if ((maskedTextBox1.Text != "" || maskedTextBox1.Text != "0") && cardnum != "" && Int32.Parse(maskedTextBox1.Text) >= 100) { MessageBox.Show("asdf" + balance + "asdf"); int newbalance = (Int32.Parse(balance) + Int32.Parse(maskedTextBox1.Text)); CreateNewCard.Insert("Update card_list set balance = '" + EncryptDecrypt.EncryptString(newbalance.ToString(), CreateNewCard.salt) + "' where Card_No = '" + encrcardnum + "'"); CreateNewCard.Initialize("server=localhost;uid=root;pwd=;database=alaybank_cards;sslmode=none;"); CreateNewCard.Insert("Insert into alay" + cardnum + " (`trans_id`, `trans_details`) VALUES (NULL ,'" + EncryptDecrypt.EncryptString("Deposit on " + DateTime.Now, CreateNewCard.salt) + "');"); MessageBox.Show("Balance Successfuly Updated"); maskedTextBox1.Clear(); cardnum = ""; label1.Text = "Deposit To: "; encrcardnum = ""; } else { string error = ""; if (maskedTextBox1.Text == "" || maskedTextBox1.Text == "0") { error += "Deposit Amount must be greater than 0\n"; } if (Int32.Parse(maskedTextBox1.Text) < 100) { error += "Amount Must be 100 Pesos or Greater"; } if (cardnum == "") { error += "No Card Selected"; } MessageBox.Show(error, "Deposit Cannot Be Processed"); } }
private void button1_Click(object sender, EventArgs e) { if (buttonmode == "Add") { if (textBox1.Text != "" && maskedTextBox1.Text != "" && maskedTextBox1.Text != "0") { CreateNewCard.Insert("Insert into rewards (`Rewards`, `Points`) VALUES ('" + EncryptDecrypt.EncryptString(textBox1.Text, CreateNewCard.salt) + "','" + EncryptDecrypt.EncryptString(maskedTextBox1.Text, CreateNewCard.salt) + "');"); MessageBox.Show("Reward Successfully Added"); } else { string error = ""; if (textBox1.Text == "") { error += "Reward Name must not be Empty\n"; } if (maskedTextBox1.Text == "") { error += "Rewards Cost must not be Empty\n"; } if (maskedTextBox1.Text == "0") { error += "Rewards Cost must not be Zero"; } } } else if (buttonmode == "Edit") { CreateNewCard.Insert("Update rewards set rewards = '" + EncryptDecrypt.EncryptString(textBox1.Text, CreateNewCard.salt) + "', points = '" + EncryptDecrypt.EncryptString(maskedTextBox1.Text, CreateNewCard.salt) + "' where rewards = '" + encrrewardname + "'"); MessageBox.Show("Reward Successfully Editted"); } Close(); }
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(); } } }
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 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 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(); } } }
private void button1_Click(object sender, EventArgs e) { foreach (ListViewItem item in listView1.SelectedItems) { Select_Reward(item.SubItems[0].Text); } CreateNewCard.Insert("Delete from rewards where rewards = '" + RewardEditor.encrrewardname + "'"); Populate_ListView("select * from rewards"); RewardEditor.encrrewardname = ""; }
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); } }
private void button2_Click(object sender, EventArgs e) { if (cardnum != "") { CreateNewCard.Insert("Update card_list set expiry = '" + EncryptDecrypt.EncryptString(DateTime.Now.AddYears(3).ToString("MM/yy"), CreateNewCard.salt) + "' where Card_No = '" + CardInsert.encrcardnum + "'"); MessageBox.Show("Card Successfully Renewed!"); Populate_ListView("select Card_No, FN,LN,Expiry from card_list"); cardnum = ""; CardInsert.encrcardnum = ""; label1.Text = "Expired Card Selected: "; } else { MessageBox.Show("No Card Selected", "Renew Failed!"); } }
private void button1_Click(object sender, EventArgs e) { if (cardnum != "") { CreateNewCard.Insert("Update card_list set block = '" + EncryptDecrypt.EncryptString("True", CreateNewCard.salt) + "' where Card_No = '" + CardInsert.encrcardnum + "'"); MessageBox.Show("Card Successfully Blocked!"); Populate_ListView("select Card_No, FN,LN,Block,Expiry from card_list"); cardnum = ""; CardInsert.encrcardnum = ""; label1.Text = "Card to be Blocked: "; } else { MessageBox.Show("Cannot Block Card!\nNo Card Selected", "Card Block Failed"); } }
private void buttonOK_Click(object sender, EventArgs e) { CreateNewCard.Insert("Update card_list set PIN = '" + EncryptDecrypt.EncryptString(textBox1.Text, CreateNewCard.salt) + "' where Card_No = '" + CardInsert.encrcardnum + "'"); MessageBox.Show("PIN sucessfully changed!"); if (MessageBox.Show("Do you want another Transaction?", "Another Transaction", MessageBoxButtons.YesNo) == DialogResult.Yes) { Form mm = new Menu(); mm.Show(); this.Close(); } else { MessageBox.Show("Thank You for Using Alay Bank ATM"); Form splash = new Splash_Screen(); splash.Show(); this.Close(); } }
private void button1_Click(object sender, EventArgs e) { if (cardnum != "") { newpin = build(); CreateNewCard.Insert("Update card_list set pin = '" + EncryptDecrypt.EncryptString(newpin, CreateNewCard.salt) + "' where Card_No = '" + CardInsert.encrcardnum + "'"); CreateNewCard.Insert("Update card_list set block = '" + EncryptDecrypt.EncryptString("False", CreateNewCard.salt) + "' where Card_No = '" + CardInsert.encrcardnum + "'"); MessageBox.Show("New PIN Generated!\n The New Pin is " + newpin); label1.Text = "Selected Card: "; Populate_ListView("select Card_No,FN,LN,Block,Expiry from card_list where Card_No != '" + CardInsert.encrcardnum + "'"); cardnum = ""; CardInsert.encrcardnum = ""; } else { MessageBox.Show("Cannot Change PIN!\nNo Card Selected", "Change PIN Failed"); } }
private void button1_Click(object sender, EventArgs e) { if (Int32.Parse(maskedTextBox1.Text) > Int32.Parse(balance)) { MessageBox.Show("Insuffient Balance\n Please Try Again"); Application.Restart(); } else { if (Int32.Parse(maskedTextBox1.Text) >= 100) { string newbalance = (Int32.Parse(balance) - Int32.Parse(maskedTextBox1.Text)).ToString(); CreateNewCard.Insert("Update card_list set balance = '" + EncryptDecrypt.EncryptString(newbalance, CreateNewCard.salt) + "' where Card_No = '" + CardInsert.encrcardnum + "'"); CreateNewCard.Initialize("server=localhost;uid=root;pwd=;database=alaybank_cards;sslmode=none;"); CreateNewCard.Insert("Insert into alay" + CardInsert.cardnum + " (`trans_id`, `trans_details`) VALUES (NULL ,'" + EncryptDecrypt.EncryptString("Withdrew on " + DateTime.Now, CreateNewCard.salt) + "');"); if (MessageBox.Show("Do you want another Transaction?", "Another Transaction", MessageBoxButtons.YesNo) == DialogResult.Yes) { Form mm = new Menu(); mm.Show(); this.Close(); } else { CreateNewCard.Initialize(); CreateNewCard.Insert("Insert Into transrec values ('" + CardInsert.cardnum + "','" + newbalance + "')"); Form print = new Recieptprint(); Recieptprint.source = "cash"; print.ShowDialog(); MessageBox.Show("Thank You for Using Alay Bank ATM"); Form splash = new Splash_Screen(); splash.Show(); this.Close(); } } else { MessageBox.Show("Withdrawn Amount must be 100 Pesos or greater", "Withdraw Failed"); Form splashscreen = new Splash_Screen(); splashscreen.Show(); this.Hide(); } } }
private void Splash_Screen_Load(object sender, EventArgs e) { checkdb("alaybank", "alaybank"); if (!alaybank) { createdb("create database alaybank"); CreateNewCard.Initialize(); createdb("create table card_list (Card_No varchar(255) , PIN varchar(255) , FN varchar(255) , MI varchar(255) , LN varchar(255) , Balance varchar(255) , Points varchar(255) , Block varchar(255) , primary key(Card_No))"); } checkdb("alaybank_cards", "alaybank_cards"); if (!alaycards) { createdb("create database alaybank_cards"); } timer1.Enabled = true; code = ""; CreateNewCard.Initialize(); CreateNewCard.Insert("Delete from rewardprint"); CreateNewCard.Insert("Delete from transrec"); }
private void button1_Click(object sender, EventArgs e) { foreach (ListViewItem item in listView1.SelectedItems) { if (Int32.Parse(Balance_Inquiry.balance) >= Int32.Parse(item.SubItems[1].Text)) { int newbal = Int32.Parse(Balance_Inquiry.balance) - Int32.Parse(item.SubItems[1].Text); CreateNewCard.Insert("Update card_list set points = '" + EncryptDecrypt.EncryptString(newbal.ToString(), CreateNewCard.salt) + "' where Card_No = '" + CardInsert.encrcardnum + "'"); CreateNewCard.Initialize("server=localhost;uid=root;pwd=;database=alaybank_cards;sslmode=none;"); CreateNewCard.Insert("Insert into alay" + CardInsert.cardnum + " (`trans_id`, `trans_details`) VALUES (NULL ,'" + EncryptDecrypt.EncryptString("Claimed Reward on " + DateTime.Now, CreateNewCard.salt) + "');"); MessageBox.Show("Balance Successfuly Updated\n Thank You for Using Alay Bank ATM System"); CreateNewCard.Initialize(); CreateNewCard.Insert("insert into rewardprint values('" + item.SubItems[0].Text + "','" + BlockChangepin.build() + "')"); Form print = new Recieptprint(); Recieptprint.source = "reward"; print.ShowDialog(); if (MessageBox.Show("Do you want another Transaction?", "Another Transaction", MessageBoxButtons.YesNo) == DialogResult.Yes) { Form mm = new Menu(); mm.Show(); this.Close(); } else { CreateNewCard.Insert("Insert Into transrec values ('" + CardInsert.cardnum + "','" + newbal + " Points')"); MessageBox.Show("Thank You for Using Alay Bank ATM"); Form splash = new Splash_Screen(); splash.Show(); this.Close(); } } else { MessageBox.Show("Transaction cannot be processed!\n Insufficient Reward Points\n Thank you for using Alay Bank ATM"); } } Form splashscreen = new Splash_Screen(); splashscreen.Show(); this.Hide(); }
public void CardBlock() { string query = "UPDATE card_list SET BLOCK = '" + EncryptDecrypt.EncryptString("True", CreateNewCard.salt) + "' where Card_No = '" + CardInsert.encrcardnum + "'"; if (CreateNewCard.OpenConnection()) { try { MySqlCommand cmd = new MySqlCommand(query, CreateNewCard.conn); cmd.ExecuteNonQuery(); } catch (MySqlException ex) { MessageBox.Show(ex.Message); } finally { CreateNewCard.CloseConnection(); } } }
private void button1_Click(object sender, EventArgs e) { if (MessageBox.Show("Do you want another Transaction?", "Another Transaction", MessageBoxButtons.YesNo) == DialogResult.Yes) { Form mm = new Menu(); mm.Show(); this.Close(); } else { CreateNewCard.Initialize(); CreateNewCard.Insert("Insert Into transrec values ('" + CardInsert.cardnum + "','" + balance + "')"); Form print = new Recieptprint(); Recieptprint.source = "cash"; print.ShowDialog(); MessageBox.Show("Thank You for Using Alay Bank ATM"); Form splash = new Splash_Screen(); splash.Show(); this.Close(); } }
public static void createdb(string q) { string query = q; if (CreateNewCard.OpenConnection()) { try { MySqlCommand cmd = new MySqlCommand(query, CreateNewCard.conn); cmd.ExecuteNonQuery(); } catch (MySqlException ex) { MessageBox.Show(ex.Message); } finally { CreateNewCard.CloseConnection(); } } }
private void button2_Click(object sender, EventArgs e) { if (Int32.Parse(Balance_Inquiry.balance) >= Int32.Parse(Amount.Text)) { int rbalance; rbalance = Int32.Parse(Balance_Inquiry.balance) - Int32.Parse(Amount.Text); if (Int32.Parse(Amount.Text) >= 1000) { int rewardpoint = Int32.Parse(Amount.Text) / 1000; int newpoints = Int32.Parse(Balance_Inquiry.points) + rewardpoint; CreateNewCard.Insert("Update card_list set ponts = '" + EncryptDecrypt.EncryptString(newpoints.ToString(), CreateNewCard.salt) + "' where Card_No = '" + CardInsert.encrcardnum + "'"); } CreateNewCard.Insert("Update card_list set balance = '" + EncryptDecrypt.EncryptString(rbalance.ToString(), CreateNewCard.salt) + "' where Card_No = '" + CardInsert.encrcardnum + "'"); CreateNewCard.Initialize("server=localhost;uid=root;pwd=;database=alaybank_cards;sslmode=none;"); CreateNewCard.Insert("Insert into alay" + CardInsert.cardnum + " (`trans_id`, `trans_details`) VALUES (NULL ,'" + EncryptDecrypt.EncryptString("Paid bill on " + DateTime.Now, CreateNewCard.salt) + "');"); if (MessageBox.Show("Do you want another Transaction?", "Another Transaction", MessageBoxButtons.YesNo) == DialogResult.Yes) { Form mm = new Menu(); mm.Show(); this.Close(); } else { CreateNewCard.Initialize(); CreateNewCard.Insert("Insert Into transrec values ('" + CardInsert.cardnum + "','" + rbalance + "')"); Form print = new Recieptprint(); Recieptprint.source = "cash"; print.ShowDialog(); MessageBox.Show("Thank You for Using Alay Bank ATM"); Form splash = new Splash_Screen(); splash.Show(); this.Close(); } } else { MessageBox.Show("Transaction cannot be processed!\n Insufficient Balance\n Thank you for using Alay Bank ATM"); } }
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); } }
public void checkdb(string ID, string check) { string query = "show databases like '" + ID + "';"; MySqlCommand command; if (CreateNewCard.OpenConnection()) { try { command = new MySqlCommand(query, CreateNewCard.conn); MySqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { if (check == reader[0].ToString()) { if (check == "alaybank") { alaybank = true; } if (check == "alaybank_cards") { alaycards = true; } } } } catch (MySqlException ex) { MessageBox.Show(ex.Message); } finally { CreateNewCard.CloseConnection(); } } }
public CardInsert() { InitializeComponent(); CreateNewCard.Initialize(); }
public Deposit() { InitializeComponent(); CreateNewCard.Initialize(); }
public PIN() { InitializeComponent(); CreateNewCard.Initialize(); }
public Renew() { InitializeComponent(); CreateNewCard.Initialize(); }
public RewardEditor() { InitializeComponent(); CreateNewCard.Initialize(); }
public ChangePin() { InitializeComponent(); CreateNewCard.Initialize(); }