Web Application |
A simple SOWI Web Application based of component SOWIWeb.Foundation
This chapter present SOWI Web Application Parts
The most popular front-end framework for developing responsive, mobile first projects on the web.
Language file e.g. DataTableDE.json
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 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.
SOWI Web layout modifications
\Content\Site.css
SOWI Components
This example implement in Global.asax.cs puts global routing.
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); ... } }
This example implement in Global.asax.cs so handle SOWIWeb.Foundation all exceptions
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); } }
Definition the layout in file \Views\_ViewStart.cshtml
This example uses standard layout of FormsLayout
@{
Layout = "~/Views/Form/Layout.cshtml";
}
This section contains the following subsections:
Enumeration of layout parts see SOWIWeb.FoundationForms
Methods about this see FormsExtensions
Enumeration of dialogs see SOWIWeb.FoundationDialogs
Methods about this see DialogsExtensions
Application layout option see: SessionAppOption
Client layout option see: SessionClientOption
Details about web conhtroller see
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
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
@section scripts { <script src="~/Scripts/App/QualiTemplate.js" type="text/javascript"></script> }
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/
@section styles
{
<style>
input, select, textarea {
max-width: 50px;
}
</style>
}
Or
Can styles direct write in cshtml
<style>
input, select, textarea {
max-width: 50px;
}
</style>
Automatic login (only for Debug mode) into file Global.asax.cs
This example has project Settings: AutoLogin, UserName and UserPassword
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