Wednesday, July 8, 2009

Genesis Hybrid Smart Client Framework part VII

If you are downloading the source code from this page, please refer to the release notes for instructions on compiling and executing the samples.

Introduction - The Complete Source

Over the last few articles I've introduced you to various aspects of the source code. This article will highlight specific source code that serve important functions. By now you should have figured out that there are multiple components to the system. A web service for communicating with the database and to provide a client API, a web application used as an online file repository, a windows client application that implements the client API and possibly other databases and web applications. You should also have an understanding of how the client updates the hosted applications.

The Genesis Management System was implemented as a complete hosted application with the client API to demonstrate how to develop rich applications that are hosted using the Genesis Smart Client Framework.

This article is part VII of VII. Go to part I to see the index.

Please refer to our web site www.bluemarble.co.za for the most up to date information about the Genesis Smart Client Framework or any of our newsfeeds.
News feed
Development feed
View our blog
Follow our tweets

In order to pursue our active interest in releasing this version of the Genesis Smart Client Framework as an open source product, we've created a profile on www.codeplex.com where we maintain the most recent copy of the source code. If you want the latest version of the Genesis Smart Client Framework source code go to our code plex profile or download the latest release from Code Plex.

Exploring the Solutions

The current release of the source code on Code Plex has three solution files in the Solutions folder. The three solutions are:

  • BlueMarble.Genesis.Client This solution demonstrates how to implement your own Smart Client application using the Genesis Smart Client Framework client API.
  • Template Solution This solution demonstrates how to implement your own hosted application using the Genesis Smart Client Framework client API.
  • Genesis Smart Client Framework This solution contains the commercial release of the Smart Client application that uses the 3rd party Ribbon control. This solution uses the BlueMarble.Genesis.Client Smart Client application as the default.

Exploring the Architecture

The Genesis Smart Client Framework has a multi-tier architecture to enable large scale enterprise rollout of Smart Client technology. The framework itself, including the client API was developed using C# for Microsoft.NET 3.5, SOAP Web Services, SQL Server 2008, TSQL, ASP.NET Web Forms and Windows Forms.

The goal was to implement an easy to use framework to allow us to focus on rapid application development without having to concern the developers with the basics for each new project. Our framework implements the following Smart Client concepts:

  • Self-Updating/Healing Our client API allows the Smart Client application to determine when it is not using the latest version of the source code. This enables the application to update itself to ensure the user is always using the latest version.
  • Advanced Communication By implementing our client API and developing your application using our guidelines, the framework facilitates advanced SOAP communication between the hosted applications and your servers.
  • Security Our framework deals with user security, developers never have to worry about confirming user access from their code, all access is dynamically handled by the security system. Operators can grant intermittend access to certain code features to selected users.
  • Richness By integrating web forms with windows forms through our Super Browser component, users can be working on a website and execute local code from inside the hosted application. A hyperlink can launch a local windows forms dialog allowing the user to edit the record. After the update the webpage will self-refresh.
  • Control & Consistancy By allowing operators to control every aspect of the user interface and therefore the user experience, good governance will consistancy in the user experience.

Back-end

The server side of the Genesis Smart Client Framework consists of a few projects, including a web services project, web application and a database. There are some common shared libraries as well.

Genesis.WebServices

The Genesis.WebServices project is an ASP.NET web services project. It contains the standard web services that implements the API. These web services are implemented by the Genesis.Client.Common libraries to form the Genesis Smart Client Framework client API.

In theory, any application using any development platform/technology can be distributed and managed by the Genesis Smart Client Framework. If you can develop your own libraries to implement the web services in this project you would have developed your own port of the Genesis Smart Client Framework client API. You can then develop a Smart Client application implementing your port in the language (or platform) of your choice.

Exception The Exception web service deals with loggin exceptions that occur in the Smart Client application while executing a hosted application to a central database where developers and system operators can access critical information. The following methods are available:

  • public void LogException(System.Xml.XmlNode Exception)

FileManager The FileManager web service deals with files in the Genesis File System. The FileManager web service allows for partial file uploads, in case of slow network connections or to allow the Smart Client application to support disconnected uploads. The following methods are available:

  • public Guid UploadFile(string FileName, string FileType, int FileSize, Guid UserGuid) This method allows the client to create a file upload session. The parameters required are the File Name, Type of File, Size of the File and the User Guid for the user uploading the file. This method returns a Guid for partial uploads.
  • public void UploadFilePart(Guid DocumentGuid, int FilePartNumber, byte[] FilePart) This method uploads parts of a file for a given file upload session. The parameters required are the File Upload Session Guid (DocumentGuid), the position of the file in the collection of parts, and a byte array containing the actual file part.
  • public void JoinFileParts(Guid DocumentGuid) Once all the file parts for a given file has been uploaded, the file parts can be joined on the server. This is simply an end to end binding of the collection of byte arrays that make up the file parts.
  • public void DeleteTemporaryFolder(Guid DocumentGuid) Once a file has been joined, the complete file will be available for other users to access. This method deletes the individual file parts on the server for a specific file.
  • public int GetArraySize() The server can determine the size of the byte arrays for individual file parts. The Smart Client applicaiton can request from the server the recommended size for the file parts.
  • protected string SetFilePath(Guid DocumentGuid) This method returns the local server path for a specific document.
  • protected string SetUrlPath(Guid DocumentGuid) This method returns the online server URL for a specific document.
  • protected string GetFileType(Guid DocumentGuid) This method queries the type of a file in the Genesis File System.

Genesis The Genesis web service deals with dynamic queries on the database. The following methods are available:

  • public System.Data.DataTable ExecuteTable(Guid TransactionGuid, string CommandText, string ConnectionStringKey, System.Data.CommandType CommandType, string TableName, params Common.Classes.DataParameter[] Parameters) This method executes an ExecuteDataset method on a SQL Command. The first table is extracted into a DataTable which is the return value of this method. The parameters required are the TransactionGuid (Not implemented), the text of the SQL Command, the name of the Connection String Key in the configuration file, the name of the Table to extract out of the Dataset and an array of the parameters.
  • public object ExecuteScalar(Guid TransactionGuid, string CommandText, string ConnectionStringKey, System.Data.CommandType CommandType, string TableName, params Common.Classes.DataParameter[] Parameters) This method executes an ExecuteScalar method on a SQL Command. The parameters required are the TransactionGuid (Not implemented), the text of the SQL Command, the name of the Connection String Key in the configuration file, the name of the Table to extract out of the Dataset and an array of the parameters.
  • public void ExecuteNonQuery(Guid TransactionGuid, string CommandText, string ConnectionStringKey, System.Data.CommandType CommandType, string TableName, params Common.Classes.DataParameter[] Parameters) This method executes an ExecuteNonQuery method on a SQL Command. The parameters required are the TransactionGuid (Not implemented), the text of the SQL Command, the name of the Connection String Key in the configuration file, the name of the Table to extract out of the Dataset and an array of the parameters.

KeepAlive The KeepAlive web service deals with keeping connections with the server active to ensure reliable network speeds. It also serves as a test for the Smart Client application to detect when to go into offline mode. The following methods are available:

  • public string Ping() This method simply returns the current time from the server.
  • public System.Xml.XmlNode Test(System.Xml.XmlNode TestNode) This method allows the Smart Client application to pass diagnostic information to the server in an XML packet. This packet can contain information from the client, such as the test start time, and test requirements on the server, such as a Ping Test. Different tests can do different server actions. Each server action updates the XML packet which is returned to the client for a local diagnostic of server access time, throughput, etc.

Lookup The Lookup web service provides a generic lookup interface to database tables. The following methods are available:

  • public DataTable GetLookupValues(string TableName, string ValueColumnName, string DisplayColumnName) This method returns a datatable with the lookup values from a custom table.
  • public DataTable GetLookupValuesUsingConnection(string TableName, string ValueColumnName, string DisplayColumnName, string ConnectionStringKey) This method returns a datatable with the lookup values from a custom table using a different database connection.

Module The Module web service deals with the Application, File, Command and user interface Meta-Data. The following methods are available:

  • public DataTable GetApplicationRibbons(Guid SessionGuid) This method returns a list of all of the top level ribbons. The parameter required is the active user SessionGuid.
  • public DataTable GetRibbonBars(Guid SessionGuid, Guid RibbonGuid) This method returns a list of all of the Ribbon Bars for a specific Ribbon. The parameters required are the active user SessionGuid and the Ribbon Guid.
  • public DataTable GetBarItems(Guid SessionGuid, Guid RibbonBarGuid, Guid ParentBarItemGuid) This method returns a list of all the Bar Items for a specific Ribbon Bar. The parameters required are the active user SessionGuid, RibbonBarGuid and the ParentBarItemGuid (for hierarchial Bar Items).
  • public DataTable GetApplicationFiles(Guid SessionGuid, Guid ApplicationGuid) This method returns a list of all the files required for a specific hosted application. The parameters required are the active user SessionGuid and the ApplicationGuid.
  • public DataTable GetApplicationCommands(Guid SessionGuid, Guid FileGuid) This method returns a list of all the Commands for a specific file. The parameters required are the active user SessionGuid and the FileGuid.
  • public DataTable ApplicationGetList() This method returns a list of all of the Hosted Applications.
  • public DataTable ApplicationGetByApplicationGuid(Guid ApplicationGuid) This method returns a specific Hosted Application. The parameter required is the ApplicationGuid.
  • public bool ApplicationUpdate(int ApplicationId, Guid ApplicationGuid, string ApplicationName, string ApplicationDescription, int Order, bool Visible) This application updates the Hosted Application record on the server. The parameters required are the ApplicationId for the record to update, ApplicationGuid, ApplicationName, ApplicationDescription, the Application Order and visibility.
  • public int ApplicationInsert(Guid ApplicationGuid, string ApplicationName, string ApplicationDescription, int Order, bool Visible) This application creates a new Hosted Application record on the server. The parameters required are the ApplicationGuid, ApplicationName, ApplicationDescription, the Application Order and visibility.
  • public DataTable FileGetList() This method returns a list of all the files for Hosted Applications.
  • public DataTable FileGetByFileGuid(Guid FileGuid) This method returns a specific File. The parameter required is the FileGuid.
  • public DataTable FileGetByFileTypeId(int FileTypeId) This method returns a list of all files that are of a specific type. The parameter required is the FileTypeId.
  • public bool FileUpdate(int FileId, Guid FileGuid, Guid ApplicationGuid, string FileName, string FileDescription, string FilePath, string FileUrl, int FileTypeId, int VersionMajor, int VersionMinor, int VersionBuild, int VersionRevision, int Order) This method updates the File record on the server. The parameters required are the FileId, FileGuid, ApplicationGuid, FileName, FileDescription, FilePath, FileUrl, FileTypeId, Version and the File Order.
  • public int FileInsert(Guid FileGuid, Guid ApplicationGuid, string FileName, string FileDescription, string FilePath, string FileUrl, int FileTypeId, int VersionMajor, int VersionMinor, int VersionBuild, int VersionRevision, int Order) This method creates a new File record on the server. The parameters required are the FileGuid, ApplicationGuid, FileName, FileDescription, FilePath, FileUrl, FileTypeId, Version and the File Order.
  • public DataTable CommandGetList() This method returns a list of all the Commands.
  • public DataTable CommandGetListWithNullRecord() This method returns a list of all the Commands, including a record with a NULL reference. This record is used when allowing the user to select a Command from a list, but where the user can select no Command as a valid option.
  • public DataTable CommandGetByCommandGuid(Guid CommandGuid) This method returns a specific Command. The parameter required is the CommandGuid.
  • public bool CommandUpdate(int CommandId, Guid CommandGuid, Guid FileGuid, string CommandName, string CommandDescription, string CommandCode, string CommandType) This method updates the Command record on the server. The parameters required are the CommandId, CommandGuid, FileGuid, CommandName, CommandDescription, CommandCode and the CommandType.
  • public int CommandInsert(Guid CommandGuid, Guid FileGuid, string CommandName, string CommandDescription, string CommandCode, string CommandType) This method creates a new Command record on the server. The parameters required are the CommandGuid, FileGuid, CommandName, CommandDescription, CommandCode and the CommandType.
  • public DataTable RibbonGetList() This method returns a list of all the Ribbons.
  • public DataTable RibbonGetByRibbonGuid(Guid RibbonGuid) This method returns a specific Ribbon. The parameter required is the RibbonGuid.
  • public bool RibbonUpdate(int RibbonId, Guid RibbonGuid, Guid ApplicationGuid, string RibbonName, int Order) This method updates the Ribbon record on the server. The parameters required are the RibbonId, RibbonGuid, ApplicationGuid, RibbonName and the Order of the Ribbon.
  • public int RibbonInsert(Guid RibbonGuid, Guid ApplicationGuid, string RibbonName, int Order) This method creates a new Ribbon record on the server. The parameters required are the RibbonGuid, ApplicationGuid, RibbonName and the Order of the Ribbon.
  • public DataTable RibbonBarGetList() This method returns a list of all the Ribbon Bars.
  • public DataTable RibbonBarGetByRibbonBarGuid(Guid RibbonBarGuid) This method returns a specific Ribbon Bar. The parameter required is the RibbonBarGuid.
  • public bool RibbonBarUpdate(int RibbonBarId, Guid RibbonBarGuid, Guid RibbonGuid, string RibbonBarName, int Order) This method updates the Ribbon Bar record on the server. The parameters required are the RibbonBarId, RibbonBarGuid, RibbonGuid, RibbonBarName and the Order for the Ribbon Bar.
  • public int RibbonBarInsert(Guid RibbonBarGuid, Guid RibbonGuid, string RibbonBarName, int Order) This method creates a new Ribbon Bar record on the server. The parameters required are the RibbonBarGuid, RibbonGuid, RibbonBarName and the Order for the Ribbon Bar.
  • public DataTable BarItemGetList() This method returns a list of all the Bar Items.
  • public DataTable BarItemGetListWithNullRecord() This method returns a list of all the Bar Items, including a record with a NULL reference. This record is used when allowing the user to select a Bar Item from a list, but where the user can select no Bar Item as a valid option.
  • public DataTable BarItemGetByBarItemGuid(Guid BarItemGuid) This method returns a specific Bar Item. The parameter required is the BarItemGuid.
  • public bool BarItemUpdate(int BarItemId, Guid BarItemGuid, Guid RibbonBarGuid, Guid ParentBarItemGuid, Guid CommandGuid, string BarItemName, string BarItemImage, int BarItemImageSize, int BarItemTypeId, int Order) This method updates the Bar Item record on the server. The parameters required are the BarItemId, BarItemGuid, RibbonBarGuid, ParentBarItemGuid, CommandGuid, BarItemName, BarItemImage, BarItemImageSize, BarItemTypeId and the Order of the Bar Item.
  • public int BarItemInsert(Guid BarItemGuid, Guid RibbonBarGuid, Guid ParentBarItemGuid, Guid CommandGuid, string BarItemName, string BarItemImage, int BarItemImageSize, int BarItemTypeId, int Order)This method creates a new Bar Item record on the server. The parameters required are the BarItemGuid, RibbonBarGuid, ParentBarItemGuid, CommandGuid, BarItemName, BarItemImage, BarItemImageSize, BarItemTypeId and the Order of the Bar Item.

Security The Security web service deals with authenticating the user and module access. The following methods are available:

  • public Guid AuthorizeUser(Guid ApplicationGuid, string Username, string Password)
  • public Guid CreateTransaction(string TransactionCode, Guid SessionGuid)
  • public void CompleteTransaction(Guid TransactionGuid)
  • public DataTable RoleGetList()
  • public DataTable RoleGetByRoleGuid(Guid RoleGuid)
  • public DataTable RoleGetByUserGuid(Guid UserGuid)
  • public DataTable RoleGetByApplicationGuid(Guid ApplicationGuid)
  • public DataTable RoleGetByCommandGuid(Guid CommandGuid)
  • public DataTable RoleGetByRibbonGuid(Guid RibbonGuid)
  • public DataTable RoleGetByRibbonBarGuid(Guid RibbonBarGuid)
  • public bool RoleUpdate(int RoleId, Guid RoleGuid, string RoleName, string RoleDescription)
  • public int RoleInsert(Guid RoleGuid, string RoleName, string RoleDescription)
  • public DataTable UserGetList()
  • public DataTable UserGetByUserGuid(Guid UserGuid)
  • public bool UserUpdate(int UserId, Guid UserGuid, string UserName, string Password, string Email, bool Active, string StartupScript)
  • public int UserInsert(Guid UserGuid, string UserName, string Password, string Email, bool Active, string StartupScript)
  • public DataTable UserRoleGetList()
  • public int UserRoleInsert(Guid UserGuid, Guid RoleGuid)
  • public int UserRoleDelete(Guid UserGuid, Guid RoleGuid)
  • public DataTable ApplicationRoleGetList()
  • public int ApplicationRoleInsert(Guid ApplicationGuid, Guid RoleGuid)
  • public int ApplicationRoleDelete(Guid ApplicationGuid, Guid RoleGuid)
  • public DataTable CommandRoleGetList()
  • public int CommandRoleInsert(Guid CommandGuid, Guid RoleGuid)
  • public int CommandRoleDelete(Guid CommandGuid, Guid RoleGuid)
  • public DataTable RibbonRoleGetList()
  • public int RibbonRoleInsert(Guid RibbonGuid, Guid RoleGuid)
  • public int RibbonRoleDelete(Guid RibbonGuid, Guid RoleGuid)
  • public DataTable RibbonBarRoleGetList()
  • public int RibbonBarRoleInsert(Guid RibbonBarGuid, Guid RoleGuid)
  • public int RibbonBarRoleDelete(Guid RibbonBarGuid, Guid RoleGuid)

Genesis.FileHost

The Genesis.FileHost acts as the Genesis File System by exposing the required application files to the Smart Client applications, and also by acting as the upload repository for files that are created by the Smart Client application. This function is important because it allows immediate access to a file from another Smart Client application.

There are a couple of functional web pages available on the file host as well. These are:


See full detail: http://www.codeproject.com/KB/smart/GenesisSCFpVII.aspx

1 comment:

Sourav Kayal said...

Check below website for real life ASP.Net programming example.Very good for project work.

http://ctrlcvprogrammer.blogspot.in/