summaryrefslogtreecommitdiff
path: root/slips/src/app/Marina/Web
diff options
context:
space:
mode:
Diffstat (limited to 'slips/src/app/Marina/Web')
-rw-r--r--slips/src/app/Marina/Web/AuthenticationHttpModule.cs28
-rw-r--r--slips/src/app/Marina/Web/Commands/AvailableSlipsCommand.cs23
-rw-r--r--slips/src/app/Marina/Web/Commands/CommandNames.cs5
-rw-r--r--slips/src/app/Marina/Web/Commands/RedirectCommand.cs11
-rw-r--r--slips/src/app/Marina/Web/CurrentHttpContext.cs135
-rw-r--r--slips/src/app/Marina/Web/CurrentHttpRequest.cs20
-rw-r--r--slips/src/app/Marina/Web/FrontController.cs21
-rw-r--r--slips/src/app/Marina/Web/GlobalApplication.cs17
-rw-r--r--slips/src/app/Marina/Web/Handlers/AvailableSlipsHandler.cs7
-rw-r--r--slips/src/app/Marina/Web/Handlers/Dispatcher.cs24
-rw-r--r--slips/src/app/Marina/Web/Handlers/IRegisteredHandlers.cs8
-rw-r--r--slips/src/app/Marina/Web/Handlers/IRequestHandler.cs6
-rw-r--r--slips/src/app/Marina/Web/Handlers/RegisteredHandlers.cs9
-rw-r--r--slips/src/app/Marina/Web/Handlers/RequestHandler.cs26
-rw-r--r--slips/src/app/Marina/Web/Handlers/RequestHandlerSpecification.cs16
-rw-r--r--slips/src/app/Marina/Web/Http/HttpGateway.cs71
-rw-r--r--slips/src/app/Marina/Web/Http/IHttpGateway.cs16
-rw-r--r--slips/src/app/Marina/Web/IHttpContext.cs69
-rw-r--r--slips/src/app/Marina/Web/IHttpRequest.cs7
-rw-r--r--slips/src/app/Marina/Web/Redirect.cs10
-rw-r--r--slips/src/app/Marina/Web/Services/AuthenticationServices.asmx1
-rw-r--r--slips/src/app/Marina/Web/Services/AuthenticationWebServices.cs21
-rw-r--r--slips/src/app/Marina/Web/Services/CatalogServices.asmx1
-rw-r--r--slips/src/app/Marina/Web/Services/CatalogWebServices.cs35
-rw-r--r--slips/src/app/Marina/Web/Services/LeaseServices.asmx1
-rw-r--r--slips/src/app/Marina/Web/Services/LeaseWebServices.cs26
-rw-r--r--slips/src/app/Marina/Web/Services/RegistrationServices.asmx1
-rw-r--r--slips/src/app/Marina/Web/Services/RegistrationWebServices.cs38
-rw-r--r--slips/src/app/Marina/Web/UnhandledExceptionsHttpModule.cs19
-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
41 files changed, 846 insertions, 0 deletions
diff --git a/slips/src/app/Marina/Web/AuthenticationHttpModule.cs b/slips/src/app/Marina/Web/AuthenticationHttpModule.cs
new file mode 100644
index 0000000..c90c317
--- /dev/null
+++ b/slips/src/app/Marina/Web/AuthenticationHttpModule.cs
@@ -0,0 +1,28 @@
+using System.Security.Principal;
+using System.Web;
+using System.Web.Security;
+
+namespace Marina.Web {
+ public class AuthenticationHttpModule : IHttpModule {
+ public void Init( HttpApplication context ) {
+ context.AuthenticateRequest += delegate { AuthenticateHttpRequest( ); };
+ }
+
+ public void Dispose() {}
+
+ public void AuthenticateHttpRequest() {
+ HttpCookie cookie = GetCookieFrom( HttpContext.Current );
+ if ( null != cookie ) {
+ BindPrincipalToThreadUsing( FormsAuthentication.Decrypt( cookie.Value ).Name );
+ }
+ }
+
+ private HttpCookie GetCookieFrom( HttpContext context ) {
+ return context.Request.Cookies[ FormsAuthentication.FormsCookieName ];
+ }
+
+ private void BindPrincipalToThreadUsing( string username ) {
+ HttpContext.Current.User = new GenericPrincipal( new GenericIdentity( username ), new string[] {"Customer"} );
+ }
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Commands/AvailableSlipsCommand.cs b/slips/src/app/Marina/Web/Commands/AvailableSlipsCommand.cs
new file mode 100644
index 0000000..4c14b14
--- /dev/null
+++ b/slips/src/app/Marina/Web/Commands/AvailableSlipsCommand.cs
@@ -0,0 +1,23 @@
+using Marina.Infrastructure;
+using Marina.Infrastructure.Container;
+using Marina.Task;
+using Marina.Web.Views.Pages;
+
+namespace Marina.Web.Commands {
+ public class AvailableSlipsCommand : ICommand {
+ public AvailableSlipsCommand() : this( new AvailableSlipsWebView( ), Resolve.DependencyFor< ICatalogTasks >( ) ) {}
+
+ public AvailableSlipsCommand( IAvailableSlipsWebView view, ICatalogTasks task ) {
+ _view = view;
+ _task = task;
+ }
+
+ public void Execute() {
+ _view.AddToBag( _task.GetAllAvailableSlips( ) );
+ _view.Render( );
+ }
+
+ private readonly IAvailableSlipsWebView _view;
+ private readonly ICatalogTasks _task;
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Commands/CommandNames.cs b/slips/src/app/Marina/Web/Commands/CommandNames.cs
new file mode 100644
index 0000000..a676be7
--- /dev/null
+++ b/slips/src/app/Marina/Web/Commands/CommandNames.cs
@@ -0,0 +1,5 @@
+namespace Marina.Web.Commands {
+ public class CommandNames {
+ public const string AvailableSlips = "AvailableSlips.marina";
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Commands/RedirectCommand.cs b/slips/src/app/Marina/Web/Commands/RedirectCommand.cs
new file mode 100644
index 0000000..c87c423
--- /dev/null
+++ b/slips/src/app/Marina/Web/Commands/RedirectCommand.cs
@@ -0,0 +1,11 @@
+using Marina.Infrastructure;
+using Marina.Web.Views;
+
+namespace Marina.Web.Commands {
+ public class RedirectCommand : ICommand {
+ public void Execute() {
+ Redirect.To( WebViews.Login );
+ //throw new Exception( "Could not find a handler for request" );
+ }
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/CurrentHttpContext.cs b/slips/src/app/Marina/Web/CurrentHttpContext.cs
new file mode 100644
index 0000000..8f3b959
--- /dev/null
+++ b/slips/src/app/Marina/Web/CurrentHttpContext.cs
@@ -0,0 +1,135 @@
+using System;
+using System.Collections;
+using System.Security.Principal;
+using System.Web;
+using System.Web.Caching;
+using System.Web.Profile;
+using System.Web.SessionState;
+
+namespace Marina.Web {
+ public class CurrentHttpContext : IHttpContext {
+ public void AddError( Exception errorInfo ) {
+ Current( ).AddError( errorInfo );
+ }
+
+ public void ClearError() {
+ Current( ).ClearError( );
+ }
+
+ public object GetSection( string sectionName ) {
+ return Current( ).GetSection( sectionName );
+ }
+
+ public void RewritePath( string path ) {
+ Current( ).RewritePath( path );
+ }
+
+ public void RewritePath( string path, bool rebaseClientPath ) {
+ Current( ).RewritePath( path, rebaseClientPath );
+ }
+
+ public void RewritePath( string filePath, string pathInfo, string queryString ) {
+ Current( ).RewritePath( filePath, pathInfo, queryString );
+ }
+
+ public void RewritePath( string filePath, string pathInfo, string queryString, bool setClientFilePath ) {
+ Current( ).RewritePath( filePath, pathInfo, queryString, setClientFilePath );
+ }
+
+ public HttpApplication ApplicationInstance {
+ get { return Current( ).ApplicationInstance; }
+ set { Current( ).ApplicationInstance = value; }
+ }
+
+ public HttpApplicationState Application {
+ get { return Current( ).Application; }
+ }
+
+ public IHttpHandler Handler {
+ get { return Current( ).Handler; }
+ set { Current( ).Handler = value; }
+ }
+
+ public IHttpHandler PreviousHandler {
+ get { return Current( ).PreviousHandler; }
+ }
+
+ public IHttpHandler CurrentHandler {
+ get { return Current( ).CurrentHandler; }
+ }
+
+ public HttpRequest Request {
+ get { return Current( ).Request; }
+ }
+
+ public HttpResponse Response {
+ get { return Current( ).Response; }
+ }
+
+ public TraceContext Trace {
+ get { return Current( ).Trace; }
+ }
+
+ public IDictionary Items {
+ get { return Current( ).Items; }
+ }
+
+ public HttpSessionState Session {
+ get { return Current( ).Session; }
+ }
+
+ public HttpServerUtility Server {
+ get { return Current( ).Server; }
+ }
+
+ public Exception Error {
+ get { return Current( ).Error; }
+ }
+
+ public Exception[] AllErrors {
+ get { return Current( ).AllErrors; }
+ }
+
+ public IPrincipal User {
+ get { return Current( ).User; }
+ set { Current( ).User = value; }
+ }
+
+ public ProfileBase Profile {
+ get { return Current( ).Profile; }
+ }
+
+ public bool SkipAuthorization {
+ get { return Current( ).SkipAuthorization; }
+ set { Current( ).SkipAuthorization = value; }
+ }
+
+ public bool IsDebuggingEnabled {
+ get { return Current( ).IsDebuggingEnabled; }
+ }
+
+ public bool IsCustomErrorEnabled {
+ get { return Current( ).IsCustomErrorEnabled; }
+ }
+
+ public DateTime Timestamp {
+ get { return Current( ).Timestamp; }
+ }
+
+ public Cache Cache {
+ get { return Current( ).Cache; }
+ }
+
+ public RequestNotification CurrentNotification {
+ get { return Current( ).CurrentNotification; }
+ }
+
+ public bool IsPostNotification {
+ get { return Current( ).IsPostNotification; }
+ }
+
+ private HttpContext Current() {
+ return HttpContext.Current;
+ }
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/CurrentHttpRequest.cs b/slips/src/app/Marina/Web/CurrentHttpRequest.cs
new file mode 100644
index 0000000..35c4fa5
--- /dev/null
+++ b/slips/src/app/Marina/Web/CurrentHttpRequest.cs
@@ -0,0 +1,20 @@
+using System.Collections.Specialized;
+using Marina.Presentation;
+
+namespace Marina.Web {
+ public class CurrentHttpRequest : IHttpRequest {
+ public CurrentHttpRequest( IHttpContext context ) {
+ _context = context;
+ }
+
+ public T ParsePayloadFor< T >( PayloadKey< T > key ) {
+ return key.ParseFrom( Payload( ) );
+ }
+
+ private NameValueCollection Payload() {
+ return new NameValueCollection( _context.Request.Params );
+ }
+
+ private readonly IHttpContext _context;
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/FrontController.cs b/slips/src/app/Marina/Web/FrontController.cs
new file mode 100644
index 0000000..8090cb9
--- /dev/null
+++ b/slips/src/app/Marina/Web/FrontController.cs
@@ -0,0 +1,21 @@
+using System.Web;
+using Marina.Web.Handlers;
+using Marina.Web.Http;
+
+namespace Marina.Web {
+ public class FrontController : IHttpHandler {
+ public FrontController( IHttpGateway gateway ) {
+ _gateway = gateway;
+ }
+
+ public void ProcessRequest( HttpContext context ) {
+ new Dispatcher( ).FindFor( _gateway ).Execute( );
+ }
+
+ public bool IsReusable {
+ get { return true; }
+ }
+
+ private IHttpGateway _gateway;
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/GlobalApplication.cs b/slips/src/app/Marina/Web/GlobalApplication.cs
new file mode 100644
index 0000000..452587f
--- /dev/null
+++ b/slips/src/app/Marina/Web/GlobalApplication.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Web;
+using Marina.Infrastructure.Logging.Interfaces;
+using Marina.Task;
+
+namespace Marina.Web {
+ public class GlobalApplication : HttpApplication {
+ public void Application_Start( object sender, EventArgs e ) {
+ ApplicationStartupTask.ApplicationBegin( );
+ Log.For(this).Informational("Application Startup completed");
+ }
+
+ public void Application_Error( object sender, EventArgs e ) {
+ Log.For( this ).Informational( "Unhandled error occurred" );
+ }
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Handlers/AvailableSlipsHandler.cs b/slips/src/app/Marina/Web/Handlers/AvailableSlipsHandler.cs
new file mode 100644
index 0000000..a8c69d5
--- /dev/null
+++ b/slips/src/app/Marina/Web/Handlers/AvailableSlipsHandler.cs
@@ -0,0 +1,7 @@
+using Marina.Web.Commands;
+
+namespace Marina.Web.Handlers {
+ public class AvailableSlipsHandler : RequestHandler {
+ public AvailableSlipsHandler() : base( For( CommandNames.AvailableSlips ), new AvailableSlipsCommand( ) ) {}
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Handlers/Dispatcher.cs b/slips/src/app/Marina/Web/Handlers/Dispatcher.cs
new file mode 100644
index 0000000..af1bd84
--- /dev/null
+++ b/slips/src/app/Marina/Web/Handlers/Dispatcher.cs
@@ -0,0 +1,24 @@
+using Marina.Infrastructure;
+using Marina.Web.Commands;
+using Marina.Web.Http;
+
+namespace Marina.Web.Handlers {
+ public class Dispatcher {
+ private readonly IRegisteredHandlers handlers;
+
+ public Dispatcher() : this( new RegisteredHandlers( ) ) {}
+
+ public Dispatcher( IRegisteredHandlers handlers ) {
+ this.handlers = handlers;
+ }
+
+ public ICommand FindFor( IHttpGateway request ) {
+ foreach ( IRequestHandler handler in handlers.All( ) ) {
+ if ( handler.IsSatisfiedBy( request ) ) {
+ return handler;
+ }
+ }
+ return new RedirectCommand( );
+ }
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Handlers/IRegisteredHandlers.cs b/slips/src/app/Marina/Web/Handlers/IRegisteredHandlers.cs
new file mode 100644
index 0000000..3049638
--- /dev/null
+++ b/slips/src/app/Marina/Web/Handlers/IRegisteredHandlers.cs
@@ -0,0 +1,8 @@
+using System.Collections.Generic;
+using Marina.Web.Handlers;
+
+namespace Marina.Web.Handlers {
+ public interface IRegisteredHandlers {
+ IEnumerable< IRequestHandler > All( );
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Handlers/IRequestHandler.cs b/slips/src/app/Marina/Web/Handlers/IRequestHandler.cs
new file mode 100644
index 0000000..e33552e
--- /dev/null
+++ b/slips/src/app/Marina/Web/Handlers/IRequestHandler.cs
@@ -0,0 +1,6 @@
+using Marina.Infrastructure;
+using Marina.Web.Http;
+
+namespace Marina.Web.Handlers {
+ public interface IRequestHandler : ISpecification< IHttpGateway >, ICommand {}
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Handlers/RegisteredHandlers.cs b/slips/src/app/Marina/Web/Handlers/RegisteredHandlers.cs
new file mode 100644
index 0000000..1f6395f
--- /dev/null
+++ b/slips/src/app/Marina/Web/Handlers/RegisteredHandlers.cs
@@ -0,0 +1,9 @@
+using System.Collections.Generic;
+
+namespace Marina.Web.Handlers {
+ public class RegisteredHandlers : IRegisteredHandlers {
+ public IEnumerable< IRequestHandler > All() {
+ yield return new AvailableSlipsHandler( );
+ }
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Handlers/RequestHandler.cs b/slips/src/app/Marina/Web/Handlers/RequestHandler.cs
new file mode 100644
index 0000000..a2162ef
--- /dev/null
+++ b/slips/src/app/Marina/Web/Handlers/RequestHandler.cs
@@ -0,0 +1,26 @@
+using Marina.Infrastructure;
+using Marina.Web.Http;
+
+namespace Marina.Web.Handlers {
+ public class RequestHandler : IRequestHandler {
+ public RequestHandler( ISpecification< IHttpGateway > specification, ICommand command ) {
+ _specification = specification;
+ _command = command;
+ }
+
+ public bool IsSatisfiedBy( IHttpGateway item ) {
+ return _specification.IsSatisfiedBy( item );
+ }
+
+ public void Execute() {
+ _command.Execute( );
+ }
+
+ public static ISpecification< IHttpGateway > For( string commandName ) {
+ return new RequestHandlerSpecification( commandName );
+ }
+
+ private readonly ISpecification< IHttpGateway > _specification;
+ private readonly ICommand _command;
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Handlers/RequestHandlerSpecification.cs b/slips/src/app/Marina/Web/Handlers/RequestHandlerSpecification.cs
new file mode 100644
index 0000000..51dd893
--- /dev/null
+++ b/slips/src/app/Marina/Web/Handlers/RequestHandlerSpecification.cs
@@ -0,0 +1,16 @@
+using Marina.Infrastructure;
+using Marina.Web.Http;
+
+namespace Marina.Web.Handlers {
+ public class RequestHandlerSpecification : ISpecification< IHttpGateway > {
+ private readonly string _commandName;
+
+ public RequestHandlerSpecification( string commandName ) {
+ _commandName = commandName;
+ }
+
+ public bool IsSatisfiedBy( IHttpGateway item ) {
+ return item.Destination( ).Contains( _commandName );
+ }
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Http/HttpGateway.cs b/slips/src/app/Marina/Web/Http/HttpGateway.cs
new file mode 100644
index 0000000..4b91315
--- /dev/null
+++ b/slips/src/app/Marina/Web/Http/HttpGateway.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Specialized;
+using System.Security.Principal;
+using System.Web;
+using System.Web.Security;
+using Marina.Infrastructure.Logging.Interfaces;
+using Marina.Presentation;
+using Marina.Web.Views;
+
+namespace Marina.Web.Http {
+ public class HttpGateway : IHttpGateway {
+ public HttpGateway( IHttpContext context ) {
+ _context = context;
+ }
+
+ public string Destination() {
+ return _context.Request.RawUrl;
+ }
+
+ public void RedirectTo( IView view ) {
+ try {
+ _context.Server.Transfer( view.Name( ) );
+ }
+ catch ( Exception ex ) {
+ Log.For( this ).CriticalError( ex.StackTrace );
+ }
+ }
+
+ public void AddAuthenticationCookieFor( string username, long customerId ) {
+ AddCookieToResponse( username, customerId );
+ BindPrincipalToCurrentThread( username );
+ }
+
+ public T ParsePayloadFor< T >( PayloadKey< T > key ) {
+ return key.ParseFrom( Payload( ) );
+ }
+
+ public bool ContainsPayload< T >( PayloadKey< T > key ) {
+ try {
+ ParsePayloadFor( key );
+ return true;
+ }
+ catch ( PayloadKeyNotFoundException ) {
+ return false;
+ }
+ }
+
+ private NameValueCollection Payload() {
+ return new NameValueCollection( _context.Request.Params );
+ }
+
+ private void BindPrincipalToCurrentThread( string username ) {
+ _context.User = new GenericPrincipal( new GenericIdentity( username ), new string[] {"Customer"} );
+ }
+
+ private void AddCookieToResponse( string username, long customerId ) {
+ FormsAuthenticationTicket ticket =
+ new FormsAuthenticationTicket( 1, username, DateTime.Now, DateTime.Now.AddMinutes( 20 ), false,
+ customerId.ToString( ) );
+
+ _context.Response.Cookies.Add( CreateCookieFrom( ticket ) );
+ _context.Response.Cookies.Add( new HttpCookie( PayloadKeys.CustomerId, customerId.ToString( ) ) );
+ }
+
+ private HttpCookie CreateCookieFrom( FormsAuthenticationTicket ticket ) {
+ return new HttpCookie( FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt( ticket ) );
+ }
+
+ private IHttpContext _context;
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Http/IHttpGateway.cs b/slips/src/app/Marina/Web/Http/IHttpGateway.cs
new file mode 100644
index 0000000..93164ad
--- /dev/null
+++ b/slips/src/app/Marina/Web/Http/IHttpGateway.cs
@@ -0,0 +1,16 @@
+using Marina.Presentation;
+using Marina.Web.Views;
+
+namespace Marina.Web.Http {
+ public interface IHttpGateway {
+ string Destination();
+
+ void RedirectTo( IView view );
+
+ void AddAuthenticationCookieFor( string username, long customerId );
+
+ bool ContainsPayload< T >( PayloadKey< T > key );
+
+ T ParsePayloadFor< T >( PayloadKey< T > key );
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/IHttpContext.cs b/slips/src/app/Marina/Web/IHttpContext.cs
new file mode 100644
index 0000000..186b8c4
--- /dev/null
+++ b/slips/src/app/Marina/Web/IHttpContext.cs
@@ -0,0 +1,69 @@
+using System;
+using System.Collections;
+using System.Security.Principal;
+using System.Web;
+using System.Web.Caching;
+using System.Web.Profile;
+using System.Web.SessionState;
+
+namespace Marina.Web {
+ public interface IHttpContext {
+ void AddError( Exception errorInfo );
+
+ void ClearError( );
+
+ object GetSection( string sectionName );
+
+ void RewritePath( string path );
+
+ void RewritePath( string path, bool rebaseClientPath );
+
+ void RewritePath( string filePath, string pathInfo, string queryString );
+
+ void RewritePath( string filePath, string pathInfo, string queryString, bool setClientFilePath );
+
+ HttpApplication ApplicationInstance { get; set; }
+
+ HttpApplicationState Application { get; }
+
+ IHttpHandler Handler { get; set; }
+
+ IHttpHandler PreviousHandler { get; }
+
+ IHttpHandler CurrentHandler { get; }
+
+ HttpRequest Request { get; }
+
+ HttpResponse Response { get; }
+
+ TraceContext Trace { get; }
+
+ IDictionary Items { get; }
+
+ HttpSessionState Session { get; }
+
+ HttpServerUtility Server { get; }
+
+ Exception Error { get; }
+
+ Exception[] AllErrors { get; }
+
+ IPrincipal User { get; set; }
+
+ ProfileBase Profile { get; }
+
+ bool SkipAuthorization { get; set; }
+
+ bool IsDebuggingEnabled { get; }
+
+ bool IsCustomErrorEnabled { get; }
+
+ DateTime Timestamp { get; }
+
+ Cache Cache { get; }
+
+ RequestNotification CurrentNotification { get; }
+
+ bool IsPostNotification { get; }
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/IHttpRequest.cs b/slips/src/app/Marina/Web/IHttpRequest.cs
new file mode 100644
index 0000000..be92c04
--- /dev/null
+++ b/slips/src/app/Marina/Web/IHttpRequest.cs
@@ -0,0 +1,7 @@
+using Marina.Presentation;
+
+namespace Marina.Web {
+ public interface IHttpRequest {
+ T ParsePayloadFor< T >( PayloadKey< T > key );
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Redirect.cs b/slips/src/app/Marina/Web/Redirect.cs
new file mode 100644
index 0000000..de4a5fe
--- /dev/null
+++ b/slips/src/app/Marina/Web/Redirect.cs
@@ -0,0 +1,10 @@
+using System.Web;
+using Marina.Web.Views;
+
+namespace Marina.Web {
+ public class Redirect {
+ public static void To( IView page ) {
+ HttpContext.Current.Server.Transfer( page.Name( ) );
+ }
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Services/AuthenticationServices.asmx b/slips/src/app/Marina/Web/Services/AuthenticationServices.asmx
new file mode 100644
index 0000000..773ace4
--- /dev/null
+++ b/slips/src/app/Marina/Web/Services/AuthenticationServices.asmx
@@ -0,0 +1 @@
+<%@ WebService Language="C#" CodeBehind="AuthenticationWebServices.cs" Class="Marina.Web.Services.AuthenticationWebServices" %> \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Services/AuthenticationWebServices.cs b/slips/src/app/Marina/Web/Services/AuthenticationWebServices.cs
new file mode 100644
index 0000000..f4002f6
--- /dev/null
+++ b/slips/src/app/Marina/Web/Services/AuthenticationWebServices.cs
@@ -0,0 +1,21 @@
+using System.Web.Services;
+using Marina.Infrastructure.Container;
+using Marina.Presentation.DTO;
+using Marina.Task;
+
+namespace Marina.Web.Services {
+ public class AuthenticationWebServices : IAuthenticationTask {
+ public AuthenticationWebServices() : this( Resolve.DependencyFor< IAuthenticationTask >( ) ) {}
+
+ public AuthenticationWebServices( IAuthenticationTask realTask ) {
+ this.realTask = realTask;
+ }
+
+ [WebMethod]
+ public DisplayResponseLineDTO AuthenticateUserUsing( LoginCredentialsDTO credentials ) {
+ return realTask.AuthenticateUserUsing( credentials );
+ }
+
+ private readonly IAuthenticationTask realTask;
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Services/CatalogServices.asmx b/slips/src/app/Marina/Web/Services/CatalogServices.asmx
new file mode 100644
index 0000000..67943dc
--- /dev/null
+++ b/slips/src/app/Marina/Web/Services/CatalogServices.asmx
@@ -0,0 +1 @@
+<%@ WebService Language="C#" CodeBehind="CatalogWebServices.cs" Class="Marina.Web.Services.CatalogWebServices" %> \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Services/CatalogWebServices.cs b/slips/src/app/Marina/Web/Services/CatalogWebServices.cs
new file mode 100644
index 0000000..6982cdd
--- /dev/null
+++ b/slips/src/app/Marina/Web/Services/CatalogWebServices.cs
@@ -0,0 +1,35 @@
+using System.Collections.Generic;
+using System.Web.Services;
+using Marina.Infrastructure.Container;
+using Marina.Presentation.DTO;
+using Marina.Task;
+
+namespace Marina.Web.Services {
+ public class CatalogWebServices {
+ public CatalogWebServices() : this( Resolve.DependencyFor< ICatalogTasks >( ) ) {}
+
+ public CatalogWebServices( ICatalogTasks underlyingTask ) {
+ _underlyingTask = underlyingTask;
+ }
+
+ public IEnumerable< SlipDisplayDTO > GetAvailableSlipsForDockBy( long dockId ) {
+ return _underlyingTask.GetAvailableSlipsForDockBy( dockId );
+ }
+
+ [WebMethod]
+ public DockDisplayDTO GetDockInformationBy( long dockId ) {
+ return _underlyingTask.GetDockInformationBy( dockId );
+ }
+
+ public IEnumerable< SlipDisplayDTO > GetAllAvailableSlips() {
+ return _underlyingTask.GetAllAvailableSlips( );
+ }
+
+ [WebMethod]
+ public SlipDisplayDTO FindSlipBy( long slipId ) {
+ return _underlyingTask.FindSlipBy( slipId );
+ }
+
+ private readonly ICatalogTasks _underlyingTask;
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Services/LeaseServices.asmx b/slips/src/app/Marina/Web/Services/LeaseServices.asmx
new file mode 100644
index 0000000..648db51
--- /dev/null
+++ b/slips/src/app/Marina/Web/Services/LeaseServices.asmx
@@ -0,0 +1 @@
+<%@ WebService Language="C#" CodeBehind="LeaseWebServices.cs" Class="Marina.Web.Services.LeaseWebServices" %> \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Services/LeaseWebServices.cs b/slips/src/app/Marina/Web/Services/LeaseWebServices.cs
new file mode 100644
index 0000000..b09cc76
--- /dev/null
+++ b/slips/src/app/Marina/Web/Services/LeaseWebServices.cs
@@ -0,0 +1,26 @@
+using System.Collections.Generic;
+using System.Web.Services;
+using Marina.Infrastructure.Container;
+using Marina.Presentation.DTO;
+using Marina.Task;
+
+namespace Marina.Web.Services {
+ public class LeaseWebServices {
+ public LeaseWebServices() : this( Resolve.DependencyFor< ILeaseTasks >( ) ) {}
+
+ public LeaseWebServices( ILeaseTasks underlyingTask ) {
+ _underlyingTask = underlyingTask;
+ }
+
+ public IEnumerable< DisplayLeaseDTO > FindAllLeasesFor( long customerId ) {
+ return _underlyingTask.FindAllLeasesFor( customerId );
+ }
+
+ [WebMethod]
+ public DisplayResponseLineDTO RequestLeaseUsing( SubmitLeaseRequestDTO request ) {
+ return _underlyingTask.RequestLeaseUsing( request );
+ }
+
+ private readonly ILeaseTasks _underlyingTask;
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Services/RegistrationServices.asmx b/slips/src/app/Marina/Web/Services/RegistrationServices.asmx
new file mode 100644
index 0000000..364b737
--- /dev/null
+++ b/slips/src/app/Marina/Web/Services/RegistrationServices.asmx
@@ -0,0 +1 @@
+<%@ WebService Language="C#" CodeBehind="RegistrationWebServices.cs" Class="Marina.Web.Services.RegistrationWebServices" %> \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/Services/RegistrationWebServices.cs b/slips/src/app/Marina/Web/Services/RegistrationWebServices.cs
new file mode 100644
index 0000000..ac98fe5
--- /dev/null
+++ b/slips/src/app/Marina/Web/Services/RegistrationWebServices.cs
@@ -0,0 +1,38 @@
+using System.Collections.Generic;
+using System.Web.Services;
+using Marina.Infrastructure.Container;
+using Marina.Presentation.DTO;
+using Marina.Task;
+
+namespace Marina.Web.Services {
+ public class RegistrationWebServices {
+ public RegistrationWebServices() : this( Resolve.DependencyFor< IRegistrationTasks >( ) ) {}
+
+ public RegistrationWebServices( IRegistrationTasks underlyingTask ) {
+ _underlyingTask = underlyingTask;
+ }
+
+ public IEnumerable< DisplayResponseLineDTO > RegisterNew( RegisterCustomerDTO customer ) {
+ return _underlyingTask.RegisterNew( customer );
+ }
+
+ public IEnumerable< DisplayResponseLineDTO > AddNewBoatUsing( BoatRegistrationDTO boat ) {
+ return _underlyingTask.AddNewBoatUsing( boat );
+ }
+
+ [WebMethod]
+ public CustomerRegistrationDisplayDTO LoadRegistrationFor( long customerId ) {
+ return _underlyingTask.LoadRegistrationFor( customerId );
+ }
+
+ public IEnumerable< DisplayResponseLineDTO > UpdateRegistrationFor( UpdateCustomerRegistrationDTO registration ) {
+ return _underlyingTask.UpdateRegistrationFor( registration );
+ }
+
+ public IEnumerable< BoatRegistrationDTO > AllBoatsFor( long customerId ) {
+ return _underlyingTask.AllBoatsFor( customerId );
+ }
+
+ private readonly IRegistrationTasks _underlyingTask;
+ }
+} \ No newline at end of file
diff --git a/slips/src/app/Marina/Web/UnhandledExceptionsHttpModule.cs b/slips/src/app/Marina/Web/UnhandledExceptionsHttpModule.cs
new file mode 100644
index 0000000..d2267f2
--- /dev/null
+++ b/slips/src/app/Marina/Web/UnhandledExceptionsHttpModule.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Web;
+using Marina.Infrastructure.Logging.Interfaces;
+using Marina.Web.Views;
+
+namespace Marina.Web {
+ public class UnhandledExceptionsHttpModule : IHttpModule {
+ public void Init( HttpApplication context ) {
+ context.Error += delegate {
+ foreach ( Exception exception in context.Context.AllErrors ) {
+ Log.For( this ).CriticalError( exception.ToString( ) );
+ }
+ Redirect.To( WebViews.Login );
+ };
+ }
+
+ public void Dispose() {}
+ }
+} \ No newline at end of file
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