Advertisement
Guest User

Untitled

a guest
May 29th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.35 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.Data.OleDb;
  10. using System.IO;
  11.  
  12. namespace Descartes
  13. {
  14.     public partial class frmAdmin : Form
  15.     {
  16.         public frmAdmin()
  17.         {
  18.             InitializeComponent();
  19.         }
  20.  
  21.         int Admin = 0;
  22.         OleDbConnection banking;
  23.         OleDbCommand accountCommand;
  24.         OleDbDataAdapter accountAdapter;
  25.         DataTable accountTable;
  26.         OleDbCommand itemsCommand;
  27.         OleDbDataAdapter itemsAdapter;
  28.         DataTable itemsTable;
  29.         OleDbCommand purchasesCommand;
  30.         OleDbDataAdapter purchasesAdapter;
  31.         DataTable purchasesTable;
  32.  
  33.         private void exitToolStripMenuItem_Click(object sender, EventArgs e)
  34.         {
  35.             Application.Exit();
  36.         }
  37.  
  38.         private void mainMenuToolStripMenuItem3_Click(object sender, EventArgs e)
  39.         {
  40.             // Goes to the Main Menu Page
  41.  
  42.             frmMainMenu frm = new frmMainMenu();
  43.             frm.Show();
  44.             this.Hide();
  45.         }
  46.  
  47.         private void catalogueToolStripMenuItem3_Click(object sender, EventArgs e)
  48.         {
  49.             // Goes to the Catalogue Page
  50.  
  51.             frmCatalogue frm = new frmCatalogue();
  52.             frm.Show();
  53.             this.Hide();
  54.         }
  55.  
  56.         private void accountInformationToolStripMenuItem3_Click(object sender, EventArgs e)
  57.         {
  58.             // Goes to the Account Info Page
  59.  
  60.             frmAccount frm = new frmAccount();
  61.             frm.Show();
  62.             this.Hide();
  63.         }
  64.  
  65.         private void topupBalanceToolStripMenuItem3_Click(object sender, EventArgs e)
  66.         {
  67.             // Goes to the Main Menu Page
  68.  
  69.             frmTop frm = new frmTop();
  70.             frm.Show();
  71.             this.Hide();
  72.         }
  73.  
  74.         private void tmrFadeIn_Tick(object sender, EventArgs e)
  75.         {
  76.             //Fades the page in
  77.  
  78.             this.Opacity += 0.02;
  79.         }
  80.  
  81.         private void tmrWait_Tick(object sender, EventArgs e)
  82.         {
  83.             //Stops the fade in function
  84.  
  85.             tmrFadeIn.Enabled = false;
  86.         }
  87.  
  88.         private void btnMainMenu_Click(object sender, EventArgs e)
  89.         {
  90.             // Goes to the Main Menu Page
  91.  
  92.             frmMainMenu frm = new frmMainMenu();
  93.             frm.Show();
  94.             this.Hide();
  95.         }
  96.  
  97.         private void logoutToolStripMenuItem3_Click(object sender, EventArgs e)
  98.         {
  99.             // Goes to the Login Page
  100.  
  101.             frmLogin frm = new frmLogin();
  102.             frm.Show();
  103.             this.Hide();
  104.         }
  105.  
  106.         private void frmAdmin_Load(object sender, EventArgs e)
  107.         {
  108.             banking = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source = " + Application.StartupPath + "\\..\\..\\banking.mdb");
  109.             banking.Open();
  110.  
  111.             accountCommand = new OleDbCommand("SELECT * FROM account ORDER BY UserID", banking);
  112.             accountAdapter = new OleDbDataAdapter();
  113.             accountAdapter.SelectCommand = accountCommand;
  114.             accountTable = new DataTable();
  115.             accountAdapter.Fill(accountTable);
  116.  
  117.             itemsCommand = new OleDbCommand("SELECT * FROM items ORDER BY ItemID", banking);
  118.             itemsAdapter = new OleDbDataAdapter();
  119.             itemsAdapter.SelectCommand = itemsCommand;
  120.             itemsTable = new DataTable();
  121.             itemsAdapter.Fill(itemsTable);
  122.  
  123.             purchasesCommand = new OleDbCommand("SELECT * FROM purchases ORDER BY PurchaseID", banking);
  124.             purchasesAdapter = new OleDbDataAdapter();
  125.             purchasesAdapter.SelectCommand = purchasesCommand;
  126.             purchasesTable = new DataTable();
  127.             purchasesAdapter.Fill(purchasesTable);
  128.         }
  129.  
  130.         private void helpToolStripMenuItem_Click(object sender, EventArgs e)
  131.         {
  132.             MessageBox.Show("The admin control page acts as a portal for the administrator to check their statistics in relation to Descartes. The box on the left shows how much money has been spent on your goods in total whereas the box on the right shows a compiled list of all the goods that you have sold. Clicking the Back button will take you back to the Main Menu.", "Catalogue Help");
  133.         }
  134.     }
  135. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement