summaryrefslogtreecommitdiff
path: root/slips/src/app/Marina/Web/Views
diff options
context:
space:
mode:
Diffstat (limited to 'slips/src/app/Marina/Web/Views')
-rw-r--r--slips/src/app/Marina/Web/Views/IView.cs7
-rw-r--r--slips/src/app/Marina/Web/Views/IViewLuggageTicket.cs3
-rw-r--r--slips/src/app/Marina/Web/Views/IViewLuggageTransporter.cs7
-rw-r--r--slips/src/app/Marina/Web/Views/IWebView.cs5
-rw-r--r--slips/src/app/Marina/Web/Views/Pages/AvailableSlipsWebView.cs16
-rw-r--r--slips/src/app/Marina/Web/Views/Pages/IAvailableSlipsWebView.cs6
-rw-r--r--slips/src/app/Marina/Web/Views/View.cs28
-rw-r--r--slips/src/app/Marina/Web/Views/ViewLuggage.cs11
-rw-r--r--slips/src/app/Marina/Web/Views/ViewLuggageTickets.cs14
-rw-r--r--slips/src/app/Marina/Web/Views/ViewLuggageTransporter.cs32
-rw-r--r--slips/src/app/Marina/Web/Views/WebView.cs27
-rw-r--r--slips/src/app/Marina/Web/Views/WebViews.cs18
12 files changed, 174 insertions, 0 deletions
diff --git a/slips/src/app/Marina/Web/Views/IView.cs b/slips/src/app/Marina/Web/Views/IView.cs
new file mode 100644
index 0000000..55c1595
--- /dev/null
+++ b/slips/src/app/Marina/Web/Views/IView.cs
@@ -0,0 +1,7 @@
+namespace Marina.Web.Views {
+ public interface IView {
+ string Name( );
+
+ void Render( );
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Views/IViewLuggageTicket.cs b/slips/src/app/Marina/Web/Views/IViewLuggageTicket.cs
new file mode 100644
index 0000000..231a008
--- /dev/null
+++ b/slips/src/app/Marina/Web/Views/IViewLuggageTicket.cs
@@ -0,0 +1,3 @@
+namespace Marina.Web.Views {
+ public interface IViewLuggageTicket< T > {}
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Views/IViewLuggageTransporter.cs b/slips/src/app/Marina/Web/Views/IViewLuggageTransporter.cs
new file mode 100644
index 0000000..7256f86
--- /dev/null
+++ b/slips/src/app/Marina/Web/Views/IViewLuggageTransporter.cs
@@ -0,0 +1,7 @@
+namespace Marina.Web.Views {
+ public interface IViewLuggageTransporter< T > {
+ void Add( T value );
+
+ T Value( );
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Views/IWebView.cs b/slips/src/app/Marina/Web/Views/IWebView.cs
new file mode 100644
index 0000000..52af842
--- /dev/null
+++ b/slips/src/app/Marina/Web/Views/IWebView.cs
@@ -0,0 +1,5 @@
+namespace Marina.Web.Views {
+ public interface IWebView< T > : IView {
+ void AddToBag( T slips );
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Views/Pages/AvailableSlipsWebView.cs b/slips/src/app/Marina/Web/Views/Pages/AvailableSlipsWebView.cs
new file mode 100644
index 0000000..bf930a7
--- /dev/null
+++ b/slips/src/app/Marina/Web/Views/Pages/AvailableSlipsWebView.cs
@@ -0,0 +1,16 @@
+using System.Collections.Generic;
+using Marina.Infrastructure.Container;
+using Marina.Presentation.DTO;
+using Marina.Web.Http;
+
+namespace Marina.Web.Views.Pages {
+ public class AvailableSlipsWebView : WebView< IEnumerable< SlipDisplayDTO > >, IAvailableSlipsWebView {
+ public AvailableSlipsWebView()
+ : this(
+ ViewLuggage.TransporterFor( ViewLuggageTickets.AvailableSlips ),
+ Resolve.DependencyFor< IHttpGateway >( ) ) {}
+
+ public AvailableSlipsWebView( IViewLuggageTransporter< IEnumerable< SlipDisplayDTO > > viewBag, IHttpGateway gateway )
+ : base( "AvailableSlips.aspx", viewBag, gateway ) {}
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Views/Pages/IAvailableSlipsWebView.cs b/slips/src/app/Marina/Web/Views/Pages/IAvailableSlipsWebView.cs
new file mode 100644
index 0000000..83535da
--- /dev/null
+++ b/slips/src/app/Marina/Web/Views/Pages/IAvailableSlipsWebView.cs
@@ -0,0 +1,6 @@
+using System.Collections.Generic;
+using Marina.Presentation.DTO;
+
+namespace Marina.Web.Views.Pages {
+ public interface IAvailableSlipsWebView : IWebView< IEnumerable< SlipDisplayDTO > > {}
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Views/View.cs b/slips/src/app/Marina/Web/Views/View.cs
new file mode 100644
index 0000000..9f22d8d
--- /dev/null
+++ b/slips/src/app/Marina/Web/Views/View.cs
@@ -0,0 +1,28 @@
+using Marina.Infrastructure.Container;
+using Marina.Web.Http;
+
+namespace Marina.Web.Views {
+ public class View : IView {
+ public View( string name ) : this( name, Resolve.DependencyFor< IHttpGateway >( ) ) {}
+
+ public View( string name, IHttpGateway gateway ) {
+ _name = name;
+ _gateway = gateway;
+ }
+
+ public string Name() {
+ return _name;
+ }
+
+ public void Render() {
+ _gateway.RedirectTo( this );
+ }
+
+ public override string ToString() {
+ return Name( );
+ }
+
+ private readonly string _name;
+ private readonly IHttpGateway _gateway;
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Views/ViewLuggage.cs b/slips/src/app/Marina/Web/Views/ViewLuggage.cs
new file mode 100644
index 0000000..7e9580d
--- /dev/null
+++ b/slips/src/app/Marina/Web/Views/ViewLuggage.cs
@@ -0,0 +1,11 @@
+namespace Marina.Web.Views {
+ public class ViewLuggage {
+ public static IViewLuggageTransporter< T > TransporterFor< T >( IViewLuggageTicket< T > ticket ) {
+ return new ViewLuggageTransporter< T >( ticket );
+ }
+
+ public static T ClaimFor< T >( IViewLuggageTicket< T > ticket ) {
+ return new ViewLuggageTransporter< T >( ticket ).Value( );
+ }
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Views/ViewLuggageTickets.cs b/slips/src/app/Marina/Web/Views/ViewLuggageTickets.cs
new file mode 100644
index 0000000..3c30368
--- /dev/null
+++ b/slips/src/app/Marina/Web/Views/ViewLuggageTickets.cs
@@ -0,0 +1,14 @@
+using System.Collections.Generic;
+using Marina.Presentation.DTO;
+
+namespace Marina.Web.Views {
+ public class ViewLuggageTickets {
+ public static IViewLuggageTicket< IEnumerable< SlipDisplayDTO > > AvailableSlips =
+ new ViewBagItem< IEnumerable< SlipDisplayDTO > >( );
+
+ public static IViewLuggageTicket< IEnumerable< DisplayResponseLineDTO > > ResponseMessages =
+ new ViewBagItem< IEnumerable< DisplayResponseLineDTO > >( );
+
+ private class ViewBagItem< T > : IViewLuggageTicket< T > {}
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Views/ViewLuggageTransporter.cs b/slips/src/app/Marina/Web/Views/ViewLuggageTransporter.cs
new file mode 100644
index 0000000..a86c734
--- /dev/null
+++ b/slips/src/app/Marina/Web/Views/ViewLuggageTransporter.cs
@@ -0,0 +1,32 @@
+using System.Collections;
+using System.Web;
+
+namespace Marina.Web.Views {
+ public class ViewLuggageTransporter< Luggage > : IViewLuggageTransporter< Luggage > {
+ public ViewLuggageTransporter( IViewLuggageTicket< Luggage > key ) : this( key, HttpContext.Current.Items ) {}
+
+ private ViewLuggageTransporter( IViewLuggageTicket< Luggage > key, IDictionary items ) {
+ _ticket = key;
+ _items = items;
+ }
+
+ public Luggage Value() {
+ foreach ( DictionaryEntry entry in _items ) {
+ if ( entry.Value is Luggage ) {
+ return ( Luggage )entry.Value;
+ }
+ //if ( entry.Key.Equals( _ticket ) ) {
+ // return ( Luggage )entry.Value;
+ //}
+ }
+ return default( Luggage );
+ }
+
+ public void Add( Luggage value ) {
+ _items.Add( _ticket, value );
+ }
+
+ private readonly IViewLuggageTicket< Luggage > _ticket;
+ private readonly IDictionary _items;
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Views/WebView.cs b/slips/src/app/Marina/Web/Views/WebView.cs
new file mode 100644
index 0000000..f517479
--- /dev/null
+++ b/slips/src/app/Marina/Web/Views/WebView.cs
@@ -0,0 +1,27 @@
+using Marina.Web.Http;
+
+namespace Marina.Web.Views {
+ public class WebView< T > : IWebView< T > {
+ public WebView( string name, IViewLuggageTransporter< T > viewBag, IHttpGateway gateway ) {
+ this.name = name;
+ this.gateway = gateway;
+ this.viewBag = viewBag;
+ }
+
+ public string Name() {
+ return name;
+ }
+
+ public void Render() {
+ gateway.RedirectTo( this );
+ }
+
+ public void AddToBag( T slips ) {
+ viewBag.Add( slips );
+ }
+
+ private readonly string name;
+ private readonly IHttpGateway gateway;
+ private readonly IViewLuggageTransporter< T > viewBag;
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Views/WebViews.cs b/slips/src/app/Marina/Web/Views/WebViews.cs
new file mode 100644
index 0000000..6431606
--- /dev/null
+++ b/slips/src/app/Marina/Web/Views/WebViews.cs
@@ -0,0 +1,18 @@
+using Marina.Web.Views.Pages;
+
+namespace Marina.Web.Views {
+ public class WebViews {
+ public static readonly IAvailableSlipsWebView AvailableSlips = new AvailableSlipsWebView( );
+
+ public static readonly IView ContactUs = new View( "ContactUs.aspx" );
+ public static readonly IView Default = new View( "Default.aspx" );
+ public static readonly IView DockView = new View( "DockView.aspx" );
+ public static readonly IView Login = new View( "Login.aspx" );
+ public static readonly IView RegisterBoat = new View( "RegisterBoat.aspx" );
+ public static readonly IView Registration = new View( "Registration.aspx" );
+ public static readonly IView UpdateCustomerRegistration = new View( "UpdateCustomerRegistration.aspx" );
+ public static readonly IView ViewRegisteredBoats = new View( "ViewRegisteredBoats.aspx" );
+ public static readonly IView CurrentLeases = new View( "CurrentLeases.aspx" );
+ public static readonly IView LeaseSlip = new View( "LeaseSlip.aspx" );
+ }
+} \ No newline at end of file