Click or drag to resize

Web Application

A simple SOWI Web Application based of component SOWIWeb.Foundation

Environment
Bootstrap

The most popular front-end framework for developing responsive, mobile first projects on the web.

Bootstrap web site...

DataTables

Language file e.g. DataTableDE.json

DataTables web site...

Modernizr

Modernizr adds classes to the html tag element which allow you to target specific browser functionality in your stylesheet. You don't actually need to write any Javascript to use it. Modernizr is a small and simple JavaScript library that helps you take advantage of emerging web technologies (CSS3, HTML5) while still maintaining a fine level of control over older browsers that may not yet support these new technologies.

Switchery

Switchery is a simple component that helps you turn your default HTML checkbox inputs into beautiful iOS 7 style switches in just few simple steps. You can easily customize switches, so that they match your design perfectly.

Switchery web site...

SOWI Layout

SOWI Web layout modifications

\Content\Site.css

Project
References

SOWI Components

Routing

This example implement in Global.asax.cs puts global routing.

C#
public class MvcApplication : System.Web.HttpApplication
{
  ...

  /// <summary>
  /// SOWI Web application start event. Puts global routes.
  /// </summary>
  protected void Application_Start()
  {
      SOWIWeb.Foundation.App.RouteConfig.RegisterRoutes(RouteTable.Routes);

      ...
  }
}
Exception Handling

This example implement in Global.asax.cs so handle SOWIWeb.Foundation all exceptions

C#
public class MvcApplication : System.Web.HttpApplication
{
  ...

  /// <summary>
  /// Application Error Handling with Redirection
  /// </summary>
  /// <seealso cref="SOWIWeb.Foundation.App.ExceptionHandler.Message(System.Web.HttpApplication, string)"/>
  protected void Application_Error(object sender, EventArgs e)
  {
      SOWIWeb.Foundation.App.ExceptionHandler.Message(this);
  }              
}
Layout

Definition the layout in file \Views\_ViewStart.cshtml

This example uses standard layout of FormsLayout

C#
@{
    Layout = "~/Views/Form/Layout.cshtml";
}
Main layout with login form (without translation)
Screen Layout
Main layout when user is logged in and without module menu (without translation)
Screen Layout Logged In

This section contains the following subsections:

Default parts of Layout view

Layout options

Controller
View and Content

Default views: Index, Details, Create, Edit and Delete. This CSHTML files stored into project folder ~/Views/ and controller name.

This files has following source code for content within views built by standard Form.

@Html.Partial("~/Views/Form/Form.cshtml")

Default content: SOWI Web Helper standard web controller puts path for view content CSHTML files and SOWI Web Foundation standard has view content as CSHTML files

An example for standard content path ~/Views/Form/EditContent.cshtml

An example for customer content path ~/Views/SchachtZeichnung/EditContent.cshtml

This can be combination see example this has two columns (first column data as standard content and secound column displayed the image)

<div class="row">
    <div class="col-md-6">
        @* standard Edit Content from SOWI Web Foundation *@
        @Html.Partial("~/Views/Form/EditContent.cshtml")
    </div>
    <div class="col-md-6">
        @if (Model.Content == null)
        {
            <div class="alert alert-danger" role="alert">
                Keine Schacht Zeichnung vorhanden!
            </div>
        }
        else
        {
            var lImage = "data:image/png;base64," + System.Convert.ToBase64String(Model.Content, 0, Model.Content.Length);
            var lValue = System.Convert.ToBase64String(Model.Content, 0, Model.Content.Length);
            string lName = "Content";
            <img src="@lImage" alt="Schacht Zeichnung" />
            <input type="hidden" name="@lName" id="@lName.GetMVCFieldIdentification()" value="@lValue" />
        }
    </div>
</div>

Structure see parts of layout

For view form contents enumeration see SOWIWeb.HelperContents

An example does define the custom content path see ContentsExtensionsOnContentsToPath

For view form enumeration see SOWIWeb.FoundationForms

An example does define the custom view path see FormsExtensionsOnFormsToPath

Scripts

Can script files declaration in view file type cshtml

Note: only first file view call from web controller
not in partial cshtml files
store App java script files in folder /Scripts/App/

An example in partial cshtml file

JScript
@section scripts
{
    <script src="~/Scripts/App/QualiTemplate.js" type="text/javascript"></script>
}
Styles

Can styles and style files declaration in view file type cshtml

Note: only first file view call from web controller
not in partial cshtml file
store App style files in folder /Content/App/

JScript
@section styles
{
    <style>
        input, select, textarea {
            max-width: 50px;
        }
    </style>
}

Or

Can styles direct write in cshtml

JScript
<style>
    input, select, textarea {
        max-width: 50px;
    }
</style>
Options

Automatic login (only for Debug mode) into file Global.asax.cs

This example has project Settings: AutoLogin, UserName and UserPassword

C#
public class MvcApplication : System.Web.HttpApplication
{
    ...

    protected void Application_Start()
    {
        ...

        #if DEBUG        
        //* puts auto login data for debug start *
        SOWIWeb.Foundation.Properties.Settings.SetLoginData(Properties.Settings.Default.AutoLogin,
                                                            Properties.Settings.Default.UserName,
                                                            Properties.Settings.Default.UserPassword);
        #endif
    }
}

More options see also

Templates
See Also