Click here to Skip to main content
12,633,998 members (22,678 online)
Click here to Skip to main content
Add your own
alternative version

Stats

18.8K views
103 downloads
15 bookmarked
Posted

ASP.NET and Commerce Server

, 15 Mar 2006
Rate this:
Please Sign up or sign in to vote.
This article give a rough view on ASP.NET developing Commerce Application

Sample Image - slcs.jpg

Introduction

If you want to develop commerce server application, do remember setup vs.net first, then setup commerce server. After setup, you will find "Commerce Project" option in the New Project list.

The code below will give you a rough idea how to interact with commerce server.

1. Get categories from a Catalog

<FONT color=#0000ff size=2>private <FONT color=#0000ff size=2>void CategoryBind()

{

ProductCatalog ProdCtlg =CommerceContext.Current.CatalogSystem.GetCatalog("LevisJeans");

DataSet ds=<FONT color=#0000ff size=2>new DataSet();

ds=ProdCtlg.GetRootCategories();

drpCategory.DataSource=ds.Tables[0].DefaultView;

drpCategory.DataTextField="CategoryName";

drpCategory.DataValueField="OrigCategoryName";

drpCategory.DataBind();

}

2. Bind products based on the category selected

<FONT color=#0000ff size=2>

private <FONT color=#0000ff size=2>void DataBind()

{

ProductCatalog ProdCtlg =CommerceContext.Current.CatalogSystem.GetCatalog("LevisJeans");

Category Cg;

Cg=ProdCtlg.GetCategory(drpCategory.SelectedValue);

DataGrid4.DataSource=Cg.GetProducts();

DataGrid4.DataBind();

}

<img src="/KB/aspnet/slcs/productlist.jpg">

 The below get list of products put into cart

<FONT color=#0000ff size=2>

private <FONT color=#0000ff size=2>void DataBind()

{

TransactionContext txContext=TransactionContext.Current;

<FONT color=#0000ff size=2>

#if DEBUG

System.Console.WriteLine("HERE");

<FONT color=#0000ff size=2>

#endif

tot_qty=0;

tot_price=0;

DataGrid1.DataSource=txContext.CartOrderForm.LineItems;

DataGrid1.DataBind();

lblTot_Qty.Text=Convert.ToString(tot_qty);

lblTot_Price.Text=Convert.ToString(tot_price);

}

<img src="/KB/aspnet/slcs/cart.jpg">

Below code is to delete one item

<FONT color=#0000ff size=2>

int d=Convert.ToInt16(deleted[j]);

txContext.CartOrderForm.LineItems.Remove(d)

 

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Simon Liu
Web Developer
United States United States
Over 10 years experience in IT software industry. Business logic and Technical adviser.

MCP and MCDBA certified. Focus Microsoft Product. Research done on Sharepoint Portal Server 2003, Microsoft Commerce Server 2002, Microsoft Report Services, etc.

I can be reached by chn_lz@yahoo.com.


You may also be interested in...

Comments and Discussions

 
GeneralMy vote of 1 Pin
hector garduno22-Sep-10 20:04
grouphector garduno22-Sep-10 20:04 
GeneralSource Download link is not working Pin
Manish Tiwari20-Feb-07 8:34
memberManish Tiwari20-Feb-07 8:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.161208.2 | Last Updated 16 Mar 2006
Article Copyright 2006 by Simon Liu
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid