Archives from S:\ Drive

Good to keep around methinks
This commit is contained in:
Amrit Panesar committed 2015-04-01 21:23:15 -07:00
1 parent eadaf70b9e
commit 6dd63cc439
606 files changed
+50212

No files matched your search

@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{CF1759B7-2217-46A8-8AD9-3169DE41C7F2}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ATM_Machine</RootNamespace>
<AssemblyName>ATM Machine</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>ATM.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Customer.cs" />
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SQLHandler.cs">
<SubType>Form</SubType>
</Compile>
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="ATM.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

@@ -0,0 +1,50 @@
using System;
using System.Collections;
using System.Linq;
using System.Text;
namespace ATM_Machine
{
class Customer
{
public Customer()
{
transactions = new ArrayList();
}
public string Name { get; set; }
public uint CustomerID { get; set; }
public uint AccountNumber { get; set; }
public uint ATMNumber { get; set; }
public uint PIN { get; set; }
public ArrayList transactions;
public decimal balance { get; set; }
}
public class Transaction
{
public Transaction()
{
}
public Transaction(uint id, uint account_number, decimal amount, char type, DateTime date)
{
this.id = id;
this.account_number = account_number;
this.amount = amount;
this.type = type;
this.date = date;
}
public Transaction(object[] values)
{
id = Convert.ToUInt32(values[0]);
account_number = Convert.ToUInt32(values[1]);
amount = Convert.ToDecimal(values[2]);
type = Convert.ToChar(values[3]);
date = (DateTime)values[4];
}
public uint id { get; set; }
public uint account_number { get; set; }
public decimal amount { get; set; }
public char type { get; set; }
public DateTime date { get; set; }
}
}
@@ -0,0 +1,887 @@
namespace ATM_Machine
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
this.label1 = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
this.button5 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.panel3 = new System.Windows.Forms.Panel();
this.button6 = new System.Windows.Forms.Button();
this.listBox1 = new System.Windows.Forms.ListBox();
this.label8 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.panel4 = new System.Windows.Forms.Panel();
this.label11 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.button16 = new System.Windows.Forms.Button();
this.button15 = new System.Windows.Forms.Button();
this.button14 = new System.Windows.Forms.Button();
this.button13 = new System.Windows.Forms.Button();
this.button12 = new System.Windows.Forms.Button();
this.button11 = new System.Windows.Forms.Button();
this.button10 = new System.Windows.Forms.Button();
this.button9 = new System.Windows.Forms.Button();
this.button8 = new System.Windows.Forms.Button();
this.button7 = new System.Windows.Forms.Button();
this.label9 = new System.Windows.Forms.Label();
this.panel5 = new System.Windows.Forms.Panel();
this.button17 = new System.Windows.Forms.Button();
this.label13 = new System.Windows.Forms.Label();
this.label12 = new System.Windows.Forms.Label();
this.panel6 = new System.Windows.Forms.Panel();
this.button20 = new System.Windows.Forms.Button();
this.button18 = new System.Windows.Forms.Button();
this.maskedTextBox1 = new System.Windows.Forms.MaskedTextBox();
this.label17 = new System.Windows.Forms.Label();
this.label14 = new System.Windows.Forms.Label();
this.label15 = new System.Windows.Forms.Label();
this.label16 = new System.Windows.Forms.Label();
this.panel7 = new System.Windows.Forms.Panel();
this.button23 = new System.Windows.Forms.Button();
this.button19 = new System.Windows.Forms.Button();
this.maskedTextBox2 = new System.Windows.Forms.MaskedTextBox();
this.label18 = new System.Windows.Forms.Label();
this.label19 = new System.Windows.Forms.Label();
this.label20 = new System.Windows.Forms.Label();
this.label21 = new System.Windows.Forms.Label();
this.panel8 = new System.Windows.Forms.Panel();
this.button22 = new System.Windows.Forms.Button();
this.button21 = new System.Windows.Forms.Button();
this.listBox2 = new System.Windows.Forms.ListBox();
this.label23 = new System.Windows.Forms.Label();
this.label22 = new System.Windows.Forms.Label();
this.statusStrip1.SuspendLayout();
this.panel2.SuspendLayout();
this.panel1.SuspendLayout();
this.panel3.SuspendLayout();
this.panel4.SuspendLayout();
this.panel5.SuspendLayout();
this.panel6.SuspendLayout();
this.panel7.SuspendLayout();
this.panel8.SuspendLayout();
this.SuspendLayout();
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripStatusLabel1});
this.statusStrip1.Location = new System.Drawing.Point(0, 407);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(560, 22);
this.statusStrip1.TabIndex = 0;
this.statusStrip1.Text = "statusStrip1";
//
// toolStripStatusLabel1
//
this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
this.toolStripStatusLabel1.Size = new System.Drawing.Size(38, 17);
this.toolStripStatusLabel1.Text = "Status";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 36F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(49, 14);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(454, 55);
this.label1.TabIndex = 1;
this.label1.Text = "Bank of Biscuit ATM";
//
// panel2
//
this.panel2.Controls.Add(this.button5);
this.panel2.Controls.Add(this.button4);
this.panel2.Controls.Add(this.button3);
this.panel2.Controls.Add(this.button2);
this.panel2.Controls.Add(this.label6);
this.panel2.Controls.Add(this.label5);
this.panel2.Location = new System.Drawing.Point(12, 80);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(536, 320);
this.panel2.TabIndex = 6;
this.panel2.Visible = false;
this.panel2.Enter += new System.EventHandler(this.panel2_Enter);
//
// button5
//
this.button5.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button5.Location = new System.Drawing.Point(297, 189);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(157, 43);
this.button5.TabIndex = 5;
this.button5.Text = "&Logoff";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// button4
//
this.button4.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button4.Location = new System.Drawing.Point(89, 189);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(157, 43);
this.button4.TabIndex = 4;
this.button4.Text = "&Statement";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// button3
//
this.button3.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button3.Location = new System.Drawing.Point(297, 112);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(157, 43);
this.button3.TabIndex = 3;
this.button3.Text = "&Deposit";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button2
//
this.button2.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button2.Location = new System.Drawing.Point(89, 112);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(157, 43);
this.button2.TabIndex = 2;
this.button2.Text = "&Withdraw";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// label6
//
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label6.Location = new System.Drawing.Point(149, 53);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(240, 20);
this.label6.TabIndex = 1;
this.label6.Text = "What would you like to do today?";
//
// label5
//
this.label5.AutoEllipsis = true;
this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label5.Location = new System.Drawing.Point(3, 9);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(530, 29);
this.label5.TabIndex = 0;
this.label5.Text = "Welcome User";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panel1
//
this.panel1.Controls.Add(this.textBox1);
this.panel1.Controls.Add(this.textBox2);
this.panel1.Controls.Add(this.label3);
this.panel1.Controls.Add(this.label4);
this.panel1.Controls.Add(this.button1);
this.panel1.Controls.Add(this.label2);
this.panel1.Location = new System.Drawing.Point(14, 81);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(533, 320);
this.panel1.TabIndex = 7;
this.panel1.Enter += new System.EventHandler(this.panel1_Enter);
//
// textBox1
//
this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.textBox1.Location = new System.Drawing.Point(168, 105);
this.textBox1.MaxLength = 5;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(183, 29);
this.textBox1.TabIndex = 14;
//
// textBox2
//
this.textBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.textBox2.Location = new System.Drawing.Point(168, 184);
this.textBox2.MaxLength = 4;
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(183, 29);
this.textBox2.TabIndex = 15;
this.textBox2.UseSystemPasswordChar = true;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(147, 78);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(231, 24);
this.label3.TabIndex = 11;
this.label3.Text = "Card or Account Number: ";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label4.Location = new System.Drawing.Point(129, 157);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(276, 24);
this.label4.TabIndex = 12;
this.label4.Text = "Personal Identification Number: ";
//
// button1
//
this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button1.Location = new System.Drawing.Point(192, 244);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(128, 33);
this.button1.TabIndex = 13;
this.button1.Text = "&Process";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(214, 23);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(81, 29);
this.label2.TabIndex = 0;
this.label2.Text = "Logon";
//
// panel3
//
this.panel3.Controls.Add(this.button6);
this.panel3.Controls.Add(this.listBox1);
this.panel3.Controls.Add(this.label8);
this.panel3.Controls.Add(this.label7);
this.panel3.Location = new System.Drawing.Point(12, 80);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(536, 321);
this.panel3.TabIndex = 8;
//
// button6
//
this.button6.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button6.Location = new System.Drawing.Point(376, 256);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(146, 51);
this.button6.TabIndex = 3;
this.button6.Text = "&Main Menu";
this.button6.UseVisualStyleBackColor = true;
this.button6.Click += new System.EventHandler(this.button6_Click);
//
// listBox1
//
this.listBox1.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.listBox1.FormattingEnabled = true;
this.listBox1.ItemHeight = 14;
this.listBox1.Location = new System.Drawing.Point(8, 67);
this.listBox1.Name = "listBox1";
this.listBox1.ScrollAlwaysVisible = true;
this.listBox1.Size = new System.Drawing.Size(514, 172);
this.listBox1.TabIndex = 2;
//
// label8
//
this.label8.AutoSize = true;
this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label8.Location = new System.Drawing.Point(166, 25);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(124, 24);
this.label8.TabIndex = 1;
this.label8.Text = "$0.00 || -$0.00";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label7.Location = new System.Drawing.Point(16, 25);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(155, 24);
this.label7.TabIndex = 0;
this.label7.Text = "Current Balance: ";
//
// panel4
//
this.panel4.Controls.Add(this.label11);
this.panel4.Controls.Add(this.label10);
this.panel4.Controls.Add(this.button16);
this.panel4.Controls.Add(this.button15);
this.panel4.Controls.Add(this.button14);
this.panel4.Controls.Add(this.button13);
this.panel4.Controls.Add(this.button12);
this.panel4.Controls.Add(this.button11);
this.panel4.Controls.Add(this.button10);
this.panel4.Controls.Add(this.button9);
this.panel4.Controls.Add(this.button8);
this.panel4.Controls.Add(this.button7);
this.panel4.Controls.Add(this.label9);
this.panel4.Location = new System.Drawing.Point(13, 81);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(535, 321);
this.panel4.TabIndex = 9;
//
// label11
//
this.label11.Location = new System.Drawing.Point(277, 40);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(245, 13);
this.label11.TabIndex = 15;
this.label11.Text = "$00.00 || -$00.00";
this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(176, 40);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(95, 13);
this.label10.TabIndex = 14;
this.label10.Text = "Account Balance: ";
this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// button16
//
this.button16.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button16.Location = new System.Drawing.Point(47, 272);
this.button16.Name = "button16";
this.button16.Size = new System.Drawing.Size(177, 45);
this.button16.TabIndex = 5;
this.button16.Text = "&Main Menu";
this.button16.UseVisualStyleBackColor = true;
this.button16.Click += new System.EventHandler(this.button16_Click);
//
// button15
//
this.button15.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button15.Location = new System.Drawing.Point(314, 170);
this.button15.Name = "button15";
this.button15.Size = new System.Drawing.Size(177, 45);
this.button15.TabIndex = 8;
this.button15.Text = "$180.00";
this.button15.UseVisualStyleBackColor = true;
this.button15.Click += new System.EventHandler(this.button15_Click);
//
// button14
//
this.button14.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button14.Location = new System.Drawing.Point(314, 272);
this.button14.Name = "button14";
this.button14.Size = new System.Drawing.Size(177, 45);
this.button14.TabIndex = 10;
this.button14.Text = "&Custom ...";
this.button14.UseVisualStyleBackColor = true;
this.button14.Click += new System.EventHandler(this.button14_Click);
//
// button13
//
this.button13.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button13.Location = new System.Drawing.Point(314, 221);
this.button13.Name = "button13";
this.button13.Size = new System.Drawing.Size(177, 45);
this.button13.TabIndex = 9;
this.button13.Text = "$200.00";
this.button13.UseVisualStyleBackColor = true;
this.button13.Click += new System.EventHandler(this.button13_Click);
//
// button12
//
this.button12.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button12.Location = new System.Drawing.Point(314, 119);
this.button12.Name = "button12";
this.button12.Size = new System.Drawing.Size(177, 45);
this.button12.TabIndex = 7;
this.button12.Text = "$140.00";
this.button12.UseVisualStyleBackColor = true;
this.button12.Click += new System.EventHandler(this.button12_Click);
//
// button11
//
this.button11.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button11.Location = new System.Drawing.Point(314, 68);
this.button11.Name = "button11";
this.button11.Size = new System.Drawing.Size(177, 45);
this.button11.TabIndex = 6;
this.button11.Text = "$120.00";
this.button11.UseVisualStyleBackColor = true;
this.button11.Click += new System.EventHandler(this.button11_Click);
//
// button10
//
this.button10.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button10.Location = new System.Drawing.Point(47, 222);
this.button10.Name = "button10";
this.button10.Size = new System.Drawing.Size(177, 45);
this.button10.TabIndex = 4;
this.button10.Text = "$100.00";
this.button10.UseVisualStyleBackColor = true;
this.button10.Click += new System.EventHandler(this.button10_Click);
//
// button9
//
this.button9.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button9.Location = new System.Drawing.Point(47, 170);
this.button9.Name = "button9";
this.button9.Size = new System.Drawing.Size(177, 45);
this.button9.TabIndex = 3;
this.button9.Text = "$80.00";
this.button9.UseVisualStyleBackColor = true;
this.button9.Click += new System.EventHandler(this.button9_Click);
//
// button8
//
this.button8.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button8.Location = new System.Drawing.Point(47, 119);
this.button8.Name = "button8";
this.button8.Size = new System.Drawing.Size(177, 45);
this.button8.TabIndex = 2;
this.button8.Text = "$40.00";
this.button8.UseVisualStyleBackColor = true;
this.button8.Click += new System.EventHandler(this.button8_Click);
//
// button7
//
this.button7.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button7.Location = new System.Drawing.Point(47, 69);
this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(177, 45);
this.button7.TabIndex = 1;
this.button7.Text = "$20.00";
this.button7.UseVisualStyleBackColor = true;
this.button7.Click += new System.EventHandler(this.button7_Click);
//
// label9
//
this.label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label9.Location = new System.Drawing.Point(8, 9);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(514, 23);
this.label9.TabIndex = 0;
this.label9.Text = "Withdrawals - Fast Cash";
this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panel5
//
this.panel5.Controls.Add(this.button17);
this.panel5.Controls.Add(this.label13);
this.panel5.Controls.Add(this.label12);
this.panel5.Location = new System.Drawing.Point(12, 80);
this.panel5.Name = "panel5";
this.panel5.Size = new System.Drawing.Size(536, 322);
this.panel5.TabIndex = 10;
this.panel5.Enter += new System.EventHandler(this.panel5_Enter);
//
// button17
//
this.button17.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button17.Location = new System.Drawing.Point(197, 189);
this.button17.Name = "button17";
this.button17.Size = new System.Drawing.Size(125, 43);
this.button17.TabIndex = 2;
this.button17.Text = "&Main Menu";
this.button17.UseVisualStyleBackColor = true;
this.button17.Click += new System.EventHandler(this.button17_Click);
//
// label13
//
this.label13.AutoSize = true;
this.label13.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label13.Location = new System.Drawing.Point(176, 124);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(180, 20);
this.label13.TabIndex = 1;
this.label13.Text = "Please Try Again Later...";
//
// label12
//
this.label12.AutoSize = true;
this.label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label12.ForeColor = System.Drawing.Color.Red;
this.label12.Location = new System.Drawing.Point(106, 93);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(310, 24);
this.label12.TabIndex = 0;
this.label12.Text = "Insufficient Funds for this transaction";
//
// panel6
//
this.panel6.Controls.Add(this.button20);
this.panel6.Controls.Add(this.button18);
this.panel6.Controls.Add(this.maskedTextBox1);
this.panel6.Controls.Add(this.label17);
this.panel6.Controls.Add(this.label14);
this.panel6.Controls.Add(this.label15);
this.panel6.Controls.Add(this.label16);
this.panel6.Location = new System.Drawing.Point(13, 80);
this.panel6.Name = "panel6";
this.panel6.Size = new System.Drawing.Size(536, 324);
this.panel6.TabIndex = 11;
this.panel6.Enter += new System.EventHandler(this.panel6_Enter);
//
// button20
//
this.button20.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button20.Location = new System.Drawing.Point(117, 227);
this.button20.Name = "button20";
this.button20.Size = new System.Drawing.Size(128, 34);
this.button20.TabIndex = 22;
this.button20.Text = "&Main Menu";
this.button20.UseVisualStyleBackColor = true;
this.button20.Click += new System.EventHandler(this.button20_Click);
//
// button18
//
this.button18.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button18.Location = new System.Drawing.Point(305, 227);
this.button18.Name = "button18";
this.button18.Size = new System.Drawing.Size(128, 34);
this.button18.TabIndex = 21;
this.button18.Text = "&Next";
this.button18.UseVisualStyleBackColor = true;
this.button18.Click += new System.EventHandler(this.button18_Click);
//
// maskedTextBox1
//
this.maskedTextBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.maskedTextBox1.HidePromptOnLeave = true;
this.maskedTextBox1.Location = new System.Drawing.Point(295, 123);
this.maskedTextBox1.Mask = "$0000";
this.maskedTextBox1.Name = "maskedTextBox1";
this.maskedTextBox1.Size = new System.Drawing.Size(100, 29);
this.maskedTextBox1.TabIndex = 20;
this.maskedTextBox1.MaskInputRejected += new System.Windows.Forms.MaskInputRejectedEventHandler(this.maskedTextBox1_MaskInputRejected);
//
// label17
//
this.label17.AutoSize = true;
this.label17.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label17.Location = new System.Drawing.Point(89, 121);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(199, 24);
this.label17.TabIndex = 19;
this.label17.Text = "Withdrawal Ammount: ";
//
// label14
//
this.label14.Location = new System.Drawing.Point(276, 41);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(245, 13);
this.label14.TabIndex = 18;
this.label14.Text = "$00.00 || -$00.00";
this.label14.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label15
//
this.label15.AutoSize = true;
this.label15.Location = new System.Drawing.Point(175, 41);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(95, 13);
this.label15.TabIndex = 17;
this.label15.Text = "Account Balance: ";
this.label15.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label16
//
this.label16.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label16.Location = new System.Drawing.Point(7, 10);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(514, 23);
this.label16.TabIndex = 16;
this.label16.Text = "Withdrawals - Custom Ammount";
this.label16.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panel7
//
this.panel7.Controls.Add(this.button23);
this.panel7.Controls.Add(this.button19);
this.panel7.Controls.Add(this.maskedTextBox2);
this.panel7.Controls.Add(this.label18);
this.panel7.Controls.Add(this.label19);
this.panel7.Controls.Add(this.label20);
this.panel7.Controls.Add(this.label21);
this.panel7.Location = new System.Drawing.Point(13, 81);
this.panel7.Name = "panel7";
this.panel7.Size = new System.Drawing.Size(536, 324);
this.panel7.TabIndex = 12;
this.panel7.Enter += new System.EventHandler(this.panel7_Enter);
//
// button23
//
this.button23.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button23.Location = new System.Drawing.Point(93, 221);
this.button23.Name = "button23";
this.button23.Size = new System.Drawing.Size(128, 34);
this.button23.TabIndex = 22;
this.button23.Text = "&Main Menu";
this.button23.UseVisualStyleBackColor = true;
this.button23.Click += new System.EventHandler(this.button23_Click);
//
// button19
//
this.button19.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button19.Location = new System.Drawing.Point(287, 221);
this.button19.Name = "button19";
this.button19.Size = new System.Drawing.Size(128, 34);
this.button19.TabIndex = 21;
this.button19.Text = "&Process";
this.button19.UseVisualStyleBackColor = true;
this.button19.Click += new System.EventHandler(this.button19_Click);
//
// maskedTextBox2
//
this.maskedTextBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.maskedTextBox2.HidePromptOnLeave = true;
this.maskedTextBox2.Location = new System.Drawing.Point(295, 123);
this.maskedTextBox2.Mask = "$0000";
this.maskedTextBox2.Name = "maskedTextBox2";
this.maskedTextBox2.Size = new System.Drawing.Size(100, 29);
this.maskedTextBox2.TabIndex = 20;
this.maskedTextBox2.MaskInputRejected += new System.Windows.Forms.MaskInputRejectedEventHandler(this.maskedTextBox2_MaskInputRejected);
//
// label18
//
this.label18.AutoSize = true;
this.label18.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label18.Location = new System.Drawing.Point(89, 121);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(170, 24);
this.label18.TabIndex = 19;
this.label18.Text = "Deposit Ammount: ";
//
// label19
//
this.label19.Location = new System.Drawing.Point(276, 41);
this.label19.Name = "label19";
this.label19.Size = new System.Drawing.Size(245, 13);
this.label19.TabIndex = 18;
this.label19.Text = "$00.00 || -$00.00";
this.label19.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label20
//
this.label20.AutoSize = true;
this.label20.Location = new System.Drawing.Point(175, 41);
this.label20.Name = "label20";
this.label20.Size = new System.Drawing.Size(95, 13);
this.label20.TabIndex = 17;
this.label20.Text = "Account Balance: ";
this.label20.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label21
//
this.label21.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label21.Location = new System.Drawing.Point(7, 10);
this.label21.Name = "label21";
this.label21.Size = new System.Drawing.Size(514, 23);
this.label21.TabIndex = 16;
this.label21.Text = "Deposits - Custom Ammount";
this.label21.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panel8
//
this.panel8.Controls.Add(this.button22);
this.panel8.Controls.Add(this.button21);
this.panel8.Controls.Add(this.listBox2);
this.panel8.Controls.Add(this.label23);
this.panel8.Controls.Add(this.label22);
this.panel8.Location = new System.Drawing.Point(12, 80);
this.panel8.Name = "panel8";
this.panel8.Size = new System.Drawing.Size(537, 324);
this.panel8.TabIndex = 13;
this.panel8.Enter += new System.EventHandler(this.panel8_Enter);
//
// button22
//
this.button22.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button22.Location = new System.Drawing.Point(376, 256);
this.button22.Name = "button22";
this.button22.Size = new System.Drawing.Size(116, 40);
this.button22.TabIndex = 4;
this.button22.Text = "&Process";
this.button22.UseVisualStyleBackColor = true;
this.button22.Click += new System.EventHandler(this.button22_Click);
//
// button21
//
this.button21.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button21.Location = new System.Drawing.Point(55, 256);
this.button21.Name = "button21";
this.button21.Size = new System.Drawing.Size(116, 40);
this.button21.TabIndex = 3;
this.button21.Text = "&Main Menu";
this.button21.UseVisualStyleBackColor = true;
this.button21.Click += new System.EventHandler(this.button21_Click);
//
// listBox2
//
this.listBox2.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.listBox2.FormattingEnabled = true;
this.listBox2.ItemHeight = 14;
this.listBox2.Location = new System.Drawing.Point(8, 116);
this.listBox2.Name = "listBox2";
this.listBox2.Size = new System.Drawing.Size(515, 32);
this.listBox2.TabIndex = 2;
//
// label23
//
this.label23.AutoSize = true;
this.label23.Location = new System.Drawing.Point(115, 66);
this.label23.Name = "label23";
this.label23.Size = new System.Drawing.Size(285, 13);
this.label23.TabIndex = 1;
this.label23.Text = "Are you sure you want to process the folowing transaction?";
//
// label22
//
this.label22.AutoSize = true;
this.label22.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label22.Location = new System.Drawing.Point(149, 24);
this.label22.Name = "label22";
this.label22.Size = new System.Drawing.Size(223, 24);
this.label22.TabIndex = 0;
this.label22.Text = "Confirm Your Transaction";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(560, 429);
this.Controls.Add(this.label1);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.panel1);
this.Controls.Add(this.panel3);
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel7);
this.Controls.Add(this.panel8);
this.Controls.Add(this.panel6);
this.Controls.Add(this.panel5);
this.Controls.Add(this.panel4);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.KeyPreview = true;
this.Name = "Form1";
this.Text = "ATM Machine";
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown);
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.panel3.ResumeLayout(false);
this.panel3.PerformLayout();
this.panel4.ResumeLayout(false);
this.panel4.PerformLayout();
this.panel5.ResumeLayout(false);
this.panel5.PerformLayout();
this.panel6.ResumeLayout(false);
this.panel6.PerformLayout();
this.panel7.ResumeLayout(false);
this.panel7.PerformLayout();
this.panel8.ResumeLayout(false);
this.panel8.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.Panel panel4;
private System.Windows.Forms.Button button16;
private System.Windows.Forms.Button button15;
private System.Windows.Forms.Button button14;
private System.Windows.Forms.Button button13;
private System.Windows.Forms.Button button12;
private System.Windows.Forms.Button button11;
private System.Windows.Forms.Button button10;
private System.Windows.Forms.Button button9;
private System.Windows.Forms.Button button8;
private System.Windows.Forms.Button button7;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Panel panel5;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.Button button17;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.Panel panel6;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.MaskedTextBox maskedTextBox1;
private System.Windows.Forms.Label label17;
private System.Windows.Forms.Button button18;
private System.Windows.Forms.Panel panel7;
private System.Windows.Forms.Button button19;
private System.Windows.Forms.MaskedTextBox maskedTextBox2;
private System.Windows.Forms.Label label18;
private System.Windows.Forms.Label label19;
private System.Windows.Forms.Label label20;
private System.Windows.Forms.Label label21;
private System.Windows.Forms.Button button20;
private System.Windows.Forms.Panel panel8;
private System.Windows.Forms.Button button22;
private System.Windows.Forms.Button button21;
private System.Windows.Forms.ListBox listBox2;
private System.Windows.Forms.Label label23;
private System.Windows.Forms.Label label22;
private System.Windows.Forms.Button button23;
}
}
@@ -0,0 +1,545 @@
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;
namespace ATM_Machine
{
public partial class Form1 : Form
{
static Customer customer = new Customer();
public Form1()
{
InitializeComponent();
InitSQL(); // init the sql side of things
InitState(); // init our screens
}
void InitState() // reinitialize the state
{
panel8.Hide(); // hide the confirmation screen
panel7.Hide(); // hide the deposit screen
panel6.Hide(); // hide custom withdrawal screen
panel5.Hide(); // hide insufficient funds screen
panel4.Hide(); // hide withdrawal screen
panel3.Hide(); // hide statement screen
panel2.Hide(); // hide main menu
label5.Text = "Welcome User"; // dummy text
panel1.Show(); // show the login screen
textBox1.Text = string.Empty; // re-initialize the account id textbox to blank
textBox2.Text = string.Empty; // re-initialize the pin textbox to blanks
panel1.Focus(); // Focus.
}
void MainMenu()
{
panel8.Hide(); // hide the confirmation screen
panel7.Hide(); // hide the deposit screen
panel6.Hide(); // hide custom withdrawal screen
panel5.Hide(); // hide insufficient funds screen
panel4.Hide(); // hide withdrawal screen
panel3.Hide(); // hide statement screen
listBox1.Items.Clear(); // clear the statement listbox
listBox2.Items.Clear(); // clear the confirmation listbox
maskedTextBox1.Text = string.Empty; // clear the deposit custom amount field
maskedTextBox2.Text = string.Empty; // clear the withdrawal custom amount field
panel2.Show(); // show the main menu
panel2.Focus(); // focus..
PopulateTransactions(); // do the transactions
}
void InffFunds()
{
panel8.Hide(); // hide the confirmation screen
panel7.Hide(); // hide the deposit screen
panel6.Hide(); // hide custom withdrawal screen
panel4.Hide(); // hide withdrawal screen
panel3.Hide(); // hide statement screen
panel2.Hide(); // show the main menu
panel5.Show(); // show insufficient funds screen
panel5.Focus(); // focus.
}
// hackity hack!
// this property determines which panel is visible
// based on each panel's visibility property.
// if statements galore
public uint visablepanel
{
get
{
if (panel8.Visible) // transaction confirm
{
return 8;
}
else if (panel7.Visible) // custom deposit
{
return 7;
}
else if (panel6.Visible) // custom withdrawal
{
return 6;
}
else if (panel5.Visible) // Insufficient Funds
{
return 5;
}
else if (panel4.Visible) // Withdrawals
{
return 4;
}
else if (panel3.Visible) // balance screen
{
return 3;
}
else if (panel2.Visible) // main menu
{
return 2;
}
else if (panel1.Visible) // login screen
{
return 1;
}
else // or else!
{
return 0;
}
}
}
private void button1_Click(object sender, EventArgs e) // process the login form
{
if (textBox1.Text != string.Empty && textBox2.Text != string.Empty)
{
ValidatePin(uint.Parse(textBox1.Text), uint.Parse(textBox2.Text));
if (customer.AccountNumber > 0) // this is a good value
{
GetCustomerIDFromAccountNumber(customer.AccountNumber);
panel1.Hide(); // hide login
panel2.Show(); // show main menu
panel2.Focus(); // focus.
GetCustomerName(customer.CustomerID); // now that we have the customer id, find customer name
label5.Text = "Welcome " + customer.Name; // populate header
PopulateTransactions(); // populate transactions
}
else
{
// show the user an error with direction
MessageBox.Show("Invalid Card Number or Pin", "Login failure", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
else
{
// show the user an error with direction
MessageBox.Show("Please enter your Card Number and PIN", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
if (textBox1.Text == string.Empty) // what is empty should be filled
{ // help the user figure out what needs to be corrected
textBox1.Focus(); // account number empty
}
else if (textBox2.Text == string.Empty)
{
textBox2.Focus(); // pin empty
}
}
}
private void button5_Click(object sender, EventArgs e) // logoff from the main menu
{
InitState();
// thanks for using bank of biscuit
MessageBox.Show("You have been successfully logged off. Thanks for using Bank of Biscuit!", "Log-off Notification", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
customer = new Customer();
}
private void Form1_KeyDown(object sender, KeyEventArgs e) // catch the enter button
{
if (e.KeyCode == Keys.Enter)
{
e.SuppressKeyPress = true;
//MessageBox.Show("visablepanel = " + visablepanel);
switch (visablepanel) // what to do based on the currently visible panel
{
case 1:
button1.PerformClick();
break;
case 2:
button5.PerformClick();
break;
case 3:
button6.PerformClick();
break;
case 4:
button16.PerformClick();
break;
case 5:
button17.PerformClick();
break;
case 6:
button18.PerformClick();
break;
case 7:
button19.PerformClick();
break;
case 8:
button22.PerformClick();
break;
default:
break;
}
}
}
private void panel2_Enter(object sender, EventArgs e) // on main menu entrance, focus logoff button
{
button5.Focus(); // Focus.
}
private void panel1_Enter(object sender, EventArgs e) // on login screen entrance, focus the account number
{
textBox1.Focus(); //Focus.
}
private void button4_Click(object sender, EventArgs e) // enter to statement screen
{
panel2.Hide(); // hide the main menu
doStatement(); // refresh the statement
if (customer.balance < 0)
{
label8.ForeColor = Color.Red; // in the red?
}
else
{
label8.ForeColor = Color.Black; // in the black
}
label8.Text = customer.balance.ToString("C"); // write out the balance
panel3.Show(); // show the statement screen
panel3.Focus(); // focus.
button6.Focus(); // now focus again!
}
private void button6_Click(object sender, EventArgs e) // mainmenu from statement screen
{
MainMenu(); // goto main menu
}
private void button2_Click(object sender, EventArgs e) // enter withdraw screen
{
panel2.Hide(); // hide main menu
doStatement(); // update statement
if (customer.balance < 0)
{
label11.ForeColor = Color.Red; // in the red
}
else
{
label11.ForeColor = Color.Black; // in the black
}
label11.Text = customer.balance.ToString("C"); // write out our balance
panel4.Show(); // show the panel
panel4.Focus(); // Focus.
button16.Focus(); // Focus again!
}
private void button7_Click(object sender, EventArgs e) // withdraw $20.00
{
if (customer.balance > 20)
{
this_transaction = new Transaction(0, customer.AccountNumber, 20.00M, 'W', DateTime.Now);
panel4.Hide(); // hide withdrawal screen
panel8.Show(); // show confirmation screen
panel8.Focus(); // focus.
}
else // insufficient funds
{
InffFunds(); // go there
}
}
private void button8_Click(object sender, EventArgs e) // withdraw $40.00
{
if (customer.balance > 40)
{
this_transaction = new Transaction(0, customer.AccountNumber, 40.00M, 'W', DateTime.Now);
panel4.Hide(); // hide withdrawal screen
panel8.Show(); // show confirmation screen
panel8.Focus(); // focus.
}
else // insufficient funds
{
InffFunds(); // go there
}
}
private void button9_Click(object sender, EventArgs e) // withdraw $80.00
{
if (customer.balance > 80)
{
this_transaction = new Transaction(0, customer.AccountNumber, 80.00M, 'W', DateTime.Now); // set the transaction
panel4.Hide(); // hide withdrawal screen
panel8.Show(); // show confirmation screen
panel8.Focus(); // focus.
}
else // insufficient funds
{
InffFunds(); // go there
}
}
private void button10_Click(object sender, EventArgs e) // withdraw $100.00
{
if (customer.balance > 100)
{
this_transaction = new Transaction(0, customer.AccountNumber, 100.00M, 'W', DateTime.Now); // set the transaction
panel4.Hide(); // hide withdrawal screen
panel8.Show(); // show confirmation screen
panel8.Focus(); // focus.
}
else // insufficient funds
{
InffFunds(); // go there
}
}
private void button11_Click(object sender, EventArgs e) // withdraw $120.00
{
if (customer.balance > 120)
{
this_transaction = new Transaction(0, customer.AccountNumber, 120.00M, 'W', DateTime.Now); // set the transaction
panel4.Hide(); // hide withdrawal screen
panel8.Show(); // show confirmation screen
panel8.Focus(); // focus.
}
else // insufficient funds
{
InffFunds(); // go there
}
}
private void button12_Click(object sender, EventArgs e) // withdraw $140.00
{
if (customer.balance > 140)
{
this_transaction = new Transaction(0, customer.AccountNumber, 140.00M, 'W', DateTime.Now); // set the transaction
panel4.Hide(); // hide withdrawal screen
panel8.Show(); // show confirmation screen
panel8.Focus(); // focus.
}
else // insufficient funds
{
InffFunds(); // go there
}
}
private void button15_Click(object sender, EventArgs e) // withdraw $180.00
{
if (customer.balance > 180)
{
this_transaction = new Transaction(0, customer.AccountNumber, 180.00M, 'W', DateTime.Now); // set the transaction
panel4.Hide(); // hide withdrawal screen
panel8.Show(); // show confirmation screen
panel8.Focus(); // focus.
}
else // insufficient funds
{
InffFunds(); // go there
}
}
private void button13_Click(object sender, EventArgs e) // withdraw $200.00
{
if (customer.balance > 200)
{
this_transaction = new Transaction(0, customer.AccountNumber, 200.00M, 'W', DateTime.Now); // set the transaction
panel4.Hide(); // hide withdrawal screen
panel8.Show(); // show confirmation screen
panel8.Focus(); // focus.
}
else // insufficient funds
{
InffFunds(); // go there
}
}
private void button14_Click(object sender, EventArgs e) // withdraw enter custom amount
{
panel4.Hide(); // hide withdrawals screen
doStatement(); // update balance
if (customer.balance < 0)
{
label14.ForeColor = Color.Red; // in the red
}
else
{
label14.ForeColor = Color.Black; // in the black
}
label14.Text = customer.balance.ToString("C"); // write out the balance
panel6.Show(); // show the panel
panel6.Focus(); // Focus.
}
private void button16_Click(object sender, EventArgs e)// withdraw enter main menu
{
this_transaction = null; // clean up the transaction variable
MainMenu(); // goto main menu
}
private void button17_Click(object sender, EventArgs e) // insufficient funds enter main menu
{
this_transaction = null; // clean up the transaction variable
MainMenu(); // goto main menu
}
private void button20_Click(object sender, EventArgs e) // main menu from custom withdrawals
{
this_transaction = null; // clean up the transaction variable
MainMenu(); // goto main menu
}
private void button18_Click(object sender, EventArgs e) // process custom withdrawal
{
if (Convert.ToDecimal(maskedTextBox1.Text.Substring(1)) > customer.balance) // insifficiant funds?
{
InffFunds(); // go there
}
else
{
this_transaction = new Transaction(0, customer.AccountNumber, Convert.ToDecimal(maskedTextBox1.Text.Substring(1)), 'W', DateTime.Now); // set the transaction
panel6.Hide(); // hide custom withdrawal screen
panel4.Hide(); // hide withdrawal screen
panel8.Show(); // show confirmation screen
panel8.Focus(); // focus.
}
}
private void button22_Click(object sender, EventArgs e) // process transaction from confirmation
{
if (InsertTransaction())
{
if (this_transaction.type == 'D')
{ // deposit confirmation
MessageBox.Show("A Deposit of " + this_transaction.amount.ToString("C") + " has been posted to your account", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{ // withdrawal confirmation
MessageBox.Show("A Withdrawal of " + this_transaction.amount.ToString("C") + " has been posted to your account", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
else
{ // unspecified error
MessageBox.Show("We are unable to process your transaction at this time, please try again later", "Termporary Unavailibility", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
MainMenu(); // goto main menu
}
private void button21_Click(object sender, EventArgs e) // main menu from confirmation
{
MainMenu(); // goto main menu
}
private void button3_Click(object sender, EventArgs e) // deposit from mainmenu
{
panel2.Hide(); // hide main menu
doStatement(); // refresh the statement
if (customer.balance < 0)
{
label19.ForeColor = Color.Red; // in the red?
}
else
{
label19.ForeColor = Color.Black; // in the black
}
label19.Text = customer.balance.ToString("C"); // write out the balance
panel7.Show(); // show deposit screen
panel7.Focus(); // focus.
}
private void button19_Click(object sender, EventArgs e) // process from deposit
{
this_transaction = new Transaction(0, customer.AccountNumber, Convert.ToDecimal(maskedTextBox2.Text.Substring(1)), 'D', DateTime.Now); // set the transaction
panel7.Hide(); // hide custom deposit screen
panel8.Show(); // show confirmation screen
panel8.Focus(); // focus.
}
private void button23_Click(object sender, EventArgs e) // main menu from deposit
{
MainMenu();
}
private void panel8_Enter(object sender, EventArgs e) // on focus of the confirmation screen
{
if (this_transaction != null)
{
string sout = "";
int padding = 13;
listBox2.Items.Add(string.Format("{0}|{1}|{2}|{3}|{4}", "Date".PadRight(padding), "Transaction".PadRight(padding), "Withdrawal".PadRight(padding), "Deposit".PadRight(padding), "Balance".PadRight(padding)));
listBox1.Items.Add("".PadLeft(padding * 5, '-'));
if (this_transaction.type == 'W')
{
// withdrawal
sout = string.Format("{0}|{1}|{2}|{3}|{4}", this_transaction.date.ToShortDateString().PadRight(padding), (customer.CustomerID.ToString().PadLeft(4, '0') + "." + this_transaction.id.ToString().PadLeft(4, '0')).PadRight(padding), this_transaction.amount.ToString("C").PadRight(padding), "".PadRight(padding), customer.balance.ToString("C").PadRight(padding));
}
else
{
// deposit
sout = string.Format("{0}|{1}|{2}|{3}|{4}", this_transaction.date.ToShortDateString().PadRight(padding), (customer.CustomerID.ToString().PadLeft(4, '0') + "." + this_transaction.id.ToString().PadLeft(4, '0')).PadRight(padding), "".PadRight(padding), this_transaction.amount.ToString("C").PadRight(padding), customer.balance.ToString("C").PadRight(padding));
}
listBox2.Items.Add(sout);
}
else
{
MessageBox.Show("A Null transaction?!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
MainMenu();
}
button22.Focus(); // focus the process button
}
private void panel7_Enter(object sender, EventArgs e) // on entrance of deposit
{
maskedTextBox2.Focus(); // Focus.
}
private void maskedTextBox2_MaskInputRejected(object sender, MaskInputRejectedEventArgs e) // move to process button on full input box
{
if (maskedTextBox2.MaskFull)
{
button19.Focus(); // Focus.
}
}
private void maskedTextBox1_MaskInputRejected(object sender, MaskInputRejectedEventArgs e) // move to process button on full input box
{
if (maskedTextBox1.MaskFull)
{
button18.Focus(); // Focus.
}
}
private void panel5_Enter(object sender, EventArgs e) // on entrance of insufficiant funds
{
button17.Focus(); // focus the main menu button
}
private void panel6_Enter(object sender, EventArgs e) // on entrance of custom withdrawal
{
maskedTextBox1.Focus(); // focus the input box
}
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace ATM_Machine
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ATM Machine")]
[assembly: AssemblyDescription("Project 4")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Coleman University")]
[assembly: AssemblyProduct("ATM Machine Project 4")]
[assembly: AssemblyCopyright("Copyright © Coleman University and Amrit Panesar 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f440311b-2d37-4e08-857e-ff0221109544")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.1008
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ATM_Machine.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ATM_Machine.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.1008
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ATM_Machine.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
@@ -0,0 +1,316 @@
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Drawing;
namespace ATM_Machine
{
public partial class Form1
{
public static SqlConnection connection;
public static Transaction this_transaction;
public bool InitSQL()
{
connection = new SqlConnection((string)(new SqlCredential("172.16.2.34", "db77260", "daeddb98", "db77260")).ToString());
if (SQLReady())
{
toolStripStatusLabel1.Text = "Connected";
return true;
}
else
{
toolStripStatusLabel1.Text = "Not connected";
MessageBox.Show("Error - unable to access server. Please try again later.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
textBox1.Enabled = false;
textBox2.Enabled = false;
button1.Enabled = false;
return false;
}
}
public bool SQLReady()
{
if (connection == null) { return false; }
try
{
connection.Open();
var canOpen = connection.State == ConnectionState.Open;
connection.Close();
return canOpen;
}
catch
{
return false;
}
}
public bool ConnIsOpen()
{
var canOpen = connection.State == ConnectionState.Open;
return canOpen;
}
public uint ValidatePin(uint cardnum, uint pin)
{
SqlCommand sql = new SqlCommand(@"SELECT * FROM ATMCard_t WHERE (card_number = " + cardnum + " AND pin = " + pin + ") "+
"OR (account_number = " + cardnum + " AND pin = " + pin + ")", connection);
object[] values = new object[4];
if (!ConnIsOpen())
{
connection.Open();
}
if (ConnIsOpen())
{
try
{
//value = Convert.ToDecimal(sql.ExecuteScalar());
SqlDataReader reader = sql.ExecuteReader();
reader.Read();
reader.GetValues(values); // grab the first row returned
}
catch (Exception ex)
{
StackTrace st = new StackTrace(new StackFrame(true));
StackFrame sf = st.GetFrame(0);
new ErrorThrower(sf, ex.Message);
}
finally
{
if (ConnIsOpen())
{
connection.Close();
}
}
if (values[0] != null) // populate the customer object
{
customer.ATMNumber = Convert.ToUInt32((int)values[0]);
customer.AccountNumber = Convert.ToUInt32((decimal)values[1]);
customer.PIN = Convert.ToUInt32((string)values[2]);
return Convert.ToUInt32((decimal)values[1]);
}
}
return 0;
}
public uint GetCustomerIDFromAccountNumber(uint accountnum)
{
SqlCommand sql = new SqlCommand(@"SELECT customer_id FROM accounts_t WHERE account_number = " + accountnum, connection);
string value = string.Empty;
if (!ConnIsOpen())
{
connection.Open();
}
try
{
value = sql.ExecuteScalar().ToString();
}
catch (Exception ex)
{
StackTrace st = new StackTrace(new StackFrame(true));
StackFrame sf = st.GetFrame(0);
new ErrorThrower(sf, ex.Message);
}
finally
{
if (ConnIsOpen())
{
connection.Close();
}
}
if (value != string.Empty)
{
customer.CustomerID = Convert.ToUInt32(value);
return Convert.ToUInt32(value);
}
else
{
return 0;
}
}
public string GetCustomerName(uint custId)
{
SqlCommand sql = new SqlCommand(@"SELECT customer_name FROM customers_t WHERE customer_id = " + custId.ToString(), connection);
string name = "";
if (!ConnIsOpen())
{
connection.Open();
}
try
{
name = Convert.ToString(sql.ExecuteScalar());
}
catch (Exception ex)
{
StackTrace st = new StackTrace(new StackFrame(true));
StackFrame sf = st.GetFrame(0);
new ErrorThrower(sf, ex.Message);
}
finally
{
if (ConnIsOpen())
{
connection.Close();
}
}
customer.Name = name;
return name;
}
public void PopulateTransactions()
{
customer.transactions.Clear();
SqlCommand sql = new SqlCommand(@"SELECT * FROM transactions_t WHERE account_number = " + customer.AccountNumber, connection);
if (!ConnIsOpen())
{
connection.Open();
}
try
{
SqlDataReader reader = sql.ExecuteReader();
object[] values = new object[6];
while (reader.Read())
{
reader.GetValues(values);
customer.transactions.Add(new Transaction(values));
}
}
catch (Exception ex)
{
StackTrace st = new StackTrace(new StackFrame(true));
StackFrame sf = st.GetFrame(0);
new ErrorThrower(sf, ex.Message);
}
finally
{
if (ConnIsOpen())
{
connection.Close();
}
}
}
public void doStatement()
{
listBox1.Items.Clear();
customer.balance = 0;
int padding = 13;
listBox1.Items.Add(string.Format("{0}|{1}|{2}|{3}|{4}","Date".PadRight(padding),"Transaction".PadRight(padding),"Withdrawal".PadRight(padding),"Deposit".PadRight(padding),"Balance".PadRight(padding)));
listBox1.Items.Add("".PadLeft(padding * 5,'-'));
ArrayList sout = new ArrayList();
foreach (Transaction tran in customer.transactions)
{
if (tran.type == 'D')
{
customer.balance += tran.amount;
sout.Add(string.Format("{0}|{1}|{2}|{3}|{4}", tran.date.ToShortDateString().PadRight(padding), (customer.CustomerID.ToString().PadLeft(4, '0') + "." + tran.id.ToString().PadLeft(4, '0')).PadRight(padding), "".PadRight(padding), tran.amount.ToString("C").PadRight(padding), customer.balance.ToString("C").PadRight(padding)));
}
else
{
customer.balance -= tran.amount;
sout.Add(string.Format("{0}|{1}|{2}|{3}|{4}", tran.date.ToShortDateString().PadRight(padding), (customer.CustomerID.ToString().PadLeft(4, '0') + "." + tran.id.ToString().PadLeft(4, '0')).PadRight(padding), tran.amount.ToString("C").PadRight(padding), "".PadRight(padding), customer.balance.ToString("C").PadRight(padding)));
}
}
sout.Reverse();
foreach (String sthis in sout)
{
listBox1.Items.Add(sthis);
}
}
public string GetAccountNumber(uint custId, string acctType)
{
string accountNumber = "";
if (!ConnIsOpen())
{
connection.Open();
}
SqlCommand sql = new SqlCommand(@"SELECT account_number FROM accounts_t WHERE customer_id = " + custId.ToString() + " AND account_type = '" + acctType + "'", connection);
try
{
accountNumber = sql.ExecuteScalar().ToString();
}
catch (Exception ex)
{
StackTrace st = new StackTrace(new StackFrame(true));
StackFrame sf = st.GetFrame(0);
new ErrorThrower(sf, ex.Message);
}
finally
{
if (ConnIsOpen())
{
connection.Close();
}
}
return accountNumber;
}
public bool InsertTransaction()
{
if (!ConnIsOpen())
{
connection.Open();
}
SqlCommand sql = new SqlCommand(@"INSERT INTO transactions_t (account_number,amount,transaction_type) " +
"VALUES ('" + this_transaction.account_number + "','" + this_transaction.amount + "','" + this_transaction.type + "')",
connection);
try
{
sql.ExecuteScalar();
}
catch (Exception ex)
{
StackTrace st = new StackTrace(new StackFrame(true));
StackFrame sf = st.GetFrame(0);
new ErrorThrower(sf, ex.Message);
return false;
}
finally
{
if (ConnIsOpen())
{
connection.Close();
}
}
return true;
}
}
class ErrorThrower
{
public ErrorThrower(StackFrame sf, string text)
{
MessageBox.Show(string.Format("Error: {0}\nLine:{1}\nFile:{2}", text, sf.GetFileLineNumber(), sf.GetFileName()), "Exception", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
}
class SqlCredential
{
public string Server { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public string Database { get; set; }
public SqlCredential(string server, string username, string password, string database)
{
Server = server;
Username = username;
Password = password;
Database = database;
}
public override string ToString()
{
return string.Format("Server={0};UID={1};PWD={2};Database={3}", Server, Username, Password, Database);
}
}
}