Blog

Labels
AJAX(112) App Studio(7) Apple(1) Application Builder(245) Application Factory(207) ASP.NET(95) ASP.NET 3.5(45) ASP.NET Code Generator(72) ASP.NET Membership(28) Azure(18) Barcode(2) Barcodes(3) BLOB(18) Business Rules(1) Business Rules/Logic(140) BYOD(13) Caching(2) Calendar(5) Charts(29) Cloud(14) Cloud On Time(2) Cloud On Time for Windows 7(2) Code Generator(54) Collaboration(11) command line(1) Conflict Detection(1) Content Management System(12) COT Tools for Excel(26) CRUD(1) Custom Actions(1) Data Aquarium Framework(122) Data Sheet(9) Data Sources(22) Database Lookups(50) Deployment(22) Designer(177) Device(1) DotNetNuke(12) EASE(20) Email(6) Features(101) Firebird(1) Form Builder(14) Globalization and Localization(6) How To(1) Hypermedia(2) Inline Editing(1) Installation(5) JavaScript(20) Kiosk(1) Low Code(3) Mac(1) Many-To-Many(4) Maps(6) Master/Detail(36) Microservices(4) Mobile(63) Mode Builder(3) Model Builder(3) MySQL(10) Native Apps(5) News(18) OAuth(9) OAuth Scopes(1) OAuth2(13) Offline(20) Offline Apps(4) Offline Sync(5) Oracle(11) PKCE(2) Postgre SQL(1) PostgreSQL(2) PWA(2) QR codes(2) Rapid Application Development(5) Reading Pane(2) Release Notes(183) Reports(48) REST(29) RESTful(29) RESTful Workshop(15) RFID tags(1) SaaS(7) Security(81) SharePoint(12) SPA(6) SQL Anywhere(3) SQL Server(26) SSO(1) Stored Procedure(4) Teamwork(15) Tips and Tricks(87) Tools for Excel(2) Touch UI(93) Transactions(5) Tutorials(183) Universal Windows Platform(3) User Interface(338) Video Tutorial(37) Web 2.0(100) Web App Generator(101) Web Application Generator(607) Web Form Builder(40) Web.Config(9) Workflow(28)
Archive
Blog
Friday, June 28, 2013PrintSubscribe
“Data-” Attributes, Chart, and Import Processor Enhancements

Code On Time release 7.0.10.0 includes the following features and enhancements:

  • Legacy attributes with the namespace "factory:*" previously used in the page markup were replaced with "data-" attributes to ensure compatibility with the upcoming Mobile Client Library, Cloud On Time, and SaaS Integration feature in Unlimited edition.
     
  • Chart views will retain the height after the first rendering.
     
  • Chart views will render with the correct width and height in FireFox.
     
  • Import processor allows overriding error reporting and handling.
     
  • Fixed the issue with the Login page title not being assigned correctly.
     
  • Fixed closed "placeholder" spans in Main.master.
     
  • Fixed the bug in lookups with the style “Auto Complete” that was freezing actions in data views.

Mobile Client Library and 2nd Generation Datasheet View are planned for the next release.

Mobile feature will be based on the latest jQuery Mobile 1.3.

Next release is also expected to include SaaS Integration  feature to enable integration of Web Site Factory, Web App Factory, and Azure Factory apps with any hosting platforms without the need to create native apps. This will dramatically increase ability to create a “cloud” solution from any existing web app created with Code On Time.

Thursday, June 27, 2013PrintSubscribe
Import Processor Error Handling

Code On Time web apps come with a native CSV Import processor that will parse comma separated files and create new records. However, this native processor does not display any errors that may have occurred due to malformed CSV. Let’s override methods in the processor in order to handle and report these errors.

Start the app generator. Click on the project name, and press Develop to open the project in Visual Studio. In the Solution Explorer, right-click on ~/App_Code folder and press Add | Class.

Adding a class to App_Code folder.

Assign a name to the item and press OK to save. Replace the code base with the following:

C#:

using System;
using System.Collections.Generic;
using System.IO;
using MyCompany.Data;
using System.Net.Mail;

namespace MyCompany.Data
{
    public partial class CsvImportProcessor
    {
        protected override bool HandleError(ActionResult r, ActionArgs args)
        {

            string dir = AppDomain.CurrentDomain.BaseDirectory;
            using (StreamWriter file = new StreamWriter(dir + "\\ImportErrorLog.txt", true))
            {
                foreach (string s in r.Errors)
                    file.WriteLine(String.Format("{0:s}: {1}",DateTime.Now, s));
            }
            return true;
        }

        protected override void ReportErrors(string controller, string recipients, string logFileName)
        {
            string[] recipientsList = recipients.Split(',');
            SmtpClient client = new SmtpClient();
            foreach (string s in recipientsList)
            {
                string address = s.Trim();
                if (!(String.IsNullOrEmpty(address)))
                {
                    MailMessage message = new MailMessage();
                    try
                    {
                        message.To.Add(new MailAddress(address));
                        message.Subject = String.Format("Import of {0} has been completed", controller);
                        message.Body = File.ReadAllText(logFileName);
                        client.Send(message);
                    }
                    catch (Exception)
                    {
                    }
                }
            }
        }
    }
}

Visual Basic:

Imports Microsoft.VisualBasic
Imports System.IO
Imports MyCompany.Data
Imports System.Net.Mail

Namespace MyCompany.Data
    Partial Public Class CsvImportProcessor
        Protected Overrides Function HandleError(r As ActionResult, args As ActionArgs) As Boolean
            Dim dir As String = AppDomain.CurrentDomain.BaseDirectory
            Using file As StreamWriter = New StreamWriter(dir + "\\ImportErrorLog.txt", True)
                For Each s As String In r.Errors
                    file.WriteLine(String.Format("{0:s}: {1}", DateTime.Now, s))
                Next
                Return True
            End Using
        End Function

        Protected Overrides Sub ReportErrors(controller As String, recipients As String, logFileName As String)
            Dim recipientsList() As String = recipients.Split(Global.Microsoft.VisualBasic.ChrW(44))
            Dim client As SmtpClient = New SmtpClient()
            For Each s As String In recipientsList
                Dim address As String = s.Trim()
                If Not (String.IsNullOrEmpty(address)) Then
                    Dim message As MailMessage = New MailMessage()
                    Try
                        message.To.Add(New MailAddress(address))
                        message.Subject = String.Format("Import of {0} has been completed", controller)
                        message.Body = File.ReadAllText(logFileName)
                        client.Send(message)
                    Catch __exception As Exception
                    End Try
                End If
            Next
        End Sub
    End Class
End Namespace

The first method above will create a file “ImportErrorLog.txt” in the application folder and write every error that occurred. It returns true in order to cancel the default handling. The second method overrides the default error reporting and sends an email to the specified recipient. This requires web app SMTP configuration. If a malformed CSV file was imported, the ImportErrorLog.txt file will look like the picture below.

Log text file logging all errors when importing.

Wednesday, June 19, 2013PrintSubscribe
ASP.NET 4.5, DotNetNuke 7, Upload on Insert, CKEditor, Dynamic Wait Indicators, Azure SDK 2.0, Native CSV Import, Container “page”

Code On Time release 7.0.9.0 includes major enhancements  providing the foundation for the upcoming Mobile Client Library and 2nd generation datasheet view. Both will be included in the follow-up release in July of 2013.

ASP.NET 4.5 has been available for awhile. We now offer support for the newest .NET Framework in  Web Site Factory, Web App Factory, and Azure Factory projects.

Starting with this release any new apps configured to use ASP.NET 4.5 (default option) will be created without dependency on Ajax Control Toolkit DLLs. We will be phasing out the toolkit by replacing any dependencies with jQuery equivalents. Existing projects that do use components of ACT will continue to be generated with the binary libraries.

Master page, theme, and script references where enhanced to further reduce application footprint and speed up page loading. Mobile client library requires this enhancement.

DotNetNuke 7 is now supported in DotNetNuke Factory. Create ASP.NET 4.0 line-of-business web apps as modules for the latest version of the populate open-source content management system. New theme Gravity is included to provide a matching look-and-feel for the apps packaged as DNN modules.

Upload on Insert is a frequently requested feature that was previously absent in the application framework. Binary content is uploaded independently from the data fields of a new record. This creates a unique challenge to delay uploading until a record has been successfully persisted. The new client library does just that. New projects will automatically include BLOB fields in createForm1 to allow upload on insert. Just make sure that the binary columns are not marked as required in the database. Drag binary fields to the createForm1 view to enable this capability in existing apps.

CKEditor is a popular web-based rich text editor embedded in many online products. We are offering a simple integration of this editor in any project created with the new release of the app generator. The built-in rich text editor is now implemented without server-side support and works entirely on the client, which makes it lightning-fast.

Dynamic Wait Indicators are now  a permanent feature of the client library. If a server-side operation takes longer than 3/4 of a second to complete, then a thin marquee line will be displayed at the top of the data view. Modal views will display a wait indicator at the top of a page. This applies to data paging/sorting/search, action execution, reporting, import, upload, and download. Consistent integration of dynamic wait indicators improves usability by offering intelligent visual clues about long running requests. Navigate to our demo web site and try printing a list of customers to see the wait indicator in action.

Azure SDK 2.0 is now supported in Azure Factory projects.

Native CSV Import classes are  implemented in web apps created with Premium or Unlimited edition. The new importer is built into the application framework, which eliminates the need for Microsoft Access Database Engine installation on the server. “Import” action is now also included under Actions menu of data views in Azure Factory web apps. Import dialog simplifies mapping of fields by hiding “mapped” fields from available mapping options.

Container “page” allows defining user controls that will be displayed in page header, title, sidebar, or footer.

The following enhancements, bug fixes, and features are included in this release:

  • ASP.NET 4.5 is now supported in Web App Factory, Web Site Factory, and Azure Factory projects.
     
  • Application Framework now includes a native CSV parser based on the work of Sébastien Lorion. Both SharePoint Factory and Azure Factory projects are now supporting the “Import” action with native CSV parsing.
     
  • Web Site Factory solution files are now located under [Documents]\Code OnTime\Solutions\Web Site Factory\PROJECT_NAME folder. The new solution file will be created if a website factory project is regenerated. If you are using a source control system then make sure to change the project bindings accordingly.
     
  • Theme file is referenced with the app generator version number in the page header.
     
  • Azure SDK 2.0 is now supported in Azure Factory.
     
  • Ajax Control Tookit 7.0429 is now integrated in the apps based on ASP.NET 3.5 and 4.0.
    Upgrade instructions for ASP.NET 4.0 projects:
    • Make sure to delete file ~/App_Code/Controls/RichEditor.* from the source code of your Web Site Factory project.
    • Delete the files MyCompany\Controls\RichEdit.* from other project types where MyCompany must be replaced with the Namespace of your project.
    • Select the project on the start page of the app generator and choose Refresh, do not select any controllers and click Refresh.
    • Re-generate the app.
       
  • Custom *.rdlc reports are now published with Web Site Factory projects.
     
  • CKEditor is seamlessly integrated in web apps created with Code On Time.
     
  • Removed references to "stub" images from the master page.
     
  • Main master page is not using “cellpadding”, “cellspacing” and “valign” attributes. It relies on new CSS rules instead.
     
  • Built in Rich Text editor and CKEDITOR will take at least as much space as specified by the CSS class "dataview-rich-text". Define a custom CSS rule with “width” and “height” property to set up a non-standard size for rich text editors.
     
  • Application pages include “lang” and “xml:lang” attributes in “html” tag when loaded in a browser.
     
  • Application framework stylesheet Core.css incorporates the core styles from AjaxControlToolkit to handle calendar, tab container, color picker, and HTML editor to minimize the number of CSS links in application pages.
     
  • Thanks to Giampaolo Bulleri for contributing Italian localization.
     
  • Membership component of the client library explicitly sets up the path to Authentication_JSON_AppService.axd of a web app when initialized.
     
  • App generator will place controls with IDs 'header', 'title', 'sidebar', and 'footer' into appropriate regions of a page if the controls belong to a page container 'page'.
     
  • Enter NoSeeAlso class in "Custom Styles" property of a page to hide the corresponding area created automatically by the class library.
     
  • The "Reset" button on automatic search bar has been replaced with "Clear" button. The new button will simply remove all filters.
     
  • BLOB fields can now be added to the "createForm1" or any other view that offers Insert command. BLOB uploading is deferred until the primary key is returned after a successful insert operation.
     
  • New projects will automatically include BLOB fields in 'createForm1'. Developers can add BLOB fields to existing data controller views 'createForm1' manually.
     
  • CSS class "dataview-loading" is added to a data view container when a data view makes a first call to fetch data. Class "dataview-loaded" will replace "dataview-loading" after the first call has been completed.
     
  • Client library will open a new window when the original of a BLOB field is downloaded by user. The data view will display a marquee indicating the download progress. The new window is twice smaller than the main browser window.
     
  • Server-side business rules (Code and SQL) do not interfere with Blob Adpaters updating utility fields.
     
  • Data fields with text mode set to "Static" work correctly in grid view when inline editin of row values is performed by a user.
     
  • Application framework includes FileSystemBlobAdapterBase class to allow override of file system blob adapter property IsPublic.
     
  • "Soft" date filters created with SQL business rules will correctly filter the data.
     
  • Import automatically adjust the list of the available unmapped fields to ease selection of mappings.
     
  • Main and Help master pages are using a short form of DOCTYPE declaration.
     
  • Methods AccessKey, SecretAccessKey and property Bucket of S3BlobAdapter are now virtual