summaryrefslogtreecommitdiff
path: root/DesignPatterns/src/app/DesignPatterns.State/IdleState.cs
diff options
context:
space:
mode:
authormo.khan <mo.khan@a0a4a051-f042-0410-9e78-9fae330bdb64>2008-01-05 07:16:52 +0000
committermo.khan <mo.khan@a0a4a051-f042-0410-9e78-9fae330bdb64>2008-01-05 07:16:52 +0000
commit8c137f229c36a777ead5cacb3350cb8692646292 (patch)
tree92876c5da0ffd17767e38f94a44415ac27a3c73e /DesignPatterns/src/app/DesignPatterns.State/IdleState.cs
parentcbdf42a6427eef7849d1ab7731f9185b410431d3 (diff)
git-svn-id: http://mokhan.googlecode.com/svn/trunk@9 a0a4a051-f042-0410-9e78-9fae330bdb64
Diffstat (limited to 'DesignPatterns/src/app/DesignPatterns.State/IdleState.cs')
-rw-r--r--DesignPatterns/src/app/DesignPatterns.State/IdleState.cs37
1 files changed, 37 insertions, 0 deletions
diff --git a/DesignPatterns/src/app/DesignPatterns.State/IdleState.cs b/DesignPatterns/src/app/DesignPatterns.State/IdleState.cs
new file mode 100644
index 0000000..52b2bc6
--- /dev/null
+++ b/DesignPatterns/src/app/DesignPatterns.State/IdleState.cs
@@ -0,0 +1,37 @@
+using System;
+
+namespace DesignPatterns.State {
+ public class IdleState : IState {
+ public IdleState( IPosTerminal terminal ) {
+ _terminal = terminal;
+
+ Console.Out.WriteLine( "Mo's POS TERMINAL" );
+ Console.Out.WriteLine( "Please swipe a card:" );
+ }
+
+ public void SwipeCard( string cardNumber ) {
+ _terminal.Transaction = new PosTransaction( );
+ _terminal.Transaction.Date = DateTime.Now;
+ _terminal.Transaction.CardNumber = cardNumber;
+ _terminal.CurrentState = new CardSwipedState( _terminal );
+ }
+
+ public void EnterAmount( double amount ) {
+ Console.Out.WriteLine( "Please swipe a card first." );
+ }
+
+ public void EnterPin( string pin ) {
+ Console.Out.WriteLine( "Please swipe a card first." );
+ }
+
+ public void ProcessTransaction( ) {
+ Console.Out.WriteLine( "Please swipe a card first." );
+ }
+
+ public void PrintReceipt( ) {
+ Console.Out.WriteLine( "Please swipe a card first." );
+ }
+
+ private IPosTerminal _terminal;
+ }
+} \ No newline at end of file