Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using System.Data.OleDb;
- using System.IO;
- namespace Descartes
- {
- public partial class frmAccount : Form
- {
- public frmAccount()
- {
- InitializeComponent();
- }
- int Admin = 0;
- /*OleDbConnection banking;
- OleDbCommand accountCommand;
- OleDbDataAdapter accountAdapter;
- DataTable accountTable;
- OleDbCommand itemsCommand;
- OleDbDataAdapter itemsAdapter;
- DataTable itemsTable;
- OleDbCommand purchasesCommand;
- OleDbDataAdapter purchasesAdapter;
- DataTable purchasesTable;*/
- OleDbConnection con;
- DataSet ds1;
- DataSet ds2;
- DataSet ds3;
- OleDbDataAdapter da;
- OleDbDataAdapter da2;
- OleDbDataAdapter da3;
- int MaxRows = 0;
- int inc = 0;
- string User = "";
- private void exitToolStripMenuItem_Click(object sender, EventArgs e)
- {
- Application.Exit();
- }
- private void mainMenuToolStripMenuItem3_Click(object sender, EventArgs e)
- {
- // Goes to the Main Menu Page
- frmMainMenu frm = new frmMainMenu();
- frm.Show();
- this.Hide();
- }
- private void catalogueToolStripMenuItem3_Click(object sender, EventArgs e)
- {
- // Goes to the Catalogue Page
- frmCatalogue frm = new frmCatalogue();
- frm.Show();
- this.Hide();
- }
- private void tmrFadeIn_Tick(object sender, EventArgs e)
- {
- //Fades the page in
- this.Opacity += 0.02;
- }
- private void tmrWait_Tick(object sender, EventArgs e)
- {
- //Stops the fade in function
- tmrFadeIn.Enabled = false;
- }
- private void btnMainMenu_Click(object sender, EventArgs e)
- {
- // Goes to the Main Menu Page
- frmMainMenu frm = new frmMainMenu();
- frm.Show();
- this.Hide();
- }
- private void topupBalanceToolStripMenuItem3_Click(object sender, EventArgs e)
- {
- // Goes to the Top-up Page
- frmTop frm = new frmTop();
- frm.Show();
- this.Hide();
- }
- private void logoutToolStripMenuItem3_Click(object sender, EventArgs e)
- {
- // Goes to the Login Page
- frmLogin frm = new frmLogin();
- frm.Show();
- this.Hide();
- }
- private void frmAccount_Load(object sender, EventArgs e)
- {
- string file_name = "user.ini";
- System.IO.StreamReader objReader;
- objReader = new System.IO.StreamReader(file_name); //Reads the text file and saves it as a variable
- User = objReader.ReadLine().ToString();
- objReader.Close();
- con = new OleDbConnection();
- ds1 = new DataSet();
- ds2 = new DataSet();
- ds3 = new DataSet();
- con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source = " + Application.StartupPath + "\\..\\..\\banking.mdb"; //connection to database
- con.Open();
- string sql = "SELECT * From account"; //select everything from the account table
- da = new OleDbDataAdapter(sql, con);
- da.Fill(ds1, "UserList"); //creates a virtual database in memory called Userlist
- MaxRows = ds1.Tables["UserList"].Rows.Count;
- string sql2 = "SELECT * From items"; //select everything from the account table
- da2 = new OleDbDataAdapter(sql2, con);
- da.Fill(ds2, "ItemList"); //creates a virtual database in memory called Userlist
- MaxRows = ds2.Tables["ItemList"].Rows.Count;
- string sql3 = "SELECT * From purchases"; //select everything from the account table
- da3 = new OleDbDataAdapter(sql3, con);
- da.Fill(ds3, "PurchaseList"); //creates a virtual database in memory called Userlist
- MaxRows = ds3.Tables["PurchaseList"].Rows.Count;
- string Balance;
- int User_int;
- int user;
- User_int = Convert.ToInt32(User);
- user = User_int - 2;
- DataRow dRow = ds1.Tables["UserList"].Rows[user];
- Balance = dRow.ItemArray.GetValue(3).ToString(); //Balance has been found
- label3.Text = Balance + ".00";
- con.Close();
- con.Dispose();
- }
- private void helpToolStripMenuItem_Click(object sender, EventArgs e)
- {
- MessageBox.Show("The account information page acts as a portal for each user to check their statistics in relation to Descartes. Your account balance total will show up in the top left box, the total amount of money you have spent purchasing items on Descartes shows up on the bottom left box and a compiled list of all goods you have purchased from Descartes will show up in the box on the right. If you wish to go directly to the Top-up page, simply click the Top-up Balance button – if not, you may go back to the Main Menu using the Back button.", "Catalogue Help");
- }
- private void btnTopUp_Click(object sender, EventArgs e)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement