Znode Storefront Developer · PDF fileThe publisher and the author make no ... 5 Znode...

33
© Copyright 2008, Znode Inc, All Rights Reserved Znode Storefront Developer Guide Version 5.1.0

Transcript of Znode Storefront Developer · PDF fileThe publisher and the author make no ... 5 Znode...

© Copyright 2008, Znode Inc, All Rights Reserved

Znode Storefront Developer Guide

Version 5.1.0

All rights reserved. No parts of this work may be reproduced in any form or by any means - graphic, electronic, ormechanical, including photocopying, recording, taping, or information storage and retrieval systems - without thewritten permission of the publisher.

Products that are referred to in this document may be either trademarks and/or registered trademarks of therespective owners. The publisher and the author make no claim to these trademarks.

While every precaution has been taken in the preparation of this document, the publisher and the author assume noresponsibility for errors or omissions, or for damages resulting from the use of information contained in this documentor from the use of programs and source code that may accompany it. In no event shall the publisher and the author beliable for any loss of profit or any other commercial damage caused or alleged to have been caused directly orindirectly by this document.

Printed: September 2008 in USA

Znode Storefront Developer Guide

© Copyright 2008, Znode Inc, All Rights Reserved

3Contents

3

© Copyright 2008, Znode Inc, All Rights Reserved

Table of Contents

Part 1 Overview 4

Part 2 Quick Start Guide 5

Part 3 Znode Storefront Architecture 7

Part 4 Template Management 9

Part 5 Data Access Layer (DAL) 11

Part 6 Business Logic Layer (BLL) 13

Part 7 Authentication and Authorization 15

Part 8 Content Management 17

Part 9 Customizing the Storefront Theme 20

Part 10 Customizing Storefront Pages 21

Part 11 Integrating with Other Applications 23

Part 12 Application Monitoring 25

Part 13 Activity and Exception Logging 26

Part 14 Diagnostics 29

Part 15 Zip Code Data for the Store Locator 30

Part 16 Guidelines for Customization 31

Znode Storefront Developer Guide4

© Copyright 2008, Znode Inc, All Rights Reserved

Version 5.1.0

1 OverviewZnode Storefront is a Flexible Storefront PlatformÔ that has been architected from the ground up tobe 100% customizable. Virtually every aspect of the storefront can be customized including the UserInterface, Business Logic, Process Workflow and Integration with other systems.

Philosophy

The overall goal behind the Znode Storefront architecture is to provide you with a standards basedplatform that implements all the base e-commerce functionality. Developers can then extend thisfunctionality to their own specific requirements. This significantly reduces the learning curve as Znodedoes not use proprietary technology to implement basic website architecture but instead relies on theMicrosoft Prescribed Best Practices for N-Tier application design.

Installation Pre-Requisites

To install Znode Storefront on a server you need to have a reasonably good understanding of InternetInformation Services (IIS) and SQL Server 2005. The following components are required to installZnode Storefront:

· IIS 6 or above· .Net Framework 2.0 or 3.5· SQL Server 2005. Znode Storefront does not support SQL Server 2000· Requires Full Trust on the server (Check with your hosting service to ensure compatibility)· ASP.NET 2.0 AJAX Extensions 1.0 (Not required if using Visual Studio 2008)

Development Pre-Requisites

Here are the pre-requisites for customizing Znode Storefront

· Visual Studio 2005 or 2008· SQL Server 2005 with SQL Management Studio· IIS 6.0 or 7.0 with .NET 2.0 Enabled

See Also:

Quick Start Guide 5

Znode Storefront Developer Guide5

© Copyright 2008, Znode Inc, All Rights Reserved

Version 5.1.0

2 Quick Start GuideHere are the Steps to start developing with Znode Storefront:

Step 1: Install the MSI

After you purchase Znode Storefront, you will be able to download an installation MSI

· Use the MSI to install the storefront on your local development machine· Create the database using the instructions included with the installation guide· You can now open the Znode Storefront Solution file using Visual Studio 2005 or 2008· Compile the solution and run it to ensure that the storefront comes up without any errors

Step 2: Basic Admin Settings

While the storefront will work with a basic install, setting the following parameters in Global Settingswill ensure that all features of your storefront operate as expected.

· Domain Name - Enter the domain name that you will be using to access this site ("localhost" forexample). This will allow the preview and send a link to a friend to use the correct links.

· Admin, Sales, and Customer Support Email Addresses - Use an email address where you will beable to receive the messages in your in box. In this way you will be able to see orders and customerrequests as they come in.

· SMTP Mail Server Settings - This setting is required for any email (orders or customer requests) tobe sent out from the system.

· UPS Settings - if you intend to use the UPS Shipping Option you will first need an account. If you donot have an account leave these settings blank and use a Custom Shipping Options instead.

· In addition you should make sure that you have the following set. (a) At least one Shipping Option. (b) At least one Payment Option.

Step 3: Getting Started With Modifying the Code

Right out of the box the Znode Storefront will provide a professional and easy to use site. You canhowever change the code (licensed versions only) to implement just about any custom look and feel orbusiness logic that you want. Znode Storefront is created from the ground up to be easilycustomizable. Here are just a few notes to get you started when looking at the code.

· You must be familiar with ASP.Net development using C# (VB is not supported).· You can use either Visual Studio 2005 or 2008 to modify your code.· The Customizable Storefront pages are located in Web\Themes\Default.· The main master page for the Storefront is in Web\Themes\Default\Common\main.master. The look

and feel for other pages are in their own directory. For example, the Home page can be found inWeb\Themes\Home\home.master. All of the code behinds for these pages are in these directoriesas well.

· The left menu for the Admin is controlled by the Web\Admin\Web.sitemap file. To disable a menuitem, such as Delete Catalog Data, just comment out the appropriate line in this file.

· Master pages for the remaining admin pages can be found in Web\Admin\Themes\Standard.

Znode Storefront Developer Guide6

© Copyright 2008, Znode Inc, All Rights Reserved

Version 5.1.0

Step 4: Before Creating a Production Catalog

Before loading your catalog data, you should delete the existing demo catalog data as follows:

· Log into the Admin.· Choose Delete Catalog Data from the left menu.· Click on Confirm on the next page.

View of the Visual Studio Solution

See Also:

Znode Storefront Architecture 7

Znode Storefront Developer Guide7

© Copyright 2008, Znode Inc, All Rights Reserved

Version 5.1.0

3 Znode Storefront ArchitectureZnode Storefront has been architected from the ground up using Microsoft Prescribed Best Practicesto achieve the ultimate flexibility and scalability.

Znode Storefront uses the following technologies

· Microsoft .NET Framework Version 2.0 and/or 3.5· ASP.NET· C#· SQL Server 2005· Net Tiers Data Access· Microsoft Enterprise Library· AJAX Library

Znode Storefront utilizes the following components/ design techniques

· ASP.NET 2.0 Master Pages are used for storefront template management· ASP.NET 2.0 Membership & Role Provider for authentication and authorization· ASP.NET 3.0 Windows Communication Foundation for middleware web services (Optional

Component)· N-tier data access layer using Net Tiers (an open source DAL based on the Microsoft Prescribed

Best Practices)· Clear separation of the web, business logic and data access layers using libraries· Microsoft enterprise library is used for exception handling, logging, data access and encryption

Znode Storefront Developer Guide8

© Copyright 2008, Znode Inc, All Rights Reserved

Version 5.1.0

See Also:

Template ManagementData Access Layer (DAL)Business Logic Layer (BLL)Authentication and Authorization

9

11

13

15

Znode Storefront Developer Guide9

© Copyright 2008, Znode Inc, All Rights Reserved

Version 5.1.0

4 Template ManagementZnode Storefront uses ASP.NET Master Pages and Cascading Style Sheets (CSS) to implementtemplates for the storefront. This standards based template architecture enables developers familiarwith ASP.NET to rapidly customize the storefront without having to learn a proprietary technology.

Highlights of the Znode Storefront Templates

· The storefront themes and related files are stored under Web\Themes\Default\· The storefront includes one common master page located at Web\Themes\Default\Common\Main.

Master - This master page defines the common areas of the storefront including header, footer,navigation, etc

· Each functional area has a secondary master page that inherits from Main.Master. This allows eachfunctional area to control the display specific to that functionality. For example: The product pageshave the following master page: Web\Themes\Default\Product\Product.Master

· The storefront has a single style sheet that controls fonts, colors and other global styles. The stylesheet is located at Web\Themes\Default\Style.CSS

Znode Storefront Developer Guide10

© Copyright 2008, Znode Inc, All Rights Reserved

Version 5.1.0

View of the themes folder in the Znode Storefront solution

See Also:

Customizing the Storefront Theme 20

Znode Storefront Developer Guide11

© Copyright 2008, Znode Inc, All Rights Reserved

Version 5.1.0

5 Data Access Layer (DAL)Znode Storefront uses a multi-tier DAL (Data Access Layer) based on the NetTiers system. This layerexposes strongly typed DataSets that make it easier and more efficient to pass entities between thebusiness logic layer and the DAL. You can either modify the DAL libraries by hand or use CodeSmithtemplates included with the storefront to re-generate them based on the database schema.

Please Note

· Catalog and Customer Data is stored in a SQL Server 2005 database· Data is accessed using stored procedures. Znode Storefront does not use dynamic SQL queries

except for certain search functionality· Znode Storefront uses XML Serialization extensively to retrieve object oriented data from the

database. This reduces the number of calls back and forth from the database

The Znode DAL

· The Znode DAL includes 5 different C# libraries that can be modified independently· The ZNode.Libraries.DataAccess.Entities library defines the strongly typed DataSets. For example:

The Order Entity maps all the fields from the ZNodeOrder table to properties in the DataSet· The ZNode.Libraries.DataAccess.Service library defines methods to retrieve data from the SQL

Server database. The service methods return strongly typed DataSets (Entity objects)· The ZNode.Libraries.DataAccess.Custom library enables developers to add their own custom data

access methods. For example, if you needed to create a new table in the database and access datafrom it, you would add your data retrieval functions here

View of the Znode DAL Libraries

Znode Storefront Developer Guide12

© Copyright 2008, Znode Inc, All Rights Reserved

Version 5.1.0

Example of a native data access method using the Znode DAL:

public TList<Manufacturer> GetAllByPortalID(int _portalID){ ZNode.Libraries.DataAccess.Service.ManufacturerService _manufacturerAccess

= new ManufacturerService(); TList<ZNode.Libraries.DataAccess.Entities.Manufacturer> _ManufacturerList

= _manufacturerAccess.GetByPortalID(_portalID);

return _ManufacturerList;}

Example of a custom data access method:

public DataSet GetDashboardItemsByPortal(int PortalID){ // Create Instance of Connection Object string ConnectionString =

System.Configuration.ConfigurationManager.ConnectionStrings["ZNodeECommerceDB"].ConnectionString; SqlConnection MyConnection = new SqlConnection(ConnectionString);

//Create Instance of Adapter Object SqlDataAdapter MyDataAdapter = new SqlDataAdapter("ZNODE_GetDashboardItemsByPortal", MyConnection);

//Mark as stored procedure MyDataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure;

// Add Parameters to Stored Procedure SqlParameter myParam = new SqlParameter("@PortalID", SqlDbType.Int); myParam.Value = PortalID;

MyDataAdapter.SelectCommand.Parameters.Add(myParam);

//Fill DataSet DataSet MyDataSet = new DataSet(); MyDataAdapter.Fill(MyDataSet);

//Return DataSet return MyDataSet;}

See Also:

Business Logic Layer (BLL) 13

Znode Storefront Developer Guide13

© Copyright 2008, Znode Inc, All Rights Reserved

Version 5.1.0

6 Business Logic Layer (BLL)Znode Storefront uses a multi-tier BLL (Business Logic Layer) that has been organized to allowdevelopers to easily extend the e-commerce functionality available out of the box.

Please Note

· The BLL does not include any database access functionality. You must avoid adding any dataaccess functions and use the DAL instead to retrieve data

· Modifying certain areas of the BLL could effect PCI compliance. You should refer to the PCICompliance Guide included with Znode Storefront before making any changes

The Znode BLL

The Znode BLL includes 6 different C# libraries that can be modified independently

· The ZNode.Libraries.ECommerce.Business library is the primary business layer that is called fromthe ASP.NET code behind. This layer encapsulates all the business logic and workflow required bythe storefront

· The ZNode.Libraries.FedEx library connects to the FedEx services to retrieve shipping rates andother functions

· The ZNode.Libraries.Google library connects to the Google Checkout service· The ZNode.Libraries.Payment library includes code to connect to the different payment gateways

such as Authorize.NET and Verisign. Please note that modifying this library can effect PCIcompliance

· The ZNode.Libraries.PayPal library connects to the PayPal service· The ZNode.Libraries.UPS library connects to the UPS service to retrieve shipping rates and other

functions

Znode Storefront Developer Guide14

© Copyright 2008, Znode Inc, All Rights Reserved

Version 5.1.0

View of the Znode BLL Libraries

See Also:

Znode Storefront Architecture 7

Znode Storefront Developer Guide15

© Copyright 2008, Znode Inc, All Rights Reserved

Version 5.1.0

7 Authentication and AuthorizationZnode Storefront uses the ASP.NET Membership and Roles Provider model. This allows developersto write their own Membership provider instead of using the default that is included out of the box (forexample: Active Directory, LDAP, etc)

Please Note

· The Znode Storefront database includes schema for both ASP.NET Authentication/Authorizationand Customer Accounts. Customer Accounts are linked with UserIDs that are stored in theAuthentication tables

· In order to enable easy separation of the Authentication/ Authorization data, the Account tables donot have foreign key constraints into the Authentication tables. As a result, you can easily separatethe Authentication tables into their own database or share the database with another application forSingle Sign-On

Authentication and Authorization Configuration

The Membership and Role providers used for authentication/ authorization are specified in the Web.Config. You could modify these sections to use your own providers.

Database schema for user Authentication and Authorization

Znode Storefront Developer Guide16

© Copyright 2008, Znode Inc, All Rights Reserved

Version 5.1.0

See Also:

Znode Storefront Architecture 7

Znode Storefront Developer Guide17

© Copyright 2008, Znode Inc, All Rights Reserved

Version 5.1.0

8 Content ManagementZnode Storefront includes a built-in content management system. This system is meant to allow endusers to easily manage content without technical expertise. The content is stored in XML files anddatabase tables to allow integration with other systems.

Types of content managed areas in Znode Storefront:

1. Content Pages: These are static content pages that can be created by logging into the storefrontadmin as a content editor. An example of this content type is the "About Us" page. Once the contentpage is created, it can be edited using a WYSIWYG editor

2. Message Blocks: These are static content areas that are designated in the ASP.NET code using aMessage Block Control. The control is referenced in an XML file (Web\Data\Default\Config\MessageConfig.xml). You can use the storefront admin to edit content inthese message blocks. The advantage of the message block is that it can be referenced in severalpages (for example: you could create a message block to display the customer service phonenumber. This block can then be placed on different types of pages - the phone number will bedisplayed on all of these pages)

Steps to add a Custom Message Block to an ASP.NET Page

1: Add the control declaration

<%@ Register Src="CustomMessage.ascx" TagName="CustomMessage" TagPrefix="uc1" %>

2: Add an instance of the control. Note that the "messagekey" property corresponds to the referencedcontent in the Web\Data\Default\Config\MessageConfig.xml file. In the example below, the control willdisplay the Footer Copyright.

<uc1:custommessage runat="server" messagekey="FooterCopyrightText"></uc1:custommessage>

Znode Storefront Developer Guide18

© Copyright 2008, Znode Inc, All Rights Reserved

Version 5.1.0

Editing Content Pages using Admin

Editing Message Block Content using Admin

Znode Storefront Developer Guide19

© Copyright 2008, Znode Inc, All Rights Reserved

Version 5.1.0

See Also:

Customizing Storefront PagesCustomizing the Storefront Theme

21

20

Znode Storefront Developer Guide20

© Copyright 2008, Znode Inc, All Rights Reserved

Version 5.1.0

9 Customizing the Storefront ThemeIt is relatively easy to customize the Storefront Theme using Znode's standardized architecture. Znodeuses the ASP.NET Master Page template scheme to enable developers to achieve rapidcustomization of virtually every user interface element of the storefront.

Steps to modify your Storefront Theme:

1. First we will create a new theme called "MyTheme". Create an empty folder called "Web\Themes\MyTheme"

2. We will use the default theme as a starting point instead of creating all the files from scratch. Copyall the folders and files under "Web\Themes\Default" to "Web\Themes\MyTheme"

3. Edit the "Web\Themes\MyTheme\Common\Main.Master" to modify the overall HTML of the siteincluding headers, footers, etc

4. Edit the "Web\Themes\MyTheme\Common\style.css" to modify the overall global stylesheet for thestorefront

5. Login to the Storefront Admin and select the newly created theme by going to Design > Site Theme.Use the drop-down list to select your theme as shown below:

See Also:

Customizing Storefront Pages 21

Znode Storefront Developer Guide21

© Copyright 2008, Znode Inc, All Rights Reserved

Version 5.1.0

10 Customizing Storefront PagesThe Storefront is divided into broad functional areas (ex: Home Page, Product Pages, CategoryPages, etc). Each area has it's own Master Page that allows you to customize the look and feel for thatfunctional area. The functional master pages inherit from the Main.Master page which defines theoverall layout of the site.

Steps to Customize a Storefront Page

1. Let us assume that we need to edit the Storefront's Home Page. The theme and files for the homepage are located at web\themes\default\home\

2. Edit the web\themes\default\home\home.master master page to change the layout of the homepage template

3. To edit the content area on the home page, modify the user control at web\themes\default\home\home.ascx file. This control defines the dynamic content that is displayedwithin the content area.

Customizing Other Pages

Here is a reference table of various functional areas in the storefront and their corresponding MasterPages

Function Master Page

Global Master Page Web\Themes\Default\Common\Main.MasterMy Account Web\Themes\Default\Account\Account.MasterProduct Category Web\Themes\Default\Category\Category.MasterProduct Detail Web\Themes\Default\Product\Product.MasterCheckout Web\Themes\Default\Checkout\Checkout.MasterContact Us Web\Themes\Default\Contact\Contact.MasterContent Pages (CMS) Web\Themes\Default\Content\Content.MasterHome Web\Themes\Default\Home\Home.MasterShop By Price Web\Themes\Default\Price\Price.MasterShop By Brand Web\Themes\Default\Brand\Brand.MasterProduct Specials Web\Themes\Default\Specials\Specials.MasterSearch Catalog Web\Themes\Default\Search\Search.MasterShopping Cart Web\Themes\Default\ShoppingCart\ShoppingCart.MasterSiteMap Web\Themes\Default\SiteMap\SiteMap.Master

Customizing Display Logic

Each Storefront Function has a Master Page (listed above) and a set of user controls that arereferenced by that Master Page. The user control includes display logic which can effect the data thatis displayed to the user. This logic is included in code behind files referenced by the user control.

For example the display of product pricing in the product display page is controlled by a separate usercontrol (ProductPrice.ascx)

20

Znode Storefront Developer Guide22

© Copyright 2008, Znode Inc, All Rights Reserved

Version 5.1.0

The data retrieval and logic for pricing is included in the code-behind file (ProductPrice.ascx.cs)

See Also:

Customizing the Storefront Theme 20

Znode Storefront Developer Guide23

© Copyright 2008, Znode Inc, All Rights Reserved

Version 5.1.0

11 Integrating with Other ApplicationsZnode Storefront has been architected from the ground up to not just be fully customizable but also tomake it easier to integrate with virtually any 3rd party application. There are several ways to integrateZnode Storefront with back-office applications such as accounting systems, ERP, Oracle, CRMsystems, etc

1. Integration using Middleware Web Services API

· Znode Storefront Middleware (Enterprise Edition Only) exposes the storefront API using WCF(Windows Communication Foundation) web services

· The Znode Storefront Middleware is a separate component that needs to be installed on the server -This component requires .NET 3.5 and WCF to be enabled on the server

· The Znode Middleware Service allows access to key storefront functionality such as OrderManagement, Inventory, Catalog, Content Management and more using a highly structured API thatcan be easily extended to your specific requirements.

· The Middleware services can be hosted on load balanced web servers for scalability - this willreduce the resource requirements on the web servers hosting the storefront UI.

· WCF has the advantage of being able to expose the services using different types of standardsincluding SOAP, .NET Binary, ATOM, or any future specification. These services also implementsecurity using best practices and allow for a wide range of configurations.

· Read more about WCF using this link: Microsoft WCF

2. Integration using the Znode Data Manager Utility (Deprecated in version 5.1)

· The Znode Data Manager Utility is a desktop application that can be used to download catalog andorder data to CSV format

· You can modify the desktop utility using the included source code to allow download and uploads ofdata using your custom specifications

· The downloaded files can then be imported into your backend system

3. Integration using BizTalk

· Znode is currently developing a BizTalk adapter that will allow seamless integration with BizTalk.Please check out product roadmap for details

· BizTalk provides a mechanism to map incoming XML messages to a different structure. This allowsyou to transform the Znode Storefront message to any format specification.

· BizTalk also includes adapters for 3rd party specifications such as EDI - This enables integrationwith standards based systems.

· The Znode Storefront Ecommerce library can be easily extended to post Order and Customer datato the BizTalk gateway. BizTalk can then transform this data based on the system you areintegrating with.

4. Integration using SQL Server

· Since all the Storefront data is stored in the SQL Server 2005 database, you can create customintegrations that directly connect to this data using tools such as Microsoft SSIS

Znode Storefront Developer Guide24

© Copyright 2008, Znode Inc, All Rights Reserved

Version 5.1.0

See Also:

Znode Storefront Architecture 7

Znode Storefront Developer Guide25

© Copyright 2008, Znode Inc, All Rights Reserved

Version 5.1.0

12 Application MonitoringZnode Storefront includes a monitoring page with very low resource utilization that you can use tomonitor your website using a remote monitoring service. This page will return the current date-timestamp as a response - this prevents the page from being cached by proxy servers.

Accessing the Monitoring Page

You can access the monitoring page at http://<your-storefront>/monitor.aspx

Setup External Monitoring

You should setup an external monitoring service (such as WebsitePulse.com) to hit the storefrontmonitoring page every 15 minutes or less.

Note that you can also modify the monitoring page to return some storefront data if you need tomonitor critical functionality. For example: The page can call the payment processing service and posta test transaction - The response returned by the page can then be evaluated by your monitoringservice. This will enable you to monitor the payment processing on your storefront.

Keep-Alive Service

The .NET application pool gets recycled every time the number of visitors drops to zero. After therecycle, the application recompiles when the next visitor accesses a page on your site -- this cancause your site to load very slowly resulting in inconvenience to the visitor.

This issue can be resolved by setting up a "Keep-Alive" monitoring service that hits the monitoringpage every 15 minutes or less. This will also ensure that the Znode Storefront application does not getunloaded from memory. This will result in faster page responses since the application is kept alivecontinuously.

See Also:

Activity and Exception LoggingDiagnostics

26

29

Znode Storefront Developer Guide26

© Copyright 2008, Znode Inc, All Rights Reserved

Version 5.1.0

13 Activity and Exception Logging

Znode Logging

Znode Storefront provides the ability to log events programmatically. This facility can be used fordebugging and also for monitoring important events on your web site.

There are two basic types of logging provided, file and database. File logging is intended to be used fordebugging purposes and should not be used in a production environment. Database logging is used torecord things such as user login events or payment failures.

Each of these logging types can be used in your code for whatever purpose you need.  By defaultbasic logging is already be defined in Znode Storefront.

File Logging

The log file for Znode Storefront is located at Web/Data/Default/Logs/ZnodLog.txt. For file logging towork you must ensure that this file is writable by the  Network Service user.  File logging can be turnedon or off by setting the following in the web.config:

<add key="EnableLogging" value="1"/>

There are two basic methods that are available.

public static void LogObject(Type objectType, Object objectInstance)

This method will dump the contents of an object out to the log file.

ObjectType – The type of object that you want to log. This function will use this information todetermine the structure of the object passed in.ObjectInstance – An instance of the object that you would like to log.

public static void LogMessage(string Message)

This method writes a message to the log file.

Message – A message that you would like to write out the ZnodeLog.txt file.

Database Logging

Database logs are written to the ZNodeActivityLog in the database. There is a related table,ZNodeActivityLogType that defines names for each of the logging event types. When customizing yourown logging you will want to define your events in the ZNodeActivityLogType table. Events that can’t belogged into the database because they have not been defined will be written out to the file log instead.

Several error numbers are pre-defined for you in the Znode.Libraries.Framework.Business DLL. Theseerror numbers are used internally to this DLL and must be defined in your database in theZNodeActivityLogType table in the ActivityTypeId. Znode Storefront ships with these entries defined.Feel free to use these error numbers for your own use.

        public enum ErrorNum

Znode Storefront Developer Guide27

© Copyright 2008, Znode Inc, All Rights Reserved

Version 5.1.0

        {            GeneralError = 1,            GeneralWarning = 2,            GeneralMessage = 3,            LoginSuccess = 1000,            LoginFailed = 1001,            LoginCreateSuccess = 1002,            LoginCreateFailed = 1003,        }

The following are the basic methods for logging to the database. There are several overloadedfunctions to make writing your code easier but they each function in much the same way.

Record an Activity

This function records an event to the ZNodeActivityLog table

public static void LogActivity(int ActivityTypeId, string Data1, string Data2, string Data3, string Status, string LongData)

ActivityTypeId – This is your error number and must be defined in the ZNodeActivityLogType table.Data1 – This is a place for you to store any custom data that you would like to log. You can save up to255 characters and this field is indexed in the database.Data2 – This is a place for you to store any custom data that you would like to log. You can save up to255 characters and this field is indexed in the database.Data3 – This is a place for you to store any custom data that you would like to log. You can save up to255 characters and this field is indexed in the database.Status – A placeholder for writing any status information that you would like to save. Typically in ZnodeStorefront this field is used to provide further detail about the event that has been logged.LongData – This filed is provided to allow storage for up to 4000 characters of your information.

Start Transaction Monitoring

This function will make an entry into the ZNodeActivityLog table marking the start time of your event bysetting the CreateDte entry for this log entry.

public void LogActivityTimerStart ()

End Transaction Monitoring

This function will log the end time of your logging activity as well as other data that you would like tocollect. With this function and the LogActivityTimeStart function you will be able to keep metrics onhow long events take. The begin and end time will be recorded in the CreateDte and EndDte columnsof the ZNodeActivityLog table.

public void LogActivityTimerEnd(int ActivityTypeId, string Data1, string Data2, string Data3, string Status, string LongData)

ActivityTypeId – This is your error number and must be defined in the ZNodeActivityLogType table.Data1 – This is a place for you to store any custom data that you would like to log. You can save up to255 characters and this field is indexed in the database.Data2 – This is a place for you to store any custom data that you would like to log. You can save up to255 characters and this field is indexed in the database.Data3 – This is a place for you to store any custom data that you would like to log. You can save up to255 characters and this field is indexed in the database.

Znode Storefront Developer Guide28

© Copyright 2008, Znode Inc, All Rights Reserved

Version 5.1.0

Status – A placeholder for writing any status information that you would like to save. Typically in ZnodeStorefront this field is used to provide further detail about the event that has been logged.LongData – This filed is provided to provide storage for up to 4000 characters of information.

See Also:

Application MonitoringDiagnostics

25

29

Znode Storefront Developer Guide29

© Copyright 2008, Znode Inc, All Rights Reserved

Version 5.1.0

14 DiagnosticsZnode Storefront includes a diagnostics page that you can use to diagnose environment issues suchas database connectivity, SMTP settings, folder permissions, and also display detailed tracemessages.

Accessing the Diagnostics Page

You can access the diagnostics page by going to http://<your-storefront>/diagnostics.aspx

Important!

In the production environment, you should disable the diagnostics page or you can expose criticalsecurity data in-advertently to others. You can disable this page by setting the "EnableDiagnostics"property in the web.config file to "0"

See Also:

Activity and Exception Logging 26

Znode Storefront Developer Guide30

© Copyright 2008, Znode Inc, All Rights Reserved

Version 5.1.0

15 Zip Code Data for the Store LocatorThe Znode Storefront Store Locator uses reference data for the zip code, city, state, and area code.Since this data contains over 42,000 entries and changes fairly regularly it is best to purchase itcommercially.

Purchasing Data

You can purchase data that is compatible with the Znode Storefront from a company calledZIPCodeDownload athttp://www.zipcodedownload.com/Products/Product/Z5Premium/Standard/Schema/

Once you receive your download file do the following:

1. Unzip the download file to a convenient location on your server.2. Edit the script below substituting the path to your download file.3. Run the script in SQL Server Management Studio.4. Go to the Store Locator link in the Admin and enter your store data.5. That's it! Customers can now search for store locations using the Store Locator.

Script to bulk-load store locator data into Znode Storefront

TRUNCATE TABLE ZNODEZIPCODE

BULK INSERT ZNODEZIPCODE FROM '<YOUR PATH TO ZIP CODE DATA FILE>\5-digitPremiumdata.txt' WITH (FIELDTERMINATOR = ',')

Znode Storefront Developer Guide31

© Copyright 2008, Znode Inc, All Rights Reserved

Version 5.1.0

16 Guidelines for CustomizationHere are a few guidelines to follow when customizing Znode Storefront.

Tracking Changes

· You should keep track of all custom code changes made to the Znode Storefront code-base using asource control system like Visual Source Safe, SVN, CVS, etc. This will allow you to merge inchanges when you upgrade to a newer version of Znode Storefront.

· Znode uses Subversion (SVN) and Tortoise for our internal source control - We highly recommendthis system. You can find out more about SVN at: subversion.tigris.org

Data Access

· Always add custom data access methods to the ZNode.Libraries.DataAccess.Custom library. Do notmodify the strongly typed data access layer by hand as it will potentially break compatibility for futureversions.

· Add separate tables in the database instead of modifying existing tables if possible. This will ensurethat you don't break the compatibility with the data access libraries.

· If you need to add columns to existing tables then set them as null-able columns - this will ensurebackward compatibility with the data access libraries

· If you need to change the schema of existing tables then you must re-generate the NetTiers layerusing the included CodeSmith templates

Performing Upgrades

· Znode does not support automatic upgrades for storefronts that have been customized or changedby the client.

· You can upgrade your storefront code-base by using a merge utility such as Beyond Compare · You can upgrade your storefront database by using data compare utilities from Red Gate Software

Miscellaneous

· Always use the "~/" syntax to reference images and pages. This will ensure the correct referencepaths when you move the framework to a hosted environment.

Znode Storefront Developer Guide32

© Copyright 2008, Znode Inc, All Rights Reserved

Version 5.1.0

Printed: September 2008 in USA.

Znode Storefront Developer Guide© Copyright 2008, Znode Inc, All Rights Reserved