This project is read-only.

Count Widget By Data Juggler Software http://www.datajuggler.com

Rounding Up

You may download the Count Widget User's Guide.zip, which contains a copy of this guide in Microsoft Word 2010 and a PDF copy.

Count Widget User's Guide

Part I

Using the Count Widget Control

System Requirements:

The Count Widget Web and Widget Data Service require Visual Studio 2010 or Visual Studio 2012; I cannot think of anything that would prevent the Count Widget Control from running on earlier versions of Visual Studio, but I have not used these products in a few years.

You can also call the Widget Data Service without using the control, for example in Windows applications or web services.

Getting Started

The first step is to sign up for a free account at www.countwidget.com .

After you complete the registration, you will be given your companyID and License Key.

The next step is to click the Editor’s menu button to create sites, pages and widgets.

The Editors page should be self-explanatory; first you create a site, and then add pages to the site. You may need to refresh the page after adding a site to make the new site available to the Page Editor and Widget Editor.

Widgets do not require a Page, but they do require a site. I debated having widgets available to multiple sites for a company, but decided to keep it simple for the first version.

What is a Widget? In this context a widget is anything you want to count.
This could be button clicks, voting polls, likes or shares or anything you want to count.

Setup

Add a reference to your Visual Studio project for the CountWidgetControl.

You can either add a reference to the source code project or you can add a reference to the CountWidgetControl.dll located in the bin directory of the CountWidgetControl directory in the download.

At the top of any page you want to use the CountWidgetControl, add this to the markup:

<%@ Register TagPrefix="DataJuggler" Assembly="CountWidgetControl" Namespace="CountWidgetControl" %>

Then place your count widget control where you like on the page:

<DataJuggler:CountWidget ID="CountWidget1" runat="server" CompanyID="Your Company ID"
LicenseKey="YourLicenseKey" LookupType="ByWidgetID"
TargetID="Your Target ID" Theme="BlackGold" CssClass="countwidgetdownload1" />

CountWidget Properties

Lookup Type (ByCompanyID, BySiteID, ByPageID, ByWidgetID, and ManualDispay)

The lookup type tells CountWidget how to handle the lookup and display of the target value. Typically ByPageID or ByWidgetID are the most common.
ByPageID will automatically increment the count in the page load event for non-postbacks; all other Lookup Types requires an action by you.

The following event shows an example of manually calling CountWidgetControl.UpdateCount() method.

#region WidgetButton_Click(object sender, EventArgs e)
/// <summary>
/// This event is fired when the 'WidgetButton' is clicked.
/// </summary>
public void WidgetButton_Click(object sender, EventArgs e)
{
// information needed to do a manual 'Count'
int companyID = 7;
string licenseKey = "39V23-CUKBR-TYVJK-4YK26-S24RY";
int targetID = 1;
LookupTypeEnum lookupType = LookupTypeEnum.ByWidgetID;

// now update the count
this.CountWidget2.UpdateCount(companyID, licenseKey, lookupType, targetID, CountTypeEnum.TotalCount);
}
#endregion

TargetID

The TargetID is the id of the item being counted; PageID for a Page, WidgetID for a widget, etc.

If the companyID / LicenseKey combination does not validate, if the TargetID is not found, or if you are over your transaction limit for the month, the control will be invisible.

HideOnError

The property HideOnError is true by default.

IgnoreBots

This is a new property I am experimenting with; after I published www.countwidget.com I noticed the home page count was incrementing by about 50 counts per day, although I was the only one who knew about the site. I am setting this property to true by default; if the User Agent does not appear to be Internet Explorer, Firefox, Chrome or Safari (I am sure the list is not complete) then Count Widget skips processing so transactions are not incurred for bots.

I am aware some bots disguise themselves with fake user agents, but at least the number of counts will not go up as fast. The default page of your website is usually the most bombarded with bots. I plan on investigating this further and experiment with using the AjaxControlToolkit NoBot control.

Theme

At the time of this writing there are only two themes, BlackGold and LightBlue.

In the near future I plan on hosting a contest to create a few more themes; keep up with www.datajuggler.com or http://countwidget.codeplex.com for details.

ApplyStyle Method

Due to the fact the control does not read the markup (because AutoEventWireup="False"), you will have to call the ApplyStyle method to place the control anywhere other than on the absolute positioned right hand corner of the page.

(Add this code to the PageLoad event or PagePreRender)

// apply style here
string countWidgetCssClass = "countwidgetcontrol1";

// use black gold
string numberContainerCssClass = "numbercontainerblackgold";

// Apply style here as the load of the event properties does not apply style correctly
this.CountWidget1.ApplyStyle(countwidgetcontrol1, numberContainerCssClass);

Download the complete solution to see dozens of examples in the CountWidgetWeb project.

Part II

The following is only applicable if you are self-hosting the WidgetData database, the CountWidgetWeb and WidgetDataService projects.

Setting up the Count Widget Web and Web Services

If you want to self-host the database, web project and web services, you must modify app.config and web.config files of the project you are hosting.

You will need to download RAD Studio Code Generation Toolkit; available at http://radstudio.codeplex.com (The apps Crypto and RAD Studio Configuration Manager are located in the Tools folder of the RAD Studio Code Generation Toolkit download).

The CountWidgetControl has a web reference to the CountWidgetService; to self-host you must update this reference to your server.

You will need to modify the IP Address and connection strings stored in the web.config (CountWidgetWeb) and app.config (WidgetDataService) files. Use the Configuration Manager, to build a connection string, or use your own and encrypt the string with the RAD Studio Cryptography Manager (Crypto), also located in the tools folder of the RAD Studio download.

Use the default password of ‘pokerpro’ (contact me if you want to know how to use your own password) and encrypt the connection string.

After you save the IP Address and Connection string, you should be able to run the Web Service and website.

Creating the WidgetData database

SQL Server 2012

Attach to the WidgetData database

Earlier Versions of SQL

Execute the WidgetData SQL Scripts

Create Database (or manually create it)

Create Tables

Create Stored Procedures

Create a SQL user called ‘WidgetJuggler’ (or use one of your own)

Add the WidgetJuggler user to the dbdatareader and dbdatawriter roles.

Run the following procedure

UpdateProcPermissions ‘WidgetJuggler’

This will grant permission to the user to execute the stored procedures.

Contact support@datajuggler.com with any questions or problems and I will try to answer as fast as possible.

For commercial projects, support is available for RAD Studio or any Data Juggler products at the rate of $75 per hour.

If you like this project or any Data Juggler products, please support my web site www.daily-click.com which is dedicated to using technology to helping people and animals.

Last edited Apr 30, 2013 at 4:26 AM by Corby, version 9

Comments

No comments yet.