Ecommerce site project

profileeadariq.seais
sri_ITSD325_IP3.zip.zip

Code-Shopping/About Us/frmAboutus.aspx

<%@ Page Language="C#" MasterPageFile="~/Templates/Default/MasterPage.master" AutoEventWireup="true" CodeFile="frmAboutus.aspx.cs" Inherits="About_Us_frmAboutus" Title="Untitled Page" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server"> <html> <head> <title></title> </head> <body> <table> <tr> <td align="left"> <h3> About Us</h3> </td> </tr> <tr> <td style="text-align: justify"> <p>This Organization is ISO-9001 Certified Company.We are a group of 20 Lakh Employees spread all over the globe.We Provide Excellent Services to Costume and Fashion Industry.We specialize in Kurthis,Jeans, Shirts,Salwars,Sarees etc.Our Head office is located in Head Office Mumbai.We have our Branch Offices all over India(Hyderabad,Chennai etc).We Plan to extend our services to rural India in the near future. </p> </td> </tr> </table> </body> </html> </asp:Content>

Code-Shopping/About Us/frmAboutus.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class About_Us_frmAboutus : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/About Us/TEST.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TEST.aspx.cs" Inherits="About_Us_TEST" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <table width="100%" border="1"> <tr> <td> hello</td></tr><tr><td>Shopping</td></tr></table> </div> </form> </body> </html>

Code-Shopping/About Us/TEST.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class About_Us_TEST : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/Admin/AdminCatalog/adminBrand/frmBrandList.aspx

<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Templates/Default/AdminMaster.master"CodeFile="frmBrandList.aspx.cs" Inherits="AdminBrand_frmBrandList" %> <%@ Register Src="ucBrandList.ascx" TagName="ucBrandList" TagPrefix="uc1" %> <asp:Content ID="content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <div> <uc1:ucBrandList ID="UcBrandList1" runat="server" /> </div> </asp:Content>

Code-Shopping/Admin/AdminCatalog/adminBrand/frmBrandList.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class AdminBrand_frmBrandList : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/Admin/AdminCatalog/adminBrand/ucBrandList.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucBrandList.ascx.cs" Inherits="ucBrandList" %> <table style="width:100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td align="center" bgcolor="navy"> <strong><span style="color:White">BRAND LIST</span></strong><br /> </td> </tr> <tr> <td id="tdBrandList" style="width:100%" align="left"> <asp:Panel ID="panelTop" runat="server" Width="100%"> <asp:LinkButton ID="lBtnNewBrand" Text="Add New Brand" runat="server" OnClick="lBtnNewBrand_Click"></asp:LinkButton> <asp:DataList ID="dlBrand" RepeatColumns="1" runat="server" Width="100%" OnItemCommand="dlBrand_ItemCommand"> <HeaderStyle BackColor="Lavender"/> <ItemStyle BackColor="Azure"/> <AlternatingItemStyle BackColor="LightBlue"/> <HeaderTemplate > <table style="width:100%"> <tr> <td style="width:25%" align="center">Brand Name</td> <td style="width:45%" align="center">Description</td> <td style="width:15%" align="center">Edit</td> <td style="width:15%" align="center">Delete</td> </tr> </table> </HeaderTemplate> <ItemTemplate> <table style="width:100%"> <tr> <td style="width:25%" align="center"> <asp:Label ID="lblBrandName" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"BrandName")%>'></asp:Label> </td> <td style="width:45%" align="center"> <img id="imgBrand" alt='<%#DataBinder.Eval(Container.DataItem,"Description")%>' src='<%#DataBinder.Eval(Container.DataItem,"Logo","~/Browse/Images/{0}")%>' runat="server" width="50" height="50" /> </td> <td style="width:15%" align="center"> <asp:ImageButton ID="IbtnBrandEdit" AlternateText="Edit Record" ImageUrl="~/Admin/AdminCatalog/Images/edit.gif" CommandName="Edit" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"ID")%>' runat="server" /> </td> <td style="width:15%" align="center"> <asp:ImageButton ID="IbtnBrandDelete" AlternateText="Delete Record" ImageUrl="~/Admin/AdminCatalog/Images/delete.gif" CommandName="Delete" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"ID")%>' runat="server" /> </td> </tr> </table> </ItemTemplate> </asp:DataList> <asp:Label ID="lblMsg" runat="server" ></asp:Label> </asp:Panel> </td> </tr> <tr> <td id="tdNewBrand" style="width:100%" align="left"> <asp:Panel ID="panelupdate" runat="server" Width="100%"> <table style="width:100%"> <tr> <th colspan="3" align="center" style="height: 21px"> <asp:Label ID="lblUpdateBrand" runat="server" ForeColor="Green"></asp:Label></th> </tr> <tr> <td colspan="3" align="center"><asp:Label ID="lblBrandID" Text="" runat="server" Visible="false"></asp:Label></td> </tr> <tr> <td align="right">Brand Name</td> <td align="center" style="width:2%"><b>:</b></td> <td align="left"> <asp:TextBox ID="txtBrandName" runat="server"></asp:TextBox> </td> </tr> <tr> <td align="right">Description</td> <td align="center" style="width:2%"><b>:</b></td> <td align="left"> <asp:TextBox ID="txtBrandDescriptrion" runat="server" TextMode="MultiLine"></asp:TextBox> </td> </tr> <tr> <td align="right" style="height: 36px"> <asp:Label ID="lblBrandLogo" runat="server" Text="UpLoadLogo"></asp:Label> </td> <td align="center" style="width:2%; height: 36px;"><b>:</b></td> <td align="left" style="height: 36px"> <asp:Image ID="imgBrandLogo" runat="server" AlternateText="Not Available" width="100" Height="75"/> </td> </tr> <tr> <td align="right">Logo (Image)</td> <td align="center" style="width:2%"><b>:</b></td> <td align="left"> <asp:FileUpload ID="fileBrand" runat="server" /></td> </tr> <tr> <td colspan="3" align="center"> <asp:ImageButton ID="IbtnBrandSubmit" ImageUrl="~/Admin/AdminCatalog/Images/update11.jpg" AlternateText="Submit" runat="server" OnClick="IbtnBrandSubmit_Click" /> <asp:ImageButton ID="IBtnBrandCancel" ImageUrl="~/Admin/AdminCatalog/Images/cancel11.jpg" AlternateText="Cancel" runat="server" OnClick="IBtnBrandCancel_Click" /> </td> </tr> </table> <asp:Label ID="lblMsgNewBrand" runat="server" ForeColor="Red" Text=""></asp:Label></asp:Panel> </td> </tr> </table>

Code-Shopping/Admin/AdminCatalog/adminBrand/ucBrandList.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.IO; using ShoppingCart.BL; public partial class ucBrandList : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BindList(); panelTop.Visible = true; panelupdate.Visible = false; } } private void BindList() { DataSet ds = ProductController.getALLBrands(); lblMsg.Text = ""; if (ds.Tables[0].Rows.Count > 0) { dlBrand.DataSource = ds; dlBrand.DataBind(); } else { lblMsg.Text = "No such Item !!! Please add one"; } } protected void lBtnNewBrand_Click(object sender, EventArgs e) { lblUpdateBrand.Text = "Add New Record"; panelTop.Visible = false; panelupdate.Visible = true; IbtnBrandSubmit.AlternateText = "Submit"; txtBrandName.Text = ""; txtBrandDescriptrion.Text = ""; //imgBrandLogo.Visible = false; //lblBrandLogo.Visible = false; } protected void IbtnBrandSubmit_Click(object sender, ImageClickEventArgs e) { string BrandName="", Description="",imageurl="",Logo=""; if (txtBrandName.Text.Trim().Length > 0) BrandName = txtBrandName.Text.Trim(); else lblMsgNewBrand.Text = "Enter Brand Name"; Description =txtBrandDescriptrion.Text.Trim(); if (fileBrand.FileName != null && fileBrand.FileName.Trim() != "") { imageurl = "~/Browse/Images/" + fileBrand.FileName; fileBrand.SaveAs(Server.MapPath(imageurl)); Logo = fileBrand.FileName; } else { if (imgBrandLogo.ImageUrl != null) { Logo = Path.GetFileName(imgBrandLogo.ImageUrl); } else Logo = "na.jpg"; } if (IbtnBrandSubmit.AlternateText == "Submit") { ProductController.InsertBrand(BrandName, Description, Logo); } else { int ID = int.Parse(lblBrandID.Text); ProductController.UpdateBrand(ID, BrandName,Description,Logo); } BindList(); panelTop.Visible = true; panelupdate.Visible = false; } protected void dlBrand_ItemCommand(object source, DataListCommandEventArgs e) { if (e.CommandName == "Edit") { lblUpdateBrand.Text = "Update Record"; //IbtnBrandSubmit.AlternateText = "Update"; DataSet ds = ProductController.GetAllBrandBYBrandID(int.Parse(e.CommandArgument.ToString())); if (ds.Tables[0].Rows.Count > 0) { lblBrandID.Text = e.CommandArgument.ToString(); txtBrandName.Text = ds.Tables[0].Rows[0]["BrandName"].ToString(); txtBrandDescriptrion.Text = ds.Tables[0].Rows[0]["Description"].ToString(); imgBrandLogo.ImageUrl = String.Format("~/Browse/Images/{0}", ds.Tables[0].Rows[0]["Logo"].ToString()); IbtnBrandSubmit.AlternateText = "Update"; panelTop.Visible = false; panelupdate.Visible = true; } } if (e.CommandName == "Delete") { lblBrandID.Text = e.CommandArgument.ToString(); int BrandId = int.Parse(lblBrandID.Text); //Response.Write(BrandId); ProductController.DeleteBrand(BrandId); BindList(); } } protected void IBtnBrandCancel_Click(object sender, ImageClickEventArgs e) { panelupdate.Visible = false; panelTop.Visible = true; } }

Code-Shopping/Admin/AdminCatalog/adminCategory/frmCategoriesList.aspx

<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Templates/Default/AdminMaster.master" CodeFile="frmCategoriesList.aspx.cs" Inherits="frmCategoriesList" %> <%@ Register Src="ucategoryListl.ascx" TagName="ucategoryListl" TagPrefix="uc1" %> <%@ Register Src="ucategoryListl.ascx" TagName="ucategoryListl" TagPrefix="uc2" %> <asp:Content ID="content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <div> <uc2:ucategoryListl ID="UcategoryListl1" runat="server" /> </div> </asp:Content>

Code-Shopping/Admin/AdminCatalog/adminCategory/frmCategoriesList.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class frmCategoriesList : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/Admin/AdminCatalog/adminCategory/ucategoryListl.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucategoryListl.ascx.cs" Inherits="ucategoryListl" %> <table style="width:100%" cellpadding="0" cellspacing="0"> <tr> <td style="width:100%" id="tdCategoryList" align="left"> <asp:Panel ID="panelCategoryTop" runat="server" Width="100%"> <asp:LinkButton ID="lBtnNewCategory" Text="Add New Category" runat="server" OnClick="lBtnNewCategory_Click"></asp:LinkButton> <asp:DataList ID="dlCategory" RepeatColumns="1" runat="server" Width="100%" OnItemCommand="dlCategory_ItemCommand"> <HeaderStyle BackColor="Aqua" /> <ItemStyle BackColor="azure"/> <AlternatingItemStyle BackColor="lightBlue"/> <HeaderTemplate > <table style="width:100%"> <tr> <td style="width:30%" align="center">Category Name</td> <td style="width:40%" align="center">Description</td> <td style="width:15%" align="center">Edit</td> <td style="width:15%" align="center">Delete</td> </tr> </table> </HeaderTemplate> <ItemTemplate> <table style="width:100%"> <tr> <td style="width:30%" align="center"> <asp:Label ID="lblCategoryName" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Name") %>'></asp:Label> </td> <td style="width:40%" align="center"> <img id="imgCategory" alt='<%#DataBinder.Eval(Container.DataItem,"Description")%>' src='<%#DataBinder.Eval(Container.DataItem,"Image","~/Browse/Images/{0}")%>' runat="server" width="100" height="75" /> </td> <td style="width:15%" align="center"> <asp:ImageButton ID="IbtnEditCat" AlternateText="Edit Record" ImageUrl="~/Admin/AdminCatalog/Images/edit.gif" CommandName="Edit" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"ID")%>' runat="server" /> </td> <td style="width:15%" align="center"> <asp:ImageButton ID="IbtnDeleteCat" AlternateText="Delete Record" ImageUrl="~/Admin/AdminCatalog/Images/delete.gif" CommandName="Delete" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"ID")%>' runat="server" /> </td> </tr> </table> </ItemTemplate> </asp:DataList> <asp:Label ID="lblMsg" Text="" ForeColor="Red" runat="server"></asp:Label> </asp:Panel> </td> </tr> <tr> <td style="width:100%" id="tdNewCategory" align="left"> <asp:Panel ID="panelNewCategory" runat="server" Width="100%"> <table style="width:100%" cellpadding="0" cellspacing="0"> <tr> <th align="center" colspan="3"> <asp:Label ID="lblNewCAtegoryHeader" Text="" runat="server"></asp:Label> </th> </tr> <tr> <td colspan="3" align="center"> <asp:Label ID="lblCatID" Text="" runat="server" Visible="false"></asp:Label> </td> </tr> <tr> <td align="right"> Category Name</td> <td align="center" style="width: 2%"> <b>:</b></td> <td align="left"> <asp:TextBox ID="txtCategoryName" runat="server" /> </td> </tr> <tr> <td align="right" style="height: 38px">Description</td> <td align="center" style="width:2%; height: 38px;"><b>:</b></td> <td align="left" style="height: 38px"> <asp:TextBox ID="txtCatDescriptrion" runat="server" TextMode="MultiLine"></asp:TextBox> </td> </tr> <tr> <td align="right"> <asp:Label ID="lblImage" Text="Uploaded Image" runat="server"></asp:Label></td> <td align="center" style="width:2%"><b>:</b></td> <td align="left"> <asp:Image ID="imgCatLogo" runat="server" AlternateText="Not Available" Height="75px" Width="100px" /> </td> </tr> <tr> <td align="right">Upload New Image</td> <td align="center" style="width:2%"><b>:</b></td> <td align="left"> <asp:FileUpload ID="fileCat" runat="server" /></td> </tr> <tr> <td colspan="3" align="center" style="height: 34px"> <asp:ImageButton ID="IbtnCatSubmit" ImageUrl="~/Admin/AdminCatalog/Images/update11.jpg" AlternateText="Submit" runat="server" OnClick="IbtnCatSubmit_Click" /> <asp:ImageButton ID="IBtnCatCancel" ImageUrl="~/Admin/AdminCatalog/Images/cancel11.jpg" AlternateText="Cancel" runat="server" OnClick="IBtnCatCancel_Click" /> </td> </tr> </table> <asp:Label ID="lblMsgNewCat" runat="server" ForeColor="Red" Text=""></asp:Label></asp:Panel> </td> </tr> </table>

Code-Shopping/Admin/AdminCatalog/adminCategory/ucategoryListl.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.IO; using ShoppingCart.BL; public partial class ucategoryListl : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BindList(); panelCategoryTop.Visible = true; panelNewCategory.Visible = false; } } private void BindList() { DataSet ds = ProductController.getALLCategories(); lblMsg.Text = ""; if (ds.Tables[0].Rows.Count > 0) { dlCategory.DataSource = ds; dlCategory.DataBind(); } else { lblMsg.Text = "No such Item !!! Please add one"; } } protected void lBtnNewCategory_Click(object sender, EventArgs e) { lblNewCAtegoryHeader.Text = "Add New Category"; panelCategoryTop.Visible = false; panelNewCategory.Visible = true; IbtnCatSubmit.AlternateText = "Submit"; txtCategoryName.Text = ""; txtCatDescriptrion.Text = ""; // imgCatLogo.Visible = false; //lblImage.Visible = false; } protected void IbtnCatSubmit_Click(object sender, ImageClickEventArgs e) { string catname="", description="", imageurl="",image=""; if (txtCategoryName.Text.Trim().Length > 0) catname = txtCategoryName.Text.Trim(); else lblMsgNewCat.Text = "Enter Category Name"; description = txtCatDescriptrion.Text.Trim(); if (fileCat.FileName != null && fileCat.FileName.Trim()!="") { imageurl = "~/Browse/Images/" + fileCat.FileName; fileCat.SaveAs(Server.MapPath(imageurl)); image=fileCat.FileName; } else { if (imgCatLogo.ImageUrl != null) { image = Path.GetFileName(imgCatLogo.ImageUrl); } else image = "na.jpg"; } if (IbtnCatSubmit.AlternateText == "Submit") { ProductController.InsertCategory(catname, description, image); } else { int catid = int.Parse(lblCatID.Text); ProductController.UpdateCategory(catid,catname, description, image); } BindList(); panelCategoryTop.Visible = true; panelNewCategory.Visible = false; } protected void dlCategory_ItemCommand(object source, DataListCommandEventArgs e) { if (e.CommandName == "Edit") { lblNewCAtegoryHeader.Text = "Update Category"; DataSet ds = ProductController.GetAllCategoriesBYCategoryID(int.Parse(e.CommandArgument.ToString())); if (ds.Tables[0].Rows.Count > 0) { lblCatID.Text = e.CommandArgument.ToString(); txtCategoryName.Text = ds.Tables[0].Rows[0]["Name"].ToString(); txtCatDescriptrion.Text = ds.Tables[0].Rows[0]["Description"].ToString(); imgCatLogo.ImageUrl = String.Format("~/Browse/Images/{0}", ds.Tables[0].Rows[0]["Image"].ToString()); IbtnCatSubmit.AlternateText = "Update"; panelCategoryTop.Visible = false; panelNewCategory.Visible = true; } } if (e.CommandName == "Delete") { lblCatID.Text = e.CommandArgument.ToString(); int catid = int.Parse(lblCatID.Text); //Response.Write(catid); ProductController.DeleteCategory(catid); BindList(); } } protected void IBtnCatCancel_Click(object sender, ImageClickEventArgs e) { panelCategoryTop.Visible = true; panelNewCategory.Visible = false; } }

Code-Shopping/Admin/AdminCatalog/adminProduct/frmProductList.aspx

<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Templates/Default/AdminMaster.master" CodeFile="frmProductList.aspx.cs" Inherits="AdminProduct_frmProductList" %> <%@ Register Src="ucProductList.ascx" TagName="ucProductList" TagPrefix="uc1" %> <asp:Content ID="content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <div> <uc1:ucProductList ID="UcProductList1" runat="server" /> </div> </asp:Content>

Code-Shopping/Admin/AdminCatalog/adminProduct/frmProductList.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class AdminProduct_frmProductList : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/Admin/AdminCatalog/adminProduct/ucProductList.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucProductList.ascx.cs" Inherits="ucProductList" %> <table style="width:100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td style="width:100%" id="tdProductList" align="left"> <asp:Panel ID="panelProductTop" runat="server" Width="100%"> <asp:LinkButton ID="lBtnNewProduct" Text="Add New Product" runat="server" OnClick="lBtnNewProduct_Click"></asp:LinkButton> <asp:DataList ID="dlProduct" RepeatColumns="1" runat="server" Width="100%" OnItemCommand="dlProduct_ItemCommand"> <HeaderStyle BackColor="lavender"/> <ItemStyle BackColor="azure"/> <AlternatingItemStyle BackColor="lightBlue"/> <HeaderTemplate > <table style="width:100%"> <tr> <td style="width:10%" align="center">Brand Name</td> <td style="width:30%" align="center">Product Name/PurchasePrice/SalePrice</td> <td style="width:30%" align="center">Description</td> <td style="width:10%" align="center">Quantity</td> <td style="width:10%" align="center">Edit</td> <td style="width:10%" align="center">Delete</td> </tr> </table> </HeaderTemplate> <ItemTemplate> <table style="width:100%"> <tr> <td style="width:10%" align="center"> <asp:Label ID="lblBrandName" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"BrandName" )%>'></asp:Label> </td> <td style="width:30%" align="center"> <asp:Label ID="lblProductName" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Name")%>'></asp:Label> /$ <asp:Label ID="lblPurchasePrice" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"PurchasePrice" )%>'></asp:Label> /$ <asp:Label ID="lblSalePrice" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"SalePrice") %>'></asp:Label> </td> <td style="width:30%" align="center"> <img id="imgProduct" alt='<%#DataBinder.Eval(Container.DataItem,"Description")%>' src='<%#DataBinder.Eval(Container.DataItem,"Image","~/Browse/Images/{0}")%>' runat="server" width="100" height="75" /> </td> <td style="width:10%" align="center"> <asp:Label ID="lblProductQuantity" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Quantity")%>'></asp:Label> </td> <td style="width:10%" align="center"> <asp:ImageButton ID="IbtnProductEdit" AlternateText="Edit Record" ImageUrl="~/Admin/AdminCatalog/Images/edit.gif" CommandName="Edit" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"ID")%>' runat="server" /> </td> <td style="width:10%" align="center"> <asp:ImageButton ID="IbtnProductDelete" AlternateText="Delete Record" ImageUrl="~/Admin/AdminCatalog/Images/delete.gif" CommandName="Delete" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"ID")%>' runat="server" /> </td> </tr> </table> </ItemTemplate> </asp:DataList> <asp:Label ID="lblMsg" Text="" ForeColor="Red" runat="server"></asp:Label> </asp:Panel> </td> </tr> <tr> <td style="width:100%" id="tdNewProduct" align="left"> <asp:Panel ID="panelEditProduct" runat="server" Width="100%"> <table style="width:100%" cellpadding="0" cellspacing="0"> <tr> <td colspan="3" align="center"> Update Product</td> </tr> <tr> <td colspan="3" align="center"><asp:Label ID="lblID" Text="" runat="server" Visible="false"></asp:Label></td> </tr> <tr> <td align="right">Product Name</td> <td align="center" style="width:2%"><b>:</b></td> <td align="left"> &nbsp;<asp:TextBox ID="txtUpdateProductName" runat="server"></asp:TextBox></td> </tr> <tr> <td align="right"> Quantity</td> <td align="center" style="width: 2%"> <b>:</b></td> <td align="left"> <asp:TextBox ID="txtUpdateQuantity" runat="server" /></td> </tr> <tr> <td align="right"> PurchasePrice</td> <td align="center" style="width: 2%"> <b>:</b></td> <td align="left"> <asp:TextBox ID="txtUpdatePurchasePrice" runat="server"/></td> </tr> <tr> <td align="right"> Sale Price</td> <td align="center" style="width: 2%"> <b>:</b> </td> <td align="left"> <asp:TextBox ID="txtUpdateSalePrice" runat="server" /> </td> </tr> <tr> <td align="right">Description</td> <td align="center" style="width:2%"><b>:</b></td> <td align="left"> <asp:TextBox ID="txtUpdateDiscription" runat="server" TextMode="MultiLine"></asp:TextBox></td> </tr> <tr> <td align="right">Uploaded Logo (Image)</td> <td align="center" style="width:2%"><b>:</b></td> <td align="left"> <asp:Image ID="iUpload" runat="server" AlternateText="Not Available" Height="75" Width="100"/></td> </tr> <tr> <td align="right">Logo (Image)</td> <td align="center" style="width:2%"><b>:</b></td> <td align="left"> <asp:FileUpload ID="fileUpdateImage" runat="server" /></td> </tr> <tr> <td colspan="3" align="center" style="height: 34px"> <asp:ImageButton ID="IbtnProUpdate" ImageUrl="~/Admin/AdminCatalog/Images/update11.jpg" AlternateText="Update" runat="server" OnClick="IbtnProUpdate_Click" /> <asp:ImageButton ID="IBtnProCancel" ImageUrl="~/Admin/AdminCatalog/Images/cancel11.jpg" AlternateText="Cancel" runat="server" OnClick="IBtnProCancel_Click" /> </td> </tr> <tr> <td align="center" colspan="3"> <asp:Label ID="lblMsgUdateProduct" runat="server"></asp:Label></td> </tr> </table> </asp:Panel> </td> </tr> <tr> <td style="width:100%" id="td1" align="left"> <asp:Panel ID="panelNewProduct" runat="server" Width="100%"> <table style="width:100%" cellpadding="0" cellspacing="0"> <tr> <td colspan="3" align="center" style="height: 19px">Add New Product</td> </tr> <tr> <td colspan="3" align="center"><asp:Label ID="lblBrandId" runat="server" Visible="False"></asp:Label></td> </tr> <tr> <td align="right"> Brand Name</td> <td align="center" style="width: 2%"> <b>:</b></td> <td align="left"> <asp:DropDownList ID="ddlBrandName" runat="server" > <asp:ListItem>BrandName</asp:ListItem> </asp:DropDownList></td> </tr> <tr> <td align="right"> CategoryName</td> <td align="center" style="width: 2%"><b>:</b> </td> <td align="left"> <asp:DropDownList ID="ddlCategoryName" runat="server"> <asp:ListItem>CategoryName</asp:ListItem> </asp:DropDownList></td> </tr> <tr> <td align="right">Product Name</td> <td align="center" style="width:2%"><b>:</b></td> <td align="left"> <asp:TextBox ID="txtProductName" runat="server"></asp:TextBox></td> </tr> <tr> <td align="right"> Quantity On Hand</td> <td align="center" style="width: 2%"> <b>:</b></td> <td align="left"> <asp:TextBox ID="txtProductQuantity" runat="server" /></td> </tr> <tr> <td align="right"> PurchasePrice</td> <td align="center" style="width: 2%"> <b>:</b></td> <td align="left"> &nbsp;<asp:TextBox ID="txtPurPrice" runat="server"/></td> </tr> <tr> <td align="right"> Sale Price</td> <td align="center" style="width: 2%"> <b>:</b> </td> <td align="left"> &nbsp;<asp:TextBox ID="txtSalePrice" runat="server" /></td> </tr> <tr> <td align="right">Description</td> <td align="center" style="width:2%"><b>:</b></td> <td align="left"> <asp:TextBox ID="txtProDescriptrion" runat="server" TextMode="MultiLine"></asp:TextBox></td> </tr> <tr> <td align="right">Uploaded Logo (Image)</td> <td align="center" style="width:2%"><b>:</b></td> <td align="left"> &nbsp;<asp:Image ID="imgProductLogo" runat="server" AlternateText="Not Available" Height="75" Width="100"/></td> </tr> <tr> <td align="right" style="height: 22px">Logo (Image)</td> <td align="center" style="width:2%; height: 22px;"><b>:</b></td> <td align="left" style="height: 22px"> <asp:FileUpload ID="fileProduct" runat="server" /></td> </tr> <tr> <td colspan="3" align="center"> <asp:ImageButton ID="ibNewproduct" ImageUrl="" AlternateText="Submit" runat="server" OnClick="ibNewproduct_Click" /> <asp:ImageButton ID="ibCancel" ImageUrl="" AlternateText="Cancel" runat="server" OnClick="ibCancel_Click" /> </td> </tr> </table> <asp:Label ID="lblMsgNewProduct" runat="server" ForeColor="Red" Text=""></asp:Label></asp:Panel> </td> </tr> </table>

Code-Shopping/Admin/AdminCatalog/adminProduct/ucProductList.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.IO; using ShoppingCart.BL; public partial class ucProductList : System.Web.UI.UserControl { string Image="" ,imageUrl=""; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { CategoryName(); BrandName(); BindList(); panelProductTop.Visible = true; panelNewProduct.Visible = false; panelEditProduct.Visible = false; } } private void CategoryName() { DataSet ds = ProductController.getCategoryNames(); BindDDL(ddlCategoryName, ds, "Name", "Id"); } private void BrandName() { DataSet ds = ProductController.getBrandNames(); BindDDL(ddlBrandName, ds, "BrandName", "Id"); } private void BindDDL(DropDownList ddl, DataSet ds, string txtField, string valField) { ddl.DataSource = ds; ddl.DataTextField = txtField; ddl.DataValueField = valField; ddl.DataBind(); } private void BindList() { DataSet ds = ProductController.GetAllProducts(); lblMsg.Text = ""; if (ds.Tables[0].Rows.Count > 0) { dlProduct.DataSource = ds; dlProduct.DataBind(); } else { lblMsg.Text = "No such Item !!! Please add one"; } } protected void lBtnNewProduct_Click(object sender, EventArgs e) { panelProductTop.Visible = false; panelNewProduct.Visible = true; panelEditProduct.Visible = false; } protected void dlProduct_ItemCommand(object source, DataListCommandEventArgs e) { if (e.CommandName == "Edit") { DataSet ds = ProductController.GetAllProductsBYID(int.Parse(e.CommandArgument.ToString())); if (ds.Tables[0].Rows.Count > 0) { lblID.Text = e.CommandArgument.ToString(); txtUpdateProductName.Text = ds.Tables[0].Rows[0]["Name"].ToString(); txtUpdateQuantity.Text = ds.Tables[0].Rows[0]["Quantity"].ToString(); txtUpdatePurchasePrice.Text = ds.Tables[0].Rows[0]["PurchasePrice"].ToString(); txtUpdateSalePrice.Text = ds.Tables[0].Rows[0]["SalePrice"].ToString(); txtUpdateDiscription.Text = ds.Tables[0].Rows[0]["Description"].ToString(); iUpload.ImageUrl = String.Format("~/Browse/Images/{0}", ds.Tables[0].Rows[0]["Image"]).ToString(); panelProductTop.Visible = false; panelNewProduct.Visible = false; panelEditProduct.Visible = true; } } if (e.CommandName == "Delete") { lblID.Text = e.CommandArgument.ToString(); int Id = int.Parse(lblID.Text); ProductController.DeleteProduct(Id); BindList(); } } protected void ibCancel_Click(object sender, ImageClickEventArgs e) { panelProductTop.Visible = true; panelNewProduct.Visible = false; panelEditProduct.Visible = false; } protected void IBtnProCancel_Click(object sender, ImageClickEventArgs e) { panelProductTop.Visible = true; panelNewProduct.Visible = false; panelEditProduct.Visible = false; } protected void ibNewproduct_Click(object sender, ImageClickEventArgs e) { string productname = "", Description = ""; float PurchasePrice = 0, SalePrice = 0; int Quantity = 0; int BrandId = int.Parse(ddlBrandName.SelectedValue); Response.Write(BrandId); int CategoryId = int.Parse(ddlCategoryName.SelectedValue); Response.Write(CategoryId); PurchasePrice = float.Parse(txtPurPrice.Text); SalePrice = float.Parse(txtSalePrice.Text); Quantity = int.Parse(txtProductQuantity.Text); Image = fileProduct.FileName; if (txtProductName.Text.Trim().Length > 0) productname = txtProductName.Text.Trim(); else lblMsgNewProduct.Text = "Enter Product Name"; Description = txtProDescriptrion.Text.Trim(); if (fileProduct.FileName != null && fileProduct.FileName.Trim() != "") { imageUrl = "~/Browse/Images/" + fileProduct.FileName; fileProduct.SaveAs(Server.MapPath(imageUrl)); Image = fileProduct.FileName; } else { if (imgProductLogo.ImageUrl != null) { Image = Path.GetFileName(imgProductLogo.ImageUrl); } else imageUrl = "na.jpg"; } ProductController.InsertProduct(productname, PurchasePrice, SalePrice, Quantity, Description, Image, BrandId, CategoryId); Response.Write(Image); BindList(); panelProductTop.Visible = true; panelEditProduct.Visible = false; panelNewProduct.Visible = false; } protected void IbtnProUpdate_Click(object sender, ImageClickEventArgs e) { string productname = "", Description = ""; float PurchasePrice = 0, SalePrice = 0; int Quantity = 0; PurchasePrice = float.Parse(txtUpdatePurchasePrice.Text); SalePrice = float.Parse(txtUpdateSalePrice.Text); Quantity = int.Parse(txtUpdateQuantity.Text); Image = fileUpdateImage.FileName; if (txtUpdateProductName.Text.Trim().Length > 0) productname = txtUpdateProductName.Text.Trim(); else lblMsgUdateProduct.Text = "Enter Product Name"; Description = txtUpdateDiscription.Text.Trim(); if (fileUpdateImage.FileName != null && fileUpdateImage.FileName.Trim() != "") { imageUrl = "~/Browse/Images/" + fileUpdateImage.FileName; fileUpdateImage.SaveAs(Server.MapPath(imageUrl)); Image = fileUpdateImage.FileName; } else { if (iUpload.ImageUrl != null) { Image = Path.GetFileName(iUpload.ImageUrl); } else Image = "na.jpg"; } int Id = int.Parse(lblID.Text); ProductController.UpdateProduct(Id, productname, Description, Quantity, Image, PurchasePrice, SalePrice); BindList(); panelProductTop.Visible = true; panelNewProduct.Visible = false; panelEditProduct.Visible = false; } }

Code-Shopping/Admin/AdminCatalog/AdminUsers/frmUsersList.aspx

<%@ Page Language="C#" MasterPageFile="~/Templates/Default/AdminMaster.master" AutoEventWireup="true" CodeFile="frmUsersList.aspx.cs" Inherits="Admin_AdminCatalog_AdminUsers_frmUsersList" %> <%@ Register Src="ucUsersList.ascx" TagName="ucUsersList" TagPrefix="uc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <uc1:ucUsersList ID="UcUsersList1" runat="server" /> </asp:Content>

Code-Shopping/Admin/AdminCatalog/AdminUsers/frmUsersList.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Admin_AdminCatalog_AdminUsers_frmUsersList : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/Admin/AdminCatalog/AdminUsers/ucUsersList.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucUsersList.ascx.cs" Inherits="Admin_AdminCatalog_AdminUsers_ucUsersList" %> <%@ Register Assembly="GMDatePicker" Namespace="GrayMatterSoft" TagPrefix="cc1" %> <table style="width:100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td id="tdBrandList" style="width:100%" align="left"> <asp:Panel ID="panelTop" runat="server" Width="100%"> <%--<asp:LinkButton ID="lBtnNewBrand" Text="Add New Brand" runat="server" OnClick="lBtnNewBrand_Click" Visible="False"></asp:LinkButton>--%> <asp:DataList ID="dlBrand" RepeatColumns="1" runat="server" Width="100%" OnItemCommand="dlBrand_ItemCommand"> <HeaderStyle BackColor="Lavender"/> <ItemStyle BackColor="Azure"/> <AlternatingItemStyle BackColor="LightBlue"/> <HeaderTemplate > <table style="width:100%"> <tr> <td style="width:20%" align="center">UserName</td> <td style="width:18%" align="center">Firstname</td> <td style="width:17%" align="center">LastName</td> <td style="width:15%" align="center">EmailID</td> <td style="width:10%" align="center">Gender</td> <td style="width:10%" align="center">ContactNo</td> <td style="width:05%" align="center">Edit</td> <td style="width:05%" align="center">Delete</td> </tr> </table> </HeaderTemplate> <ItemTemplate> <table style="width:100%"> <tr> <td style="width:20%" align="center"> <asp:Label ID="lblUserName" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"UserName")%>'></asp:Label> </td> <td style="width:18%" align="center"> <asp:Label ID="Label1" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Firstname")%>'></asp:Label> </td> <td style="width:17%" align="center"> <asp:Label ID="Label2" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"LastName")%>'></asp:Label> </td> <td style="width:15%" align="center"> <asp:Label ID="Label3" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"EmailID")%>'></asp:Label> </td> <td style="width:10%" align="center"> <asp:Label ID="Label4" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Gender")%>'></asp:Label> </td> <td style="width:10%" align="center"> <asp:Label ID="Label5" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"ContactNo")%>'></asp:Label> </td> <td style="width:05%" align="center"> <asp:ImageButton ID="IbtnBrandEdit" AlternateText="Edit Record" ImageUrl="~/Admin/AdminCatalog/Images/edit.gif" CommandName="Edit" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"UserID")%>' runat="server" /> </td> <td style="width:05%" align="center"> <asp:ImageButton ID="IbtnBrandDelete" AlternateText="Delete Record" ImageUrl="~/Admin/AdminCatalog/Images/delete.gif" CommandName="Delete" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"UserID")%>' runat="server" /> </td> </tr> </table> </ItemTemplate> </asp:DataList> <asp:Label ID="lblMsg" runat="server" ></asp:Label> </asp:Panel> </td> </tr> <tr> <td id="tdNewBrand" style="width:100%; height: 290px;" align="left"> <asp:Panel ID="panelupdate" runat="server" Width="100%"> <table style="width:100%"> <tr> <th colspan="3" align="center" style="height: 21px"> <asp:Label ID="lblUpdateBrand" runat="server" ForeColor="Green"></asp:Label></th> </tr> <tr> <td colspan="3" align="center"><asp:Label ID="lblUserID" runat="server" Visible="False"></asp:Label> <asp:Label ID="lblAddressID" runat="server" Visible="False"></asp:Label> </td> </tr> <tr> <td align="right"> <span style="color: red">*</span> User Name: </td> <td align="left"> <asp:TextBox ID="txtuser" runat="server" CausesValidation="true"></asp:TextBox> <asp:RequiredFieldValidator ID="rfvUsername" runat="server" ErrorMessage="User name required" ControlToValidate="txtuser" ToolTip="User name required">*</asp:RequiredFieldValidator> <asp:Label ID="lblUser" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label> </td> </tr> <tr> <td align="right" style="width: 195px; height: 34px;"> <span style="color: red">*</span>First Name: </td> <td align="left" style="height: 34px"> <asp:TextBox ID="txtfname" runat="server" CausesValidation="true"></asp:TextBox> <asp:RequiredFieldValidator ID="FirstNameValidator" runat="server" ControlToValidate="txtfname" ErrorMessage="First Name should not be empty" SetFocusOnError="True"></asp:RequiredFieldValidator> </td> </tr> <tr> <td align="right" style="width: 195px"> Last Name: </td> <td align="left" style="width: 551px"> <asp:TextBox ID="txtlname" runat="server" CausesValidation="true"></asp:TextBox> </td> </tr> <tr> <td align="right" style="width: 195px; height: 40px;"> Date Of Birth: </td> <td align="left" style="width: 551px; height: 40px;"> <cc1:GMDatePicker ID="GMDatePicker1" runat="server" Style="z-index: 225; left: 0px; position: absolute; top: 0px"> </cc1:GMDatePicker> <asp:Label ID="lblFormat" runat="server" Text="mm/dd/yyyy" Enabled="false"></asp:Label> </td> </tr> <tr> <td align="right" style="height: 55px"> <span style="color: red">*</span>Gender: </td> <td align="left" style="width: 551px; height: 55px;"> <asp:RadioButtonList ID="rdSex" runat="server" RepeatDirection="Horizontal"> <asp:ListItem Text="Male" Value="Male"> </asp:ListItem> <asp:ListItem Text="Female" Value="Female"> </asp:ListItem> </asp:RadioButtonList> <asp:RequiredFieldValidator ID="GenderValidator" runat="server" ErrorMessage="PLZ Select the gender!!!" ControlToValidate="rdSex" Display="Dynamic"></asp:RequiredFieldValidator> </td> </tr> <tr> <td align="right" style="width: 195px"> Contact No: </td> <td align="left" style="width: 551px"> <asp:TextBox ID="txtcontact" MaxLength="20" runat="server"></asp:TextBox> <asp:CompareValidator ID="CompareValidator2" runat="server" ErrorMessage="Must enter numeric value" Operator="DataTypeCheck" Type="Integer" ControlToValidate="txtcontact"></asp:CompareValidator> </td> </tr> <tr> <td align="right" style="width: 195px; height: 34px;"> Alternate E-Mail ID: </td> <td align="left" style="width: 551px; height: 34px;"> <asp:TextBox ID="txtmail" runat="server"></asp:TextBox> </td> </tr> <tr> <td align="right" style="width: 195px"> <span style="color: red">*</span>Address: </td> <td align="left" style="width: 551px"> <asp:TextBox ID="txtaddr" runat="server" TextMode="MultiLine"> </asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="This Field should not be blank" ControlToValidate="txtaddr"></asp:RequiredFieldValidator> </td> </tr> <tr> <td align="right" style="width: 195px; height: 32px;"> <span style="color: red">*</span>Country:</td> <td align="left" style="width: 551px; height: 32px;"> <asp:DropDownList ID="ddlcountry" runat="server" OnSelectedIndexChanged="ddlcountry_SelectedIndexChanged" AutoPostBack="True"> </asp:DropDownList> </td> </tr> <tr> <td align="right" style="width: 195px"> <span style="color: red">*</span>State: </td> <td align="left" style="width: 551px"> <asp:DropDownList ID="ddlstate" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlstate_SelectedIndexChanged"> </asp:DropDownList> </td> </tr> <tr> <td align="right" style="width: 195px"> <span style="color: red">*</span>City: </td> <td align="left" style="width: 551px"> <asp:DropDownList ID="ddlcity" runat="server"> </asp:DropDownList> </td> </tr> <tr> <td align="right" style="width: 195px; height: 34px;"> ZIP Code: </td> <td align="left" style="width: 551px; height: 34px;"> <asp:TextBox ID="txtZipCode" MaxLength="6" runat="server"></asp:TextBox> <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtZipCode" ErrorMessage="Enter Proper Zip Code" ValidationExpression="\d{6}"> </asp:RegularExpressionValidator> </td> </tr> <tr> <td align="center" colspan="2"> <asp:Label ID="lblres" runat="server" BackColor="#80FF80" Font-Bold="True" ForeColor="Red" ></asp:Label> </td> </tr> <tr> <td align="center" colspan="2"> <small><span style="color: red">*Note:</span>Must enter data</small> </td> </tr> <tr> <td colspan="3" align="center"> <asp:ImageButton ID="IbtnBrandSubmit" ImageUrl="~/Admin/AdminCatalog/Images/update11.jpg" AlternateText="Submit" runat="server" OnClick="IbtnBrandSubmit_Click" /> <asp:ImageButton ID="IBtnBrandCancel" ImageUrl="~/Admin/AdminCatalog/Images/cancel11.jpg" AlternateText="Cancel" runat="server" OnClick="IBtnBrandCancel_Click" /> </td> </tr> </table> <asp:Label ID="lblMsgNewBrand" runat="server" ForeColor="Red" Text=""></asp:Label></asp:Panel> </td> </tr> </table> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:EasyWearConnectionString %>" SelectCommand="SELECT tblAddress.Address, tblAddress.CityId, tblAddress.StateId, tblAddress.CountryId, tblAddress.ZipCode, tblAddress.AddressId, tblUser.FName, tblUser.LName, tblUser.DOB, tblUser.ContactNo, tblUser.Gender, tblUser.AccountId, tblUser.EmailID, tblUser.AddressID AS Expr1, tblUser.Description, tblUser.UserId, tblCity.Name, tblUserAccount.UserName, tblUserAccount.Password, tblUserAccount.HintQuestion, tblUserAccount.Answer, tblUserAccount.RoleId, tblCountry.Name AS Expr2, tblState.Name AS Expr3, tblRole.Role FROM tblAddress INNER JOIN tblUser ON tblAddress.AddressId = tblUser.AddressID INNER JOIN tblUserAccount ON tblUser.AccountId = tblUserAccount.Id INNER JOIN tblCity ON tblAddress.CityId = tblCity.Id INNER JOIN tblCountry ON tblAddress.CountryId = tblCountry.ID INNER JOIN tblState ON tblAddress.StateId = tblState.Id AND tblCity.StateID = tblState.Id AND tblCountry.ID = tblState.CountryId INNER JOIN tblRole ON tblUserAccount.RoleId = tblRole.Id"> </asp:SqlDataSource>

Code-Shopping/Admin/AdminCatalog/AdminUsers/ucUsersList.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.IO; using ShoppingCart.BL; public partial class Admin_AdminCatalog_AdminUsers_ucUsersList : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BindList(); panelTop.Visible = true; panelupdate.Visible = false; } } private void BindList() { DataSet ds = UserController.getALLUsers(); lblMsg.Text = ""; if (ds.Tables[0].Rows.Count > 0) { dlBrand.DataSource = ds; dlBrand.DataBind(); } else { lblMsg.Text = "No such Item !!! Please add one"; } country(); state(); city(); } protected void ddlcountry_SelectedIndexChanged(object sender, EventArgs e) { DataSet dsState = ProductController.getAllStatesByCountryID(int.Parse(ddlcountry.SelectedValue)); BindDDL(ddlstate, dsState, "Name", "ID"); DataSet dscity = ProductController.getCitydetailsByStateID(int.Parse(ddlstate.SelectedValue)); BindDDL(ddlcity, dscity, "Name", "ID"); } protected void ddlstate_SelectedIndexChanged(object sender, EventArgs e) { DataSet dscity = ProductController.getCitydetailsByStateID(int.Parse(ddlstate.SelectedValue)); BindDDL(ddlcity, dscity, "Name", "ID"); } private void state() { DataSet dsState = ProductController.getAllStatedetails(); BindDDL(ddlstate, dsState, "Name", "ID"); } private void country() { DataSet dsCountry = ProductController.getCountrydetails(); BindDDL(ddlcountry, dsCountry, "Name", "ID"); } private void BindDDL(DropDownList ddl, DataSet ds, string txtField, string valField) { ddl.DataSource = ds; ddl.DataTextField = txtField; ddl.DataValueField = valField; ddl.DataBind(); } private void city() { DataSet dscity = ProductController.getCitydetails(); BindDDL(ddlcity, dscity, "Name", "ID"); } protected void IbtnBrandSubmit_Click(object sender, ImageClickEventArgs e) { string BrandName = "", Description = "", imageurl = "", Logo = ""; //if (txtBrandName.Text.Trim().Length > 0) // BrandName = txtBrandName.Text.Trim(); //else // lblMsgNewBrand.Text = "Enter Brand Name"; //Description = txtBrandDescriptrion.Text.Trim(); //if (fileBrand.FileName != null && fileBrand.FileName.Trim() != "") //{ // imageurl = "~/Browse/Images/" + fileBrand.FileName; // fileBrand.SaveAs(Server.MapPath(imageurl)); // Logo = fileBrand.FileName; //} //else //{ // if (imgBrandLogo.ImageUrl != null) // { // Logo = Path.GetFileName(imgBrandLogo.ImageUrl); // } // else // Logo = "na.jpg"; //} int AddressID = Convert.ToInt32(lblAddressID.Text.Trim()); int UserID = Convert.ToInt32(lblUserID.Text.Trim()); UserController.UpdateUserDetails(txtuser.Text, txtfname.Text, txtlname.Text, GMDatePicker1.Date, txtcontact.Text, rdSex.SelectedValue, txtmail.Text, txtaddr.Text, int.Parse(ddlcountry.SelectedValue), int.Parse(ddlstate.SelectedValue), int.Parse(ddlcity.SelectedValue), txtZipCode.Text, AddressID, UserID); lblres.Text = "Done!!!"; BindList(); panelTop.Visible = true; panelupdate.Visible = false; } protected void dlBrand_ItemCommand(object source, DataListCommandEventArgs e) { ListItem li = null; if (e.CommandName == "Edit") { DataSet ds = UserController.GetUserBYUserID(int.Parse(e.CommandArgument.ToString())); if (ds.Tables[0].Rows.Count > 0) { lblUserID.Text = e.CommandArgument.ToString(); lblAddressID.Text = ds.Tables[0].Rows[0]["AddressId"].ToString(); txtuser.Text = ds.Tables[0].Rows[0]["UserName"].ToString(); txtaddr.Text = ds.Tables[0].Rows[0]["Address"].ToString(); txtcontact.Text = ds.Tables[0].Rows[0]["ContactNo"].ToString(); txtfname.Text = ds.Tables[0].Rows[0]["FirstName"].ToString(); txtlname.Text = ds.Tables[0].Rows[0]["LastName"].ToString(); txtmail.Text = ds.Tables[0].Rows[0]["EmailID"].ToString(); txtZipCode.Text = ds.Tables[0].Rows[0]["ZipCode"].ToString(); li = ddlcity.Items.FindByText(ds.Tables[0].Rows[0]["CityName"].ToString()); if(li!=null) { ddlcity.ClearSelection(); li.Selected = true; } li = ddlcountry.Items.FindByText(ds.Tables[0].Rows[0]["CountryName"].ToString()); if (li != null) { ddlcountry.ClearSelection(); li.Selected = true; } li = ddlstate.Items.FindByText(ds.Tables[0].Rows[0]["StateName"].ToString()); if (li != null) { ddlstate.ClearSelection(); li.Selected = true; } li = rdSex.Items.FindByText(ds.Tables[0].Rows[0]["Gender"].ToString()); if (li != null) { rdSex.ClearSelection(); li.Selected = true; } GMDatePicker1.Date = Convert.ToDateTime(ds.Tables[0].Rows[0]["DOB"].ToString()); panelTop.Visible = false; panelupdate.Visible = true; } } if (e.CommandName == "Delete") { lblUserID.Text = e.CommandArgument.ToString(); int UserId = int.Parse(lblUserID.Text); UserController.DeleteUserByUserID(UserId); BindList(); } } protected void IBtnBrandCancel_Click(object sender, ImageClickEventArgs e) { panelupdate.Visible = false; panelTop.Visible = true; } }

Code-Shopping/Admin/AdminCatalog/Images/background_fullwidth.jpg

Code-Shopping/Admin/AdminCatalog/Images/banner1.jpg

Code-Shopping/Admin/AdminCatalog/Images/banner2.jpg

Code-Shopping/Admin/AdminCatalog/Images/banner7.jpg

Code-Shopping/Admin/AdminCatalog/Images/Bar1.bmp

Code-Shopping/Admin/AdminCatalog/Images/benner11.bmp

Code-Shopping/Admin/AdminCatalog/Images/Blue hills.jpg

Code-Shopping/Admin/AdminCatalog/Images/bottombanner_people.png

Code-Shopping/Admin/AdminCatalog/Images/btn_addtocart.gif

Code-Shopping/Admin/AdminCatalog/Images/buy-but.gif

Code-Shopping/Admin/AdminCatalog/Images/cancel.jpg

Code-Shopping/Admin/AdminCatalog/Images/cancel1.jpg

Code-Shopping/Admin/AdminCatalog/Images/cancel11.jpg

Code-Shopping/Admin/AdminCatalog/Images/close.gif

Code-Shopping/Admin/AdminCatalog/Images/Contact Us.gif

Code-Shopping/Admin/AdminCatalog/Images/core-nav-bg.jpg

Code-Shopping/Admin/AdminCatalog/Images/Cort_Image.gif

Code-Shopping/Admin/AdminCatalog/Images/delete.gif

Code-Shopping/Admin/AdminCatalog/Images/Edit.gif

Code-Shopping/Admin/AdminCatalog/Images/F224200781003.jpg

Code-Shopping/Admin/AdminCatalog/Images/FA_FadingRollovers.js

/******************************************************************* * File : FA_ImageFadeSwap.js © JavaScript-FX.com * Created : 2001/08/31 * Author : Roy Whittle ([email protected]) www.Roy.Whittle.com * Purpose : To create a more dynamic image swap using opacity * History * Date Version Description * 2001-08-09 1.0 First version * 2001-08-31 1.1 Got it working with NS6 - You must use opaque * GIF's and use a STYLE attrib in the main * HTML Page - Thanks Owl. * 2001-08-31 1.2 Added different FadIn/FadeOut and converted * all vars to FA name space. * 2001-09-01 1.3 Make it so you only need one onMouseOver * onMouseOut in the main document. * 2001-09-09 1.4 Allow you to do a "Swap Other Image" so * you can swap the same image with different pictures. * 2001-09-17 1.5 Create the pre-loading object - just like * simple rollovers and animated rollovers. * allows for a similar interface to all. * 2001-09-18 1.6 The code contains so much of SimpleRollovers that * I added imgOn and imgOff so you can mix rollovers * without having to include 2 ".js" files. * 2002-02-08 1.7 If the ON image is already loaded don't reload it. * This should help with the IE bug that reloads images * from the server even though they are pre-cached. * (will not work for swapping multiple pictures into same Image object) * 2002-02-13 1.8 Corrected a bug in FA.findImg * 2002-04-23 1.9 Write out the style tag. * 2002-06-09 1.10 Attempt fix for IE on a Mac * 2002-08-27 1.11 Fix a bug whereby opacity may go over 100 which * may be causing a bug in IE6 * 2002-08-29 1.12 Thanks to piglet (http://homepage.ntlworld.com/thepiglet/) * I now have a partial fix for NS7 and Mozilla 1.1. ***********************************************************************/ /****** User may alter these to change the fade effect ********/ var FadeInStep = 20; var FadeOutStep = 20; /****** Don't alter anything else **************/ document.write('<STYLE TYPE="text/css">.imgFader{ position:relative; filter:alpha(opacity=0); -moz-opacity:0.0 }</STYLE>'); if(!window.FA) FA=new Object(); FA.RolloverObjects=new Array(); FA.Rollover = function(name, img) { FA.RolloverObjects[name]=new Image(); FA.RolloverObjects[name].img_src = img; if(!FA.Rollover.postLoad) FA.RolloverObjects[name].src = img; } FA.Rollover.postLoad = false; FA.Rollover.loadImages = function() { var i; for(i in FA.RolloverObjects) { r=FA.RolloverObjects[i]; r.src=r.img_src; } } FA.Rollover.error = function(n) { alert("FA.Rollover - An Error has been detected\n" + "----------------------------------\n" + "You must define a FA.Rollover in your document\n" + "FA.Rollover(\""+n+"\",\"your_on_img.gif\")\n" + "(check the spelling of your FA.Rollovers)"); } /******************************************************************* * * Function : getImg * * Description : In Netscape 4 images could be in layers so we might * have to recurse the layers to find the image * *****************************************************************/ FA.getImg = function(n, d) { var img = d.images[n]; if(!img && d.layers) for(var i=0 ; !img && i<d.layers.length ; i++) img=FA.getImg(n,d.layers[i].document); return img; } /******************************************************************* * * Function : findImg * * Description : gets the image from the document and reports an * error if it cannot find it. * *****************************************************************/ FA.findImg = function(n, d) { var img = FA.getImg(n, d); /*** Stop emails because the image was named incorrectly ***/ if(!img) { alert("FA.findImg - An Error has been detected\n" + "----------------------------------\n" + "You must define an image in your document\n" + "<IMG SRC=\"your_image.ext\" NAME=\""+n+"\">\n" + "(check the NAME= attribute of your images)"); return(new Image()); } return img; } FA.ImageFadeRunning=false; FA.ImageFadeInterval=30; /******************************************************************* * * Function : imgFadeIn * * Description : This function is based on the turn_on() function * of animate2.js (animated rollovers from www.roy.whittle.com). * Each image object is given a state. * OnMouseOver the state is switched depending on the current state. * Current state -> Switch to * =========================== * null -> OFF. * OFF -> FADE_IN * FADE_OUT -> FADE_IN * FADE_OUT -> FADE_OUT_IN (if the new image is different) * FADE_IN_OUT-> FADE_IN (if the image is the same) *****************************************************************/ FA.imgFadeIn = function(img, imgSrc) { if(img) { if(img.state == null) { img.state = "OFF"; img.index = 0; img.next_on = null; } if(img.state == "OFF") { /*** Vers 1.7 only load the ON image once ever ***/ if(img.src.indexOf(imgSrc) == -1) img.src=imgSrc; img.currSrc = imgSrc; img.state = "FADE_IN"; FA.startFading(); } else if( img.state == "FADE_IN_OUT" || img.state == "FADE_OUT_IN" || img.state == "FADE_OUT") { if(img.currSrc == imgSrc) img.state = "FADE_IN"; else { img.next_on = imgSrc; img.state="FADE_OUT_IN"; } } } } /******************************************************************* * * Function : imgFadeOut * * Description : This function is based on the turn_off function * of animate2.js (animated rollovers from www.roy.whittle.com). * Each image object is given a state. * OnMouseOut the state is switched depending on the current state. * Current state -> Switch to * =========================== * ON -> FADE_OUT. * FADE_IN -> FADE_IN_OUT. * FADE_OUT_IN -> FADE_IN. (after swapping to the next image) *****************************************************************/ FA.imgFadeOut = function(img) { if(img) { if(img.state=="ON") { img.state="FADE_OUT"; FA.startFading(); } else if(img.state == "FADE_IN") { img.state="FADE_IN_OUT"; } else if(img.state=="FADE_OUT_IN") { img.next_on == null; img.state = "FADE_OUT"; } } } /******************************************************************* * * Function : startFading * * Description : This function is based on the start_animating() function * of animate2.js (animated rollovers from www.roy.whittle.com). * If the timer is not currently running, it is started. * Only 1 timer is used for all objects *****************************************************************/ FA.startFading = function() { if(!FA.ImageFadeRunning) FA.ImageFadeAnimation(); } /******************************************************************* * * Function : ImageFadeAnimation * * Description : This function is based on the Animate function * of animate2.js (animated rollovers from www.roy.whittle.com). * Each image object has a state. This function * modifies each object and (possibly) changes its state. *****************************************************************/ FA.ImageFadeAnimation = function() { FA.ImageFadeRunning = false; for(i=0 ; i<document.images.length ; i++) { var img = document.images[i]; if(img.state) { if(img.state == "FADE_IN") { img.index+=FadeInStep; if(img.index > 100) img.index = 100; if(img.filters) img.filters.alpha.opacity = img.index; else img.style.MozOpacity = img.index/101; if(img.index == 100) img.state="ON"; else FA.ImageFadeRunning = true; } else if(img.state == "FADE_IN_OUT") { img.index+=FadeInStep; if(img.index > 100) img.index = 100; if(img.filters) img.filters.alpha.opacity = img.index; else img.style.MozOpacity = img.index/101; if(img.index == 100) img.state="FADE_OUT"; FA.ImageFadeRunning = true; } else if(img.state == "FADE_OUT") { img.index-=FadeOutStep; if(img.index < 0) img.index = 0; if(img.filters) img.filters.alpha.opacity = img.index; else img.style.MozOpacity = img.index/101; if(img.index == 0) img.state="OFF"; else FA.ImageFadeRunning = true; } else if(img.state == "FADE_OUT_IN") { img.index-=FadeOutStep; if(img.index < 0) img.index = 0; if(img.filters) img.filters.alpha.opacity = img.index; else img.style.MozOpacity = img.index/101; if(img.index == 0) { img.src = img.next_on; img.currSrc = img.next_on; img.state="FADE_IN"; } FA.ImageFadeRunning = true; } } } /*** Check to see if we need to animate any more frames. ***/ if(FA.ImageFadeRunning) setTimeout("FA.ImageFadeAnimation()", FA.ImageFadeInterval); } /******************************************************************* * * Function : hasOpacity * * Description : Tests if the browser allows Opacity * *****************************************************************/ FA.hasOpacity = function(obj) { if(document.layers) return false; if(window.opera) return false; if(navigator.userAgent.toLowerCase().indexOf("mac") != -1) return false; return true; } /******************************************************************* * * Function : fadeIn /fadeOut * * Description : Detects browser that can do opacity and fades the images * For browsers that do not support opacity it just does an image swap. * (I only know about NS4 but maybe IE on a Mac also ?) * For these functions to work you need to name the image * e.g. for an image named "home" you need * <IMG .... NAME="home"> * and you need 2 images, the on and the off image *****************************************************************/ FA.fadeIn = function(imgName, rollName) { if(rollName == null) rollName=imgName; /*** Stop emails because the rollover was named incorrectly ***/ if(!FA.RolloverObjects[rollName]) { FA.Rollover.error(rollName); return; } var img = FA.findImg(imgName, document); if(FA.hasOpacity(img)) FA.imgFadeIn(img, FA.RolloverObjects[rollName].img_src); else { if(img.offSrc==null) img.offSrc=img.src; img.src=FA.RolloverObjects[rollName].img_src; } } FA.fadeOut = function(imgName) { var img = FA.findImg(imgName, document); if(FA.hasOpacity(img)) FA.imgFadeOut(img); else img.src=img.offSrc; } /******************************************************************* * * Function : imgOn /imgOff * * Description : Included these functions so you can mix simple and * fading rollovers without having to include 2 ".js" files * *****************************************************************/ FA.imgOn = function(imgName, rollName) { if(rollName == null) rollName=imgName; /*** Stop emails because the rollover was named incorrectly ***/ if(!FA.RolloverObjects[rollName]) { FA.Rollover.error(rollName); return; } var img = FA.findImg(imgName,document); if(img.offSrc==null) img.offSrc=img.src; img.src=FA.RolloverObjects[rollName].img_src; } FA.imgOff = function(imgName) { var img = FA.findImg(imgName,document); img.src=img.offSrc; }

Code-Shopping/Admin/AdminCatalog/Images/Header_Brands.gif

Code-Shopping/Admin/AdminCatalog/Images/icon_download_event.gif

Code-Shopping/Admin/AdminCatalog/Images/icon_event.gif

Code-Shopping/Admin/AdminCatalog/Images/img1.jpg

Code-Shopping/Admin/AdminCatalog/Images/imgCCHPMeBAAGSignedOut.gif

Code-Shopping/Admin/AdminCatalog/Images/imgEcheck.gif

Code-Shopping/Admin/AdminCatalog/Images/imgHdrLiveHelpIcon.gif

Code-Shopping/Admin/AdminCatalog/Images/inner_ima1.jpg

Code-Shopping/Admin/AdminCatalog/Images/inner_ima2.jpg

Code-Shopping/Admin/AdminCatalog/Images/inner_ima3.jpg

Code-Shopping/Admin/AdminCatalog/Images/inner_ima4.jpg

Code-Shopping/Admin/AdminCatalog/Images/inner_ima5.jpg

Code-Shopping/Admin/AdminCatalog/Images/inner_ima6.jpg

Code-Shopping/Admin/AdminCatalog/Images/inner_ima7.jpg

Code-Shopping/Admin/AdminCatalog/Images/loading.gif

Code-Shopping/Admin/AdminCatalog/Images/movedown.gif

Code-Shopping/Admin/AdminCatalog/Images/moveup.gif

Code-Shopping/Admin/AdminCatalog/Images/notavailable.gif

Code-Shopping/Admin/AdminCatalog/Images/print.jpg

Code-Shopping/Admin/AdminCatalog/Images/rollimages.js

// JavaScript Document FadeInStep=20; FadeOutStep=6; FA.Rollover("l1", "http://localhost/SweetNewBaby2.0/images/home_o.gif"); FA.Rollover("l2", "http://localhost/SweetNewBaby2.0/images/aboutus_o.gif"); FA.Rollover("l3", "http://localhost/SweetNewBaby2.0/images/our_services_o.gif"); FA.Rollover("l4", "http://localhost/SweetNewBaby2.0/images/best_solutions_o.gif"); FA.Rollover("l5", "http://localhost/SweetNewBaby2.0/images/faq_o.gif"); FA.Rollover("l6", "http://localhost/SweetNewBaby2.0/images/services_o.gif"); FA.Rollover("l7", "http://localhost/SweetNewBaby2.0/images/contact_o.gif");

Code-Shopping/Admin/AdminCatalog/Images/Search.gif

Code-Shopping/Admin/AdminCatalog/Images/signin.gif

Code-Shopping/Admin/AdminCatalog/Images/slideshow_inner.js

// JavaScript Document var fadeimages=new Array() //SET IMAGE PATHS. Extend or contract array as needed fadeimages[0]=["http://localhost/ShoppingCart/Admin/AdminCatalog/images/inner_ima1.jpg", "", ""] fadeimages[1]=["http://localhost/ShoppingCart/Admin/AdminCatalog/images/inner_ima2.jpg", "", ""] fadeimages[2]=["http://localhost/ShoppingCart/Admin/AdminCatalog/images/inner_ima3.jpg", "", ""] fadeimages[3]=["http://localhost/ShoppingCart/Admin/AdminCatalog/images/inner_ima4.jpg", "", ""] fadeimages[4]=["http://localhost/ShoppingCart/Admin/AdminCatalog/images/inner_ima5.jpg", "", ""] fadeimages[5]=["http://localhost/ShoppingCart/Admin/AdminCatalog/images/inner_ima6.jpg", "", ""] fadeimages[6]=["http://localhost/ShoppingCart/Admin/AdminCatalog/images/inner_ima7.jpg", "", ""] var fadebgcolor="black" ////NO need to edit beyond here///////////// var fadearray=new Array() //array to cache fadeshow instances var fadeclear=new Array() //array to cache corresponding clearinterval pointers var dom=(document.getElementById) //modern dom browsers var iebrowser=document.all function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder){ this.pausecheck=pause this.mouseovercheck=0 this.delay=delay this.degree=10 //initial opacity degree (10%) this.curimageindex=0 this.nextimageindex=1 fadearray[fadearray.length]=this this.slideshowid=fadearray.length-1 this.canvasbase="canvas"+this.slideshowid this.curcanvas=this.canvasbase+"_0" if (typeof displayorder!="undefined") theimages.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :) this.theimages=theimages this.imageborder=parseInt(borderwidth) this.postimages=new Array() //preload images for (p=0;p<theimages.length;p++){ this.postimages[p]=new Image() this.postimages[p].src=theimages[p][0] } var fadewidth=fadewidth+this.imageborder*2 var fadeheight=fadeheight+this.imageborder*2 if (iebrowser&&dom||dom) //if IE5+ or modern browsers (ie: Firefox) document.write('<div id="master'+this.slideshowid+'" style="position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);-moz-opacity:10;-khtml-opacity:10;background-color:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);-moz-opacity:10;background-color:'+fadebgcolor+'"></div></div>') else document.write('<div><img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'"></div>') if (iebrowser&&dom||dom) //if IE5+ or modern browsers such as Firefox this.startit() else{ this.curimageindex++ setInterval("fadearray["+this.slideshowid+"].rotateimage()", this.delay) } } function fadepic(obj){ if (obj.degree<100){ obj.degree+=10 if (obj.tempobj.filters&&obj.tempobj.filters[0]){ if (typeof obj.tempobj.filters[0].opacity=="number") //if IE6+ obj.tempobj.filters[0].opacity=obj.degree else //else if IE5.5- obj.tempobj.style.filter="alpha(opacity="+obj.degree+")" } else if (obj.tempobj.style.MozOpacity) obj.tempobj.style.MozOpacity=obj.degree/101 else if (obj.tempobj.style.KhtmlOpacity) obj.tempobj.style.KhtmlOpacity=obj.degree/100 } else{ clearInterval(fadeclear[obj.slideshowid]) obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1" obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas) obj.populateslide(obj.tempobj, obj.nextimageindex) obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0 setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay) } } fadeshow.prototype.populateslide=function(picobj, picindex){ var slideHTML="" if (this.theimages[picindex][1]!="") //if associated link exists for image slideHTML='<a href="'+this.theimages[picindex][1]+'" target="'+this.theimages[picindex][2]+'">' slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">' if (this.theimages[picindex][1]!="") //if associated link exists for image slideHTML+='</a>' picobj.innerHTML=slideHTML } fadeshow.prototype.rotateimage=function(){ if (this.pausecheck==1) //if pause onMouseover enabled, cache object var cacheobj=this if (this.mouseovercheck==1) setTimeout(function(){cacheobj.rotateimage()}, 100) else if (iebrowser&&dom||dom){ this.resetit() var crossobj=this.tempobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas) crossobj.style.zIndex++ fadeclear[this.slideshowid]=setInterval("fadepic(fadearray["+this.slideshowid+"])",50) this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0" } else{ var ns4imgobj=document.images['defaultslide'+this.slideshowid] ns4imgobj.src=this.postimages[this.curimageindex].src } this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0 } fadeshow.prototype.resetit=function(){ this.degree=10 var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas) if (crossobj.filters&&crossobj.filters[0]){ if (typeof crossobj.filters[0].opacity=="number") //if IE6+ crossobj.filters(0).opacity=this.degree else //else if IE5.5- crossobj.style.filter="alpha(opacity="+this.degree+")" } else if (crossobj.style.MozOpacity) crossobj.style.MozOpacity=this.degree/101 else if (crossobj.style.KhtmlOpacity) crossobj.style.KhtmlOpacity=obj.degree/100 } fadeshow.prototype.startit=function(){ var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas) this.populateslide(crossobj, this.curimageindex) if (this.pausecheck==1){ //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVER var cacheobj=this var crossobjcontainer=iebrowser? iebrowser["master"+this.slideshowid] : document.getElementById("master"+this.slideshowid) crossobjcontainer.onmouseover=function(){cacheobj.mouseovercheck=1} crossobjcontainer.onmouseout=function(){cacheobj.mouseovercheck=0} } this.rotateimage() }

Code-Shopping/Admin/AdminCatalog/Images/stars-4.gif

Code-Shopping/Admin/AdminCatalog/Images/style.css

BODY { background-image:url(bg.jpg); background-repeat:repeat-x; margin:0px; background-color:#000000; } .heading { FONT-WEIGHT: bold; FONT-SIZE: 16px; FONT-FAMILY: Verdana, Verdana; color: #000000; } .message { FONT-SIZE: 16px; COLOR: #F2c100; FONT-FAMILY: Verdana; font-weight: normal; } B { COLOR: #000080 } P { FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Verdana; font-weight: normal; } .topxextlinks { FONT-SIZE: 10px; COLOR: #000000; FONT-FAMILY: Verdana; TEXT-DECORATION: none; font-weight: normal; } .topxextlinks A { FONT-SIZE: 10px; COLOR: #ffffff; FONT-FAMILY: Verdana; TEXT-DECORATION: none } .topxextlinks A:hover { FONT-SIZE: 10px; COLOR: #FF0000; FONT-FAMILY: Verdana; TEXT-DECORATION: underline } .leftlinks { FONT-SIZE: 11px; COLOR: #FFFFFF; FONT-FAMILY: Georgia, "Times New Roman", Times, serif; TEXT-DECORATION: underline; font-weight: normal; font-style: normal; margin: 0px; } .leftlinks A { FONT-SIZE: 11px; COLOR: #000000; FONT-FAMILY: Verdana; TEXT-DECORATION: underline; font-weight: normal; } .leftlinks A:hover { FONT-SIZE: 11px; COLOR: #FF0000; FONT-FAMILY: Verdana; text-decoration: underline; font-style: normal; } .leftlinksw { FONT-SIZE: 11px; COLOR: #ffffff; FONT-FAMILY: Verdana; TEXT-DECORATION: none; font-weight: normal; font-style: normal; margin: 0px; } .leftlinksw A { FONT-SIZE: 11px; COLOR: #ffffff; FONT-FAMILY: Verdana; TEXT-DECORATION: none; font-weight: normal; } .leftlinksw A:hover { FONT-SIZE: 11px; COLOR: yellow; FONT-FAMILY: Verdana; text-decoration: underline; font-style: normal; } .leftlinkssamll { FONT-SIZE: 9px; COLOR: #000000; FONT-FAMILY: Verdana; TEXT-DECORATION: none; font-weight: normal; font-style: normal; margin: 0px; } .leftlinkssamll A { FONT-SIZE: 9px; COLOR: #000000; FONT-FAMILY: Verdana; TEXT-DECORATION: none; font-weight: normal; } .leftlinkssamll A:hover { FONT-SIZE: 9px; COLOR: #FF0000; FONT-FAMILY: Verdana; text-decoration: underline; font-style: normal; } .rightlinks { FONT-SIZE: 11px; COLOR: #000000; FONT-FAMILY: "Courier New", Courier, mono; text-decoration: none; margin-top: 2px; margin-bottom: 2px; } .rightlinks A { FONT-SIZE: 11px; COLOR: #FFFFFF; FONT-FAMILY: "Courier New", Courier, mono; TEXT-DECORATION: none; margin-top: 2px; margin-bottom: 2px; } .rightlinks A:hover { FONT-SIZE: 11px; COLOR: #000000; FONT-FAMILY: "Courier New", Courier, mono; text-decoration: none; margin-top: 2px; margin-bottom: 2px; } .botlinks { FONT-SIZE: 11px; COLOR: #000000; FONT-FAMILY: Verdana; TEXT-DECORATION: none; font-weight: bold; } .botlinks A { FONT-SIZE: 11px; COLOR: #339933; FONT-FAMILY: Verdana; TEXT-DECORATION: underline } .botlinks A:hover { FONT-SIZE: 11px; COLOR: #000000; LINE-HEIGHT: 12px; FONT-FAMILY: Verdana; TEXT-DECORATION: none } .email { FONT-SIZE: 11px; COLOR: #0000CC; FONT-FAMILY: Verdana; font-weight: bold; } .email A { FONT-SIZE: 11px; COLOR: #0000CC; FONT-FAMILY: Verdana; font-weight: bold; } .email A:hover { FONT-SIZE: 11px; COLOR: #000000; LINE-HEIGHT: 12px; FONT-FAMILY: Verdana; font-weight: bold; } .boldlink { FONT-SIZE: 12px; COLOR: #ffffff; FONT-FAMILY: Verdana; font-weight: bold; } .boldlink A { FONT-SIZE: 12px; COLOR: #ffffff; FONT-FAMILY: Verdana; font-weight: bold; } .boldlink A:hover { FONT-SIZE: 12px; COLOR: #ffffff; LINE-HEIGHT: 12px; FONT-FAMILY: Verdana; font-weight: bold; } .subheading { FONT-WEIGHT: bold; FONT-SIZE: 12px; FONT-FAMILY: Verdana; color: #000000; } .button { FONT-SIZE: 11px; COLOR: #FFFFFF; FONT-FAMILY: Verdana; TEXT-DECORATION: none; font-weight: bold; background-color: #68775A; border: 1px solid #000000; } .address { font-family: Verdana; font-size: 13px; font-weight: bold; color: #000000; } .maintable { border: 1px solid #000000; } .flashtable { border: 3px solid #02AB0A; } .textbox { FONT-SIZE:12px; COLOR: #000000; FONT-FAMILY: Verdana; TEXT-DECORATION: none; font-weight: normal; background-color: #FFFFA0; border: 1px solid #000000; } .bodytextbold { FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: verdana; font-weight: bold; } .usercontrol { FONT-WEIGHT: bold; FONT-SIZE: 10px; FONT-FAMILY: Verdana; color: #000000; } .mandatory { FONT-WEIGHT: bold; FONT-SIZE: 9px; FONT-FAMILY: Verdana; color: #FF0000; } .error { FONT-WEIGHT: normal; FONT-SIZE: 10px; FONT-FAMILY: Verdana; color: #FF0000; } .leftlinksCopy { FONT-SIZE: 9px; COLOR: #000000; FONT-FAMILY: verdana; font-weight: normal; font-style: normal; margin: 0px; text-decoration: none; } .Bigling { FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Verdana; font-weight: bold; } .submedihead { FONT-WEIGHT: bold; FONT-SIZE: 16px; FONT-FAMILY: Verdana, Verdana; color: #FF0000; font-style: normal; } .subheadingCopy { FONT-WEIGHT: bold; FONT-SIZE: 12px; FONT-FAMILY: Verdana; color: #FF0000; text-decoration: none; } .bodytextCopy { FONT-SIZE: 9px; COLOR: #000000; FONT-FAMILY: Verdana; font-weight: normal; } .bodytextsmall { FONT-SIZE: 9px; COLOR: #000000; FONT-FAMILY: Verdana; } .bodytext { FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: verdana; font-weight: normal; line-height: 21px; } .star { FONT-SIZE: 12px; COLOR: red; FONT-FAMILY: verdana; font-weight: normal; line-height: 21px; } td { FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: verdana; font-weight: normal; line-height: 21px; } .bodytextalign { FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Georgia; font-weight: normal; line-height: 22px; } .headingbig { background: url('../images/background_nav_main.gif') repeat-x; FONT-WEIGHT: bold; FONT-SIZE: 14px; FONT-FAMILY: Verdana, Verdana; /*background-color:#D7B829;*/ color: #ffffff; } .contenttdbg{ background-image:url(content_bg.gif); background-repeat:repeat-x; background-color:White; } #navtop, #navbottom { background: url('../images/background_nav_main.gif') repeat-x; font-size: 11px; font-weight: bold; font-family: Verdana, Helvetica, Helvetica-Narrow, Tahoma, sans-serif; margin-right: auto; margin-left: auto; width: 950px; height: 45px; color:#ffffff; } A.whitelinks:link { FONT-SIZE: 11px; COLOR: #ffffff; TEXT-DECORATION: none; FONT-FAMILY: "Verdana"; font-weight: bold; } A.whitelinks:visited { FONT-SIZE: 11px; COLOR: #ffffff; TEXT-DECORATION: none; FONT-FAMILY: "Verdana"; font-weight: bold; } A.whitelinks:hover { FONT-SIZE: 11px; FONT-FAMILY: "Verdana"; COLOR: #ffffff; TEXT-DECORATION:underline; font-weight: bold; } A.whitelinks:active { FONT-SIZE: 11px; FONT-FAMILY: "Verdana"; COLOR: #ffffff; font-weight: bold; } #navbottom { margin-top: 15px; } .fullwidth, #loginbanner { border: 1px solid #DBDB79; /*width: 694px;*/ margin-right: auto; margin-left: auto; background: #FEFFAB url('images/background_fullwidth.jpg') repeat-y; margin-bottom: 10px; padding-left: 15px; padding-right: 15px; padding-top: 10px; padding-bottom: 10px; text-align: left; } #footer { width: 100%; margin-right: auto; margin-left: auto; text-align: center; margin-top: 1px; padding-bottom: 5px; color: #C89F3D; background: #FEFFAB url('images/background_fullwidth.jpg') repeat-y; } .dashedline { border-bottom: 1px dashed #DBCE6A; padding-top: 10px; margin-bottom: 10px; clear:right; } .button { BORDER: #000000 1px solid; FONT-WEIGHT: bold; FONT-SIZE: 8pt; COLOR: #FFFFFF; FONT-FAMILY: Verdana; BACKGROUND-COLOR:#51652C; TEXT-DECORATION: none; cursor:hand; vertical-align:top; height:20px; } .textbox { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: Verdana; TEXT-DECORATION: none; font-weight: normal; background-color: #FFFFFF; border: 1px solid #000000; vertical-align:middle; }

Code-Shopping/Admin/AdminCatalog/Images/submit.gif

Code-Shopping/Admin/AdminCatalog/Images/Sunset.jpg

Code-Shopping/Admin/AdminCatalog/Images/Thumbs.db

Code-Shopping/Admin/AdminCatalog/Images/tile_back.gif

Code-Shopping/Admin/AdminCatalog/Images/Untitled-30.jpg

Code-Shopping/Admin/AdminCatalog/Images/update.gif

Code-Shopping/Admin/AdminCatalog/Images/update11.jpg

Code-Shopping/Admin/AdminCatalog/Images/Water lilies.jpg

Code-Shopping/Admin/AdminCatalog/Images/weaccept.gif

Code-Shopping/Admin/AdminCatalog/Images/wf1_notavailable.gif

Code-Shopping/Admin/AdminCatalog/Images/Winter.jpg

Code-Shopping/Admin/frmadmin.aspx

<%@ Page Language="C#" MasterPageFile="~/Templates/Default/AdminMaster.master" AutoEventWireup="true" CodeFile="frmadmin.aspx.cs" Inherits="Admin_frmadmin" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <table width="100%" cellpadding="0" cellspacing="0" border="1" height="345"> <tr> <td width="20%" valign="top"> <ul> <li> <a href='Order/frmOrdersList.aspx' runat='server'>Admin Order</a> </li> <li> <a href='AdminCatalog/adminCategory/frmCategoriesList.aspx' runat='server'>Admin Category</a> </li> <li> <a id="A1" href='AdminCatalog/adminBrand/frmBrandList.aspx' runat='server'>Admin Brand</a> </li> <li> <a id="A2" href='AdminCatalog/adminProduct/frmProductList.aspx' runat='server'>Admin Products</a> </li> <li> <a id="A3" href='AdminCatalog/adminUsers/frmUsersList.aspx' runat='server'>Manage Users</a> </li> </ul> </td> <td align="center" style="font-size:20px"> <strong>Welcome to Shopping Cart Administration</strong> </td> </tr> </table> </asp:Content>

Code-Shopping/Admin/frmadmin.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Admin_frmadmin : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/Admin/Order/Controls/ucOrdersList.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucOrdersList.ascx.cs" Inherits="Order_Controls_ucOrdersList" %> <%@ Register Assembly="GMDatePicker" Namespace="GrayMatterSoft" TagPrefix="cc1" %> <table style="width: 100%" cellpadding="0" cellspacing="0" border="0"> <tr bgcolor='#ccccff'> <td align="left" nowrap valign="top"> <table style="width: 100%"> <tr> <td valign="top"> Sort By: </td> <td valign="top"> <asp:DropDownList ID="ddlSort" runat="server" OnSelectedIndexChanged="ddlSort_SelectedIndexChanged"> <asp:ListItem>Order No</asp:ListItem> <asp:ListItem>Order Date</asp:ListItem> <asp:ListItem>Customer Name</asp:ListItem> </asp:DropDownList> </td> <td valign="top"> <asp:RadioButtonList ID="rdOrder" runat="server" RepeatDirection='horizontal'> <asp:ListItem Selected="true">Ascending</asp:ListItem> <asp:ListItem>Descending</asp:ListItem> </asp:RadioButtonList> </td> <td valign="top"> <asp:Button ID="btnSortByGo" Text="Go" runat="server" OnClick="btnSortByGo_Click" /> </td> </tr> </table> </td> <td nowrap> &nbsp;</td> <td align="left" nowrap valign="top"> <table style="width: 100%"> <tr> <td align="left" valign="top" nowrap> Filter By: </td> <td align="left" valign="top" nowrap> <asp:DropDownList ID="ddlFilter" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlFilter_SelectedIndexChanged"> <asp:ListItem>Order Date</asp:ListItem> <asp:ListItem>Order Amount</asp:ListItem> <asp:ListItem>Customer Name</asp:ListItem> <asp:ListItem>Order Status</asp:ListItem> <asp:ListItem>Order Number</asp:ListItem> </asp:DropDownList> </td> <td align="left" valign="top" nowrap> <asp:Panel ID="pnlDate" runat="server"> From Date:<cc1:GMDatePicker ID="GMDatePicker1" runat="server"> </cc1:GMDatePicker> To Date:<cc1:GMDatePicker ID="GMDatePicker2" runat="server"> </cc1:GMDatePicker> </asp:Panel> <asp:Panel ID="pnlAmount" runat="server" Visible="false"> Enter Amount: <asp:DropDownList ID="ddlOAmount" runat="server"> <asp:ListItem Value="1">Less than</asp:ListItem> <asp:ListItem Value="2">Greater than</asp:ListItem> <asp:ListItem Value="3">Equal to</asp:ListItem> <asp:ListItem Value="4">Not Equal to</asp:ListItem> </asp:DropDownList> <asp:TextBox ID="txtOAmount" Width="75" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtOAmount" Display="Dynamic" ErrorMessage="RequiredFieldValidator" ToolTip="Must enter amount">*</asp:RequiredFieldValidator> <asp:CompareValidator ID="cmpvamount" runat="server" ControlToValidate="txtOAmount" Display="Dynamic" ErrorMessage="Must enter Amount" Operator="DataTypeCheck" ToolTip="Must Enter Amount" Type="Double">*</asp:CompareValidator> </asp:Panel> <asp:Panel ID="pnlCustName" runat="server" Visible="false"> Enter Name(Mail-Id):<asp:TextBox ID="txtCustName" runat="server"></asp:TextBox> </asp:Panel> <asp:Panel ID="pnlStatus" runat="server" Visible="false"> <asp:DropDownList ID="ddlStatus" runat="server"> <asp:ListItem>New Order</asp:ListItem> <asp:ListItem>Ready</asp:ListItem> <asp:ListItem>Canceled</asp:ListItem> <asp:ListItem>Shipped</asp:ListItem> <asp:ListItem>Delivered</asp:ListItem> </asp:DropDownList> </asp:Panel> <asp:Panel ID="pnlNumber" runat="server" Visible="false"> Enter Order No:<asp:TextBox ID="txtOrderNo" Width="75" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="rfvorderno" runat="server" ControlToValidate="txtOrderNo" Text="*" ToolTip="Must enter order no" Display="Dynamic"></asp:RequiredFieldValidator> <asp:CompareValidator ID="cvorderno" runat="server" Text="*" ToolTip="Must enter orderno" ControlToValidate="txtOrderNo" Type="Double" Operator="DataTypeCheck" Display="Dynamic"></asp:CompareValidator> </asp:Panel> </td> <td valign="top" align="left" nowrap> <asp:Button ID="btnFilterBYGo" Text="Go" runat="server" OnClick="btnFilterBYGo_Click" /> </td> </tr> </table> </td> </tr> <tr> <td colspan="3"> <asp:Label ID="lblComment" runat="server" Font-Bold="True" Font-Size="Medium" ForeColor="Red" Visible="False"></asp:Label></td> </tr> <tr> <td colspan="3" style="width: 100%" align="center"> <asp:DataList ID="dlOrder" runat="server" RepeatColumns="1" Width="100%" OnItemCommand="dlOrder_ItemCommand"> <HeaderTemplate> <table width="100%"> <tr> <td align="left" style="width: 5%"> <b>Order No.</b> </td> <td align="left" style="width: 25%"> <b>Customer Name</b> </td> <td align="left" style="width: 25%"> <b>Order Date</b> </td> <td align="left" style="width: 10%"> <b>Order Amount</b> </td> <td align="left" style="width: 10%"> <b>Order Status</b> </td> <td align="left" style="width: 20%"> </td> <td align="left" style="width: 5%"> </td> </tr> </table> </HeaderTemplate> <ItemTemplate> <table style="width: 100%"> <tr> <td align="left" style="width: 5%"> <asp:Label ID="lblOrderNo" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"OrderId")%>'> </asp:Label> </td> <td align="left" style="width: 25%"> <asp:Label ID="lblCustName" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"UserName") %>'> </asp:Label> </td> <td align="left" style="width: 25%"> <asp:Label ID="lblOrderDate" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"OrderDate")%>'> </asp:Label> </td> <td align="left" style="width: 10%"> $<asp:Label ID="lblAmount" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"NetAmount")%>'> </asp:Label> <asp:TextBox ID="txtAmount" Width="75" runat='server' Text='<%#DataBinder.Eval(Container.DataItem,"NetAmount") %>' Visible='false'></asp:TextBox> </td> <td align="left" style="width: 10%"> <asp:Label ID="lblOrderStatus" runat='server' Text='<%#DataBinder.Eval(Container.DataItem,"Description") %>'></asp:Label> <asp:DropDownList ID="ddlOrderStatus" runat='server' Visible='false'> <asp:ListItem>New Order</asp:ListItem> <asp:ListItem>Ready</asp:ListItem> <asp:ListItem>Canceled</asp:ListItem> <asp:ListItem>Shipped</asp:ListItem> <asp:ListItem>Delivered</asp:ListItem> </asp:DropDownList> </td> <td align="left" style="width: 20%"> <asp:Button ID="btnEdit" runat="server" Text="Edit" CommandName="Edit" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"OrderId")%>' /> <asp:Button ID="btnCancel" runat="server" Text="Cancel" Visible="false" CommandName="Cancel" /> </td> <td align="left" style="width: 5%"> <asp:Button ID="btnDelete" runat="server" Text="Delete" CommandName="Delete" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"OrderId")%>' /> </tr> </table> </ItemTemplate> </asp:DataList> </td> </tr> </table>

Code-Shopping/Admin/Order/Controls/ucOrdersList.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ShoppingCart.BL; using System.Data.SqlClient; public partial class Order_Controls_ucOrdersList : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataSet ds = ProductController.getadminorder(); if (ds.Tables[0].Rows.Count > 0) { dlOrder.DataSource = ds; dlOrder.DataBind(); } } } protected void dlOrder_ItemCommand(object source, DataListCommandEventArgs e) { float amnt = 0; int j = 0; string s=""; TextBox t = null; Button b = null, bcancel = null; Label l = null,lorder=null; DropDownList ddl = null; Control cnt = null; float bl; bool IsError = false; if (e.CommandName == "Edit") { cnt = e.Item.FindControl("btnEdit"); if (cnt != null) { b = (Button)cnt; b.Text = "Update"; b.CommandName="Update"; } cnt = e.Item.FindControl("btnCancel"); if (cnt != null) { bcancel = (Button)cnt; bcancel.Visible = true; } cnt = e.Item.FindControl("txtAmount"); if (cnt != null) { t = (TextBox)cnt; t.Visible = true; } cnt = e.Item.FindControl("lblOrderStatus"); if (cnt != null) { l = (Label)cnt; l.Visible = false; } cnt = e.Item.FindControl("lblAmount"); if (cnt != null) { l = (Label)cnt; l.Visible = false; } cnt = e.Item.FindControl("ddlOrderStatus"); if (cnt != null) { ddl = (DropDownList)cnt; ddl.Visible = true; } } if (e.CommandName == "Update") { cnt = e.Item.FindControl("txtAmount"); if (cnt != null) { t = (TextBox)cnt; cnt = e.Item.FindControl("lblAmount"); if (cnt != null) { l = (Label)cnt; l.Visible = false; } bl = float.Parse(l.Text); if (float.TryParse(t.Text, out bl)) amnt = float.Parse(t.Text); else { //lblComment.Text = "Must enter valid amount"; Response.Write("<script>alert('Must enter valid amount');</script>"); lblComment.Visible = true; IsError = true; } } cnt = e.Item.FindControl("ddlOrderStatus"); if (cnt != null) { ddl = (DropDownList)cnt; s = ddl.SelectedItem.Text; } cnt = e.Item.FindControl("lblOrderNo"); if (cnt != null) { l = (Label)cnt; j = int.Parse(l.Text); } if(!IsError) ProductController.updateadminorder(amnt, s, j); cnt = e.Item.FindControl("lblAmount"); if (cnt != null) { l = (Label)cnt; l.Visible = true; } cnt = e.Item.FindControl("lblOrderNo"); if (cnt != null) { lorder = (Label)cnt; j = int.Parse(lorder.Text); SqlDataReader dr = ProductController.updateadminorder1(j); if (dr.HasRows) { if (dr.Read()) { l.Text = dr["netamount"].ToString(); cnt = e.Item.FindControl("lblOrderStatus"); if (cnt != null) { l = (Label)cnt; l.Visible = true; } l.Text = dr["description"].ToString(); } } } cnt = e.Item.FindControl("ddlOrderStatus"); if (cnt != null) { ddl = (DropDownList)cnt; ddl.Visible = false; } cnt = e.Item.FindControl("txtAmount"); if (cnt != null) { t = (TextBox)cnt; t.Visible = false; } cnt = e.Item.FindControl("btnEdit"); if (cnt != null) { b = (Button)cnt; b.Text = "Edit"; b.CommandName = "Edit"; } cnt = e.Item.FindControl("btnCancel"); if (cnt != null) { bcancel = (Button)cnt; bcancel.Visible = false; } } if (e.CommandName == "Cancel") { cnt = e.Item.FindControl("lblAmount"); if (cnt != null) { l = (Label)cnt; l.Visible = true; } cnt = e.Item.FindControl("lblOrderNo"); if (cnt != null) { lorder = (Label)cnt; j = int.Parse(lorder.Text); SqlDataReader dr=ProductController.updateadminorder1(j); if (dr.HasRows) { if (dr.Read()) { l.Text = dr["netamount"].ToString(); cnt = e.Item.FindControl("lblOrderStatus"); if (cnt != null) { l = (Label)cnt; l.Visible = true; } l.Text = dr["description"].ToString(); } } } cnt = e.Item.FindControl("ddlOrderStatus"); if (cnt != null) { ddl = (DropDownList)cnt; ddl.Visible = false; } cnt = e.Item.FindControl("txtAmount"); if (cnt != null) { t = (TextBox)cnt; t.Visible = false; } cnt = e.Item.FindControl("btnEdit"); if (cnt != null) { b = (Button)cnt; b.Text = "Edit"; b.CommandName = "Edit"; } cnt = e.Item.FindControl("btnCancel"); if (cnt != null) { bcancel = (Button)cnt; bcancel.Visible = false; } } if (e.CommandName == "Delete") { cnt = e.Item.FindControl("lblOrderNo"); if (cnt != null) { lorder = (Label)cnt; j = int.Parse(lorder.Text); ProductController.deleteadminorder(j); DataSet ds = ProductController.getadminorder(); if (ds.Tables[0].Rows.Count > 0) { dlOrder.DataSource = ds; dlOrder.DataBind(); } } } } protected void ddlFilter_SelectedIndexChanged(object sender, EventArgs e) { if (ddlFilter.SelectedValue == "Order Date") { pnlDate.Visible = true; pnlAmount.Visible = false; pnlCustName.Visible = false; pnlStatus.Visible = false; pnlNumber.Visible = false; } else if (ddlFilter.SelectedValue == "Order Amount") { pnlDate.Visible = false; pnlAmount.Visible = true; pnlCustName.Visible = false; pnlStatus.Visible = false; pnlNumber.Visible = false; } else if (ddlFilter.SelectedValue == "Customer Name") { pnlDate.Visible = false; pnlAmount.Visible = false; pnlCustName.Visible = true; pnlStatus.Visible = false; pnlNumber.Visible = false; } else if (ddlFilter.SelectedValue == "Order Status") { pnlDate.Visible = false; pnlAmount.Visible = false; pnlCustName.Visible = false; pnlStatus.Visible = true; pnlNumber.Visible = false; } else if (ddlFilter.SelectedValue == "Order Number") { pnlDate.Visible = false; pnlAmount.Visible = false; pnlCustName.Visible = false; pnlStatus.Visible = false; pnlNumber.Visible = true; } } protected void btnFilterBYGo_Click(object sender, EventArgs e) { int k=0; if (pnlCustName.Visible == true) { if (txtCustName.Text != null) { SqlDataReader dr = ProductController.filterbyname(txtCustName.Text); if (dr.HasRows) { dlOrder.Visible = true; dlOrder.DataSource = dr; dlOrder.DataBind(); lblComment.Visible = false; } else { dlOrder.Visible = false; lblComment.Visible = true; lblComment.Text = "No records found"; } } } if (pnlNumber.Visible == true) { if (txtOrderNo.Text != null) { k = int.Parse(txtOrderNo.Text); SqlDataReader sqldr = ProductController.filterbyorderno(k); if (sqldr.HasRows) { dlOrder.Visible = true; dlOrder.DataSource = sqldr; dlOrder.DataBind(); lblComment.Visible = false; } else { dlOrder.Visible = false; lblComment.Visible = true; lblComment.Text = "No records found"; } } } if (pnlStatus.Visible == true) { if (ddlStatus.SelectedValue!=null) { DataSet ds = ProductController.filterbystatus(ddlStatus.SelectedValue.ToString()); if (ds.Tables[0].Rows.Count > 0) { dlOrder.Visible = true; dlOrder.DataSource = ds; dlOrder.DataBind(); lblComment.Visible = false; } else { lblComment.Visible = true; lblComment.Text = "No records found"; dlOrder.Visible = false; } } } if(pnlAmount.Visible==true) { if (txtOAmount.Text != null) { DataSet ds = ProductController.CustomFilter(int.Parse(ddlOAmount.SelectedValue), double.Parse(txtOAmount.Text)); if (ds.Tables[0].Rows.Count > 0) { dlOrder.DataSource = ds; dlOrder.DataBind(); dlOrder.Visible = true; lblComment.Visible = false; } else { lblComment.Visible = true; lblComment.Text = "No records found"; dlOrder.Visible = false; } } } if (pnlDate.Visible == true) { if (GMDatePicker1.Date != null) { if (GMDatePicker2.Date != null) { DataSet ds = ProductController.filterbydate(GMDatePicker1.Date, GMDatePicker2.Date); if (ds.Tables[0].Rows.Count > 0) { dlOrder.DataSource = ds; dlOrder.DataBind(); dlOrder.Visible = true; lblComment.Visible = false; } else { lblComment.Visible = true; lblComment.Text = "No records found"; dlOrder.Visible = false; } } } } } protected void ddlSort_SelectedIndexChanged(object sender, EventArgs e) { } protected void btnSortByGo_Click(object sender, EventArgs e) { if (ddlSort.SelectedValue == "Order No") { if (rdOrder.Text == "Ascending") { DataSet ds = ProductController.sortbyordernoasc(); if (ds.Tables[0].Rows.Count > 0) { dlOrder.DataSource = ds; dlOrder.DataBind(); } } if (rdOrder.Text == "Descending") { DataSet ds = ProductController.sortbyordernodesc(); if (ds.Tables[0].Rows.Count > 0) { dlOrder.DataSource = ds; dlOrder.DataBind(); } } } if (ddlSort.SelectedValue == "Customer Name") { if (rdOrder.Text == "Ascending") { DataSet ds = ProductController.sortbycustnameasc(); if (ds.Tables[0].Rows.Count > 0) { dlOrder.DataSource = ds; dlOrder.DataBind(); } } if (rdOrder.Text == "Descending") { DataSet ds = ProductController.sortbycustnamedesc(); if (ds.Tables[0].Rows.Count > 0) { dlOrder.DataSource = ds; dlOrder.DataBind(); } } } if (ddlSort.SelectedValue == "Order Date") { if (rdOrder.Text == "Ascending") { DataSet ds = ProductController.sortbyorderdateasc(); if (ds.Tables[0].Rows.Count > 0) { dlOrder.DataSource = ds; dlOrder.DataBind(); } } if (rdOrder.Text == "Descending") { DataSet ds = ProductController.sortbyorderdatedesc(); if (ds.Tables[0].Rows.Count > 0) { dlOrder.DataSource = ds; dlOrder.DataBind(); } } } } }

Code-Shopping/Admin/Order/frmOrdersList.aspx

<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Templates/Default/AdminMaster.master" EnableEventValidation="true" CodeFile="frmOrdersList.aspx.cs" Inherits="Order_frmOrdersList" %> <%@ Register Src="Controls/ucOrdersList.ascx" TagName="ucOrdersList" TagPrefix="uc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <uc1:ucOrdersList ID="UcOrdersList1" runat="server" /> </asp:Content>

Code-Shopping/Admin/Order/frmOrdersList.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Order_frmOrdersList : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/Admin/Order/ucOrderMgnt.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucOrderMgnt.ascx.cs" Inherits="WebUserControl" %> <table style="width:100%" cellpadding="0" cellspacing="0" border="0"> <tr bgcolor='#ccccff'> <td align="left" nowrap valign="top" style="width:40%"> <table style="width:100%"> <tr> <td valign="top" style="height: 47px"> Sort By: </td> <td valign="top" style="height: 47px"> <asp:DropDownList ID="ddlSort" runat="server"> <asp:ListItem>Order No</asp:ListItem> <asp:ListItem>Order Date</asp:ListItem> <asp:ListItem>Customer Name</asp:ListItem> <asp:ListItem>Order Status</asp:ListItem> </asp:DropDownList> </td> <td valign="top" style="height: 47px"> <asp:RadioButtonList ID="rdOrder" runat="server" RepeatDirection='horizontal'> <asp:ListItem>Ascending</asp:ListItem> <asp:ListItem>Descending</asp:ListItem> </asp:RadioButtonList> </td> <td valign="top"> <asp:Button ID="btnSortByGo" Text="Go" runat="server" /> </td> </tr> </table> </td> <td style="width:10%" nowrap>&nbsp;</td> <td align="left" nowrap valign="top" style="width:50%"> <table style="width:100%"> <tr> <td align="left" valign="top" nowrap> Filter By: </td> <td align="left" valign="top" nowrap> <asp:DropDownList ID="ddlFilter" runat="server" OnSelectedIndexChanged="ddlFilter_SelectedIndexChanged"> <asp:ListItem>Order Date</asp:ListItem> <asp:ListItem>Order Amount</asp:ListItem> <asp:ListItem>Customer Name</asp:ListItem> <asp:ListItem>Order Status</asp:ListItem> <asp:ListItem>Order Number</asp:ListItem> </asp:DropDownList> </td> <td valign="top" align="left" nowrap> <asp:Button ID="btnFilterBYGo" Text="Go" runat="server" /> </td> </tr> </table> </td> </tr> <tr> <td colspan="3" style="width: 100%" align="center"> <asp:DataList ID="dlOrder" runat="server" RepeatColumns="1" Width="100%" OnItemCommand="dlOrder_ItemCommand"> <HeaderTemplate> <table width="100%"> <tr> <td align="left" style="width:5%"> <b>Order No.</b> </td> <td align="left" style="width:25%"> <b>Customer Name</b> </td> <td align="left" style="width:25%"> <b>Order Date</b> </td> <td align="left" style="width:10%"> <b>Order Amount</b> </td> <td align="left" style="width:10%"> <b>Order Status</b> </td> <td align="left" style="width:20%"> </td> <td align="left" style="width:5%"> </td> </tr> </table> </HeaderTemplate> <ItemTemplate> <table style="width:100%"> <tr> <td align="left" style="width:5%"> <asp:Label ID="lblOrderNo" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"OrderId")%>'> </asp:Label> </td> <td align="left" style="width:25%"> <asp:Label ID="lblCustName" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"UserName") %>'> </asp:Label> </td> <td align="left" style="width:25%"> <asp:Label ID="lblOrderDate" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"orderdate")%>'> </asp:Label> </td> <td align="left" style="width:10%"> <asp:Label ID="lblAmount" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"NetAmount")%>'> </asp:Label> <asp:TextBox ID="txtAmount" runat='server' Text='<%#DataBinder.Eval(Container.DataItem,"NetAmount") %>' Visible='false'></asp:TextBox> </td> <td align="left" style="width:10%"> <asp:Label ID="lblOrderStatus" runat='server' Text='Delivered'></asp:Label> <asp:DropDownList ID="ddlOrderStatus" runat='server' Visible='false'> <asp:ListItem>Pending</asp:ListItem> <asp:ListItem>Delivered</asp:ListItem> </asp:DropDownList> </td> <td align="left" style="width:20%"> <asp:Button ID="btnEdit" runat="server" Text="Edit" CommandName="Edit" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"OrderId")%>'/> <asp:Button ID="btnCancel" runat="server" Text="Cancel" Visible="false" CommandName="Cancel" /> </td> <td align="left" style="width:5%"> <asp:Button ID="btnDelete" runat="server" Text="Delete" CommandName="Delete" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"OrderId")%>' /> </td> </tr> </table> </ItemTemplate> </asp:DataList> </td> </tr> </table>

Code-Shopping/Admin/Order/ucOrderMgnt.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ShoppingCart.BL; public partial class WebUserControl : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { DataSet ds = ProductController.getadminorder(); if (ds.Tables[0].Rows.Count > 0) { dlOrder.DataSource = ds; dlOrder.DataBind(); } } protected void dlOrder_SelectedIndexChanged1(object sender, EventArgs e) { } protected void dlOrder_ItemCommand(object source, DataListCommandEventArgs e) { TextBox t = null; Button b = null, bcancel = null; Label l = null; DropDownList ddl = null; Control cnt = null; if (e.CommandName == "Edit") { cnt = e.Item.FindControl("btnEdit"); if (cnt != null) { b = (Button)cnt; b.Text = "Update"; } cnt = e.Item.FindControl("btnCancel"); if (cnt != null) { bcancel = (Button)cnt; bcancel.Visible = true; } cnt = e.Item.FindControl("lblAmount"); if (cnt != null) { l = (Label)cnt; l.Visible = false; } cnt = e.Item.FindControl("txtAmount"); if (cnt != null) { t = (TextBox)cnt; t.Visible = true; } cnt = e.Item.FindControl("lblStatus"); if (cnt != null) { l = (Label)cnt; l.Visible = false; } cnt = e.Item.FindControl("ddlStatus"); if (cnt != null) { ddl = (DropDownList)cnt; ddl.Visible = true; } //foreach (DataListItem li in dlOrder.Items) //{ // b = (Button)(li.FindControl("btnEdit")); // b.Text = "Update"; // bcancel = (Button)(li.FindControl("btnCancel")); // bcancel.Visible = true; // l = (Label)(li.FindControl("lblAmount")); // l.Visible = false; // t = (TextBox)(li.FindControl("txtAmount")); // t.Visible = true; // l = (Label)(li.FindControl("lblOrderStatus")); // l.Visible = false; // ddl = (DropDownList)(li.FindControl("ddlOrderStatus")); // ddl.Visible = true; // // "btnCancel"txtAmount"lblAmount" // //lblOrderStatus "ddlOrderStatus" //} } } protected void ddlFilter_SelectedIndexChanged(object sender, EventArgs e) { } }

Code-Shopping/App_Data/ASPNETDB.MDF

Code-Shopping/App_Data/aspnetdb_log.ldf

Code-Shopping/Bin/GMDatePicker.dll

Code-Shopping/Bin/GMDatePicker.dll.refresh

Bin\GMDatePicker.dll

Code-Shopping/Bin/ShoppingCart.BL.dll

Code-Shopping/Bin/ShoppingCart.BL.dll.refresh

..\ShoppingCart.BL\ShoppingCart.BL\obj\Debug\ShoppingCart.BL.dll

Code-Shopping/Bin/ShoppingCart.BL.pdb

Code-Shopping/Bin/ShoppingCart.DAL.dll

Code-Shopping/Bin/ShoppingCart.DAL.dll.refresh

..\ShoppingCart.BL\ShoppingCart.BL\bin\Debug\ShoppingCart.DAL.dll

Code-Shopping/Bin/ShoppingCart.DAL.pdb

Code-Shopping/Browse/Content.css

body { background-color:#3376ff; }

Code-Shopping/Browse/Controls/ProductDetails/ucBrandName.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucBrandName.ascx.cs" Inherits="Browse_Controls_ProductDetails_ucBrandName" %> &nbsp; <table width="100%"> <tr> <td style="width:100%"> <table width="100%"> <tr> <td align="left" style="width:20%"> <b> Brand</b> </td> <td align="left"> :<asp:Label ID="lblBrandName" Text="" runat="server"></asp:Label> </td> </tr> <tr> <td align="left" style="width:20%"> <b>Price</b> </td> <td align="left"> : <asp:Label ID="lblPrice" Text="" runat="server"></asp:Label> </td> </tr> </table> </td> </tr> </table>

Code-Shopping/Browse/Controls/ProductDetails/ucBrandName.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ShoppingCart.BL; public partial class Browse_Controls_ProductDetails_ucBrandName : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { Session["pid"] = Request["PID"]; int ProductId; if (!IsPostBack) { if (Request["PID"] != null) { ProductId = Int32.Parse(Request["PID"].ToString()); lblBrandName.Text = ProductController.getBrandName(ProductId); lblPrice.Text = ProductController.getProductPrice(ProductId); } } } }

Code-Shopping/Browse/Controls/ProductDetails/ucOffers.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucOffers.ascx.cs" Inherits="Browse_Controls_ProductDetails_ucOffers" %> <asp:DataList ID="dloffer" runat="server" RepeatColumns="1"> <ItemTemplate> <table> <tr> <td> <b> Offer Price</b> </td> <td> : <%#DataBinder.Eval(Container.DataItem,"OfferPrice")%> </td> </tr> </table> </ItemTemplate> </asp:DataList>

Code-Shopping/Browse/Controls/ProductDetails/ucOffers.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ShoppingCart.BL; public partial class Browse_Controls_ProductDetails_ucOffers : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { int ProductId; if (!IsPostBack) { if (Request["PID"] != null) { ProductId = Int32.Parse(Request["PID"].ToString()); DataSet ds = ProductController.GetOffers(ProductId); if (ds.Tables[0].Rows.Count > 0) { dloffer.DataSource = ds; dloffer.DataBind(); } } } } }

Code-Shopping/Browse/Controls/ProductDetails/ucProddesc.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucProddesc.ascx.cs" Inherits="Browse_Controls_ProductDetails_ucProddesc" %> <table> <tr> <td> <b>Description:</b> </td> </tr> <tr> <td> <asp:Label ID="lblDesc" runat="server"> </asp:Label> </td> <td> <asp:Label ID="lblimgrating" runat="server" /> </td> </tr> </table>

Code-Shopping/Browse/Controls/ProductDetails/ucProddesc.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ShoppingCart.BL; using System.Data.SqlClient; public partial class Browse_Controls_ProductDetails_ucProddesc : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { string ProductId; SqlDataReader dr; if (!IsPostBack) { if (Request["PID"] != null) { ProductId = (Request["PID"]).ToString(); dr= ProductController.GetProductDesc(ProductId); if (dr.HasRows) { if (dr.Read()) { lblDesc.Text = dr["desc"].ToString(); lblimgrating.Text = dr["img"].ToString(); } } } } } }

Code-Shopping/Browse/Controls/ProductDetails/ucProdFeatures.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucProdFeatures.ascx.cs" Inherits="Browse_Controls_ProductDetails_ucProdFeatures" %> <asp:DataList ID="dlProdFeatures" runat="server" RepeatColumns="1"> <ItemTemplate> <table width="100%"> <tr valign="top" align="left"> <td align="left"><%#DataBinder.Eval(Container.DataItem,"AttributeName") %> </td> <td align="left"> : <%#DataBinder.Eval(Container.DataItem,"AttributeValue") %> </td> </tr> </table> </ItemTemplate> </asp:DataList>

Code-Shopping/Browse/Controls/ProductDetails/ucProdFeatures.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ShoppingCart.BL; public partial class Browse_Controls_ProductDetails_ucProdFeatures : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { int ProductId; if (!IsPostBack) { if (Request["PID"] != null) { ProductId = Int32.Parse(Request["PID"].ToString()); DataSet ds = ProductController.GetProductAttributes(ProductId); if (ds.Tables[0].Rows.Count > 0) { dlProdFeatures.DataSource = ds; dlProdFeatures.DataBind(); } } } } }

Code-Shopping/Browse/Controls/ProductDetails/ucProductImgName.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucProductImgName.ascx.cs" Inherits="Browse_Controls_ProductDetails_ucProductImgName" %> <asp:DataList ID="dlimgname" RepeatColumns="1" runat="server"> <ItemTemplate> <table width="100%"> <tr align="center" valign="top"> <td style="width: 100%"> <h3> <%#DataBinder.Eval(Container.DataItem,"Name") %> </h3> </td> </tr> <tr style="width: 39%" align="left" valign="top"> <td> <img src='<%#DataBinder.Eval(Container.DataItem,"Image","/Shopping/Browse/Images/{0}")%>' alt='<%#DataBinder.Eval(Container.DataItem,"Name")%>' width="400" height="200" /> </td> </tr> </table> </ItemTemplate> </asp:DataList>

Code-Shopping/Browse/Controls/ProductDetails/ucProductImgName.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ShoppingCart.BL; public partial class Browse_Controls_ProductDetails_ucProductImgName : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { int ProductId; if (!IsPostBack) { if(Request["PID"]!=null) { ProductId=Int32.Parse(Request["PID"].ToString()); DataSet ds = ProductController.GetProductNameImage(ProductId); if (ds.Tables[0].Rows.Count > 0) { dlimgname.DataSource = ds; dlimgname.DataBind(); } } } } }

Code-Shopping/Browse/Controls/Rating/ucRating.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucRating.ascx.cs" Inherits="Browse_Controls_Rating_ucRating" %> <table> <tr align="center"> <td align="center"> <asp:RadioButtonList ID="rdbtnRate" runat="server" RepeatDirection="Horizontal" > <asp:ListItem Value="0">Poor * &nbsp;&nbsp;&nbsp; </asp:ListItem> <asp:ListItem Value="1">Fair ** &nbsp;&nbsp;&nbsp; </asp:ListItem> <asp:ListItem Value="2" Selected="True">Good *** &nbsp;&nbsp;&nbsp; </asp:ListItem> <asp:ListItem Value="3">Outstanding **** &nbsp;&nbsp;&nbsp; </asp:ListItem> <asp:ListItem Value="4">Excellent ***** </asp:ListItem> </asp:RadioButtonList> </td> </tr> <tr align="center"> <td> <asp:Button ID="btnrate" Text="Rate" runat="server" Width="75px" OnClick="btnrate_Click" /> </td> </tr> </table>

Code-Shopping/Browse/Controls/Rating/ucRating.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ShoppingCart.BL; public partial class Browse_Controls_Rating_ucRating : System.Web.UI.UserControl { string S; protected void Page_Load(object sender, EventArgs e) { if ((Request["PID"]) != null) { S = Request["PID"].ToString(); } } protected void btnrate_Click(object sender, EventArgs e) { Int16 I; I = Int16.Parse(rdbtnRate.SelectedValue); ProductController.UpdateRate(S, I); } }

Code-Shopping/Browse/Controls/ucAllBrands.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucAllBrands.ascx.cs" Inherits="Browse_Controls_ucAllBrands" %> <table><tr><td><h3>All Brands</h3></td></tr></table> <asp:DataList ID="dlAllBrands" runat="server" RepeatColumns="4"> <ItemTemplate> <table> <tr> <td> <a href='<%#DataBinder.Eval(Container.DataItem,"ID","/Shopping/Browse/frmBrandsProducts.aspx?BID={0}") %>'> <img src='<%#DataBinder.Eval(Container.DataItem,"Logo","/Shopping/Browse/Images/{0}") %>' alt='<%#DataBinder.Eval(Container.DataItem,"BrandName")%>' width="100" height="100" /> </a> </td> </tr> </table> </ItemTemplate> </asp:DataList>

Code-Shopping/Browse/Controls/ucAllBrands.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ShoppingCart.BL; public partial class Browse_Controls_ucAllBrands : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { DataSet dsBrands = ProductController.getALLBrands(); if (dsBrands.Tables[0].Rows.Count > 0) { BindDataList(dlAllBrands, dsBrands); } } } private void BindDataList(DataList dl, DataSet ds) { dl.DataSource = ds; dl.DataBind(); } }

Code-Shopping/Browse/Controls/ucAllCategories.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucAllCategories.ascx.cs" Inherits="Browse_Controls_ucAllcategories" %> <table width="100%"> <tr> <td style="width:100%;"> <h3>All Categories</h3> </td> </tr> <tr> <td style="width:100%"> <asp:DataList ID="dlCategories" runat="server" RepeatColumns="4" CellSpacing="12"> <ItemTemplate> <a href='<%#DataBinder.Eval(Container.DataItem,"ID","/Shopping/Browse/frmCategoriesProducts.aspx?CID={0}")%>'> <img alt='<%#DataBinder.Eval(Container.DataItem,"Name")%>' src='<%#DataBinder.Eval(Container.DataItem,"Image","/Shopping/Browse/Images/{0}")%>' width="100" height="100" /> </a> <a href='<%#DataBinder.Eval(Container.DataItem,"ID","/Shopping/Browse/frmCategoriesProducts.aspx?CID={0}")%>'> <%#DataBinder.Eval(Container.DataItem,"Name")%> </a> </ItemTemplate> </asp:DataList> </td> </tr> </table>

Code-Shopping/Browse/Controls/ucAllCategories.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ShoppingCart.BL; public partial class Browse_Controls_ucAllcategories : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataSet dsAllCategories = ProductController.getALLCategories(); if (dsAllCategories.Tables[0].Rows.Count > 0) { BindDataList(dlCategories, dsAllCategories); } } } private void BindDataList(DataList dl, DataSet ds) { dl.DataSource = ds; dl.DataBind(); } }

Code-Shopping/Browse/Controls/ucBrandProducts.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucBrandProducts.ascx.cs" Inherits="Browse_Controls_ucBrandProducts" %> <table width="100%"> <tr> <td style="width:100%;height: 21px;"> <asp:Label ID="lblHeader" Font-Bold="True" Font-Size="Large" runat="server" ForeColor="#FF9966"></asp:Label> </td> </tr> <tr> <td style="width:100%" valign="top" align="center"> <asp:DataList ID="dlProducts" runat="server" RepeatColumns="3" Width="100%" OnItemCommand="dlProducts_ItemCommand"> <ItemTemplate> <table cellpadding="1" cellspacing="2"> <tr> <td colspan="2" align="center" valign="top"> <%#DataBinder.Eval(Container.DataItem,"Name")%> </td> </tr> <tr> <td align="center" valign="top"> <a href='<%#DataBinder.Eval(Container.DataItem,"ID","/Shopping/Browse/frmProductDetails.aspx?PID={0}")%>'> <img alt='<%#DataBinder.Eval(Container.DataItem,"Name")%>' src='<%#DataBinder.Eval(Container.DataItem,"Image","/Shopping/Browse/Images/{0}")%>' width="50" height="50" /> </a> </td> </tr> <tr> <td align="center" valign="top"> <b>$&nbsp;<%#DataBinder.Eval(Container.DataItem,"SalePrice")%></b> </td> </tr> <tr> <td colspan="2" style="width:50%" align="center"> <asp:ImageButton ID="ibtnDetail" AlternateText="Detail" runat="server" BorderStyle="ridge" BackColor="Bisque" ImageUrl="~/Browse/Images/details.gif" CommandName="Detail" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"ID")%>' Width="65"/> <asp:ImageButton ID="ibtnBuy" AlternateText="Buy Now" runat="server" CommandName="Buy" ImageUrl="~/Browse/Images/BuyNow.gif" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"ID")%>' Width="65" /> </td> </tr> </table> </ItemTemplate> </asp:DataList> </td> </tr> <tr> <td> <asp:Label ID="lblMsg" runat="server" ForeColor="red"></asp:Label> </td> </tr> </table>

Code-Shopping/Browse/Controls/ucBrandProducts.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ShoppingCart.BL; public partial class Browse_Controls_ucBrandProducts : System.Web.UI.UserControl { int PID; DataSet dsProducts; protected void Page_Load(object sender, EventArgs e) { int BrandID; if (!IsPostBack) { lblMsg.Text = ""; if (Request["BID"] != null) { BrandID=Int32.Parse(Request["BID"].ToString()); lblHeader.Text = ProductController.GetBrandName(BrandID); dsProducts = ProductController.GetAllProductsBYBrandID(BrandID); if (dsProducts.Tables[0].Rows.Count > 0) { BindDataList(dlProducts, dsProducts); //Response.Write(dsProducts.Tables[0].Rows[0][1]).ToString(); } else { lblMsg.Text = "No Products available for this brand"; } } else { lblMsg.Text = "Not a valid Brand"; } } } private void BindDataList(DataList dl, DataSet ds) { dl.DataSource = ds; dl.DataBind(); } protected void dlProducts_ItemCommand(object source, DataListCommandEventArgs e) { float Price; if (e.CommandName == "Detail") { Response.Redirect("frmProductDetails.aspx?PID=" + e.CommandArgument.ToString()); } else { if (e.CommandName == "Buy") { PID =int.Parse(e.CommandArgument.ToString()); Price = float.Parse(ProductController.getProductPrice(PID)); AddProductToCart(Session["sessionId"].ToString(), PID, Price, 1); Response.Redirect("/Shopping/Cart/frmShoppingCart.aspx?PID=" + e.CommandArgument.ToString()); } } } private void AddProductToCart(string SID,int PID,float Price,int Qty) { ProductController.GetQuantity(PID, SID, Qty, Price); } }

Code-Shopping/Browse/Controls/ucCategoryProducts.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucCategoryProducts.ascx.cs" Inherits="Browse_Controls_ucCategoryProducts" %> <table width="100%"> <tr> <td style="width:100%<%--; background-color:#6699ff--%>"> <asp:Label ID="lblHeader" runat="server"></asp:Label> </td> </tr> <tr> <td style="width:100%" valign="top" align="center"> <asp:DataList ID="dlCatProducts" runat="server" RepeatColumns="3" Width="100%" OnItemCommand="dlCatProducts_ItemCommand"> <ItemTemplate> <table cellpadding="1" cellspacing="2"> <tr> <td colspan="2" align="center" valign="top"> <%#DataBinder.Eval(Container.DataItem,"Name")%> </td> </tr> <tr> <td align="center" valign="top"> <a href='<%#DataBinder.Eval(Container.DataItem,"ID","/Shopping/Browse/frmCategoriesProducts.aspx?PID={0}")%>'> <img alt='<%#DataBinder.Eval(Container.DataItem,"Name")%>' src='<%#DataBinder.Eval(Container.DataItem,"Image","/Shopping/Browse/Images/{0}")%>' width="50" height="50" /> </a> </td> </tr> <tr> <td align="center" valign="top"> <b>$&nbsp;<%#DataBinder.Eval(Container.DataItem,"SalePrice")%></b> </td> </tr> <tr> <td colspan="2"> <asp:ImageButton ID="ibtnDetail" AlternateText="Detail" runat="server" CommandName="Detail" ImageUrl="~/Browse/Images/details.gif" Width="65" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"ID")%>'/> </td> <td> <asp:ImageButton ID="ibtnBuy" AlternateText="Buy Now" runat="server" CommandName="Buy Now" ImageUrl="~/Browse/Images/BuyNow.gif" Width="65" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"ID")%>' /> </td> </tr> </table> </ItemTemplate> </asp:DataList> </td> </tr> <tr> <td> <asp:Label ID="lblMsg" runat="server" ForeColor="red"></asp:Label> </td> </tr> </table>

Code-Shopping/Browse/Controls/ucCategoryProducts.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ShoppingCart.BL; public partial class Browse_Controls_ucCategoryProducts : System.Web.UI.UserControl { int CategoryID; protected void Page_Load(object sender, EventArgs e) { DataSet dsProducts; if (!IsPostBack) { lblMsg.Text = ""; if (Request["CID"] != null) { CategoryID = Int32.Parse(Request["CID"].ToString()); dsProducts = ProductController.GetAllProductsByCategoryID(CategoryID); if (dsProducts.Tables[0].Rows.Count > 0) { BindDataList(dlCatProducts, dsProducts); } else { lblMsg.Text = "No Products available for this Category"; } } else { lblMsg.Text = "Not a valid Category"; } } } private void BindDataList(DataList dl, DataSet ds) { dl.DataSource = ds; dl.DataBind(); } protected void dlCatProducts_ItemCommand(object source, DataListCommandEventArgs e) { if (e.CommandName == "Detail") { Response.Redirect("frmProductDetails.aspx?PID=" + e.CommandArgument.ToString()); } else { if (e.CommandName == "Buy Now") { int p; p= int.Parse(e.CommandArgument.ToString()); float price=float.Parse(ProductController.getProductPrice(p)); AddProductToCart(Session.SessionID,p,price,1); Response.Redirect("/Shopping/Cart/frmShoppingCart.aspx?=" + e.CommandArgument.ToString()); } } } private void AddProductToCart(string s,int Pid,float p,int Qty) { ProductController.GetQuantity(Pid, s, Qty, p); } }

Code-Shopping/Browse/Controls/ucPopularBrands.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucPopularBrands.ascx.cs" Inherits="Browse_Controls_ucPopularBrands" %> <table style="width: 10%"> <tr> <td style="width:100%"> <span style="font-size: 9pt"> <b style="color:orange; font-family:Verdana">Popular Brands</b> </span> </td> </tr> <tr> <td style="width:100%; text-align: right;"> <asp:DataList ID="dlBrands" runat="server" RepeatColumns="2"> <ItemTemplate> <a href='<%#DataBinder.Eval(Container.DataItem,"ID","/Shopping/Browse/frmBrandsProducts.aspx?BID={0}")%>'> <img alt='<%#DataBinder.Eval(Container.DataItem,"BrandName")%>' src='<%#DataBinder.Eval(Container.DataItem,"Logo","/Shopping/Browse/Images/{0}")%>' width="50" height="50" /> </a> </ItemTemplate> </asp:DataList> <a href='/Shopping/Browse/frmAllBrands.aspx'> More.. </a> </td> </tr> </table>

Code-Shopping/Browse/Controls/ucPopularBrands.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient; using ShoppingCart.BL; public partial class Browse_Controls_ucPopularBrands : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { DataSet dsBrands = ProductController.getPopularBrands(); if (dsBrands.Tables[0].Rows.Count > 0) { BindDataList(dlBrands, dsBrands); } } } private void BindDataList(DataList dl, DataSet ds) { dl.DataSource = ds; dl.DataBind(); } }

Code-Shopping/Browse/Controls/ucPopularCategories.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucPopularCategories.ascx.cs" Inherits="Browse_Controls_ucPopularCategories" %> <table border="0" style="width: 14%"> <tr> <td style="width:122%; height: 21px;"> <b style="color:orange;font-family:Verdana"><span style="font-size: 8pt">Popular Category</span></b></td> </tr> <tr> <td style="width:122%; text-align: right;"> <asp:DataList ID="dlCategories" runat="server" RepeatColumns="2" Width="125px"> <ItemTemplate> <a href='<%#DataBinder.Eval(Container.DataItem,"ID","/Shopping/Browse/frmCategoriesProducts.aspx?CID={0}")%>'> <img alt='<%#DataBinder.Eval(Container.DataItem,"Name")%>' src='<%#DataBinder.Eval(Container.DataItem,"Image","/Shopping/Browse/Images/{0}")%>' width="50" height="50" border="0" /> </a> </ItemTemplate> </asp:DataList><a style="margin-left:0" href='/Shopping/Browse/frmAllCategories.aspx'>More... </a> </td> </tr> </table>

Code-Shopping/Browse/Controls/ucPopularCategories.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient; using ShoppingCart.BL; public partial class Browse_Controls_ucPopularCategories : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { DataSet dsCategories = ProductController.getPopularCategories(); if (dsCategories.Tables[0].Rows.Count > 0) { BindDataList(dlCategories, dsCategories); } } } private void BindDataList(DataList dl, DataSet ds) { dl.DataSource = ds; dl.DataBind(); } }

Code-Shopping/Browse/Controls/ucPopularTypes.ascx

Code-Shopping/Browse/Controls/ucPopularTypes.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient; using ShoppingCart.BL; public partial class Browse_Controls_ucTypes : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { DataSet dsTypes = ProductController.getPopularTypes(); if (dsTypes.Tables[0].Rows.Count > 0) { BindDataList(dlTypes, dsTypes); } } } private void BindDataList(DataList dl, DataSet ds) { dl.DataSource = ds; dl.DataBind(); } }

Code-Shopping/Browse/Controls/ucRefertoFriend.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucRefertoFriend.ascx.cs" Inherits="Browse_Controls_ucRefertoFriend" %> <table > <tr> <td align="left" colspan="2"> <strong>Refer to Friend</strong></td> </tr> <tr> <td colspan="2"> <asp:Label ID="lblLink" runat="server"> </asp:Label> </td> </tr> <tr> <td style="background-color:#ccc0fc"> <asp:Label ID="lblfemail" runat="server" Text="Sender's Email" > </asp:Label> </td> <td align="left"> <asp:TextBox ID="txtemail" runat="server"> </asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="*" ControlToValidate="txtemail" ></asp:RequiredFieldValidator> <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtemail" ErrorMessage="Invalid Email" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator> </td> </tr> <tr> <td style="background-color:#ccc0fc"> <asp:Label ID="lblName" runat="server" Text="Your Name" > </asp:Label> </td> <td align="left"> <asp:TextBox ID="txtName" runat="server"> </asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtName" ErrorMessage="*" ></asp:RequiredFieldValidator> </td> </tr> <tr> <td style="background-color:#ccc0fc"> <asp:Label ID="lblRemail" runat="server" Text="Receipient's Email" > </asp:Label> </td> <td align="left"> <asp:TextBox ID="txtrEmail" runat="server"> </asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtrEmail" ErrorMessage="*" ></asp:RequiredFieldValidator> <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="txtrEmail" ErrorMessage="Invalid Email" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator> </td> </tr> <tr> </tr> <tr> <td colspan="2" align="center"> <p> use comma(,) to separate more than 1 email-ids</p> </td> </tr> <tr> <td colspan="2" align="center"> <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" /> </td> </tr> </table>

Code-Shopping/Browse/Controls/ucRefertoFriend.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Web.Mail; //using System.Net.Mail; public partial class Browse_Controls_ucRefertoFriend : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { } protected void btnSubmit_Click(object sender, EventArgs e) { string subject = ConfigurationManager.AppSettings["ReferToFriendSubject"]; string body = ConfigurationManager.AppSettings["ReferToFriendBody"]; string[] email = txtrEmail.Text.Split(','); for (int i = 0; i < email.Length; i++) { body = String.Format(body,email[i], txtName.Text); SendMail(lblfemail.Text, email[i], subject, body); } } private void SendMail(string From, string To, string Subject, string Body) { MailMessage mail = new MailMessage(); mail.From = From; mail.To = To; mail.Subject = Subject; mail.Body = Body; SmtpMail.SmtpServer = "localhost"; SmtpMail.Send(mail); Response.Write("<script>alert('Mail Sent Successfully');</script>"); } }

Code-Shopping/Browse/Controls/ucRightTemplate.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucRightTemplate.ascx.cs" Inherits="Browse_Controls_ucRightTemplate" %> <table width="100%"> <tr style="height: 100%"> <td> <b><a href="/Shopping/Featured Products/frmFeaturedProducts.aspx">Featured Products </a></b> </td> </tr> <tr style="height: 60%"> <td> </td> </tr> <tr style="height: 100%"> <td style="width: 100%"> <b><a href="/Shopping/Browse/frmNewlyAddedProducts.aspx">Newly Added Products </a></b> </td> </tr> <tr style="height: 60%"> <td> </td> </tr> <tr> <td> <b><a href="/Shopping/Browse/frmUpcomingProduct.aspx">Upcoming Products</a></b> </td> </tr> </table>

Code-Shopping/Browse/Controls/ucRightTemplate.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Browse_Controls_ucRightTemplate : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/Browse/frmAllBrands.aspx

<%@ Page Language="C#" MasterPageFile="~/Templates/Default/MasterPage.master" AutoEventWireup="true" CodeFile="frmAllBrands.aspx.cs" Inherits="Browse_frmAllBrands" %> <%@ Register Src="Controls/ucAllBrands.ascx" TagName="ucAllBrands" TagPrefix="uc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <uc1:ucAllBrands id="UcAllBrands1" runat="server"> </uc1:ucAllBrands> </asp:Content>

Code-Shopping/Browse/frmAllBrands.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Browse_frmAllBrands : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/Browse/frmAllCategories.aspx

<%@ Page Language="C#" MasterPageFile="~/Templates/Default/MasterPage.master" AutoEventWireup="true" CodeFile="frmAllCategories.aspx.cs" Inherits="Browse_Images_frmAllCategories" %> <%@ Register Src="Controls/ucAllCategories.ascx" TagName="ucAllCategories" TagPrefix="uc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <table width="100%"> <tr> <td> <uc1:ucAllCategories ID="UcAllCategories1" runat="server" /> </td> </tr> </table> </asp:Content>

Code-Shopping/Browse/frmAllCategories.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Browse_Images_frmAllCategories : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/Browse/frmBrandsProducts.aspx

<%@ Page Language="C#" MasterPageFile="~/Templates/Default/MasterPage.master" AutoEventWireup="true" CodeFile="frmBrandsProducts.aspx.cs" Inherits="Browse_frmBrandsProducts" %> <%@ Register Src="Controls/ucBrandProducts.ascx" TagName="ucBrandProducts" TagPrefix="uc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <table style="width:100%"> <tr> <td style="width:100%"> <uc1:ucBrandProducts ID="UcBrandProducts1" runat="server" /> </td> </tr> </table> </asp:Content>

Code-Shopping/Browse/frmBrandsProducts.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient; using ShoppingCart.BL; public partial class Browse_frmBrandsProducts : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/Browse/frmCategoriesProducts.aspx

<%@ Page Language="C#" MasterPageFile="~/Templates/Default/MasterPage.master" AutoEventWireup="true" CodeFile="frmCategoriesProducts.aspx.cs" Inherits="Browse_frmCategoriesProducts" %> <%@ Register Src="Controls/ucCategoryProducts.ascx" TagName="ucCategoryProducts" TagPrefix="uc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <table style="width:100%"> <tr> <td style="width:100%"> <h3>Products</h3> <uc1:ucCategoryProducts ID="UcCategoryProducts1" runat="server" /> </td> </tr> </table> </asp:Content>

Code-Shopping/Browse/frmCategoriesProducts.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Browse_frmCategoriesProducts : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/Browse/frmNewlyAddedProducts.aspx

<%@ Page Language="C#" MasterPageFile="~/Templates/Default/MasterPage.master" AutoEventWireup="true" CodeFile="frmNewlyAddedProducts.aspx.cs" Inherits="Browse_frmNewlyAddedProducts" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <table width="100%" border="0"> <tr> <td> <h3>Newly Added Products</h3></td></tr> <tr> <td> <img id="Img1" src="Images/Blazer.jpg" runat="server" alt="Blazer" /> </td> </tr> </table> </asp:Content>

Code-Shopping/Browse/frmNewlyAddedProducts.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Browse_frmNewlyAddedProducts : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/Browse/frmProductDetails.aspx

<%@ Page Language="C#" MasterPageFile="~/Templates/Default/MasterPage.master" AutoEventWireup="true" CodeFile="frmProductDetails.aspx.cs" Inherits="Browse_frmProductDetails" %> <%@ Register Src="Controls/ProductDetails/ucOffers.ascx" TagName="ucOffers" TagPrefix="uc1" %> <%@ Register Src="Controls/ProductDetails/ucBrandName.ascx" TagName="ucBrandName" TagPrefix="uc6" %> <%@ Register Src="Controls/ProductDetails/ucProductImgName.ascx" TagName="ucProductImgName" TagPrefix="uc2" %> <%@ Register Src="Controls/ProductDetails/ucProdFeatures.ascx" TagName="ucProdFeatures" TagPrefix="uc3" %> <%--<%@ Register Src="Controls/ProductDetails/ucOffers.ascx" TagName="ucOffers" TagPrefix="uc4" %> --%> <%@ Register Src="Controls/ProductDetails/ucProddesc.ascx" TagName="ucProddesc" TagPrefix="uc5" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server"> <table width="100%"> <tr align="left"> <td style="width:40%"> <uc2:ucProductImgName ID="UcProductImgName1" runat="server" /> </td> <td align="left"> <uc6:ucBrandName ID="UcBrandName1" runat="server"></uc6:ucBrandName> <uc1:ucOffers ID="UcOffers1" runat="server" /> <b><i>Product Features</i></b> <uc3:ucProdFeatures ID="UcProdFeatures1" runat="server"></uc3:ucProdFeatures> </td> </tr> <tr align="left"> <td colspan="2"> <uc5:ucProddesc ID="UcProddesc1" runat="server" /> </td> </tr> </table> <table> <tr> <td align="center"> <asp:Button ID="btnBuy" Text="Buy Now" runat="server" OnClick="btnBuy_Click1" /> </td> <td align="center"> <asp:Button ID="btnRating" Text="Rate Now" runat="server" OnClick="btnRating_Click1" /> </td> <td align="center"> <asp:Button ID="btnRefer" Text="Refer to Friend" runat="server" OnClick="btnRefer_Click" /> </td> <td align="center"> <asp:Button ID="btnWish" Text="Add to wish List" runat="server" OnClick="btnWish_Click" Visible="false"/> </td> </tr> </table> </asp:Content>

Code-Shopping/Browse/frmProductDetails.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ShoppingCart.BL; public partial class Browse_frmProductDetails : System.Web.UI.Page { string User; string ProductId; protected void Page_Load(object sender, EventArgs e) { this.btnWish.Attributes.Add("onclick", "return alert('Your Product added to Wishlist');"); if (Session["Username"] != null) { btnWish.Visible = true; } } protected void btnBuy_Click1(object sender, EventArgs e) { int PID; string SID; int Qty = 1; float Price; SID = Session.SessionID; PID =Int32.Parse(Request["PID"].ToString()); Price = float.Parse(ProductController.getProductPrice(PID)); ProductController.GetQuantity(PID, SID, Qty, Price); Response.Redirect("/Shopping/Cart/frmShoppingCart.aspx"); } protected void btnRefer_Click(object sender, EventArgs e) { Response.Redirect("/Shopping/Browse/frmrefertofriend.aspx"); } protected void btnRating_Click(object sender, EventArgs e) { } protected void btnRating_Click1(object sender, EventArgs e) { Response.Redirect("/Shopping/Browse/frmRating.aspx?PID=" + Request["PID"].ToString()); } protected void btnWish_Click(object sender, EventArgs e) { if (Session["Username"] != null) { User = Session["Username"].ToString(); } if (Request["PID"] != null) { ProductId = Request["PID"].ToString(); } ProductController.InsertWishlist(User, ProductId); } }

Code-Shopping/Browse/frmRating.aspx

<%@ Page Language="C#" MasterPageFile="~/Templates/Default/MasterPage.master" AutoEventWireup="true" CodeFile="frmRating.aspx.cs" Inherits="Browse_frmRating" %> <%@ Register Src="Controls/Rating/ucRating.ascx" TagName="ucRating" TagPrefix="uc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <uc1:ucRating ID="UcRating1" runat="server" OnLoad="UcRating1_Load" /> </asp:Content>

Code-Shopping/Browse/frmRating.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Browse_frmRating : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void UcRating1_Load(object sender, EventArgs e) { } }

Code-Shopping/Browse/frmrefertofriend.aspx

<%@ Page Language="C#" MasterPageFile="~/Browse/MasterPage1.master" AutoEventWireup="true" CodeFile="frmrefertofriend.aspx.cs" Inherits="Browse_frmrefertofriend" %> <%@ Register Src="Controls/ucRefertoFriend.ascx" TagName="ucRefertoFriend" TagPrefix="uc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <table align="center" width="100%"> <tr> <td > <div align="center"> <uc1:ucRefertoFriend ID="UcRefertoFriend1" runat="server" /></div> </td> </tr> </table> </asp:Content>

Code-Shopping/Browse/frmrefertofriend.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Browse_frmrefertofriend : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/Browse/frmTypesProducts.aspx

<%@ Page Language="C#" MasterPageFile="~/Templates/Default/MasterPage.master" AutoEventWireup="true" CodeFile="frmTypesProducts.aspx.cs" Inherits="Browse_frmTypesProducts" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> </asp:Content>

Code-Shopping/Browse/frmTypesProducts.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Browse_frmTypesProducts : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/Browse/frmUpcomingProduct.aspx

<%@ Page Language="C#" MasterPageFile="~/Browse/MasterPage1.master" AutoEventWireup="true" CodeFile="frmUpcomingProduct.aspx.cs" Inherits="Browse_frmUpcomingProduct" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> </asp:Content>

Code-Shopping/Browse/frmUpcomingProduct.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Browse_frmUpcomingProduct : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/Browse/Images/4b62584e746631416f6247384d34366f2d4e41-100x100-0-0.jpg

Code-Shopping/Browse/Images/appliquehanddyed.jpg

Code-Shopping/Browse/Images/bananashirt_75x75.jpg

Code-Shopping/Browse/Images/banner1.jpg

Code-Shopping/Browse/Images/banner2.jpg

Code-Shopping/Browse/Images/banner7.jpg

Code-Shopping/Browse/Images/benner11.bmp

Code-Shopping/Browse/Images/Blazer.jpg

Code-Shopping/Browse/Images/Blue hills.jpg

Code-Shopping/Browse/Images/bottombanner_people.png

Code-Shopping/Browse/Images/bugfrog.jpg

Code-Shopping/Browse/Images/BuyNow.gif

Code-Shopping/Browse/Images/BuyNow.png

Code-Shopping/Browse/Images/CABQ2PBR.htm

Code-Shopping/Browse/Images/chocchips.jpg

Code-Shopping/Browse/Images/close.gif

Code-Shopping/Browse/Images/colouful.jpg

Code-Shopping/Browse/Images/colourful1.jpg

Code-Shopping/Browse/Images/colourful2.jpg

Code-Shopping/Browse/Images/cooltext75055321.gif

Code-Shopping/Browse/Images/core-nav-bg.jpg

Code-Shopping/Browse/Images/delete.gif

Code-Shopping/Browse/Images/Detail.gif

Code-Shopping/Browse/Images/details.gif

Code-Shopping/Browse/Images/details.png

Code-Shopping/Browse/Images/doc.gif

Code-Shopping/Browse/Images/dottedfab.jpg

Code-Shopping/Browse/Images/duralee.jpg

Code-Shopping/Browse/Images/Edit.gif

Code-Shopping/Browse/Images/elegacyhanddyed.jpg

Code-Shopping/Browse/Images/eshopping.GIF

Code-Shopping/Browse/Images/F224200781003.jpg

Code-Shopping/Browse/Images/fab.jpg

Code-Shopping/Browse/Images/fabrics.jpg

Code-Shopping/Browse/Images/fabsoocer.jpg

Code-Shopping/Browse/Images/familyreunion.jpg

Code-Shopping/Browse/Images/feelingfabric.jpg

Code-Shopping/Browse/Images/flralfancy.jpg

Code-Shopping/Browse/Images/go-button-rollover.gif

Code-Shopping/Browse/Images/Halloween.jpg

Code-Shopping/Browse/Images/handdyedfish.jpg

Code-Shopping/Browse/Images/header.JPG

Code-Shopping/Browse/Images/headermain.jpg

Code-Shopping/Browse/Images/HO-FW07-BLO-thumb.jpg

Code-Shopping/Browse/Images/HouseHolds.jpg

Code-Shopping/Browse/Images/icon_download_event.gif

Code-Shopping/Browse/Images/icon_event.gif

Code-Shopping/Browse/Images/image00.jpg

Code-Shopping/Browse/Images/image111.jpg

Code-Shopping/Browse/Images/images.jpg

Code-Shopping/Browse/Images/images1.jpg

Code-Shopping/Browse/Images/images11.jpg

Code-Shopping/Browse/Images/images6.jpg

Code-Shopping/Browse/Images/images7.jpg

Code-Shopping/Browse/Images/img1.jpg

Code-Shopping/Browse/Images/kid.jpg

Code-Shopping/Browse/Images/kids.jpg

Code-Shopping/Browse/Images/Lee.gif

Code-Shopping/Browse/Images/lenin.jpg

Code-Shopping/Browse/Images/loading.gif

Code-Shopping/Browse/Images/logout.gif

Code-Shopping/Browse/Images/man.gif

Code-Shopping/Browse/Images/Mayur.gif

Code-Shopping/Browse/Images/men.gif

Code-Shopping/Browse/Images/Men.JPG

Code-Shopping/Browse/Images/movedown.gif

Code-Shopping/Browse/Images/moveup.gif

Code-Shopping/Browse/Images/nicholashaslam.jpg

Code-Shopping/Browse/Images/ojjas_stormbrraingear.jpg

Code-Shopping/Browse/Images/PayCards.gif

Code-Shopping/Browse/Images/peterfasano.jpg

Code-Shopping/Browse/Images/polyster.jpg

Code-Shopping/Browse/Images/pothys-120x30.gif

Code-Shopping/Browse/Images/print.jpg

Code-Shopping/Browse/Images/printed.jpg

Code-Shopping/Browse/Images/PV-F07-DMT-thumb.jpg

Code-Shopping/Browse/Images/Raymond.gif

Code-Shopping/Browse/Images/Raymond.jpg

Code-Shopping/Browse/Images/Search.gif

Code-Shopping/Browse/Images/shirts.jpg

Code-Shopping/Browse/Images/slipperyfabric.jpg

Code-Shopping/Browse/Images/sofafabrics.jpg

Code-Shopping/Browse/Images/Suit.jpg

Code-Shopping/Browse/Images/Sunset.jpg

Code-Shopping/Browse/Images/sunshine.jpg

Code-Shopping/Browse/Images/swathces.jpg

Code-Shopping/Browse/Images/SWeekend-Assortment.jpg

Code-Shopping/Browse/Images/t_shirts.gif

Code-Shopping/Browse/Images/terryfab.jpg

Code-Shopping/Browse/Images/thaiandindo.jpg

Code-Shopping/Browse/Images/Thumbs.db

Code-Shopping/Browse/Images/ties.jpg

Code-Shopping/Browse/Images/tile_back.gif

Code-Shopping/Browse/Images/trousers.jpg

Code-Shopping/Browse/Images/Untitled-30.jpg

Code-Shopping/Browse/Images/update.gif

Code-Shopping/Browse/Images/verticalad.gif

Code-Shopping/Browse/Images/verticalimg.gif

Code-Shopping/Browse/Images/Water lilies.jpg

Code-Shopping/Browse/Images/weaccept.gif

Code-Shopping/Browse/Images/wf1_notavailable.gif

Code-Shopping/Browse/Images/W-FW07-SWD-thumb.jpg

Code-Shopping/Browse/Images/Winter.jpg

Code-Shopping/Browse/Images/Womens.jpg

Code-Shopping/Browse/Images/Womens1.jpg

Code-Shopping/Browse/images6.jpg

Code-Shopping/Browse/MasterPage1.master

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage1.master.cs" Inherits="Browse_MasterPage1" %> <%@ Register Src="../Templates/Default/controls/ucHeader.ascx" TagName="ucHeader" TagPrefix="uc1" %> <%@ Register Src="../Templates/Default/controls/ucFooter.ascx" TagName="ucFooter" TagPrefix="uc2" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <link rel="stylesheet" href="../stylesht.css" type="text/css" /> <title>Shopping Cart</title> </head> <body> <form id="form1" runat="server"> <div> <table width="100%"> <tr style="width:20%; height:5"> <td colspan="3"> <uc1:ucHeader ID="UcHeader1" runat="server" /> <asp:LinkButton ID="lblUser" CausesValidation="false" runat="server" Text="" BackColor="White" Font-Bold="True" Font-Italic="True" ForeColor="#FF8080"></asp:LinkButton> </td> </tr> <tr style="width:60%; height:90%"> <td style="width:15%;"> </td> <td style="width:70%;height:100%" valign="top"> <%-- background-color:#ccccff;--%> <asp:contentplaceholder id="ContentPlaceHolder1" runat="server"> </asp:contentplaceholder> </td> <td style="width:15%;"> <img src="Images/verticalad.gif" runat="server" alt="hosting" /> </td> </tr> <tr style="width:20%; height:5%"> <td colspan="3"> <uc2:ucFooter ID="UcFooter1" runat="server" /> </td> </tr> </table> </div> </form> </body> </html>

Code-Shopping/Browse/MasterPage1.master.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Browse_MasterPage1 : System.Web.UI.MasterPage { protected void Page_Load(object sender, EventArgs e) { if (Session["UserName"] == null) { lblUser.Text = "Welcome Guest"; } else { lblUser.Text = "Welcome " + " " + Session["UserName"].ToString(); lblUser.PostBackUrl = "~/MyAccount/frmMyAccount.aspx"; } } }

Code-Shopping/Browse/Thumbs.db

Code-Shopping/Cart/frmShoppingCart.aspx

<%@ Page Language="C#" MasterPageFile="~/Browse/MasterPage1.master" AutoEventWireup="true" CodeFile="frmShoppingCart.aspx.cs" Inherits="Browse_frmShoppingCart1" %> <%@ Register Src="../Cart/ucShopping.ascx" TagName="ucShopping" TagPrefix="uc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <uc1:ucShopping ID="UcShopping1" runat="server" /> </asp:Content>

Code-Shopping/Cart/frmShoppingCart.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ShoppingCart.BL; public partial class Browse_frmShoppingCart1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/Cart/frmShoppingCart2.aspx

<%@ Page Language="C#" MasterPageFile="~/Browse/MasterPage1.master" AutoEventWireup="true" CodeFile="frmShoppingCart2.aspx.cs" Inherits="Cart_frmShoppingCart" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <div> <table width="100%" > <tr> <td> </td> <td style="width:60%; height:60%; background-color:#aaccff"> <table width="100%"> <tr> <td> Your cart allows you to buy multiple products from different stores with fast, simple and safe checkout.<br /> Your shopping cart is empty. <br /> <b> Remember: </b> <br /> Items stay in your cart for 7 days. </td> </tr> </table> </td> <td style="width:20%"> </td> </tr> </table> </div> </asp:Content>

Code-Shopping/Cart/frmShoppingCart2.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Cart_frmShoppingCart : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/Cart/ucShopping.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucShopping.ascx.cs" Inherits="Browse_Controls_ucShopping" %> <table width="100%"> <tr> <td> <h4>Shopping Cart</h4> </td> </tr> <tr> <td style="width: 100%"> <asp:DataList ID="dlCart" runat="server" Width="100%" CellPadding="4" ForeColor="#333333" > <HeaderTemplate> <table width="100%"> <tr> <td style="width: 10%" align="center"> Select</td> <td style="width: 30%" align="center"> Product</td> <td style="width: 20%" align="center"> Price </td> <td style="width: 20%" align="center"> Quantity</td> <td style="width: 20%" align="center"> Amount</td> </tr> </table> </HeaderTemplate> <ItemTemplate> <table width="100%"> <tr> <td style="width: 10%"> <asp:CheckBox ID="chkSelect" runat="server" Checked="false" /> </td> <asp:Label ID="lblSessionID" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"SessionId") %>' Visible="false"></asp:Label> <asp:Label ID="lblProductID" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Id") %>' Visible="false"></asp:Label> <td style="width: 35%" align="center"> <asp:Label ID="lblImage" runat="server"> <img src='<%#DataBinder.Eval(Container.DataItem,"Image","/Shopping/Browse/Images/{0}")%>' alt='<%#DataBinder.Eval(Container.DataItem,"Name")%>' width="30" height="30" /><br> <%#DataBinder.Eval(Container.DataItem,"Name") %> </asp:Label> </td> <td style="width: 10%" align="left"> $ <asp:Label ID="lblPrice" runat="server" Text=' <%#DataBinder.Eval(Container.DataItem,"Price")%>'> </asp:Label> </td> <td style="width: 20%"> <asp:TextBox ID="txtQuantity" runat="server" MaxLength="2" Width="40%" Text='<%#DataBinder.Eval(Container.DataItem,"Quantity")%>'></asp:TextBox> <%--<asp:CompareValidator ID="comp" runat="server" Operator="greaterThan" Type=> </asp:CompareValidator>--%> </td> <td style="width: 20%"> $ <asp:Label ID="lblTotal" runat="server"> <%#DataBinder.Eval(Container.DataItem,"Total")%> </asp:Label> </td> </tr> </table> </ItemTemplate> <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> <SelectedItemStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /> <AlternatingItemStyle BackColor="White" ForeColor="#284775" /> <ItemStyle BackColor="#F7F6F3" ForeColor="#333333" /> <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> </asp:DataList> </td> </tr> </table> <table width="87%"> <tr align="right"> <td> <asp:Label ID="lblGrandTotal" runat="server"></asp:Label> </td> </tr> <tr> <td> <asp:Label ID="lblMsg" Text="" ForeColor="Red" runat="server"></asp:Label> </td> </tr> </table> <table width="100%"> <tr> <td align="center"> <asp:Button ID="btnSelectAll" Text="Select All" runat="server" OnClick="btnSelectAll_Click" /> </td> <td align="center"> <asp:Button ID="btnUpdate" Text="Update Cart" runat="server" OnClick="btnUpdate_Click" /> </td> <td align="center"> <asp:Button ID="btnRemove" Text="Remove from cart" runat="server" OnClick="btnRemove_Click" /> </td> <td align="center"> <asp:Button ID="btnCheckOut" runat="server" Text="CheckOut" OnClick="btnCheckOut_Click" /> </td> <td align="center"> <asp:Button ID="btnContinue" runat="server" Text="ContinueShopping" OnClick="btnContinue_Click" /> </td> </tr> </table>

Code-Shopping/Cart/ucShopping.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ShoppingCart.BL; public partial class Browse_Controls_ucShopping : System.Web.UI.UserControl { int cartcount; protected void Page_Load(object sender, EventArgs e) { cartcount = dlCart.Items.Count; if (!IsPostBack) { BindCart(); } } private void BindCart() { string SessionId; try { SessionId = Session["sessionId"].ToString(); DataSet ds=ProductController.GetShoppingCartDetails(SessionId); if (SessionId == null) { lblGrandTotal.Visible = false; btnCheckOut.Visible = false; btnContinue.Visible = false; btnSelectAll.Visible = false; btnUpdate.Visible = false; } if (ds.Tables[0].Rows.Count > 0) { dlCart.DataSource = ds; dlCart.DataBind(); lblGrandTotal.Text = "Grand Total: $ " + ProductController.GetCartTotal(SessionId).ToString(); } else { dlCart.Visible = false; lblGrandTotal.Visible = false; btnCheckOut.Visible = false; btnRemove.Visible = false; btnSelectAll.Visible = false; btnUpdate.Visible = false; lblMsg.Text = "Your cart is empty."; } } catch (Exception ex) { lblMsg.Text = ex.Message; } } protected void btnSelectAll_Click(object sender, EventArgs e) { if (btnSelectAll.Text == "Select All") { SelectAllCartItems(true); btnSelectAll.Text = "DeSelect All"; } else { SelectAllCartItems(false); btnSelectAll.Text = "Select All"; } } private void SelectAllCartItems(bool status) { Object obj; CheckBox chk; try { lblMsg.Text = ""; foreach (DataListItem li in dlCart.Items) { obj = li.FindControl("chkSelect"); if (obj != null) { chk = (CheckBox)obj; chk.Checked = status; } } } catch (Exception ex) { lblMsg.Text = ex.Message; } } protected void btnUpdate_Click(object sender, EventArgs e) { Object obj; Object obj1; CheckBox chk; TextBox txtQty; Label lblSID, lblPID,lblTOT,lblPRICE; lblMsg.Text = ""; lblPID = null; lblSID = null; txtQty = null; int i = 0; try { foreach (DataListItem li in dlCart.Items) { obj = li.FindControl("chkSelect"); if (obj != null) { chk = (CheckBox)obj; } obj = li.FindControl("txtQuantity"); if (obj != null) { txtQty = (TextBox)obj; } obj = li.FindControl("lblSessionID"); if (obj != null) { lblSID = (Label)obj; } obj = li.FindControl("lblProductID"); if (obj != null) { lblPID = (Label)obj; } ProductController.UpdateShoppingCartItem(lblSID.Text, Convert.ToInt32(lblPID.Text),Convert.ToInt32(txtQty.Text)); obj = li.FindControl("lblTotal"); obj1=li.FindControl("lblPrice"); if (obj != null) { lblTOT = (Label)obj; lblPRICE = (Label)obj1; lblTOT.Text = (Convert.ToInt32(lblPRICE.Text) * Convert.ToInt32(txtQty.Text)).ToString(); } } BindCart(); } catch (Exception ex) { lblMsg.Text = ex.Message; } } protected void btnRemove_Click(object sender, EventArgs e) { Object obj; CheckBox chk=null; Label lblSID, lblPID; lblPID = null; lblSID = null; try { lblMsg.Text = ""; foreach (DataListItem li in dlCart.Items) { obj = li.FindControl("chkSelect"); if (obj != null) { chk = (CheckBox)obj; } obj = li.FindControl("lblSessionID"); if (obj != null) { lblSID = (Label)obj; } obj = li.FindControl("lblProductID"); if (obj != null) { lblPID = (Label)obj; } if (chk.Checked == true) { ProductController.RemoveShoppingCartItem(lblSID.Text, Convert.ToInt32(lblPID.Text)); } } BindCart(); } catch (Exception ex) { lblMsg.Text = ex.Message; } } protected void btnContinue_Click(object sender, EventArgs e) { Response.Redirect("/Shopping/Default.aspx"); } protected void btnCheckOut_Click(object sender, EventArgs e) { if (cartcount > 0) { Response.Redirect("../ShipingBilling/frmShipping.aspx"); } //else //{ // lblGrandTotal.Visible = false; // btnSelectAll.Visible = false; // btnUpdate.Visible = false; // btnRemove.Visible = false; // btnCheckOut.Visible = false; // Response.Write("hai"); // //Response.Write(""<script> alert('cart is empty')</script>""); //} } }

Code-Shopping/Contact Us/frmContactUs.aspx

<%@ Page Language="C#" MasterPageFile="~/Templates/Default/MasterPage.master" AutoEventWireup="true" CodeFile="frmContactUs.aspx.cs" Inherits="Contact_Us_frmContactUs" %> <%@ Register Src="ucContactUs.ascx" TagName="ucContactUs" TagPrefix="uc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <uc1:ucContactUs ID="UcContactUs1" runat="server" /> </asp:Content>

Code-Shopping/Contact Us/frmContactUs.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Contact_Us_frmContactUs : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/Contact Us/ucContactUs.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucContactUs.ascx.cs" Inherits="ucContactUs" %> <table style="width: 55%"> <tr> <td align="left" colspan="2" > <h3>Contact Us</h3> </td> </tr> <tr> <td align="center" style="text-align: left" colspan="2"> Shopping Solutions Pvt India Ltd Head Office: Andheri West Mumbai Hello: 020-23456787 Branch Offices: <ol> <li style="text-align: left"> <p style="text-align: justify"> <strong>Public Gardens road <br /> Nampally <br /> Hyderabad <br /> Phone:040-23000296 </strong> </p> </li> <li> <p style="text-align: justify"> <strong>T-Nagar <br /> Chennai <br /> Phone:044-12345678</strong></p> </li> </ol> </td> </tr> <tr> <td align="right" > <asp:Label ID="lblname" runat="server" CssClass="text" Text="Your Name:" Font-Bold="True"></asp:Label> </td> <td style="width: 253px"> <asp:TextBox ID="txtname" runat="server" Width="50%"> </asp:TextBox> </td> </tr> <tr> <td align="right"> <asp:Label ID="lblemail" runat="server" CssClass="text" Text="Your Email-ID:" Font-Bold="True"></asp:Label> </td> <td style="width: 253px"> <asp:TextBox ID="txtemail" runat="server" Width="50%"> </asp:TextBox> </td> </tr> <tr> <td align="right"> <asp:Label ID="lblsubject" runat="server" CssClass="text" Text ="Subject:" Font-Bold="True"></asp:Label> </td> <td style="width: 253px"> <asp:TextBox ID="txtsubject" runat="server" Width="50%"> </asp:TextBox> </td> </tr> <tr> <td align="right"> <asp:Label ID="lblMessage" runat="server" CssClass="text" Text="Message to Admin:" Font-Bold="True"></asp:Label> </td> <td style="width: 253px"> <asp:TextBox ID="txtmessage" runat="server" TextMode="MultiLine" Width="50%"> </asp:TextBox> </td> </tr> <tr> <td colspan="2" align="center"> <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" /> </td> </tr> </table>

Code-Shopping/Contact Us/ucContactUs.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Web.Mail; public partial class ucContactUs : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { } private void SendMail(string From, string To, string Subject, string Body) { MailMessage mail = new MailMessage(); mail.From = From; mail.To = To; mail.Subject = Subject; mail.Body = Body; SmtpMail.SmtpServer = "localhost"; SmtpMail.Send(mail); Response.Write("<script>alert('Mail Sent Successfully');</script>"); } protected void btnSubmit_Click(object sender, EventArgs e) { string Subject = txtsubject.Text; string Body = txtmessage.Text; string From=txtemail.Text; string To = "[email protected]"; Body = String.Format(Body, From,txtname.Text); SendMail(From,To,Subject,Body); } }

Code-Shopping/Default.aspx

<%@ Page Language="C#" MasterPageFile="~/Templates/Default/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <%@ Register Src="Templates/Default/controls/default.ascx" TagName="default" TagPrefix="uc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server"> <uc1:default ID="Default1" runat="server" /> </asp:Content>

Code-Shopping/Default.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { //PID = Int32.Parse(Request["PID"].ToString()); } }

Code-Shopping/Featured Products/frmFeaturedProducts.aspx

<%@ Page Language="C#" MasterPageFile="~/Templates/Default/MasterPage.master" AutoEventWireup="true" CodeFile="frmFeaturedProducts.aspx.cs" Inherits="Featured_Products_frmFeaturedProducts" %> <%@ Register Src="ucFeaturedp.ascx" TagName="ucFeaturedp" TagPrefix="uc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <uc1:ucFeaturedp ID="UcFeaturedp1" runat="server" /> </asp:Content>

Code-Shopping/Featured Products/frmFeaturedProducts.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Featured_Products_frmFeaturedProducts : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/Featured Products/ucFeaturedp.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucFeaturedp.ascx.cs" Inherits="Featured_Products_ucFeaturedp" %> <table style="width:100%"> <tr> <td style="width:100%"> <asp:DataList ID="dlProduct" runat="server" RepeatColumns="1" Width="100%"> <HeaderTemplate> <table width="100%"> <tr> <td style="width:25%">Name</td> <td style="width:25%">Description</td> <td style="width:25%">Saleprice</td> <td style="width:25%">Image</td> </tr> </table> </HeaderTemplate> <ItemTemplate> <table width="100%"> <tr> <td style="width:25%"> <asp:Label ID="lblName" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Name")%>'> </asp:Label> </td> <td style="width:25%"> <asp:Label ID="lblDescription" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Name")%>'> </asp:Label> </td> <td style="width:25%"> <asp:Label ID="lblSalePrice" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"SalePrice")%>'> </asp:Label> </td> <td style="width:25%"> <img src='<%#DataBinder.Eval(Container.DataItem,"Image","/Shopping/Browse/Images/{0}")%>' alt='<%#DataBinder.Eval(Container.DataItem,"Name")%>' width="30" height="30" /> </td> </tr> </table> </ItemTemplate> </asp:DataList> </td> </tr> </table>

Code-Shopping/Featured Products/ucFeaturedp.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ShoppingCart.BL; public partial class Featured_Products_ucFeaturedp : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { DataSet dsProducts = ProductController.ViewGallery(); dlProduct.DataSource = dsProducts; dlProduct.DataBind(); } }

Code-Shopping/Gallery/frmGallery.aspx

<%@ Page Language="C#" MasterPageFile="~/Templates/Default/MasterPage.master" AutoEventWireup="true" CodeFile="frmGallery.aspx.cs" Inherits="Gallery_frmGallery" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <table width="100%" border="0"> <tr> <td> <h3>Gallery</h3></td></tr> <tr> <td> <img width="100" height="100" src="../Browse/Images/bananashirt_75x75.jpg" /> </td> <td> <img width="100" height="100" src="../Browse/Images/bugfrog.jpg" /> </td> <td> <img width="100" height="100" src="../Browse/Images/chocchips.jpg" /> </td> <td> <img width="100" height="100" src="../Browse/Images/dottedfab.jpg" /> </td> <td> <img width="100" height="100" src="../Browse/Images/duralee.jpg" /> </td> </tr> <tr> <td> <img width="100" height="100" src="../Browse/Images/fabsoocer.jpg" /></td> <td> <img width="100" height="100" src="../Browse/Images/fab.jpg" /> </td> <td> <img width="100" height="100" src="../Browse/Images/feelingfabric.jpg" /> </td> <td> <img width="100" height="100" src="../Browse/Images/flralfancy.jpg" /> </td> <td> <img width="100" height="100" src="../Browse/Images/Halloween.jpg" /> </td> </tr> <tr> <td> <img width="100" height="100" src="../Browse/Images/shirts.jpg" /> </td> <td> <img width="100" height="100" src="../Browse/Images/images1.jpg" /> </td> <td> <img width="100" height="100" src="../Browse/Images/images11.jpg" /> </td> <td> <img width="100" height="100" src="../Browse/Images/kid.jpg" /> </td> <td> <img width="100" height="100" src="../Browse/Images/ties.jpg" /> </td> </tr> </table> </asp:Content>

Code-Shopping/Gallery/frmGallery.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Gallery_frmGallery : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/Global.asax

<%@ Application Language="C#" %> <script runat="server"> void Application_Start(object sender, EventArgs e) { // Code that runs on application startup } void Application_End(object sender, EventArgs e) { // Code that runs on application shutdown } void Application_Error(object sender, EventArgs e) { // Code that runs when an unhandled error occurs } void Session_Start(object sender, EventArgs e) { // Code that runs when a new session is started Session["sessionId"] = HttpContext.Current.Session.SessionID; } void Session_End(object sender, EventArgs e) { // Code that runs when a session ends. // Note: The Session_End event is raised only when the sessionstate mode // is set to InProc in the Web.config file. If session mode is set to StateServer // or SQLServer, the event is not raised. } </script>

Code-Shopping/MyAccount/frmChangeAccountDetails.aspx

<%@ Page Language="C#" MasterPageFile="~/Browse/MasterPage1.master" AutoEventWireup="true" CodeFile="frmChangeAccountDetails.aspx.cs" Inherits="MyAccount_frmChangeAccountDetails" %> <%@ Register Src="ucChangeDetails.ascx" TagName="ucChangeDetails" TagPrefix="uc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <uc1:ucChangeDetails id="UcChangeDetails1" runat="server"> </uc1:ucChangeDetails> </asp:Content>

Code-Shopping/MyAccount/frmChangeAccountDetails.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class MyAccount_frmChangeAccountDetails : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/MyAccount/frmMyAccount.aspx

<%@ Page Language="C#" MasterPageFile="~/Browse/MasterPage1.master" AutoEventWireup="true" CodeFile="frmMyAccount.aspx.cs" Inherits="MyAccount_frmMyAccount" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server"> <table> <ol> <tr> <td> <li><a href='/Shopping/MyAccount/frmChangeAccountDetails.aspx?U=<%=Request["u"]%>' style="color: red"> Change Account Details</a> </li> </td> </tr> <tr> <td> <li><a href='/Shopping/OrderDetails/frmOrderDetails.aspx' style="color: red">View Order History</a></li></td> </tr> <tr> <td> <li><a href='/Shopping/OrderDetails/frmSubmitOrderno.aspx' style="color: red">View Order status</a></li></td> </tr> <tr> <td> <li><a href="/Shopping/WishList/frmWishList.aspx" style="color: red">View Wish List</a></li></td> </tr> </ol> </table> </asp:Content>

Code-Shopping/MyAccount/frmMyAccount.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class MyAccount_frmMyAccount : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/MyAccount/ucChangeDetails.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucChangeDetails.ascx.cs" Inherits="MyAccount_ucChangeDetails" %> <%@ Register Assembly="GMDatePicker" Namespace="GrayMatterSoft" TagPrefix="cc1" %> <table> <tr> <th align="left"colspan="2" style="font-family:Verdana; color:orange; font-size:medium"> Account Details </th> </tr> <tr> <td align="right"> <asp:Label ID="lblUser" runat="server" Text="UserName"> </asp:Label> </td> <td> <asp:TextBox ID="txtUser" runat="server" Enabled="false"> </asp:TextBox> </td> </tr> <tr> <td align="right"> <span style="color: Red">*</span>First Name: </td> <td align="left" style="height: 34px"> <asp:TextBox ID="txtfname" runat="server" CausesValidation="true"></asp:TextBox> <asp:RequiredFieldValidator ID="rfvUser" ControlToValidate="txtfname" runat="server" Text="*" Display="Dynamic" ErrorMessage="Username cannot be blank" ToolTip="Username cannot be blank"></asp:RequiredFieldValidator> </td> </tr> <tr> <td align="right"> Last Name: </td> <td align="left" style="width: 551px"> <asp:TextBox ID="txtlname" runat="server" CausesValidation="true"></asp:TextBox> </td> </tr> <tr> <td align="right" style="width: 195px"> Date Of Birth: </td> <td align="left" style="width: 551px"> <cc1:GMDatePicker ID="GMDatePicker1" runat="server"> </cc1:GMDatePicker> </td> </tr> <tr> <td align="right"> <span style="color: Red">*</span>Gender: </td> <td align="left" style="width: 551px"> <asp:RadioButtonList ID="rdSex" runat="server" RepeatDirection="Horizontal"> <asp:ListItem Text="Male" Value="Male"> </asp:ListItem> <asp:ListItem Text="Female" Value="Female"> </asp:ListItem> </asp:RadioButtonList> <asp:RequiredFieldValidator ID="GenderValidator" runat="server" ErrorMessage="PLZ Select the gender!!!" ControlToValidate="rdSex" Display="Dynamic"></asp:RequiredFieldValidator> </td> </tr> <tr> <td align="right" style="width: 195px"> Contact No: </td> <td align="left" style="width: 551px"> <asp:TextBox ID="txtcontact" MaxLength="12" runat="server"> </asp:TextBox> </td> </tr> <tr> <td align="right"> E-Mail ID: </td> <td align="left"> <asp:TextBox ID="txtmail" runat="server"></asp:TextBox> </td> </tr> <tr> <td align="right" style="height: 23px"> Hint Question: </td> <td align="left" style="height: 23px"> <asp:DropDownList ID="ddlQuestion" runat="server"> <asp:ListItem>What is your Favourite Pet</asp:ListItem> <asp:ListItem>What is Your Favourite Color</asp:ListItem> <asp:ListItem>What is your Favourite PassTime</asp:ListItem> <asp:ListItem>What is your Favourite Food</asp:ListItem> <asp:ListItem>What is your Favourite movie</asp:ListItem> <asp:ListItem>Which is Your Favourite Bike</asp:ListItem> </asp:DropDownList> </td> </tr> <tr> <td align="right"> Answer: </td> <td> <asp:TextBox ID="txtAnswer" runat="SERVER"></asp:TextBox> </td> </tr> <tr> <th colspan="2" align="left" style="width: 100%; color:orange;font-family: Verdana;"> Address Details </th> </tr> <tr> <td align="right"> <span style="color: Red">*</span>Address: </td> <td align="left"> <asp:TextBox ID="txtaddr" runat="server" TextMode="MultiLine"> </asp:TextBox> <asp:RequiredFieldValidator ID="rfvAddress" runat="server" Display="dynamic" ControlToValidate="txtaddr" Text="*" ToolTip="Must enter Address"> </asp:RequiredFieldValidator> </td> </tr> <tr> <td align="right"> <span style="color: Red">*</span>Country:</td> <td align="left"> <asp:DropDownList ID="ddlcountry" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlcountry_SelectedIndexChanged"> </asp:DropDownList> </td> </tr> <tr> <td align="right"> <span style="color: Red">*</span>State: </td> <td align="left"> <asp:DropDownList ID="ddlstate" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlstate_SelectedIndexChanged"> </asp:DropDownList> </td> </tr> <tr> <td align="right"> <span style="color: Red">*</span>City: </td> <td align="left"> <asp:DropDownList ID="ddlcity" runat="server" AutoPostBack="True"> </asp:DropDownList> </td> </tr> <tr> <td align="right"> ZIP Code: </td> <td align="left"> <asp:TextBox ID="txtZipCode" MaxLength="6" runat="server"></asp:TextBox> </td> </tr> <tr> <td colspan="2" align="center"> <asp:Button ID="btnUpdate" runat="server" Text="Submit" OnClick="btnUpdate_Click" /> <asp:Label ID="lbl" runat="server" Text="" Font-Size="Medium" Font-Bold="true" ForeColor="red"></asp:Label> </td> </tr> </table>

Code-Shopping/MyAccount/ucChangeDetails.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ShoppingCart.BL; using System.Data.SqlClient; public partial class MyAccount_ucChangeDetails : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { string s = ""; ; if (Session["Username"] != null) { s = Session["Username"].ToString(); txtUser.Text = s; } SqlDataReader dr = ProductController.getAccountDetails(s); if (!IsPostBack) { country(); state(); city(); if (dr.HasRows) { if (dr.Read()) { GMDatePicker1.DateString = dr["DOB"].ToString(); txtfname.Text = dr["FName"].ToString(); txtlname.Text = dr["LName"].ToString(); rdSex.SelectedValue = dr["Gender"].ToString(); txtcontact.Text = dr["ContactNo"].ToString(); txtmail.Text = dr["EmailID"].ToString(); //ddlQuestion.Items.FindByText(dr["HintQuestion"].ToString()).Selected = true; ListItem li = ddlQuestion.Items.FindByText(dr["HintQuestion"].ToString().Trim()); if (li != null) li.Selected = true; txtAnswer.Text = dr["Answer"].ToString(); txtaddr.Text = dr["Address"].ToString(); txtZipCode.Text = dr["ZipCode"].ToString(); ddlcountry.Items.FindByText(dr["CountryName"].ToString()).Selected = true; ddlstate.Items.FindByText(dr["StateName"].ToString()).Selected = true; ddlcity.Items.FindByText(dr["Cityname"].ToString()).Selected = true; } } } } private void state() { DataSet dsState = ProductController.getAllStatedetails(); BindDDL(ddlstate, dsState, "Name", "ID"); } private void country() { DataSet dsCountry = ProductController.getCountrydetails(); BindDDL(ddlcountry, dsCountry, "Name", "ID"); } private void city() { DataSet dscity = ProductController.getCitydetails(); BindDDL(ddlcity, dscity, "Name", "ID"); } private void BindDDL(DropDownList ddl, DataSet ds, string txtField, string valField) { ddl.DataSource = ds; ddl.DataTextField = txtField; ddl.DataValueField = valField; ddl.DataBind(); } protected void ddlstate_SelectedIndexChanged(object sender, EventArgs e) { DataSet dscity = ProductController.getCitydetailsByStateID(int.Parse(ddlstate.SelectedValue)); BindDDL(ddlcity, dscity, "Name", "ID"); } protected void ddlcountry_SelectedIndexChanged(object sender, EventArgs e) { DataSet dsState = ProductController.getAllStatesByCountryID(int.Parse(ddlcountry.SelectedValue)); BindDDL(ddlstate, dsState, "Name", "ID"); DataSet dscity = ProductController.getCitydetailsByStateID(int.Parse(ddlstate.SelectedValue)); BindDDL(ddlcity, dscity, "Name", "ID"); } protected void btnUpdate_Click(object sender, EventArgs e) { ProductController.getupdate(txtUser.Text, txtfname.Text, txtlname.Text,ddlQuestion.SelectedItem.Text ,txtAnswer.Text,GMDatePicker1.Date,txtcontact.Text, rdSex.Text,txtmail.Text, txtaddr.Text,int.Parse( ddlcountry.SelectedValue), int.Parse(ddlstate.SelectedValue),int.Parse( ddlcity.SelectedValue), txtZipCode.Text); lbl.Text = "Your data is updated"; } }

Code-Shopping/myNewBanner.swf

Code-Shopping/OrderDetails/frmOrderDetails.aspx

<%@ Page Language="C#" MasterPageFile="~/Browse/MasterPage1.master" AutoEventWireup="true" CodeFile="frmOrderDetails.aspx.cs" Inherits="OrderDetails_frmOrderDetails" %> <%@ Register Src="ucOrderDetails.ascx" TagName="ucOrderDetails" TagPrefix="uc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <uc1:ucOrderDetails ID="UcOrderDetails1" runat="server" /> </asp:Content>

Code-Shopping/OrderDetails/frmOrderDetails.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class OrderDetails_frmOrderDetails : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/OrderDetails/frmOrderStatus.aspx

<%@ Page Language="C#" MasterPageFile="~/Templates/Default/MasterPage.master" AutoEventWireup="true" CodeFile="frmOrderStatus.aspx.cs" Inherits="OrderDetails_frmOrderStatus" %> <%@ Register Src="ucOrderStatus.ascx" TagName="ucOrderStatus" TagPrefix="uc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <uc1:ucOrderStatus ID="UcOrderStatus1" runat="server" /> </asp:Content>

Code-Shopping/OrderDetails/frmOrderStatus.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class OrderDetails_frmOrderStatus : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/OrderDetails/frmSubmitOrderno.aspx

<%@ Page Language="C#" MasterPageFile="~/Templates/Default/MasterPage.master" AutoEventWireup="true" CodeFile="frmSubmitOrderno.aspx.cs" Inherits="OrderDetails_frmSubmitOrderno" %> <%@ Register Src="ucSubmitOrderno.ascx" TagName="ucSubmitOrderno" TagPrefix="uc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <uc1:ucSubmitOrderno id="UcSubmitOrderno1" runat="server"> </uc1:ucSubmitOrderno> </asp:Content>

Code-Shopping/OrderDetails/frmSubmitOrderno.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class OrderDetails_frmSubmitOrderno : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/OrderDetails/ucOrderDetails.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucOrderDetails.ascx.cs" Inherits="OrderDetails_ucOrderDetails" %> <table width="100%"> <tr> <td></td> <td style="width: 100%"> <asp:DataList ID="dlOrders" runat="server" Width="100%" CellPadding="4" ForeColor="#333333"> <HeaderTemplate> <table width="100%"> <tr> <td align="center" style="width:7%">CustomerId</td> <td align="center" style="width:7%">OrderId</td> <td align="center" style="width:7%">OrderDate</td> <td align="center" style="width:7%">ProductId</td> <td align="center" style="width:7%">ProductName</td> <td align="center" style="width:7%">ProductImage</td> <td align="center" style="width:7%">Price</td> <td align="center" style="width:7%">Quantity</td> <td align="center" style="width:7%">OrderAmount</td> <td align="center" style="width:7%">ShippingAmount</td> <td align="center" style="width:7%">TaxAmount</td> <td align="center" style="width:7%">NetAmount</td> <td align="center" style="width:7%">OrderStatus</td> </tr> </table> </HeaderTemplate> <ItemTemplate> <table width="100%"> <tr> <td style="width:7%"> <asp:Label ID="lblCustomerId" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"CustomerId")%>'> </asp:Label> </td> <td style="width:7%"><asp:Label ID="lblOrderId" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"OrderId")%>'> </asp:Label> </td> <td style="width:7%"> <asp:Label ID="lblOrderDate" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"OrderDate")%>'> </asp:Label> </td> <td style="width:7%"> <asp:Label ID="lblProductId" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"ProductId")%>'> </asp:Label> </td> <td style="width:7%"> <asp:Label ID="lblProductName" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"ProductName")%>'> </asp:Label> </td> <td style="width:7%"> <img src='<%#DataBinder.Eval(Container.DataItem,"ProductImage","/Shopping/Browse/Images/{0}")%>' alt='<%#DataBinder.Eval(Container.DataItem,"ProductName")%>' width="30" height="30" /> </td> <td style="width:7%"> <asp:Label ID="lblPrice" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Price")%>'> </asp:Label></td> <td style="width:7%"> <asp:Label ID="lblQuantity" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Quantity")%>'> </asp:Label></td> <td style="width:7%"> <asp:Label ID="LabelOrderAmount" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"OrderAmount")%>'> </asp:Label></td> <td style="width:7%"> <asp:Label ID="lblShippingAmount" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"ShippingAmount")%>'> </asp:Label></td> <td style="width:7%"> <asp:Label ID="lblTaxAmount" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"TaxAmount")%>'> </asp:Label></td> <td style="width:7%"> <asp:Label ID="lblNetAmount" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"NetAmount")%>'> </asp:Label></td> <td style="width:7%"> <asp:Label ID="lblOrderStatus" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"OrderStatus")%>'> </asp:Label></td> </tr> </table> </ItemTemplate> </asp:DataList> </td> </tr> </table>

Code-Shopping/OrderDetails/ucOrderDetails.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ShoppingCart.BL; using System.Data.SqlClient; public partial class OrderDetails_ucOrderDetails : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { if (Session["UserName"] != null) { string s = Session["UserName"].ToString(); DataSet dsRetrieveOrders = ProductController.RetrieveOrderDetails(s); dlOrders.DataSource = dsRetrieveOrders; dlOrders.DataBind(); } } }

Code-Shopping/OrderDetails/ucOrderStatus.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucOrderStatus.ascx.cs" Inherits="OrderDetails_ucOrderStatus" %> <table width="100%"> <tr> <td></td> <td style="width: 100%"> <asp:DataList ID="dlOrders" runat="server" Width="100%" CellPadding="4" ForeColor="#333333"> <HeaderTemplate> <table width="100%"> <tr> <td align="center" style="width:25%">CustomerId</td> <td align="center" style="width:25%">OrderId</td> <td align="center" style="width:25%">OrderDate</td> <td align="center" style="width:25%">OrderStatus</td> </tr> </table> </HeaderTemplate> <ItemTemplate> <table width="100%"> <tr> <td style="width:25%" align="center"> <asp:Label ID="lblCustomerId" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"CustomerId")%>'> </asp:Label> </td> <td style="width:25%" align="center"><asp:Label ID="lblOrderId" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"OrderId")%>'> </asp:Label> </td> <td style="width:25%" align="center"> <asp:Label ID="lblOrderDate" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"OrderDate")%>'> </asp:Label> </td> <td style="width:25%" align="center"> <asp:Label ID="lblOrderStatus" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"OrderStatus")%>'> </asp:Label></td> </tr> </table> </ItemTemplate> </asp:DataList> </td> </tr> <tr> <td colspan="7" align="center"> <asp:Button ID="btnCancelOrder" runat="server" Text="CancelOrder" OnClick="btnCancelOrder_Click" /> </td> </tr> </table>

Code-Shopping/OrderDetails/ucOrderStatus.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ShoppingCart.BL; public partial class OrderDetails_ucOrderStatus : System.Web.UI.UserControl { int On; protected void Page_Load(object sender, EventArgs e) { if (Session["UserName"] != null) { string s = Session["UserName"].ToString(); On = Int16.Parse(Request["Orderno"].ToString()); Response.Write(On); DataSet dsRetrieveOrders = ProductController.RetrieveOrderStatus(s, On); dlOrders.DataSource = dsRetrieveOrders; dlOrders.DataBind(); } } protected void btnCancelOrder_Click(object sender, EventArgs e) { On = Int16.Parse(Request["Orderno"].ToString()); ProductController.DeleteOrderDetails(On); } }

Code-Shopping/OrderDetails/ucSubmitOrderno.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucSubmitOrderno.ascx.cs" Inherits="OrderDetails_ucSubmitOrderno" %> <table width="100%" > <tr> <td align="right" style="width:50%"> <asp:Label ID="lblOrderId" runat="server" Text="OrderId"> </asp:Label> </td> <td align="center" style="width:50%"> <asp:TextBox ID="txtOrderId" ValidationGroup="o" runat="server"> </asp:TextBox> <asp:RequiredFieldValidator ValidationGroup="o" ID="rfvOrderid" runat="server" ControlToValidate="txtOrderId" ErrorMessage="This field cannot be blank!!Plz Enter Order no" Display="Dynamic"> </asp:RequiredFieldValidator> </td> </tr> <tr> <td align="center" colspan="2"> <asp:Button ID="btnSubmit" ValidationGroup="o" Text="Submit" runat="server" OnClick="btnSubmit_Click" /> </td> </tr> </table>

Code-Shopping/OrderDetails/ucSubmitOrderno.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class OrderDetails_ucSubmitOrderno : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { } protected void btnSubmit_Click(object sender, EventArgs e) { Response.Redirect("/Shopping/OrderDetails/frmOrderStatus.aspx?Orderno=" + txtOrderId.Text); } }

Code-Shopping/Payment/frmPayment.aspx

<%@ Page Language="C#" MasterPageFile="~/Browse/MasterPage1.master" AutoEventWireup="true" CodeFile="frmPayment.aspx.cs" Inherits="Payment_frmPayment" %> <%@ Register Src="UcPayment.ascx" TagName="UcPayment" TagPrefix="uc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <uc1:UcPayment ID="UcPayment1" runat="server" OnLoad="UcPayment1_Load" /> </asp:Content>

Code-Shopping/Payment/frmPayment.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Payment_frmPayment : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void UcPayment1_Load(object sender, EventArgs e) { } }

Code-Shopping/Payment/UcPayment.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="UcPayment.ascx.cs" Inherits="Payment_UcPayment" %> <script language="javascript" type="text/javascript"> // <!CDATA[ // ]]> </script> <table width="100%" id="TABLE1"> <tr> <td style="width: auto"> <asp:Label ID="lbltitle" runat="server" Text="Payment Details" ForeColor="gray" Font-Size="Large" Width="283px"></asp:Label> </td> </tr> <tr> </tr> <tr> </tr> <tr> <td> <asp:Label ID="lblSummary" runat="server" Text="Order Summary" BackColor="Cornsilk"> </asp:Label> </td> </tr> <tr> </tr> <tr> </tr> <tr style="width: 100%"> <td align="center" style="width: 40%"> <asp:Label ID="lblCamount" runat="server" Text="Cart Amount"> </asp:Label> </td> <td> <asp:TextBox ID="txtcamount" runat="server" OnTextChanged="txtcamount_TextChanged" Width="225px" Enabled="False" EnableTheming="True"></asp:TextBox> </td> </tr> <tr style="width: 100%"> <td align="center" style="width: 40%"> <asp:Label ID="lbltamount" runat="server" Text="Tax Amount(8.5)"> </asp:Label> </td> <td> <asp:TextBox ID="txttamount" runat="server" Width="225px" Enabled="False"></asp:TextBox> </td> </tr> <tr style="width: 100%"> <td align="center" style="width: 40%"> <asp:Label ID="lblsamount" runat="server" Text="Shipping Amount"> </asp:Label> </td> <td> <asp:TextBox ID="txtsamount" runat="server" Width="223px" Text="$10" Enabled="False"></asp:TextBox> </td> </tr> <tr style="width: 100%"> <td align="center" style="width: 40%; height: 26px;"> <asp:Label ID="lblnamount" runat="server" Text="Net Payable Amount"> </asp:Label> </td> <td style="height: 26px"> <asp:TextBox ID="txtnamount" runat="server" Width="225px" Enabled="False"></asp:TextBox> </td> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> <td> <asp:Label ID="lblenter" runat="server" Text="Accepted Cards: Visa,MasterCard,American Express"> </asp:Label> </td> <td> <asp:Image ID="icard" runat="server" ImageUrl="~/Browse/Images/PayCards.gif" /> </td> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> <td> <asp:Label ID="lblcdetails" runat="server" Text="Enter card details" Font-Size="Larger"> </asp:Label> </td> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr style="width: 100%"> <td style="width: 40%" align="center"> <asp:Label ID="lblcnumber" runat="server" Text="Card Number" Font-Size="Small"> </asp:Label> </td> <td> &nbsp; <asp:TextBox ID="txtCardno" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="txtCardno" ToolTip="Must enter Card number">*</asp:RequiredFieldValidator> <asp:RegularExpressionValidator ID="revcno" runat="server" ControlToValidate="txtCardno" ToolTip="Must enter card number" Text="*" ErrorMessage="Must enter card number" ValidationExpression="\d{4}-\d{4}-\d{4}-\d{4}"></asp:RegularExpressionValidator> </td> <td> *Enter in format (1111-1111-1111-1111) </td> </tr> <tr> </tr> <tr style="width: 100%"> <td style="width: 40%; height: 59px;" align="center"> <asp:Label ID="lblccode" runat="server" Font-Size="Small" Text="Card Code"> </asp:Label> </td> <td> <asp:TextBox ID="txtcode" runat="server"></asp:TextBox> <asp:RegularExpressionValidator ID="revCode" runat="server" ControlToValidate="txtcode" ToolTip="Must enter 3-4 digit card code" Text="*" ErrorMessage="Must enter 3-4 digit card code" ValidationExpression="\d{3,4}"></asp:RegularExpressionValidator> </td> <td style="height: 59px"> *(Valid CVV2,CVC2 or CID value,3 or 4 digit number on back of credit card for American Express) </td> </tr> <tr> </tr> <tr> </tr> <tr style="width: 100%"> <td style="width: 40%" align="center"> <asp:Label ID="lblexpiry" runat="server" Text="Expiry Date"> </asp:Label> </td> <td> <asp:DropDownList ID="ddlMonth" runat="server" ToolTip="EnterMonth"> <asp:ListItem></asp:ListItem> </asp:DropDownList> <asp:RequiredFieldValidator ID="rfvMonth" runat="server" ControlToValidate="ddlMonth" ErrorMessage="RequiredFieldValidator" ToolTip="Select Month">*</asp:RequiredFieldValidator> <asp:DropDownList ID="ddlyear" runat="server" ToolTip="EnterYear"> <asp:ListItem></asp:ListItem> </asp:DropDownList> <asp:RequiredFieldValidator ID="rfvYear" runat="server" ControlToValidate="ddlyear" ErrorMessage="RequiredFieldValidator" ToolTip="Select Year">*</asp:RequiredFieldValidator> &nbsp; mm/yyyy</td> </tr> <tr> </tr> <tr> </tr> <tr> <td colspan="2" align="center"> <asp:Button ID="btnpay" runat="server" Text="PAY NOW" OnClick="btnpay_Click" CausesValidation="True" /> </td> </tr> </table>

Code-Shopping/Payment/UcPayment.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ShoppingCart.BL; public partial class Payment_UcPayment : System.Web.UI.UserControl { int OrderNo; double carttotal, taxamt; protected void Page_Load(object sender, EventArgs e) { string SessionId; SessionId = Session["sessionId"].ToString(); for (int i = 1; i <= 12; i++) { ddlMonth.Items.Add(i.ToString()); } for (int j = 2007; j <= 2099; j++) { ddlyear.Items.Add(j.ToString()); } carttotal = Int32.Parse(ProductController.GetCartTotal(SessionId).ToString()); taxamt = 0.085 * ProductController.GetCartTotal(SessionId); txtcamount.Text = "$ " + ProductController.GetCartTotal(SessionId).ToString(); txttamount.Text = "$" + (0.085 * Int32.Parse(ProductController.GetCartTotal(SessionId).ToString())); txtnamount.Text = "$"+(carttotal + taxamt+10).ToString(); } protected void txtcamount_TextChanged(object sender, EventArgs e) { } protected void btnpay_Click(object sender, EventArgs e) { int i; string a; a = Session["sessionid"].ToString(); if (Session["UserName"] != null) { i = ProductController.GetIdFromtblUserAccount(Session["UserName"].ToString()); OrderNo = ProductController.insertorder(i, float.Parse(carttotal.ToString()), float.Parse(taxamt.ToString()), float.Parse((carttotal + taxamt + 10).ToString()), Int32.Parse(Session["shipid"].ToString()), Int32.Parse(Session["billid"].ToString()), a, Request["Billfname"].ToString()); btnpay.Enabled = false; Response.Redirect("/Shopping/Thanks page/frmThanks.aspx?orderno=" + OrderNo); } else { OrderNo = ProductController.insertorder(int.Parse(Request["Custid"].ToString()), float.Parse(carttotal.ToString()), float.Parse(taxamt.ToString()), float.Parse((carttotal + taxamt + 10).ToString()), Int32.Parse(Session["shipid"].ToString()), Int32.Parse(Session["billid"].ToString()), a, Request["Billfname"].ToString()); Response.Redirect("/Shopping/Thanks page/frmThanks.aspx?orderno=" + OrderNo); } } public int orderno { get { return OrderNo; } } }

Code-Shopping/Registration/frmChangePassword.aspx

<%@ Page Language="C#" MasterPageFile="~/Browse/MasterPage1.master" AutoEventWireup="true" CodeFile="frmChangePassword.aspx.cs" Inherits="Browse_frmChangePassword" %> <%@ Register Src="RContols/ucResetPassword.ascx" TagName="ucResetPassword" TagPrefix="uc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <uc1:ucResetPassword ID="UcResetPassword1" runat="server" /> </asp:Content>

Code-Shopping/Registration/frmChangePassword.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Browse_frmChangePassword : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/Registration/frmForgotPassword.aspx

<%@ Page Language="C#" MasterPageFile="~/Browse/MasterPage1.master" AutoEventWireup="true" CodeFile="frmForgotPassword.aspx.cs" Inherits="Browse_frmForgotPassword" %> <%@ Register Src="RContols/ucForgotPassword.ascx" TagName="ucForgotPassword" TagPrefix="uc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <uc1:ucForgotPassword ID="UcForgotPassword1" runat="server" /> </asp:Content>

Code-Shopping/Registration/frmForgotPassword.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Browse_frmForgotPassword : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/Registration/frmLogin.aspx

<%@ Page Language="C#" MasterPageFile="~/Templates/Default/MasterPage.master" AutoEventWireup="true" CodeFile="frmLogin.aspx.cs" Inherits="Registration_frmLogin" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server"> <table width="100%"> <tr> <td> <asp:Label ID="lblLogin" runat="server"><b>Log In</b></asp:Label>&nbsp;<br /> <div> <asp:Label ID="lblError" runat="server" Font-Bold="true" ForeColor="red" Text=""></asp:Label> </div> <table> <tr> <td> UserName: </td> <td> <asp:TextBox ID="txtUserName" runat="server" Width="160px"></asp:TextBox> <asp:RequiredFieldValidator ID="rfvUser" runat="server" ControlToValidate="txtUserName" Text="*" ToolTip="Username cannot be Blank" Display="Dynamic"></asp:RequiredFieldValidator> </td> </tr> <tr> <td> Password: </td> <td> <asp:TextBox ID="txtPwd" runat="server" TextMode="Password" Width="160px"></asp:TextBox> <asp:RequiredFieldValidator ID="rfvPwd" runat="server" ControlToValidate="txtPwd" Text="*" ToolTip="Must enter password" Display="Dynamic"></asp:RequiredFieldValidator> </td> </tr> <tr> <td colspan="2"> <asp:Button ID="btnSignin" Text="Sign in" runat="server" OnClick="btnSignin_Click" /> </td> <td> </td> </tr> <tr> <td colspan="2"> &nbsp;</td> <td> </td> </tr> <tr> <td align="center" colspan="2">Not yet Registered? Click here to <a href="/Shopping/Registration/frmNewUser.aspx">Register Now</a> </td> </tr> <tr> <td align="center" colspan="2"> &nbsp;</td> </tr> <tr> <td align="center" colspan="2"> <a href="/Shopping/Registration/frmForgotPassword.aspx">Forgot Password?</a> </td> </tr> <%--<tr> <td> </td> <td align="right"> <a href="/reEasyWear/Registration/frmChangePassword.aspx">Change Password</a> </td> </tr>--%> </table> </td> </tr> </table> </asp:Content>

Code-Shopping/Registration/frmLogin.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ShoppingCart.BL; using System.Data.SqlClient; public partial class Registration_frmLogin : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void btnSignin_Click(object sender, EventArgs e) { string s,l; int IdRole = 0; SqlDataReader dr = ProductController.GetLogin(txtUserName.Text, txtPwd.Text); if (dr != null) { if (dr.Read()) { s = dr["FName"].ToString(); l = dr["LName"].ToString(); Session["Username"] = txtUserName.Text; Object obj = ProductController.GetRoleByUsername(txtUserName.Text.Trim()); if (obj != null) { IdRole = Convert.ToInt32(obj.ToString()); } //FormsAuthentication.RedirectFromLoginPage(txtUserName.Text.Trim(),false); if (IdRole == 8) Response.Redirect("~/Admin/frmAdmin.aspx"); else Response.Redirect("/Shopping/MyAccount/frmMyAccount.aspx?u=" + Session["Username"]); } else { lblError.Text="not a valid user"; } } } }

Code-Shopping/Registration/frmNewUser.aspx

<%@ Page Language="C#" MasterPageFile="~/Browse/MasterPage1.master" AutoEventWireup="true" CodeFile="frmNewUser.aspx.cs" Inherits="Registration_frmNewUser" %> <%@ Register Src="RContols/ucRegistration.ascx" TagName="ucRegistration" TagPrefix="uc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <uc1:ucRegistration ID="UcRegistration1" runat="server" /> </asp:Content>

Code-Shopping/Registration/frmNewUser.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Registration_frmNewUser : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/Registration/RContols/ucForgotPassword.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucForgotPassword.ascx.cs" Inherits="Browse_Controls_ucForgotPassword" %> <asp:Panel ID="Panel1" runat="server" Width="100%"> <table cellspacing="2" width="100%"> <tr align="center" style="width: 100%"> <td style="background-color: #ccccff;"> <asp:Label ID="lblUser" Text="Username" runat="server"> </asp:Label> </td> <td align="left"> <asp:TextBox ID="txtUser" runat="server"> </asp:TextBox> <asp:RequiredFieldValidator ID="rfvUser" runat="server" ControlToValidate="txtUser" ErrorMessage="Must enter username"> </asp:RequiredFieldValidator> </td> <td> <asp:Label ID="lbler" Font-Bold="true" ForeColor="red" runat="server"></asp:Label> </td> </tr> <tr style="width: 100%" align="center"> <td style="background-color: #ccccff"> <asp:Label ID="lblEmail" Text="Email Id" runat="server"> </asp:Label> </td> <td align="left"> <asp:TextBox ID="txtEmail" Text="" runat="server"> </asp:TextBox> <asp:RequiredFieldValidator ID="rfvEmail" runat="server" ControlToValidate="txtEmail" ErrorMessage="Must enter Mail Id" Display="Dynamic"></asp:RequiredFieldValidator> <asp:RegularExpressionValidator ID="revMail" runat="server" ControlToValidate="txtEmail" Display="Dynamic" ErrorMessage="Not in correct format" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator> </td> </tr> <tr align="center"> <td colspan="2"> <asp:Button ID="btnSubmit" Text="Submit" BackColor="#9999ff" runat="Server" OnClick="btnSubmit_Click" /> </td> </tr> </table> </asp:Panel> <br /> <asp:Panel ID="Panel2" runat="server" Visible="false" Width="100%"> <table cellspacing="2" width="100%"> <tr> <td style="background-color: #ccccff"> <asp:Label ID="lblUser1" Text="Username:" runat="server"> </asp:Label> </td> <td> <asp:TextBox ID="txtUser1" runat="server" Enabled="False"></asp:TextBox> </td> </tr> <tr> <td style="background-color: #ccccff"> <asp:Label ID="lblQ" runat="server" Text="Question:"> </asp:Label> </td> <td> <asp:Label ID="lblQuestion" runat="server" Width="200px" BackColor="#FFC0C0"></asp:Label> </td> </tr> <tr> <td style="background-color: #ccccff"> <asp:Label ID="lblAnswer" runat="server" Text="Answer:"> </asp:Label> </td> <td> <asp:TextBox ID="txtAnswer" runat="server"> </asp:TextBox> </td> <td> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtAnswer" ErrorMessage="Must Enter Answer" SetFocusOnError="True" Display="Dynamic"></asp:RequiredFieldValidator> </td> </tr> <tr> <td> <asp:Label ID="lblans" runat="server" ForeColor="red" Font-Bold="true"></asp:Label> </td></tr> <tr align="center"> <td colspan="2" align="center"> <table> <tr> <td> <asp:Button Text="Get Password" ID="btnPwd" BackColor="#9999ff" runat="server" OnClick="btnPwd_Click" /> </td> </tr> </table> </td> </tr> <tr> <td> <asp:Label ID="lbl" runat="server" Text=" "> </asp:Label> </td> </tr> </table> </asp:Panel>

Code-Shopping/Registration/RContols/ucForgotPassword.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ShoppingCart.BL; using System.Data.SqlClient; using System.Web.Mail; public partial class Browse_Controls_ucForgotPassword : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { } protected void btnSubmit_Click(object sender, EventArgs e) { string s = txtUser.Text; SqlDataReader dr = ProductController.getQuestion(txtUser.Text); if (dr != null) { if (dr.Read()) { txtUser1.Text = s; Panel1.Visible = false; Panel2.Visible = true; lblQuestion.Text = dr["HintQuestion"].ToString(); } else lbler.Text="Invalid Username!!!"; txtUser.Focus(); } } protected void btnPwd_Click(object sender, EventArgs e) { SqlDataReader dr = ProductController.getPassword(txtUser.Text, txtAnswer.Text); if (dr != null) { if (dr.Read()) { string s = ConfigurationManager.AppSettings["SendPwd"] + dr["Password"].ToString(); string From = ConfigurationManager.AppSettings["From"]; string subject = ConfigurationManager.AppSettings["Subject"]; sendmail(From, txtEmail.Text, subject, s); } else lblans.Text = "Invalid Answer!!! Try Again"; } } private void sendmail(string from, string to, string sub, string body) { try { MailMessage mail = new MailMessage(); mail.From = from; mail.To = to; mail.Subject = sub; mail.Body = body; SmtpMail.SmtpServer = "localhost"; SmtpMail.Send(mail); } catch (Exception ex) { lbl.Text=ex.Message; } } }

Code-Shopping/Registration/RContols/ucRegistration.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucRegistration.ascx.cs" Inherits="Browse_Controls_ucRegistration" %> <%@ Register Assembly="GMDatePicker" Namespace="GrayMatterSoft" TagPrefix="cc1" %> <table cellpadding="5" cellspacing="3"><%-- style="background-color: #ccccff"--%> <tr> <td colspan="2"> <asp:Label ID="lblres" runat="server" BackColor="#80FF80" Font-Bold="True" ForeColor="Red" ></asp:Label> </td> </tr> <tr> <td colspan="2" align="left" style="width: 100%;font-family: Verdana;color:Orange; font-size: 10pt; font-style: italic; font-weight: bolder"> Account Details </td> </tr> <tr> <td align="right"> <span style="color: Red">*</span> User Name: <br /> <small>(Enter your E-Mail ID) </small> </td> <td align="left"> <asp:TextBox ID="txtuser" runat="server" CausesValidation="true"></asp:TextBox> <asp:RequiredFieldValidator ID="rfvUsername" runat="server" ErrorMessage="User name required" ControlToValidate="txtuser" ToolTip="User name required">*</asp:RequiredFieldValidator> <asp:RegularExpressionValidator ID="revUserName" runat="server" Text="*" ErrorMessage="Invalid Username, Please enter in emailid format" ControlToValidate="txtUser" Display="Dynamic" ToolTip="Invalid Username, Please enter in emailid format" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>&nbsp; <asp:Label ID="lblUser" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label> </td> </tr> <tr> <td align="right"> <span style="color: Red">*</span>Password: </td> <td align="left"> <asp:TextBox ID="txtpswd" runat="server" MaxLength="10" CausesValidation="true" TextMode="Password"> </asp:TextBox> <small style="color: Blue">(Minimum 3-10 characters)</small> <asp:RequiredFieldValidator ID="rfvpswd" runat="server" ControlToValidate="txtpswd" Text="*" ErrorMessage="Must enter password" ToolTip="Must enter password"></asp:RequiredFieldValidator> </td> </tr> <tr> <td align="right" style="width: 195px; height: 34px;"> <span style="color: Red">*</span>Re-Type Password: </td> <td align="left" style="width: 551px; height: 34px;"> <asp:TextBox ID="txtRePswd" runat="server" CausesValidation="true" TextMode="Password"> </asp:TextBox> <asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="Password mismatch" ControlToCompare="txtpswd" ControlToValidate="txtRePswd"></asp:CompareValidator> <asp:RequiredFieldValidator ID="rfvRetype" runat="server" Text="*" ToolTip="must reenter the password" ControlToValidate="txtRePswd"></asp:RequiredFieldValidator> </td> </tr> <tr> <td align="right" style="height: 32px"> <asp:Label ID="lblQuestion" runat="server"> Hint Question: </asp:Label> </td> <td style="height: 32px"> <asp:DropDownList ID="ddlQuestion" runat="server" Width="180px"> <asp:ListItem> What is your Favourite Pet</asp:ListItem> <asp:ListItem> What is Your Favourite Color</asp:ListItem> <asp:ListItem>What is your pass time</asp:ListItem> <asp:ListItem>What is your Favourite Food</asp:ListItem> <asp:ListItem>What is your Favourite movie</asp:ListItem> <asp:ListItem>Which is Your Favourite Bike</asp:ListItem> </asp:DropDownList> </td> </tr> <tr> <td align="right" style="height: 34px"> Answer: </td> <td align="left" style="height: 34px"> <asp:TextBox ID="txtAnswer" runat="server"> </asp:TextBox> </td> </tr> <tr> <td align="right" style="width: 195px"> </td> <td align="left" style="width: 551px"> &nbsp;</td> </tr> <tr> <td colspan="2" align="left" style="width: 100%; font-family: Verdana; font-size: 10pt; color:Orange; font-style: italic; font-weight: bolder"> Personal Details</td> </tr> <tr> <td align="right" style="width: 195px; height: 34px;"> <span style="color: Red">*</span>First Name: </td> <td align="left" style="height: 34px"> <asp:TextBox ID="txtfname" runat="server" CausesValidation="true"></asp:TextBox> <asp:RequiredFieldValidator ID="FirstNameValidator" runat="server" ControlToValidate="txtfname" ErrorMessage="First Name should not be empty" SetFocusOnError="True"></asp:RequiredFieldValidator> </td> </tr> <tr> <td align="right" style="width: 195px"> Last Name: </td> <td align="left" style="width: 551px"> <asp:TextBox ID="txtlname" runat="server" CausesValidation="true"></asp:TextBox> </td> </tr> <tr> <td align="right" style="width: 195px; height: 40px;"> Date Of Birth: </td> <td align="left" style="width: 551px; height: 40px;"> <cc1:GMDatePicker ID="GMDatePicker1" runat="server" Style="z-index: 225; left: 0px; position: absolute; top: 0px"> </cc1:GMDatePicker> <asp:Label ID="lblFormat" runat="server" Text="mm/dd/yyyy" Enabled="false"></asp:Label> </td> </tr> <tr> <td align="right" style="height: 55px"> <span style="color: Red">*</span>Gender: </td> <td align="left" style="width: 551px; height: 55px;"> <asp:RadioButtonList ID="rdSex" runat="server" RepeatDirection="Horizontal"> <asp:ListItem Text="Male" Value="Male"> </asp:ListItem> <asp:ListItem Text="Female" Value="Female"> </asp:ListItem> </asp:RadioButtonList> <asp:RequiredFieldValidator ID="GenderValidator" runat="server" ErrorMessage="PLZ Select the gender!!!" ControlToValidate="rdSex" Display="Dynamic"></asp:RequiredFieldValidator> </td> </tr> <tr> <td align="right" style="width: 195px"> Contact No: </td> <td align="left" style="width: 551px"> <asp:TextBox ID="txtcontact" MaxLength="20" runat="server"></asp:TextBox> <%--<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="txtcontact" ErrorMessage="Must enter contact no." ValidationExpression="\d{1,15}"></asp:RegularExpressionValidator> --%> <asp:CompareValidator ID="CompareValidator2" runat="server" ErrorMessage="Must enter numeric value" Operator="DataTypeCheck" Type="Integer" ControlToValidate="txtcontact"></asp:CompareValidator> </td> </tr> <tr> <td align="right" style="width: 195px; height: 34px;"> Alternate E-Mail ID: </td> <td align="left" style="width: 551px; height: 34px;"> <asp:TextBox ID="txtmail" runat="server"></asp:TextBox> </td> </tr> <tr> <td colspan="2" align="left" style="width: 100%;font-family: Verdana; font-size: 10pt; color: Orange; font-style: italic; font-weight: bolder"> Address Details </td> </tr> <tr> <td align="right" style="width: 195px"> <span style="color: Red">*</span>Address: </td> <td align="left" style="width: 551px"> <asp:TextBox ID="txtaddr" runat="server" TextMode="MultiLine"> </asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="This Field should not be blank" ControlToValidate="txtaddr"></asp:RequiredFieldValidator> </td> </tr> <tr> <td align="right" style="width: 195px; height: 32px;"> <span style="color: Red">*</span>Country:</td> <td align="left" style="width: 551px; height: 32px;"> <asp:DropDownList ID="ddlcountry" runat="server" OnSelectedIndexChanged="ddlcountry_SelectedIndexChanged" AutoPostBack="True"> </asp:DropDownList> </td> </tr> <tr> <td align="right" style="width: 195px"> <span style="color: Red">*</span>State: </td> <td align="left" style="width: 551px"> <asp:DropDownList ID="ddlstate" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlstate_SelectedIndexChanged"> </asp:DropDownList> </td> </tr> <tr> <td align="right" style="width: 195px"> <span style="color: Red">*</span>City: </td> <td align="left" style="width: 551px"> <asp:DropDownList ID="ddlcity" runat="server"> </asp:DropDownList> </td> </tr> <tr> <td align="right" style="width: 195px; height: 34px;"> ZIP Code: </td> <td align="left" style="width: 551px; height: 34px;"> <asp:TextBox ID="txtZipCode" MaxLength="6" runat="server"></asp:TextBox> <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtZipCode" ErrorMessage="Enter Proper Zip Code" ValidationExpression="\d{6}"> </asp:RegularExpressionValidator> </td> </tr> <tr> <td> &nbsp;</td> </tr> <tr> <td colspan="2" align="center"> <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" BackColor="#C0C0FF" /> </td> </tr> <tr> <td> <small><span style="color: Red">*Note:</span>Must enter data</small> </td> </tr> </table>

Code-Shopping/Registration/RContols/ucRegistration.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ShoppingCart.BL; public partial class Browse_Controls_ucRegistration : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { int i; if (!IsPostBack) { //for (i = 1930; i <= 2007; i++) // ddlyear.Items.Add(i.ToString()); country(); state(); city(); } } protected void btnSubmit_Click(object sender, EventArgs e) { try { // DateTime dob = new DateTime(Int32.Parse(ddlyear.Text), Int32.Parse(ddlmonth.Text), Int32.Parse(ddldate.Text)); ProductController.GetLoginDetails(txtuser.Text, txtfname.Text, txtlname.Text, txtpswd.Text, ddlQuestion.Text, txtAnswer.Text, GMDatePicker1.Date, txtcontact.Text, rdSex.SelectedValue, txtmail.Text, txtaddr.Text, int.Parse(ddlcountry.SelectedValue), int.Parse(ddlstate.SelectedValue), int.Parse(ddlcity.SelectedValue), txtZipCode.Text); lblres.Text = "Registration Completed Successfully !!!"; ClearData(); } catch (Exception ex) { lblUser.Text = "UserName already exists"; } } void ClearData() { txtaddr.Text = ""; txtAnswer.Text = ""; txtcontact.Text = ""; txtfname.Text = ""; txtlname.Text = ""; txtmail.Text = ""; txtpswd.Text = ""; txtRePswd.Text = ""; txtuser.Text = ""; } protected void txtuser_TextChanged(object sender, EventArgs e) { } protected void ddlcountry_SelectedIndexChanged(object sender, EventArgs e) { DataSet dsState = ProductController.getAllStatesByCountryID(int.Parse(ddlcountry.SelectedValue)); BindDDL(ddlstate, dsState, "Name", "ID"); DataSet dscity = ProductController.getCitydetailsByStateID(int.Parse(ddlstate.SelectedValue)); BindDDL(ddlcity, dscity, "Name", "ID"); } protected void ddlstate_SelectedIndexChanged(object sender, EventArgs e) { //ddlcity.Items.Clear(); DataSet dscity = ProductController.getCitydetailsByStateID(int.Parse(ddlstate.SelectedValue)); BindDDL(ddlcity, dscity, "Name", "ID"); } private void state() { DataSet dsState = ProductController.getAllStatedetails(); BindDDL(ddlstate, dsState, "Name", "ID"); } private void country() { DataSet dsCountry = ProductController.getCountrydetails(); BindDDL(ddlcountry, dsCountry, "Name", "ID"); } private void BindDDL(DropDownList ddl, DataSet ds, string txtField, string valField) { ddl.DataSource = ds; ddl.DataTextField = txtField; ddl.DataValueField = valField; ddl.DataBind(); } private void city() { DataSet dscity=ProductController.getCitydetails(); BindDDL(ddlcity, dscity, "Name", "ID"); } }

Code-Shopping/Registration/RContols/ucResetPassword.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucResetPassword.ascx.cs" Inherits="Browse_Controls_ucResetPassword" %> <table cellspacing="2" cellpadding="2" style="width: 100%" border="0"> <tr> <td> <asp:Label ID="lblUser" runat="server" Text="User Name"> </asp:Label> </td> <td style=""> <asp:TextBox ID="txtUser" runat="server" CausesValidation="true"> </asp:TextBox> <asp:RequiredFieldValidator ID="rfvUsername" runat="server" ErrorMessage="Must enter username" ControlToValidate="txtUser" Text="*" ToolTip="Must enter username"></asp:RequiredFieldValidator> </td> </tr> <tr> <td> <asp:Label ID="lblOldpwd" runat="server" Text="Old Password"> </asp:Label> </td> <td> <asp:TextBox ID="txtOldpwd" runat="server" TextMode="Password"> </asp:TextBox><asp:RequiredFieldValidator ID="rfvOldpwd" runat="server" ErrorMessage="Must enter password" ControlToValidate="txtOldpwd" Text="*" ToolTip="Must enter Password"> </asp:RequiredFieldValidator> </td> </tr> <tr> <td> <asp:Label ID="lblNewpwd" runat="server" Text="New Password"> </asp:Label> </td> <td> <asp:TextBox ID="txtNewpwd" runat="server" TextMode="Password"> </asp:TextBox> <asp:RequiredFieldValidator ID="rfvNewpwd" runat="server" ErrorMessage="Must enter the new password" ControlToValidate="txtNewpwd" Text="*" ToolTip="Must enter new password"> </asp:RequiredFieldValidator> </td> </tr> <tr> <td> <asp:Label ID="lblRetype" runat="server" Text="Retype New Password"> </asp:Label> </td> <td> <asp:TextBox ID="txtRetype" runat="server" TextMode="password"> </asp:TextBox> <asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="Entered passwords are not same" ControlToCompare="txtNewpwd" ControlToValidate="txtRetype"></asp:CompareValidator> </td> </tr> <tr> <td colspan="2" align="center" style="width: 100%"> <asp:Label ID="lblMsg" runat="server" Text="" ForeColor="Red" /> </td> </tr> <tr> <td colspan="2" align="center" style="width: 100%"> <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" /> </td> </tr> </table>

Code-Shopping/Registration/RContols/ucResetPassword.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ShoppingCart.BL; using System.Data.SqlClient; public partial class Browse_Controls_ucResetPassword : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { } protected void btnSubmit_Click(object sender, EventArgs e) { string result=ProductController.getuserpwd(txtUser.Text, txtOldpwd.Text, txtNewpwd.Text); lblMsg.Text = result; } }

Code-Shopping/ShipingBilling/frmShipping.aspx

<%@ Page Language="C#" MasterPageFile="~/Browse/MasterPage1.master" AutoEventWireup="true" CodeFile="frmShipping.aspx.cs" Inherits="ShipingBilling_frmShipping" %> <%@ Register Src="ucShipping.ascx" TagName="ucShipping" TagPrefix="uc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <uc1:ucShipping ID="UcShipping1" runat="server" /> </asp:Content>

Code-Shopping/ShipingBilling/frmShipping.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class ShipingBilling_frmShipping : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/ShipingBilling/ucShipping.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucShipping.ascx.cs" Inherits="Payment_ucShipping" %> <html><head><style type="text/css"> td { color:Gray; } </style></head><body> <table width="100%" border="0"> <tr align="center"> <%--style="background-color:#ccccff" >--%> <th colspan="2" valign="bottom"><h4> <span style="color: #0066ff"> Shipping and Billing Details</span></h4></th> </tr> <%--<tr><td colspan="2" style="height: 21px"> </td></tr>--%> <tr> <td> <%--style="background-color:#ccccff">--%> <table width="100%" border="0"> <tr align="center"> <td colspan="2" style="color:Blue; font-size:larger; height: 22px;"> Shipping Details</td> </tr> <tr> <td> <asp:CheckBox ID="chkEditShip" runat="server" Text="Edit Shipping Details" OnCheckedChanged="chkEditShip_CheckedChanged" AutoPostBack="True"/></td> </tr> <tr> <td style="height: 26px"> First Name:</td> <td style="height: 26px"> <asp:TextBox ID="txtfname" runat="server" Enabled="False"></asp:TextBox> <asp:RequiredFieldValidator ID="rfvfname" runat="server" ErrorMessage="This Field Cannot be Blank" ToolTip="This Field Cannot be Blank" ControlToValidate="txtfname">*</asp:RequiredFieldValidator> </td> </tr> <tr> <td style="height: 27px"> Last Name:</td> <td style="height: 27px"> <asp:TextBox ID="txtlname" runat="server" Enabled="False"></asp:TextBox></td> </tr> <tr> <td> Email Id:</td> <td> <asp:TextBox ID="txtEmail" runat="server" Enabled="False"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="This Field Cannot be Blank" ToolTip="This Field Cannot be Blank" ControlToValidate="txtEmail">*</asp:RequiredFieldValidator> </td> </tr> <tr> <td> Gender:</td> <td> <asp:RadioButtonList ID="rdbtn" runat="server" RepeatDirection="Horizontal" > <asp:ListItem Selected='true'>Male</asp:ListItem> <asp:ListItem>Female</asp:ListItem> </asp:RadioButtonList> <asp:RequiredFieldValidator ID="rfvGender" runat="server" ErrorMessage="Must select gender" text="*" ToolTip ="Must select gender" ControlToValidate="rdbtn" ></asp:RequiredFieldValidator> </td> </tr> <tr> <td style="height: 26px"> Contact No.:</td> <td style="height: 26px"> <asp:TextBox ID="txtContact" runat="server" Enabled="False"></asp:TextBox></td> </tr> <tr> <td> Address:</td> <td> <asp:TextBox ID="txtaddr" runat='server' Enabled="False" TextMode="MultiLine"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="This Field Cannot be Blank" ToolTip="This Field Cannot be Blank" ControlToValidate="txtaddr">*</asp:RequiredFieldValidator> </td> </tr> <tr> <td> Country:</td> <td> <asp:DropDownList ID="ddlCountry" runat="server" Enabled="False" OnSelectedIndexChanged="ddlCountry_SelectedIndexChanged" AutoPostBack="True"> </asp:DropDownList></td> </tr> <tr> <td> State:</td> <td> <asp:DropDownList ID="ddlState" runat="server" Enabled="False" OnSelectedIndexChanged="ddlState_SelectedIndexChanged1" AutoPostBack="True"> </asp:DropDownList></td> </tr> <tr> <td> City:</td> <td> <asp:DropDownList ID="ddlCity" runat="server" Enabled="False"> </asp:DropDownList></td> </tr> </table> &nbsp; </td> <td><%--style="background-color:#ccccff">--%> <table width="100%" border="0"> <tr align="center"> <td colspan="2" style="color:Blue; font-size:larger"> Billing Details</td> </tr> <tr> <td> <asp:CheckBox ID="chkEditBiling" runat="server" Text="Same as Shipping Details" OnCheckedChanged="chkEditBiling_CheckedChanged" AutoPostBack="True"/></td> </tr> <tr> <td> First Name:</td> <td> <asp:TextBox ID="txtfname1" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="rfvfname1" runat="server" ErrorMessage="This Field Cannot be Blank" ControlToValidate="txtfname1" ToolTip="This Field Cannot be Blank">*</asp:RequiredFieldValidator> </td> </tr> <tr> <td> Last Name:</td> <td> <asp:TextBox ID="txtlname1" runat="server"></asp:TextBox></td> </tr> <tr> <td> Email Id:</td> <td> <asp:TextBox ID="txtmail1" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ErrorMessage="This Field Cannot be Blank" ControlToValidate="txtmail1" ToolTip="This Field Cannot be Blank">*</asp:RequiredFieldValidator> </td> </tr> <tr> <td> Gender:</td> <td> <asp:RadioButtonList ID="rdbtn1" runat="server" RepeatDirection="Horizontal"> <asp:ListItem>Male</asp:ListItem> <asp:ListItem>Female</asp:ListItem> </asp:RadioButtonList><asp:RequiredFieldValidator ID="rfvGender1" runat="server" ErrorMessage="Must select gender" text="*" ToolTip ="Must select gender" ControlToValidate="rdbtn1" ></asp:RequiredFieldValidator> </td> </tr> <tr> <td> Contact No.:</td> <td> <asp:TextBox ID="txtno1" runat="server"></asp:TextBox></td> </tr> <tr> <td> Address:</td> <td> <asp:TextBox ID="txtaddr1" runat='server' TextMode="MultiLine"></asp:TextBox> <asp:RequiredFieldValidator ID="rfvaddr1" runat="server" ErrorMessage="This Field Cannot be Blank" ControlToValidate="txtaddr1" ToolTip="This Field Cannot be Blank">*</asp:RequiredFieldValidator> </td> </tr> <tr> <td> Country:</td> <td> <asp:DropDownList ID="ddlcountry1" runat="server" OnSelectedIndexChanged="ddlcountry1_SelectedIndexChanged" AutoPostBack="True"> </asp:DropDownList></td> </tr> <tr> <td> State:</td> <td> <asp:DropDownList ID="ddlstate1" runat="server" AutoPostBack="True"> </asp:DropDownList></td> </tr> <tr> <td style="height: 29px"> City:</td> <td style="height: 29px"> <asp:DropDownList ID="ddlcity1" runat="server"> </asp:DropDownList></td> </tr> </table> </td> </tr> <tr align="center"> <td colspan="2" style="height: 26px"> <asp:Button ID="btnPayment" runat="server" Text="Proceed to Payment" OnClick="btnPayment_Click" /> </td> </tr></table> </body></html>

Code-Shopping/ShipingBilling/ucShipping.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ShoppingCart.BL; using System.Data.SqlClient; public partial class Payment_ucShipping : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { string s = ""; ListItem li = null; if (!IsPostBack) { country(); state(); city(); if (Session["UserName"] != null) { s = Session["UserName"].ToString(); SqlDataReader dr = ProductController.getAccountDetails(s); if (dr.HasRows) { if (dr.Read()) { txtfname.Text = dr["Fname"].ToString(); txtlname.Text = dr["Lname"].ToString(); txtContact.Text = dr["ContactNo"].ToString(); txtEmail.Text = dr["EmailID"].ToString(); txtaddr.Text = dr["Address"].ToString(); rdbtn.Text = dr["Gender"].ToString(); li=ddlCountry.Items.FindByValue(dr["CountryID"].ToString()); if (li != null) li.Selected = true; li = ddlState.Items.FindByValue(dr["StateID"].ToString()); if (li != null) li.Selected = true; li=ddlCity.Items.FindByText(dr["CityID"].ToString()); if (li != null) li.Selected = true; } } } } } private void state() { DataSet dsState = ProductController.getAllStatedetails(); BindDDL(ddlState, dsState, "Name", "ID"); BindDDL(ddlstate1, dsState, "Name", "ID"); } private void country() { DataSet dsCountry = ProductController.getCountrydetails(); BindDDL(ddlCountry, dsCountry, "Name", "ID"); BindDDL(ddlcountry1, dsCountry, "Name", "ID"); } private void BindDDL(DropDownList ddl, DataSet ds, string txtField, string valField) { ddl.DataSource = ds; ddl.DataTextField = txtField; ddl.DataValueField = valField; ddl.DataBind(); } private void city() { DataSet dscity = ProductController.getCitydetails(); BindDDL(ddlCity, dscity, "Name", "ID"); BindDDL(ddlcity1, dscity, "Name", "ID"); } protected void btnPayment_Click(object sender, EventArgs e) { int custid; int []a=new int[2]; a = ProductController.spInsertAddressV2(txtfname.Text, txtlname.Text, txtEmail.Text, rdbtn.SelectedItem.ToString(), txtContact.Text, txtaddr.Text, int.Parse(ddlCountry.SelectedItem.Value), int.Parse(ddlState.SelectedItem.Value), int.Parse(ddlCity.SelectedItem.Value)); custid=a[1]; Session["shipid"] = a[0]; a=ProductController.spInsertAddressV2(txtfname1.Text, txtlname1.Text, txtmail1.Text, rdbtn1.SelectedItem.ToString(), txtno1.Text, txtaddr1.Text, int.Parse(ddlcountry1.SelectedItem.Value), int.Parse(ddlstate1.SelectedItem.Value), int.Parse(ddlcity1.SelectedItem.Value)); Session["billid"] = a[0]; Response.Redirect("/Shopping/Payment/frmPayment.aspx?Billfname=" + txtfname.Text + "&custid=" + custid); } protected void ddlCountry_SelectedIndexChanged(object sender, EventArgs e) { DataSet dsState = ProductController.getAllStatesByCountryID(int.Parse(ddlCountry.SelectedValue)); BindDDL(ddlState, dsState, "Name", "ID"); DataSet dsCity = ProductController.getCitydetailsByStateID(int.Parse(ddlState.SelectedValue)); BindDDL(ddlCity, dsCity, "Name", "ID"); } protected void ddlState_SelectedIndexChanged1(object sender, EventArgs e) { DataSet dscity = ProductController.getCitydetailsByStateID(int.Parse(ddlState.SelectedValue)); BindDDL(ddlCity, dscity, "Name", "ID"); } protected void chkEditShip_CheckedChanged(object sender, EventArgs e) { if (chkEditShip.Checked == true) { txtfname.Enabled = true; txtlname.Enabled = true; txtContact.Enabled = true; txtEmail.Enabled = true; txtaddr.Enabled = true; rdbtn.Enabled = true; ddlCountry.Enabled = true; ddlState.Enabled = true; ddlCity.Enabled = true; } else { txtfname.Enabled =false; txtlname.Enabled = false; txtContact.Enabled = false; txtEmail.Enabled = false; txtaddr.Enabled = false; rdbtn.Enabled = false; ddlCountry.Enabled = false; ddlState.Enabled = false; ddlCity.Enabled = false; } } protected void chkEditBiling_CheckedChanged(object sender, EventArgs e) { if (chkEditBiling.Checked == true) { ListItem li = null; txtfname1.Enabled = false; txtfname1.Text = txtfname.Text; txtlname1.Enabled = false; txtlname1.Text = txtlname.Text; txtno1.Enabled = false; txtno1.Text = txtContact.Text; txtmail1.Enabled = false; txtmail1.Text = txtEmail.Text; txtaddr1.Enabled = false; txtaddr1.Text = txtaddr.Text; ddlcountry1.Enabled = false; rdbtn1.Items.FindByValue(rdbtn.SelectedValue.ToString()).Selected=true; li=ddlcountry1.Items.FindByValue(ddlCountry.SelectedValue.ToString()); if (li != null) { ddlcountry1.ClearSelection(); li.Selected = true; } ddlstate1.Enabled = false; li = ddlstate1.Items.FindByValue(ddlState.SelectedValue.ToString()); if (li != null) { ddlstate1.ClearSelection(); li.Selected = true; } ddlcity1.Enabled = false; li = ddlcity1.Items.FindByValue(ddlCity.SelectedValue.ToString()); if (li != null) { ddlcity1.ClearSelection(); li.Selected = true; } } else { txtfname1.Enabled =true; txtlname1.Enabled =true; txtno1.Enabled = true; txtmail1.Enabled = true; txtaddr1.Enabled = true; rdbtn1.Enabled = true; ddlcountry1.Enabled = true; ddlstate1.Enabled = true; ddlcity1.Enabled = true; } } protected void ddlcountry1_SelectedIndexChanged(object sender, EventArgs e) { DataSet dsState = ProductController.getAllStatesByCountryID(int.Parse(ddlcountry1.SelectedValue)); BindDDL(ddlstate1, dsState, "Name", "ID"); DataSet dsCity = ProductController.getCitydetailsByStateID(int.Parse(ddlstate1.SelectedValue)); BindDDL(ddlcity1, dsCity, "Name", "ID"); } protected void ddlstate1_SelectedIndexChanged(object sender, EventArgs e) { ddlCity.Items.Clear(); DataSet dscity = ProductController.getCitydetailsByStateID(int.Parse(ddlstate1.SelectedValue)); BindDDL(ddlcity1, dscity, "Name", "ID"); } }

Code-Shopping/SiteMap/frmSitemap.aspx

<%@ Page Language="C#" MasterPageFile="~/Templates/Default/MasterPage.master" AutoEventWireup="true" CodeFile="frmSitemap.aspx.cs" Inherits="SiteMap_frmSitemap" %> <%@ Register Src="ucSitemap.ascx" TagName="ucSitemap" TagPrefix="uc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <uc1:ucSitemap id="UcSitemap1" runat="server"> </uc1:ucSitemap> </asp:Content>

Code-Shopping/SiteMap/frmSitemap.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class SiteMap_frmSitemap : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/SiteMap/ucSitemap.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucSitemap.ascx.cs" Inherits="SiteMap_ucSitemap" %> <table style="width: 100%"> <tr> <td align="left"> <h3> Site Map</h3> </td> </tr> <tr> <td style="width: 30%"> <asp:Panel ID="pnlAboutus" runat="server" Visible="true" Width="100%"> <table style="width: 100%"> <tr> <td align="left"> <asp:LinkButton ID="btnAboutus" Text="About Us" runat="server" Font-Underline="false" OnClick="btnAboutus_Click"> </asp:LinkButton> </td> </tr> <tr> <td align="left"> <asp:LinkButton ID="btnContact" runat="server" Text="Contact Us" Font-Underline="false" OnClick="btnContact_Click"> </asp:LinkButton> </td> </tr> </table> </asp:Panel> </td> <td style="width: 30%"> <asp:Panel ID="pnlaccount" runat="server" Visible="false" Width="100%"> <table style="width: 100%"> <tr> <td align="center"> <asp:Label ID="lblAccount" runat="server" Text="Account Details" Font-Bold="True"></asp:Label> </td> </tr> <tr> <td align="center"> <asp:LinkButton ID="btnAccount" runat="server" Text="My Account" Font-Underline="false" OnClick="btnAccount_Click"> </asp:LinkButton> </td> </tr> <tr> <td align="center"> <asp:LinkButton ID="btnchangeaccount" runat="server" Text="Change Account Details" Font-Underline="false" OnClick="btnchangeaccount_Click"> </asp:LinkButton> </td> </tr> </table> </asp:Panel> </td> </tr> <tr> <td style="width: 30%"> <asp:Panel ID="pnlregister" runat="server" CssClass=".sitemap" Width="100%"> <table style="width: 100%"> <tr> <td> </td> </tr> <tr> <td> </td> </tr> <tr> <td align="center" style="height: 25px" class="sitemap"> <asp:Label ID="lblRegistration" runat="server" Text="Registration Page" Font-Bold="True"></asp:Label> </td> </tr> <tr> <td align="center" class="sitemap"> <asp:LinkButton ID="btnnewuser" runat="server" Text="New User Register" Font-Underline="false" OnClick="btnnewuser_Click"> </asp:LinkButton> </td> </tr> <tr> <td align="center" class="sitemap"> <asp:LinkButton ID="btnlogin" runat="server" Text="Login Page" Font-Underline="false" OnClick="btnlogin_Click"> </asp:LinkButton> </td> </tr> <tr> <td align="center" style="height: 21px" class="sitemap"> <asp:LinkButton ID="btnforgotpwd" runat="server" Text="Retrieve Password" Font-Underline="false" OnClick="btnforgotpwd_Click"> </asp:LinkButton> </td> </tr> <tr> <td align="center" class="sitemap"> <asp:LinkButton ID="btnchangepwd" runat="server" Text="Change Password" Font-Underline="false" OnClick="btnchangepwd_Click"> </asp:LinkButton> </td> </tr> </table> </asp:Panel> </td> <td style="width: 30%"> <asp:Panel ID="pnlOrder" runat="server" Visible="false" Width="100%"> <table style="width: 100%"> <tr> <td align="center" style="height: 21px"> <asp:Label ID="lblOdetails" runat="server" Text="Order Details" Font-Bold="True"></asp:Label> &nbsp; </td> </tr> <tr> <td align="center"> <asp:LinkButton ID="btnodetails" runat="server" Text="View Order History" Font-Underline="false" OnClick="btnodetails_Click"> </asp:LinkButton> </td> </tr> <tr> <td align="center"> <asp:LinkButton ID="btnostatus" runat="server" Text="View Order Status" Font-Underline="false" OnClick="btnostatus_Click"> </asp:LinkButton> </td> </tr> </table> </asp:Panel> </td> <td style="width: 30%"> <asp:Panel ID="pnlWish" runat="server" Visible="false" Width="100%"> <table width="100%"> <tr> <td align="center"> <asp:Label ID="lblWish" runat="server" Text="WishList" Font-Bold="True"></asp:Label> </td> </tr> <tr> <td align="center"> <asp:LinkButton ID="btnwish" runat="server" Text="View Wish List" Font-Underline="false" OnClick="btnwish_Click"> </asp:LinkButton> </td> </tr> </table> </asp:Panel> </td> </tr> </table>

Code-Shopping/SiteMap/ucSitemap.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ShoppingCart.BL; public partial class SiteMap_ucSitemap : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { if (Session["UserName"] != null) { pnlaccount.Visible = true; pnlOrder.Visible = true; pnlWish.Visible = true; } } protected void btnAboutus_Click(object sender, EventArgs e) { Response.Redirect("/Shopping/About Us/frmAboutus.aspx"); } protected void btnContact_Click(object sender, EventArgs e) { Response.Redirect("/Shopping/Contact Us/frmContactUs.aspx"); } protected void btnAccount_Click(object sender, EventArgs e) { Response.Redirect("/Shopping/MyAccount/frmMyAccount.aspx"); } protected void btnchangeaccount_Click(object sender, EventArgs e) { Response.Redirect("/Shopping/MyAccount/frmChangeAccountDetails.aspx"); } protected void btnodetails_Click(object sender, EventArgs e) { Response.Redirect("/Shopping/OrderDetails/frmOrderDetails.aspx"); } protected void btnostatus_Click(object sender, EventArgs e) { Response.Redirect("/Shopping/OrderDetails/frmSubmitOrderno.aspx"); } protected void btnnewuser_Click(object sender, EventArgs e) { Response.Redirect("/Shopping/Registration/frmNewUser.aspx"); } protected void btnlogin_Click(object sender, EventArgs e) { Response.Redirect("/Shopping/Registration/frmLogin.aspx"); } protected void btnforgotpwd_Click(object sender, EventArgs e) { Response.Redirect("/Shopping/Registration/frmForgotPassword.aspx"); } protected void btnchangepwd_Click(object sender, EventArgs e) { Response.Redirect("/Shopping/Registration/frmChangePassword.aspx"); } protected void btnwish_Click(object sender, EventArgs e) { Response.Redirect("/Shopping/WishList/frmWishList.aspx"); } }

Code-Shopping/stylesht.css

body { background-color:White; font-family:Verdana; font-size:small; font-weight:normal; margin-top:0px; margin-left:0px; margin-right:0px; margin-bottom:0px; } li { font-family:Verdana; font-size:small; font-weight:normal; } h3 { color:Orange; font-family:Verdana; } h4 { color:Gray; font-family:Verdana; } p { color:Gray; font-size:small; font-family:Verdana; display:table; padding:4; } .text { color:Gray; } a { color:#cc9966; font-family:Verdana; font-size:small; } a:link { color:red; text-decoration:none; } a:visited { color:Maroon; text-decoration:none; } a:active { color:Green; text-decoration:none; } td.sitemap { text-align:left; }

Code-Shopping/Templates/Default/AdminMaster.master

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="AdminMaster.master.cs" Inherits="Templates_Default_AdminMaster" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Welcome to Admin Shopping Cart</title> <script language="javascript" src="../../Admin/AdminCatalog/images/FA_FadingRollovers.js" type="text/javascript"></script> <script language="javascript" src="../../Admin/AdminCatalog/images/rollimages.js" type="text/javascript"></script> <script language="javascript" src="../../Admin/AdminCatalog/images/slideshow_inner.js" type="text/javascript"></script> <link type="text/css" rel="stylesheet" href="../../Admin/AdminCatalog/images/style.css"/> </head> <body> <form id="form1" runat="server"> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="background:White"> <tr> <td width="80%" colspan="2" style="height: 140px"> <asp:Image ImageUrl="~/Admin/AdminCatalog/Images/Untitled-30.jpg" runat="server" style="height: 142px; width: 100%" /> </td> <%-- <td width="198" background="http://localhost/Shopping/Admin/AdminCatalog/images/inner_ima0.jpg" style="height: 189px"> <script type="text/javascript" class="leftlinksCopy"> new fadeshow(fadeimages, 198, 191, 0, 3000, 1) </script> </td>--%> </tr> <tr> <td align="right" colspan="2" class="YellowBG" style="text-align: center; height: 24px;"> || <asp:HyperLink ID="hlRoleName" runat="server" cssclass="email" NavigateUrl="~/Admin/frmAdmin.aspx">Admin Home</asp:HyperLink>&nbsp;|&nbsp; <asp:HyperLink ID="HyperLink1" runat="server" cssclass="email" NavigateUrl="~/Admin/Admincatalog/AdminBrand/frmBrandList.aspx">Manage Brands</asp:HyperLink>&nbsp;|&nbsp; <asp:HyperLink ID="hlChangePassword" runat="server" cssclass="email" NavigateUrl="~/Admin/Admincatalog/Admincategory/frmCategoriesList.aspx">Manage Categories</asp:HyperLink>&nbsp;|&nbsp; <asp:HyperLink ID="HyperLink3" runat="server" cssclass="email" NavigateUrl="~/Admin/Admincatalog/AdminUsers/frmUsersList.aspx">Manage Users</asp:HyperLink>&nbsp;|&nbsp; <asp:HyperLink ID="HyperLink2" runat="server" cssclass="email" NavigateUrl="~/Admin/Admincatalog/AdminProduct/frmProductList.aspx">Manage Products</asp:HyperLink>&nbsp;|&nbsp; <asp:HyperLink ID="HyperLink4" runat="server" cssclass="email" NavigateUrl="~/Admin/Order/frmOrdersList.aspx">Manage Orders</asp:HyperLink>&nbsp;|&nbsp; <asp:LinkButton ID="lnkLogout" runat="server" cssclass="email" OnClick="lnkLogout_Click">Logout</asp:LinkButton> ||</td> </tr> <tr> <td colspan="2" align="left" valign="top" class="YellowBG" height="405"> <asp:contentplaceholder id="ContentPlaceHolder1" runat="server"> </asp:contentplaceholder></td></tr> <tr> <td colspan="2" valign="top" align="center" width="100%"> <div id="footer" > Copyright &copy 2008 - 2009 &nbsp;Shopping Industries. &nbsp;All Rights Reserved. </div> </td> </tr> </table> </form> </body> </html>

Code-Shopping/Templates/Default/AdminMaster.master.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Templates_Default_AdminMaster : System.Web.UI.MasterPage { protected void Page_Load(object sender, EventArgs e) { } protected void lnkLogout_Click(object sender, EventArgs e) { FormsAuthentication.SignOut(); Session["Username"] = ""; Session["IdRole"] = 0; Session["admin"] = "false"; Response.Redirect("~/Default.aspx"); } }

Code-Shopping/Templates/Default/controls/default.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="default.ascx.cs" Inherits="Templates_Default_controls_default" %> <table style="width: 63%" border="0" cellpadding="1" cellspacing="0"> <tr> <td align="left" valign="top"> <img id="imgtop" runat="server" src="../../../Browse/Images/duralee.jpg" alt="one" height="180" style="width: 270px" /> </td> <td align="right" style="text-align:justify; width:200px"> <asp:Label ID="Label1" runat="server" Font-Names="arial" Font-Size="9pt" Font-Bold="False" Font-Italic="False" Width="355px" Height="124px"> Shopping Cart is an Organization which specializes in manufacturing all types of Clothes for all age groups. Our Products Include Jeans for men, women, kids and Sarees, Salwars, kurthis, skirts, all varieties of tops. The type of material used are silk, cotton, polyster, tericotton, cotton etc. We also manufacture other home accessories like BedSheets, Table clothes, Curtains, Woollens etc. We have our Business spread all over the Globe. We tender our Products to Customer at affordable Price so that even a common man can buy our products. </asp:Label> </td> </tr> <tr> <td colspan="2" style="height:5"></td> </tr> <tr> <td> <div style="text-align:justify"> &nbsp;<img id="imgbottom" runat="server" src="../../../Browse/Images/image111.jpg" alt="one" width="270" height="180" /></div> </td> <td align="right" valign="top" style="text-align:justify; width:200px"> <br /> <br /> <asp:Label ID="Label2" runat="server" Font-Names="arial" Font-Size="9pt" Font-Bold="False" Font-Italic="False" Width="355px"> Shopping Cart is an Organization which specializes in manufacturing all types of Clothes for all age groups. Our Products Include Jeans for men, women, kids and Sarees, Salwars, kurthis, skirts, all varieties of tops. The type of material used are silk, cotton, polyster, tericotton, cotton etc. We also manufacture other home accessories like BedSheets, Table clothes, Curtains, Woolens etc. We have our Business spread all over the Globe. We tender our Products to Customer at affordable Price so that even a common man can buy our products. </asp:Label>&nbsp;<br /> </td> </tr> </table>

Code-Shopping/Templates/Default/controls/default.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Templates_Default_controls_default : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/Templates/Default/controls/ucFooter.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucFooter.ascx.cs" Inherits="Templates_Default_controls_ucFooter" %> <table style="width: 100%; height: 10%;" border="0"> <tr> <td align="center"> <small><a href='/Shopping/Default.aspx'>Home |</a> <a href='/Shopping/About Us/frmAboutus.aspx'> Aboutus|</a> <a href='/Shopping/Contact Us/frmContactUs.aspx'>Contactus|</a> <a href='/Shopping/SiteMap/frmSitemap.aspx'> Site map|</a> <a href='/Shopping/Gallery/frmGallery.aspx'>Gallery|</a> </small> </td> </tr> <tr> <td align="center"> <small><span>Copyright &copy 2008 - 2009&nbsp;Shopping Cart Pvt. Ltd. All Rights Reserved</span> </small> </td> </tr> </table>

Code-Shopping/Templates/Default/controls/ucFooter.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Templates_Default_controls_ucFooter : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/Templates/Default/controls/ucHeader.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucHeader.ascx.cs" Inherits="Templates_Default_controls_ucHeader" %> <table style="width:100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td style="height: 157px; width: 728px;"> <img id="img1" src="../../../Browse/Images/Untitled-30.jpg" alt="Easy Wear" runat="server" height="181" style="width: 697px"/></td> <td align="right" style="width:25%; height: 172px;" valign="top"> <small> <a href='/Shopping/Default.aspx'>Home</a> <asp:LinkButton ID="lnkMyaccount" runat="server" Visible="False" OnClick="lnkMyaccount_Click">My Account</asp:LinkButton> <a href='/Shopping/Cart/frmShoppingCart.aspx'> <asp:Label ID="lblCartCount" Text="Cart: (0)" runat="server"></asp:Label> </a> <asp:LinkButton ID="lnkLogin" runat="server" OnClick="lnkLogin_Click" CausesValidation="False">Login</asp:LinkButton> </small> <img id="img3" src="../../../Browse/Images/cooltext75055321.gif" alt="Easy Wear" runat="server" width="300"/><br /> <img id="img4" src="../../../Browse/Images/images6.jpg" alt="Easy Wear" runat="server" width="300" height="100"/> </td> </tr> <tr> <td align="center" colspan="2"> <table width="50%" style="background-color:#D3D3D3"> <tr align="center"> <td style="width:10%;"> <a href='/Shopping/Default.aspx'>Home</a> </td> <td style="width: 10%"> <asp:LinkButton ID="lnkAdminLogin_Click" runat="server" CausesValidation="False" OnClick="lnkAdminLogin_Click_Click">Admin</asp:LinkButton> </td> <td style="width:10%;"> <a href='/Shopping/Gallery/frmGallery.aspx'> Gallery</a> </td> <td style="width:10%;" > <a href='/Shopping/SiteMap/frmSitemap.aspx'> Site Map</a> </td> <td style="width:10%;"> <a href='/Shopping/About Us/frmAboutus.aspx'> About Us</a> </td> <td style="width:10%;"> <a href='/Shopping/Contact Us/frmContactUs.aspx'>Contact Us</a> </td> </tr> </table> </td> </tr> </table>

Code-Shopping/Templates/Default/controls/ucHeader.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ShoppingCart.BL; public partial class Templates_Default_controls_ucHeader : System.Web.UI.UserControl { int i = 0; string SessionId; protected void Page_Load(object sender, EventArgs e) { int i = 0; //string a; SessionId = Session["sessionId"].ToString(); if (Session.SessionID != null) { i = int.Parse(ProductController.shoppingcartitems(SessionId).ToString()); } lblCartCount.Text = String.Format("Cart: ({0})", i); if (Session["UserName"] == null || Session["UserName"].ToString().Trim() == "") lnkLogin.Text = "Login"; else lnkLogin.Text = "Logout"; //if (lnkLogin.Text == "Login") //{ // if (Session["UserName"] != null) // { // lnkMyaccount.Visible = true; // lnkLogin.Text = "Logout"; // } //} } protected void lnkLogin_Click(object sender, EventArgs e) { if (lnkLogin.Text == "Login") { Response.Redirect("~/Registration/frmLogin.aspx"); } else if (lnkLogin.Text == "Logout") { lnkMyaccount.Visible = false; Session.Remove("UserName"); ProductController.Deletecartlogout(Session["sessionId"].ToString()); Session["sessionId"] = ""; Session.Abandon(); Response.Redirect("~/Default.aspx"); } } protected void lnkMyaccount_Click(object sender, EventArgs e) { Response.Redirect("/Shopping/MyAccount/frmMyAccount.aspx"); } protected void lnkAdminLogin_Click_Click(object sender, EventArgs e) { if (lnkLogin.Text == "Login") { Response.Redirect("~/Registration/frmLogin.aspx"); } else if (lnkLogin.Text == "Logout") { lnkMyaccount.Visible = false; Session.Remove("UserName"); ProductController.Deletecartlogout(Session["sessionId"].ToString()); Session["sessionId"] = ""; Session.Abandon(); Response.Redirect("~/Default.aspx"); } } }

Code-Shopping/Templates/Default/controls/ucLeft.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucLeft.ascx.cs" Inherits="Templates_Default_controls_ucLeft" %> <%@ Register Src="../../../Browse/Controls/ucPopularCategories.ascx" TagName="ucPopularCategories" TagPrefix="uc1" %> <table border="0" style="width: 14%"> <tr> <td style="width:122%; text-align: right;"> <uc1:ucPopularCategories ID="UcPopularCategories1" runat="server" /> <a style="margin-left:0" href='/Shopping/Browse/frmAllCategories.aspx'> </a> </td> </tr> </table>

Code-Shopping/Templates/Default/controls/ucLeft.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Templates_Default_controls_ucLeft : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/Templates/Default/MasterPage.master

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="Templates_Default_MasterPage" %> <%@ Register Src="../../Browse/Controls/ucPopularCategories.ascx" TagName="ucPopularCategories" TagPrefix="uc7" %> <%@ Register Src="../../Browse/Controls/ucRightTemplate.ascx" TagName="ucRightTemplate" TagPrefix="uc6" %> <%@ Register Src="../../Browse/Controls/ucPopularBrands.ascx" TagName="ucPopularBrands" TagPrefix="uc4" %> <%@ Register Src="../../Browse/Controls/ucPopularTypes.ascx" TagName="ucPopularTypes" TagPrefix="uc5" %> <%@ Register Src="controls/ucHeader.ascx" TagName="ucHeader" TagPrefix="uc1" %> <%@ Register Src="controls/ucFooter.ascx" TagName="ucFooter" TagPrefix="uc2" %> <%@ Register Src="controls/ucLeft.ascx" TagName="ucLeft" TagPrefix="uc3" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Shoppping Cart</title> <link rel="stylesheet" href="../../stylesht.css" type="text/css" /> </head> <body style="margin:0"> <form id="form1" runat="server"> <div> <table style="width:100%"; border="1" cellpadding="2" cellspacing="0"> <tr> <td id="tdheader" colspan="3" valign="top"> <uc1:ucHeader ID="UcHeader1" runat="server" /> </td> </tr> <tr><td colspan="2"> <asp:LinkButton ID="lblUser" runat="server" Text="Welcome Guest" BackColor="White" Font-Bold="True" Font-Italic="True" ForeColor="#FF8080"></asp:LinkButton> </td> <td> <asp:Label ID="lblt" runat="server" Font-Bold="False" Font-Names="Verdana" Font-Size="XX-Small"></asp:Label></td> </tr> <tr id="trbody"> <td style="width:16%;" align="left" valign="top"> <uc7:ucpopularcategories id="UcPopularCategories1" runat="server"></uc7:ucpopularcategories> <uc4:ucPopularBrands ID="UcPopularBrands1" runat="server" /> <img src="../../Browse/Images/verticalimg.gif" runat="server" alt="Laptop" /> </td> <td style="width:66%" align="center" valign="top"> <%-- background-color:#ccccff"--%> <asp:contentplaceholder id="ContentPlaceHolder1" runat="server"> </asp:contentplaceholder> </td> <td style="width:20%" align="left" valign="top"> <uc6:ucRightTemplate ID="UcRightTemplate1" runat="server" /> <img src="../../Browse/Images/verticalad.gif" runat="server" alt="host" /> </td> </tr> <tr> <td colspan="3"> <uc2:ucFooter ID="UcFooter1" runat="server" /> </td> </tr> </table> </div> </form> </body> </html>

Code-Shopping/Templates/Default/MasterPage.master.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Templates_Default_MasterPage : System.Web.UI.MasterPage { protected void Page_Load(object sender, EventArgs e) { lblt.Text = DateTime.Now.ToLongDateString().ToString(); if (Session["UserName"] != null) { lblUser.Text = "Welcome " + Session["UserName"].ToString(); lblUser.PostBackUrl = "~/MyAccount/frmMyAccount.aspx"; } else lblUser.Text = "Welcome Guest"; } }

Code-Shopping/Thanks page/frmThanks.aspx

<%@ Page Language="C#" MasterPageFile="~/Browse/MasterPage1.master" AutoEventWireup="true" CodeFile="frmThanks.aspx.cs" Inherits="Thanks_page_frmThanks" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:Label ID="lblOrderno" runat="server" Font-Bold="True" ForeColor="#FF3333"></asp:Label> </asp:Content>

Code-Shopping/Thanks page/frmThanks.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class Thanks_page_frmThanks : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (Request["OrderNo"] != null) { //Response.Write(Request["OrderNo"].ToString()); lblOrderno.Text = "Order Placed Successfully!!!OrderNo:" + Request["OrderNo"].ToString(); } } }

Code-Shopping/Web.Config

Code-Shopping/WishList/frmWishList.aspx

<%@ Page Language="C#" MasterPageFile="~/Templates/Default/MasterPage.master" AutoEventWireup="true" CodeFile="frmWishList.aspx.cs" Inherits="WishList_frmWishList" Title="Untitled Page" %> <%@ Register Src="ucWishList.ascx" TagName="ucWishList" TagPrefix="uc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <uc1:ucWishList id="UcWishList1" runat="server"> </uc1:ucWishList> </asp:Content>

Code-Shopping/WishList/frmWishList.aspx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class WishList_frmWishList : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Code-Shopping/WishList/ucWishList.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucWishList.ascx.cs" Inherits="WishList_ucWishList" %> <table width="100%"> <tr width="100%" align="center"> <td width="100%" align="left"> <h4>WishList</h4></td> </tr> <tr> <td style="width: 100%"> <asp:DataList ID="dlWishList" runat="server" Width="100%" CellPadding="4" ForeColor="#333333" > <HeaderTemplate> <table width="100%"> <tr> <td style="width: 20%" align="left"> Select</td> <td style="width: 50%" align="center"> Product</td> <td style="width: 30%" align="left"> Price </td> </tr> </table> </HeaderTemplate> <ItemTemplate> <table width="100%"> <tr> <td style="width: 20%"> <asp:CheckBox ID="chkSelect" runat="server" Checked="false" /> </td> <td> <asp:Label ID="lblProductID" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Id") %>' Visible="true"></asp:Label> </td> <td style="width: 50%" align="center"> <asp:Label ID="lblImage" runat="server"> <img src='<%#DataBinder.Eval(Container.DataItem,"Image","/Shopping/Browse/Images/{0}")%>' alt='<%#DataBinder.Eval(Container.DataItem,"Name")%>' width="30" height="30" /><br> <%#DataBinder.Eval(Container.DataItem,"Name") %> </asp:Label> </td> <td style="width: 30%" align="left"> $ <asp:Label ID="lblPrice" runat="server" Text=' <%#DataBinder.Eval(Container.DataItem,"SalePrice")%>'> </asp:Label> </td> </tr> </table> </ItemTemplate> <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> <SelectedItemStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /> <AlternatingItemStyle BackColor="White" ForeColor="#284775" /> <ItemStyle BackColor="#F7F6F3" ForeColor="#333333" /> <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> </asp:DataList> </td> </tr> </table> <table width="87%"> <tr align="right"> <td> &nbsp;</td> </tr> <tr> <td> <asp:Label ID="lblMsg" Text="" ForeColor="Red" runat="server"></asp:Label> </td> </tr> </table> <table width="100%"> <tr> <td align="center"> <asp:Button ID="btnSelectAll" Text="Select All" runat="server" OnClick="btnSelectAll_Click" /> </td> <td align="center"> <asp:Button ID="btnAddToCart" Text="Add To Cart" runat="server" OnClick="btnAddToCart_Click" /> </td> <td align="center"> <asp:Button ID="btnRemove" Text="Remove from WishList" runat="server" OnClick="btnRemove_Click" /> </td> <td align="center"> &nbsp;</td> <td align="center"> &nbsp;</td> </tr> </table>

Code-Shopping/WishList/ucWishList.ascx.cs

using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ShoppingCart.BL; public partial class WishList_ucWishList : System.Web.UI.UserControl { string s; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BindWishList(); } } private void BindWishList() { s = Session["Username"].ToString(); DataSet ds = ProductController.GetWishListDetails(s); if (ds.Tables[0].Rows.Count > 0) { dlWishList.DataSource = ds; dlWishList.DataBind(); } else { dlWishList.Visible = false; btnAddToCart.Visible = false; btnSelectAll.Visible = false; btnRemove.Visible = false; lblMsg.Text = "No items available in wishlist"; } } protected void btnSelectAll_Click(object sender, EventArgs e) { CheckBox chk; if (btnSelectAll.Text == "Select All") { foreach (DataListItem li in dlWishList.Items) { chk = (CheckBox)(li.FindControl("chkSelect")); if (chk != null) { chk.Checked = true; btnSelectAll.Text = "Deselect All"; } } } else if (btnSelectAll.Text == "Deselect All") { foreach (DataListItem li in dlWishList.Items) { chk = (CheckBox)(li.FindControl("chkSelect")); if (chk != null) { btnSelectAll.Text = "Select All"; chk.Checked = false; } } } } protected void btnAddToCart_Click(object sender, EventArgs e) { CheckBox chk; int ProductId = 0; string SessionId; Label lblProduct, lblprice; float Price = 0; foreach (DataListItem li in dlWishList.Items) { chk = (CheckBox)(li.FindControl("chkSelect")); if (chk != null) { if (chk.Checked == true) { lblProduct = (Label)(li.FindControl("lblProductID")); if (lblProduct != null) { ProductId = int.Parse(lblProduct.Text); } lblprice = (Label)(li.FindControl("lblPrice")); if (lblprice != null) { Price = float.Parse(lblprice.Text); } if (Session["SessionId"] != null) { SessionId = (Session["SessionId"]).ToString(); ProductController.GetQuantity(ProductId, SessionId, 1, Price); ProductController.DeleteWishList(ProductId); } } } } BindWishList(); } protected void btnRemove_Click(object sender, EventArgs e) { CheckBox chk; Label lblProduct; int ProductId = 0; foreach (DataListItem li in dlWishList.Items) { chk = (CheckBox)(li.FindControl("chkSelect")); if (chk != null) { if (chk.Checked == true) { lblProduct = (Label)(li.FindControl("lblProductID")); if (lblProduct != null) { ProductId = int.Parse(lblProduct.Text); } ProductController.DeleteWishList(ProductId); } } } BindWishList(); } }

Database-Shopping/Database.LDF

Database-Shopping/Database.MDF

Database-Shopping/ShoppingCart.bak

Database-Shopping/SqlScript.sql

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblOrder_tblAddress]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[tblOrder] DROP CONSTRAINT FK_tblOrder_tblAddress GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblUser_tblAddress]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[tblUser] DROP CONSTRAINT FK_tblUser_tblAddress GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblProductAttribute_tblAttributes]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[tblProductAttribute] DROP CONSTRAINT FK_tblProductAttribute_tblAttributes GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblProduct_tblBrand]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[tblProduct] DROP CONSTRAINT FK_tblProduct_tblBrand GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblProduct_tblCategory]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[tblProduct] DROP CONSTRAINT FK_tblProduct_tblCategory GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblAddress_tblCity]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[tblAddress] DROP CONSTRAINT FK_tblAddress_tblCity GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblCity_tblCityType]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[tblCity] DROP CONSTRAINT FK_tblCity_tblCityType GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblAddress_tblCountry]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[tblAddress] DROP CONSTRAINT FK_tblAddress_tblCountry GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblState_tblCountry]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[tblState] DROP CONSTRAINT FK_tblState_tblCountry GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblOrderDetails_tblOrder]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[tblOrderDetails] DROP CONSTRAINT FK_tblOrderDetails_tblOrder GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblOrder_tblOrderStatus]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[tblOrder] DROP CONSTRAINT FK_tblOrder_tblOrderStatus GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblOffers_tblProduct]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[tblOffers] DROP CONSTRAINT FK_tblOffers_tblProduct GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblOrderDetails_tblProduct]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[tblOrderDetails] DROP CONSTRAINT FK_tblOrderDetails_tblProduct GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblProductAttribute_tblProduct]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[tblProductAttribute] DROP CONSTRAINT FK_tblProductAttribute_tblProduct GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblShoppingCart_tblProduct]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[tblShoppingCart] DROP CONSTRAINT FK_tblShoppingCart_tblProduct GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblWishlist_tblProduct]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[tblWishlist] DROP CONSTRAINT FK_tblWishlist_tblProduct GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblProduct_tblProductType]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[tblProduct] DROP CONSTRAINT FK_tblProduct_tblProductType GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblProduct_tblRating]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[tblProduct] DROP CONSTRAINT FK_tblProduct_tblRating GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblUserAccount_tblRole]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[tblUserAccount] DROP CONSTRAINT FK_tblUserAccount_tblRole GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblAddress_tblState]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[tblAddress] DROP CONSTRAINT FK_tblAddress_tblState GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblCity_tblState]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[tblCity] DROP CONSTRAINT FK_tblCity_tblState GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblOrder_tblUser]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[tblOrder] DROP CONSTRAINT FK_tblOrder_tblUser GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblWishlist_tblUser]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[tblWishlist] DROP CONSTRAINT FK_tblWishlist_tblUser GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_tblUser_tblUserAccount]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1) ALTER TABLE [dbo].[tblUser] DROP CONSTRAINT FK_tblUser_tblUserAccount GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[a]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[a] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[getCustId]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[getCustId] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[getQuestion]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[getQuestion] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[j]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[j] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ord]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[ord] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[shpshopentervalues]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[shpshopentervalues] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sortbycustnameasc]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[sortbycustnameasc] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sortbycustnamedesc]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[sortbycustnamedesc] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sortbyorderdateasc]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[sortbyorderdateasc] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sortbyorderdatedesc]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[sortbyorderdatedesc] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sortbyordernoasc]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[sortbyordernoasc] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sortbyordernodesc]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[sortbyordernodesc] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spAllBrands]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spAllBrands] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spBrand]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spBrand] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spBrandName]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spBrandName] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spBrandNameNew]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spBrandNameNew] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spBrandProductName]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spBrandProductName] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spCartProducts]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spCartProducts] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spChangeAccDetails]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spChangeAccDetails] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spChangeDetails]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spChangeDetails] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spCity]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spCity] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spCountry]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spCountry] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spDeactiveShpCart]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spDeactiveShpCart] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spDeleteCartlogout]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spDeleteCartlogout] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spDeleteCategory]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spDeleteCategory] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spDeleteOrder]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spDeleteOrder] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spDeleteProduct]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spDeleteProduct] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spDeleteUserByUserID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spDeleteUserByUserID] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spFindPassword]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spFindPassword] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spForgotPassword]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spForgotPassword] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGallery]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spGallery] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGetALLCategories]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spGetALLCategories] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGetALLUsers]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spGetALLUsers] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGetAllBrands]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spGetAllBrands] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGetAllCities]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spGetAllCities] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGetAllCitiesByStateID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spGetAllCitiesByStateID] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGetAllStates]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spGetAllStates] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGetAllStatesByCountryID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spGetAllStatesByCountryID] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGetAllTypes]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spGetAllTypes] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGetBrandBYBrandID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spGetBrandBYBrandID] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGetBrandName]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spGetBrandName] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGetCartItems]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spGetCartItems] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGetCartTotal]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spGetCartTotal] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGetCategoriesBYCategoryID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spGetCategoriesBYCategoryID] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGetCategoryName]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spGetCategoryName] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGetCustId]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spGetCustId] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGetOffer]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spGetOffer] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGetPopularBrands]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spGetPopularBrands] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGetPopularCategories]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spGetPopularCategories] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGetProductbyproductId]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spGetProductbyproductId] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGetProducts]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spGetProducts] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGetProductsByBrandID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spGetProductsByBrandID] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGetProductsByCategoryId]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spGetProductsByCategoryId] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGetProductsByID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spGetProductsByID] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGetRoleByUsername]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spGetRoleByUsername] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGetShopingCart]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spGetShopingCart] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGetUserBYUserID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spGetUserBYUserID] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGetWishList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spGetWishList] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spInsertAddress]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spInsertAddress] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spInsertAddressV2]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spInsertAddressV2] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spInsertNewBrand]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spInsertNewBrand] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spInsertNewCategories]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spInsertNewCategories] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spInsertNewProduct]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spInsertNewProduct] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spInsertWishList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spInsertWishList] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spLogin]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spLogin] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spLoginDetails]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spLoginDetails] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spOffer]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spOffer] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spPassworddetails]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spPassworddetails] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spPricebyProductID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spPricebyProductID] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spProductAttribute]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spProductAttribute] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spProductDesc]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spProductDesc] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spProductFeatures]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spProductFeatures] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spProductnameImage]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spProductnameImage] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spQuantity]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spQuantity] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spRatenow]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spRatenow] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spRating]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spRating] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spRegistration]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spRegistration] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spRemoveCart]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spRemoveCart] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spRemoveFromWishList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spRemoveFromWishList] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spRetrieveOrderDetails]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spRetrieveOrderDetails] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spRetrieveOrderStatus]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spRetrieveOrderStatus] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spRetrievePassword]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spRetrievePassword] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spShpRemoveCartitem]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spShpRemoveCartitem] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spState]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spState] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spUpdateAccDetails]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spUpdateAccDetails] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spUpdateBrand]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spUpdateBrand] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spUpdateCart]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spUpdateCart] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spUpdateCategory]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spUpdateCategory] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spUpdateDetails]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spUpdateDetails] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spUpdatePassword]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spUpdatePassword] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spUpdateProduct]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spUpdateProduct] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spUpdateUserDetails]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spUpdateUserDetails] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spUserPwd]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spUserPwd] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spWishCustomer]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spWishCustomer] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spadmincancel]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spadmincancel] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spadmindelete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spadmindelete] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spchkavail]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spchkavail] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spdeletebrand]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spdeletebrand] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spfilterbydate]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spfilterbydate] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spfilterbyname]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spfilterbyname] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spfilterbyorderamnt]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spfilterbyorderamnt] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spfilterbyorderno]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spfilterbyorderno] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spfilterbystatus]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spfilterbystatus] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spgetadminorder]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spgetadminorder] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spinsertintoshoppingcart]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spinsertintoshoppingcart] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spinsertintoshoppingcartNew]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spinsertintoshoppingcartNew] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spinsertorder]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spinsertorder] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spshoppingcartitems]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spshoppingcartitems] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spupdateacc]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spupdateacc] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spupdateacctest]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spupdateacctest] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spupdateadminorder]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spupdateadminorder] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spvFindPassword]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[spvFindPassword] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[test]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[test] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[testn]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[testn] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[vipin]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[vipin] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblAddress]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[tblAddress] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblAttributes]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[tblAttributes] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblBrand]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[tblBrand] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblCategory]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[tblCategory] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblCity]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[tblCity] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblCityType]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[tblCityType] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblCountry]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[tblCountry] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblFAQ]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[tblFAQ] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblOffers]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[tblOffers] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblOrder]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[tblOrder] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblOrderDetails]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[tblOrderDetails] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblOrderStatus]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[tblOrderStatus] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblProduct]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[tblProduct] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblProductAttribute]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[tblProductAttribute] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblProductType]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[tblProductType] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblRating]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[tblRating] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblRole]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[tblRole] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblShoppingCart]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[tblShoppingCart] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblState]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[tblState] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblUser]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[tblUser] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblUserAccount]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[tblUserAccount] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tblWishlist]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[tblWishlist] GO CREATE TABLE [dbo].[tblAddress] ( [Address] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [CityId] [bigint] NOT NULL , [StateId] [bigint] NOT NULL , [CountryId] [bigint] NOT NULL , [ZipCode] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Active] [bit] NOT NULL , [AddressId] [bigint] IDENTITY (1, 1) NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[tblAttributes] ( [Id] [bigint] IDENTITY (1, 1) NOT NULL , [AttributeName] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [AttributeValue] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Description] [nvarchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Active] [bit] NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[tblBrand] ( [Id] [int] IDENTITY (1, 1) NOT NULL , [BrandName] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Logo] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Description] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Active] [bit] NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[tblCategory] ( [Id] [bigint] IDENTITY (1, 1) NOT NULL , [Name] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Description] [nvarchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Image] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Active] [bit] NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[tblCity] ( [Id] [bigint] IDENTITY (1, 1) NOT NULL , [Name] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Description] [nvarchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [StateID] [bigint] NOT NULL , [CityTypeID] [tinyint] NULL , [Active] [bit] NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[tblCityType] ( [Id] [tinyint] IDENTITY (1, 1) NOT NULL , [Name] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Description] [nvarchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Active] [bit] NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[tblCountry] ( [ID] [bigint] IDENTITY (1, 1) NOT NULL , [Name] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Description] [nvarchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Active] [bit] NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[tblFAQ] ( [Id] [bigint] IDENTITY (1, 1) NOT NULL , [Question] [nvarchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Answer] [nvarchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Active] [bit] NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[tblOffers] ( [Id] [bigint] IDENTITY (1, 1) NOT NULL , [ProductId] [bigint] NOT NULL , [OfferPrice] [float] NOT NULL , [Description] [nvarchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Active] [bit] NOT NULL , [OfferStartDate] [datetime] NULL , [OfferEndDate] [datetime] NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[tblOrder] ( [OrderId] [bigint] IDENTITY (1, 1) NOT NULL , [CustomerId] [bigint] NOT NULL , [OrderDate] [datetime] NOT NULL , [OrderAmount] [float] NOT NULL , [Discount] [float] NULL , [ShippingAmount] [float] NOT NULL , [TaxAmount] [float] NOT NULL , [NetAmount] [float] NOT NULL , [ShippingDate] [datetime] NOT NULL , [ShippingAddressID] [bigint] NOT NULL , [BillingAddressID] [bigint] NOT NULL , [StatusID] [tinyint] NULL , [Active] [bit] NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[tblOrderDetails] ( [OrderId] [bigint] NOT NULL , [ProductId] [bigint] NOT NULL , [ProductPrice] [float] NOT NULL , [Quantity] [bigint] NOT NULL , [Discount] [float] NULL , [Active] [bit] NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[tblOrderStatus] ( [Id] [tinyint] IDENTITY (1, 1) NOT NULL , [Name] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Description] [nvarchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Active] [bit] NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[tblProduct] ( [Id] [bigint] IDENTITY (1, 1) NOT NULL , [Name] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [PurchasePrice] [float] NOT NULL , [SalePrice] [float] NOT NULL , [BrandId] [int] NOT NULL , [CategoryId] [bigint] NOT NULL , [TypeId] [int] NOT NULL , [Quantity] [bigint] NOT NULL , [Description] [nvarchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [RatingId] [bigint] NOT NULL , [Active] [bit] NOT NULL , [Image] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[tblProductAttribute] ( [ProductId] [bigint] NOT NULL , [AttributeId] [bigint] NOT NULL , [Active] [bit] NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[tblProductType] ( [Id] [int] IDENTITY (1, 1) NOT NULL , [Name] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Description] [nvarchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Active] [bit] NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[tblRating] ( [Id] [bigint] IDENTITY (0, 1) NOT NULL , [Name] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Image] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Description] [nvarchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Active] [bit] NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[tblRole] ( [Id] [bigint] IDENTITY (1, 1) NOT NULL , [Role] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Description] [nvarchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Active] [bit] NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[tblShoppingCart] ( [Id] [bigint] IDENTITY (1, 1) NOT NULL , [SessionId] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Date] [datetime] NOT NULL , [ProductId] [bigint] NOT NULL , [Quantity] [bigint] NOT NULL , [Price] [float] NOT NULL , [Active] [bit] NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[tblState] ( [Id] [bigint] IDENTITY (1, 1) NOT NULL , [Name] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Description] [nvarchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [CountryId] [bigint] NOT NULL , [Active] [bit] NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[tblUser] ( [UserId] [bigint] IDENTITY (1, 1) NOT NULL , [FName] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [LName] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [DOB] [datetime] NULL , [ContactNo] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Gender] [nvarchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [AccountId] [bigint] NULL , [EmailID] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [AddressID] [bigint] NOT NULL , [Description] [nvarchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Active] [bit] NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[tblUserAccount] ( [Id] [bigint] IDENTITY (1, 1) NOT NULL , [UserName] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Password] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [HintQuestion] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Answer] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [RoleId] [bigint] NOT NULL , [Description] [nvarchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Active] [bit] NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[tblWishlist] ( [CustomerId] [bigint] NULL , [ID] [bigint] IDENTITY (1, 1) NOT NULL , [Name] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [ProductId] [bigint] NULL , [InsertDate] [datetime] NULL ) ON [PRIMARY] GO ALTER TABLE [dbo].[tblAddress] ADD CONSTRAINT [DF_tblAddress_Active] DEFAULT (1) FOR [Active], CONSTRAINT [PK_tblAddress] PRIMARY KEY CLUSTERED ( [AddressId] ) ON [PRIMARY] GO ALTER TABLE [dbo].[tblAttributes] ADD CONSTRAINT [DF_tblAttributes_Active] DEFAULT (1) FOR [Active], CONSTRAINT [PK_tblAttributes] PRIMARY KEY CLUSTERED ( [Id] ) ON [PRIMARY] GO ALTER TABLE [dbo].[tblBrand] ADD CONSTRAINT [DF_Brand_Active] DEFAULT (1) FOR [Active], CONSTRAINT [PK_Brand] PRIMARY KEY CLUSTERED ( [Id] ) ON [PRIMARY] GO ALTER TABLE [dbo].[tblCategory] ADD CONSTRAINT [DF_tblCategory_Active] DEFAULT (1) FOR [Active], CONSTRAINT [PK_Category] PRIMARY KEY CLUSTERED ( [Id] ) ON [PRIMARY] GO ALTER TABLE [dbo].[tblCity] ADD CONSTRAINT [DF_tblCity_Active] DEFAULT (1) FOR [Active], CONSTRAINT [PK_tblcity] PRIMARY KEY CLUSTERED ( [Id] ) ON [PRIMARY] GO ALTER TABLE [dbo].[tblCityType] ADD CONSTRAINT [DF_tblCityType_Active] DEFAULT (1) FOR [Active], CONSTRAINT [PK_tblcitytype] PRIMARY KEY CLUSTERED ( [Id] ) ON [PRIMARY] GO ALTER TABLE [dbo].[tblCountry] ADD CONSTRAINT [DF_tblCountry_Active] DEFAULT (1) FOR [Active], CONSTRAINT [PK_tblCountry] PRIMARY KEY CLUSTERED ( [ID] ) ON [PRIMARY] GO ALTER TABLE [dbo].[tblFAQ] ADD CONSTRAINT [DF_tblFAQ_Active] DEFAULT (1) FOR [Active], CONSTRAINT [PK_tblFAQ] PRIMARY KEY CLUSTERED ( [Id] ) ON [PRIMARY] GO ALTER TABLE [dbo].[tblOffers] ADD CONSTRAINT [DF_tblOffers_OfferPrice] DEFAULT (0) FOR [OfferPrice], CONSTRAINT [DF_tblOffers_Active] DEFAULT (1) FOR [Active], CONSTRAINT [PK_tblOffers] PRIMARY KEY CLUSTERED ( [Id] ) ON [PRIMARY] GO ALTER TABLE [dbo].[tblOrder] ADD CONSTRAINT [DF_tblOrder_OrderAmount] DEFAULT (0) FOR [OrderAmount], CONSTRAINT [DF_tblOrder_Discount] DEFAULT (0) FOR [Discount], CONSTRAINT [DF_tblOrder_ShippingAmount] DEFAULT (10) FOR [ShippingAmount], CONSTRAINT [DF_tblOrder_TaxAmount] DEFAULT (0) FOR [TaxAmount], CONSTRAINT [DF_tblOrder_Active] DEFAULT (1) FOR [Active], CONSTRAINT [PK_tblOrder] PRIMARY KEY CLUSTERED ( [OrderId] ) ON [PRIMARY] GO ALTER TABLE [dbo].[tblOrderDetails] ADD CONSTRAINT [DF_tblOrderDetails_Active] DEFAULT (1) FOR [Active] GO ALTER TABLE [dbo].[tblOrderStatus] ADD CONSTRAINT [DF_tblorderstatus_Active] DEFAULT (1) FOR [Active], CONSTRAINT [PK_tblorderstatus] PRIMARY KEY CLUSTERED ( [Id] ) ON [PRIMARY] GO ALTER TABLE [dbo].[tblProduct] ADD CONSTRAINT [DF_Product_PurchasePrice] DEFAULT (0) FOR [PurchasePrice], CONSTRAINT [DF_Product_SalePrice] DEFAULT (0) FOR [SalePrice], CONSTRAINT [DF_tblProduct_TypeId] DEFAULT (1) FOR [TypeId], CONSTRAINT [DF_Product_Quantity] DEFAULT (0) FOR [Quantity], CONSTRAINT [DF_Product_Description] DEFAULT (N'No discription') FOR [Description], CONSTRAINT [DF_tblProduct_RatingId] DEFAULT (3) FOR [RatingId], CONSTRAINT [DF_tblProduct_Active] DEFAULT (1) FOR [Active], CONSTRAINT [DF__tblproduc__Image__4589517F] DEFAULT ('Na.jpg') FOR [Image], CONSTRAINT [PK_Product] PRIMARY KEY CLUSTERED ( [Id] ) ON [PRIMARY] GO ALTER TABLE [dbo].[tblProductAttribute] ADD CONSTRAINT [DF_tblProductAttribute_Active] DEFAULT (1) FOR [Active] GO ALTER TABLE [dbo].[tblProductType] ADD CONSTRAINT [DF_tblProductType_Active] DEFAULT (1) FOR [Active], CONSTRAINT [PK_type] PRIMARY KEY CLUSTERED ( [Id] ) ON [PRIMARY] GO ALTER TABLE [dbo].[tblRating] ADD CONSTRAINT [DF_tblRating_Active] DEFAULT (1) FOR [Active], CONSTRAINT [PK_Rating] PRIMARY KEY CLUSTERED ( [Id] ) ON [PRIMARY] GO ALTER TABLE [dbo].[tblRole] ADD CONSTRAINT [DF_tblRole_Description] DEFAULT (N'No Discription') FOR [Description], CONSTRAINT [DF_tblRole_Active] DEFAULT (1) FOR [Active], CONSTRAINT [PK_tblRole] PRIMARY KEY CLUSTERED ( [Id] ) ON [PRIMARY] GO ALTER TABLE [dbo].[tblShoppingCart] ADD CONSTRAINT [DF_tblShoppingCart_Quantity] DEFAULT (1) FOR [Quantity], CONSTRAINT [DF_tblShoppingCart_Price] DEFAULT (0) FOR [Price], CONSTRAINT [DF_tblShoppingCart_Active] DEFAULT (1) FOR [Active], CONSTRAINT [PK_tblShoppingCard] PRIMARY KEY CLUSTERED ( [Id] ) ON [PRIMARY] GO ALTER TABLE [dbo].[tblState] ADD CONSTRAINT [DF_tblState_Active] DEFAULT (1) FOR [Active], CONSTRAINT [PK_tblstate] PRIMARY KEY CLUSTERED ( [Id] ) ON [PRIMARY] GO ALTER TABLE [dbo].[tblUser] ADD CONSTRAINT [DF_tblUser_Active] DEFAULT (1) FOR [Active], CONSTRAINT [PK_tblUser] PRIMARY KEY CLUSTERED ( [UserId] ) ON [PRIMARY] GO ALTER TABLE [dbo].[tblUserAccount] ADD CONSTRAINT [DF_tblUserAccount_Active] DEFAULT (1) FOR [Active], CONSTRAINT [PK_tblUserAccount] PRIMARY KEY CLUSTERED ( [Id] ) ON [PRIMARY] , CONSTRAINT [IX_tblUserAccount] UNIQUE NONCLUSTERED ( [UserName] ) ON [PRIMARY] GO ALTER TABLE [dbo].[tblWishlist] ADD CONSTRAINT [PK_tblWishlist] PRIMARY KEY CLUSTERED ( [ID] ) ON [PRIMARY] GO ALTER TABLE [dbo].[tblAddress] ADD CONSTRAINT [FK_tblAddress_tblCity] FOREIGN KEY ( [CityId] ) REFERENCES [dbo].[tblCity] ( [Id] ), CONSTRAINT [FK_tblAddress_tblCountry] FOREIGN KEY ( [CountryId] ) REFERENCES [dbo].[tblCountry] ( [ID] ), CONSTRAINT [FK_tblAddress_tblState] FOREIGN KEY ( [StateId] ) REFERENCES [dbo].[tblState] ( [Id] ) GO ALTER TABLE [dbo].[tblCity] ADD CONSTRAINT [FK_tblCity_tblCityType] FOREIGN KEY ( [CityTypeID] ) REFERENCES [dbo].[tblCityType] ( [Id] ), CONSTRAINT [FK_tblCity_tblState] FOREIGN KEY ( [StateID] ) REFERENCES [dbo].[tblState] ( [Id] ) GO ALTER TABLE [dbo].[tblOffers] ADD CONSTRAINT [FK_tblOffers_tblProduct] FOREIGN KEY ( [ProductId] ) REFERENCES [dbo].[tblProduct] ( [Id] ) GO ALTER TABLE [dbo].[tblOrder] ADD CONSTRAINT [FK_tblOrder_tblAddress] FOREIGN KEY ( [ShippingAddressID] ) REFERENCES [dbo].[tblAddress] ( [AddressId] ), CONSTRAINT [FK_tblOrder_tblOrderStatus] FOREIGN KEY ( [StatusID] ) REFERENCES [dbo].[tblOrderStatus] ( [Id] ), CONSTRAINT [FK_tblOrder_tblUser] FOREIGN KEY ( [CustomerId] ) REFERENCES [dbo].[tblUser] ( [UserId] ) GO ALTER TABLE [dbo].[tblOrderDetails] ADD CONSTRAINT [FK_tblOrderDetails_tblOrder] FOREIGN KEY ( [OrderId] ) REFERENCES [dbo].[tblOrder] ( [OrderId] ), CONSTRAINT [FK_tblOrderDetails_tblProduct] FOREIGN KEY ( [ProductId] ) REFERENCES [dbo].[tblProduct] ( [Id] ) GO ALTER TABLE [dbo].[tblProduct] ADD CONSTRAINT [FK_tblProduct_tblBrand] FOREIGN KEY ( [BrandId] ) REFERENCES [dbo].[tblBrand] ( [Id] ), CONSTRAINT [FK_tblProduct_tblCategory] FOREIGN KEY ( [CategoryId] ) REFERENCES [dbo].[tblCategory] ( [Id] ), CONSTRAINT [FK_tblProduct_tblProductType] FOREIGN KEY ( [TypeId] ) REFERENCES [dbo].[tblProductType] ( [Id] ), CONSTRAINT [FK_tblProduct_tblRating] FOREIGN KEY ( [RatingId] ) REFERENCES [dbo].[tblRating] ( [Id] ) GO ALTER TABLE [dbo].[tblProductAttribute] ADD CONSTRAINT [FK_tblProductAttribute_tblAttributes] FOREIGN KEY ( [AttributeId] ) REFERENCES [dbo].[tblAttributes] ( [Id] ), CONSTRAINT [FK_tblProductAttribute_tblProduct] FOREIGN KEY ( [ProductId] ) REFERENCES [dbo].[tblProduct] ( [Id] ) GO ALTER TABLE [dbo].[tblShoppingCart] ADD CONSTRAINT [FK_tblShoppingCart_tblProduct] FOREIGN KEY ( [ProductId] ) REFERENCES [dbo].[tblProduct] ( [Id] ) GO ALTER TABLE [dbo].[tblState] ADD CONSTRAINT [FK_tblState_tblCountry] FOREIGN KEY ( [CountryId] ) REFERENCES [dbo].[tblCountry] ( [ID] ) GO ALTER TABLE [dbo].[tblUser] ADD CONSTRAINT [FK_tblUser_tblAddress] FOREIGN KEY ( [AddressID] ) REFERENCES [dbo].[tblAddress] ( [AddressId] ), CONSTRAINT [FK_tblUser_tblUserAccount] FOREIGN KEY ( [AccountId] ) REFERENCES [dbo].[tblUserAccount] ( [Id] ) GO ALTER TABLE [dbo].[tblUserAccount] ADD CONSTRAINT [FK_tblUserAccount_tblRole] FOREIGN KEY ( [RoleId] ) REFERENCES [dbo].[tblRole] ( [Id] ) GO ALTER TABLE [dbo].[tblWishlist] ADD CONSTRAINT [FK_tblWishlist_tblProduct] FOREIGN KEY ( [ProductId] ) REFERENCES [dbo].[tblProduct] ( [Id] ), CONSTRAINT [FK_tblWishlist_tblUser] FOREIGN KEY ( [CustomerId] ) REFERENCES [dbo].[tblUser] ( [UserId] ) GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure a (@username varchar(50)) as declare @b bigint set @b=(select id from tbluseraccount where Username=@username) print @b GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create proc getCustId(@username nvarchar(50), @customerid bigint output) as Begin set @customerid = (select [Id] from tblUserAccount where [UserName]=@username) end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO Create procedure getQuestion as select UserName,HintQuestion from tblUserAccount where Active=1 GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE proc j as declare @i bigint begin set @i=(select count(*) from tblshoppingcart where sessionid='qyviwe55lxykgue54yahfavr') while @i>0 begin insert into tblorderdetails(OrderId,ProductId,ProductPrice,Quantity) values(1,6,750,2) set @i=@i-1 end end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE proc ord as declare @datediff varchar(60) Begin set @datediff =(select datediff(dd,OrderDate,ShippingDate)from tblorder where orderid=3) if @datediff>7 print'delivered if not received call 123456' else print'accepted' end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create procedure shpshopentervalues @ProID bigint ,@ProPrice decimal,@ProQty bigint,@ProActive bit as Begin insert into tblShoppingCart values(1,1,@ProId,@Proprice,@ProQty,@ProActive) end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE proc sortbycustnameasc as select OrderId, OrderDate, isnull((Select [UserName] from tblUserAccount WHERE [Id]=tblorder.CustomerId),'NA')'UserName', isnull(NetAmount,0)'NetAmount', isnull((Select [Description] from tblorderstatus where [Id]=tblorder.statusid),'') Description from tblorder where active=1 order by UserName GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE proc sortbycustnamedesc as select OrderId, OrderDate, isnull((Select [UserName] from tblUserAccount WHERE [Id]=tblorder.CustomerId),'NA')'UserName', isnull(NetAmount,0)'NetAmount', isnull((Select [Description] from tblorderstatus where [Id]=tblorder.statusid),'') Description from tblorder where active=1 order by UserName desc GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE proc sortbyorderdateasc as select OrderId, OrderDate, isnull((Select [UserName] from tblUserAccount WHERE [Id]=tblorder.CustomerId),'NA')'UserName', isnull(NetAmount,0)'NetAmount', isnull((Select [Description] from tblorderstatus where [Id]=tblorder.statusid),'') Description from tblorder where active=1 order by OrderDate GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE proc sortbyorderdatedesc as select OrderId, OrderDate, isnull((Select [UserName] from tblUserAccount WHERE [Id]=tblorder.CustomerId),'NA')'UserName', isnull(NetAmount,0)'NetAmount', isnull((Select [Description] from tblorderstatus where [Id]=tblorder.statusid),'') Description from tblorder where active=1 order by OrderDate desc GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE proc sortbyordernoasc as select OrderId, OrderDate, isnull((Select [UserName] from tblUserAccount WHERE [Id]=tblorder.CustomerId),'NA')'UserName', isnull(NetAmount,0)'NetAmount', isnull((Select [Description] from tblorderstatus where [Id]=tblorder.statusid),'') Description from tblorder where active=1 order by orderId GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE proc sortbyordernodesc as select OrderId, OrderDate, isnull((Select [UserName] from tblUserAccount WHERE [Id]=tblorder.CustomerId),'NA')'UserName', isnull(NetAmount,0)'NetAmount', isnull((Select [Description] from tblorderstatus where [Id]=tblorder.statusid),'') Description from tblorder where active=1 order by orderId desc GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE Procedure spAllBrands As Begin Set NoCount ON Select BrandName,Logo,[Description] from tblBrand where [Active]=1 End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create procedure spBrand as begin set nocount on select BrandName,Id from tblBrand where Active=1 end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spBrandName (@ProductID bigint) as begin select cast(isnull([BrandName],'')as nvarchar)as BrandName ,cast(isnull([salePrice],0)as nvarchar)as SalePrice from tblProduct,tblBrand where tblproduct.[Active]=1 and tblProduct.BrandId=tblBrand.Id and tblProduct.Id=@ProductID end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spBrandNameNew (@BrandID bigint) as begin select cast(isnull(b.[BrandName],'')as nvarchar),cast(isnull(p.[salePrice],0)as nvarchar) from tblProduct p,tblBrand b where p.[Active]=1 and p.[BrandId]=b.[Id] and b.Id=@BrandID end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spBrandProductName (@ProductID bigint) as begin select [Name],[SalePrice],tblProduct.[Description],[Image],[BrandName],[Logo] from tblProduct,tblBrand where tblproduct.[Active]=1 and tblProduct.BrandId=tblBrand.Id end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spCartProducts (@SessionId nvarchar(50)) as Begin Select p.Id,s.SessionId ,s.Quantity,s.Price,p.Name,p.Image,s.Quantity*s.Price as Total from tblShoppingCart s,tblProduct p where s.ProductId=p.Id and s.Active=1 and s.SessionId=@SessionId End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spChangeAccDetails(@User nvarchar(50)) as begin select Fname,Lname,DOB,Gender,ContactNo,EmailID,ZipCode, UserName,Address,u.AddressID,c.Id "CityId",c.Name "Cityname", d.Id "StateId",d.Name "StateName",e.ID "CountryId", e.Name "CountryName",s.Password,s.HintQuestion,s.Answer from tbluser u,tbluseraccount s,tblAddress a, tblCity c,tblState d,tblCountry e where s.UserName=@User and u.AccountId=s.id and u.AddressID=a.AddressId and a.CityId=c.Id and a.StateId=d.Id and a.CountryId=e.ID end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spChangeDetails(@User nvarchar(50)) as begin select Fname,Lname,DOB,Gender,ContactNo,EmailID,ZipCode, UserName, HintQuestion,Answer, Address,u.AddressID,c.Id "CityId",c.Name "Cityname", d.Id "StateId",d.Name "StateName",e.ID "CountryId", e.Name "CountryName"from tbluser u,tbluseraccount s,tblAddress a, tblCity c,tblState d,tblCountry e where s.UserName=@User and u.AccountId=s.id and u.AddressID=a.AddressId and a.CityId=c.Id and a.StateId=d.Id and a.CountryId=e.ID end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spCity(@statename nvarchar(20)) as Declare @StateId bigint Begin set @StateId= (select Id from tblState where Name=@statename) Select Name,Id from tblCity where StateID=@StateId End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spCountry as Begin Select Name,ID from tblCountry Where Active=1 End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spDeactiveShpCart (@ProductId int,@SessionId varchar) as begin set nocount on update tblShoppingCart set Active=0 where(ProductId=@ProductId and SessionId=@SessionId) end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spDeleteCartlogout(@sessionId nvarchar(50)) as Delete from tblShoppingCart where SessionId=@sessionId GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spDeleteCategory @catid int as begin Update tblcategory set Active=0 Where [ID]=@catid And Active=1 end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO Create Procedure spDeleteOrder (@OrderId bigint) As Declare @Status bigint Begin Set @Status=(Select StatusID from tblOrder where OrderId=@OrderId) Update tblOrder set [Active]=0 where OrderId=@OrderId Update tblOrderDetails set [Active]=0 where OrderId=@OrderId Update tblOrderStatus set [Active]=0 where Id=@Status End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spDeleteProduct @Id int as begin set nocount on Update tblProduct set Active=0 Where [Id]=@Id And Active=1 end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE Procedure spDeleteUserByUserID ( @UserID int ) as Declare @AID bigint,@AccountID bigInt,@ErrorCode int begin Begin Tran Select @AID=AddressID,@AccountID=AccountID from tbluser where UserID=@UserID Select @ErrorCode=@@ERROR if @ErrorCode<>0 Goto Error Delete From tbluser where UserID=@UserID Select @ErrorCode=@@ERROR if @ErrorCode<>0 Goto Error Delete From tblUserAccount where [ID]=@AccountID Select @ErrorCode=@@ERROR if @ErrorCode<>0 Goto Error Delete From tblAddress Where AddressID=@AID Select @ErrorCode=@@ERROR if @ErrorCode<>0 Goto Error Commit Tran Error: if @ErrorCode<>0 Begin Print 'Transaction Failed' RollBack Tran End End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spFindPassword(@answer nvarchar(15),@username varchar(15)) as Begin select [Password] from tblUserAccount where Answer=@answer and Active=1 and UserName=@username end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE proc spForgotPassword(@username nvarchar(15)) as Begin select [HintQuestion] from tblUserAccount where UserName=@username and Active=1 end exec spForgotPassword vipi select * from tbluser select * from tblUserAccount GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO Create procedure spGallery As Select Name,Description,SalePrice,Image from tblProduct where [Active]=1 GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE Procedure spGetALLCategories AS Begin Set NOCOUNT ON Select [ID],[Name],[Description],[Image] from tblCategory where [Active]=1 End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE Procedure spGetALLUsers As SELECT isnull(tblAddress.Address,'')'Address', tblAddress.CityId, tblAddress.StateId, tblAddress.CountryId, isnull(tblAddress.ZipCode,'')'Zipcode', tblAddress.AddressId, isnull(tblUser.FName,'')'Firstname', isnull(tblUser.LName,'')'Lastname', tblUser.DOB, isnull(tblUser.ContactNo,'')'ContactNo', tblUser.Gender, tblUser.AccountId,tblUser.EmailID, tblUser.Description, tblUser.UserId, tblCity.Name as 'CityName', tblUserAccount.UserName, tblUserAccount.Password, isnull(tblUserAccount.HintQuestion,'')'HintQuestion', isnull(tblUserAccount.Answer,'')'Answer', tblUserAccount.RoleId, tblCountry.Name AS 'CountryName',tblState.Name AS 'StateName', tblRole.Role FROM tblAddress INNER JOIN tblUser ON tblAddress.AddressId = tblUser.AddressID INNER JOIN tblUserAccount ON tblUser.AccountId = tblUserAccount.Id INNER JOIN tblCity ON tblAddress.CityId = tblCity.Id INNER JOIN tblCountry ON tblAddress.CountryId = tblCountry.ID INNER JOIN tblState ON tblAddress.StateId = tblState.Id AND tblCity.StateID = tblState.Id AND tblCountry.ID = tblState.CountryId INNER JOIN tblRole ON tblUserAccount.RoleId = tblRole.Id GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO --use easyware CREATE Procedure spGetAllBrands As Select [Id],[BrandName],isnull([Logo],'na.jpg') as [Logo],isnull([Description],'') as [Description] from tblBrand where [Active]=1 GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spGetAllCities as Begin Select isnull([Name],'')'Name',[Id] from tblCity where [Active]=1 End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spGetAllCitiesByStateID ( @StateID int ) as Begin Select isnull([Name],'')'Name',[Id] from tblCity where [Active]=1 And [StateID]=@StateID End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spGetAllStates as select isnull([Name],'')'Name',[Id] from tblState where [Active]=1 GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spGetAllStatesByCountryID ( @CountryID int ) as select isnull([Name],'')'Name',[Id] from tblState where [Active]=1 And [CountryID]=@CountryID GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create procedure spGetAllTypes as begin set NOCOUNT on select [Id],[Name],[Description] from tblProductType where [Active]=1 end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE Procedure spGetBrandBYBrandID ( @BrandID int ) AS Begin Set NOCOUNT ON Select [ID],[BrandName],[Description],[Logo] from tblBrand where [Active]=1 And [ID]=@BrandID End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create procedure spGetBrandName as begin set nocount on select BrandName,Id from tblBrand where Active=1 end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spGetCartItems (@SessionId nvarchar(50)) as Begin Select isnull(sum(isnull(s.Quantity,0)),0) as Total from tblShoppingCart s where s.Active=1 and s.SessionId=@SessionId End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spGetCartTotal (@SessionId nvarchar(50)) as Begin Select sum(isnull(s.Quantity,0) * isnull(s.Price,'')) as Total from tblShoppingCart s where s.Active=1 and s.SessionId=@SessionId End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE Procedure spGetCategoriesBYCategoryID ( @CatID int ) AS Begin Set NOCOUNT ON Select [ID],[Name],[Description],[Image] from tblCategory where [Active]=1 And [ID]=@CatID End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create procedure spGetCategoryName as begin set nocount on select Name,Id from tblcategory where Active=1 end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create proc spGetCustId(@username nvarchar(50), @customerid bigint output) as Begin set @customerid = (select [Id] from tblUserAccount where [UserName]=@username) end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spGetOffer ( @ProductID int ) As Begin set NoCount ON select tblproduct.[Id],[Name],[SalePrice],tblproduct.[Description],[RatingId],tblproduct.[CategoryID], [Image],[OfferPrice] from tblproduct, tbloffers where tblproduct.[active]=1 and tbloffers.active=1 and tblProduct.[Id]=tbloffers.ProductId and tblProduct.[ID]=@ProductID End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO Create Procedure spGetPopularBrands AS Begin Set NOCOUNT ON Select Top 3 [ID],[BrandName],[Logo],[Description] from tblBrand where [Active]=1 End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO Create Procedure spGetPopularCategories AS Begin Set NOCOUNT ON Select Top 3 [ID],[Name],[Description],[Image] from tblCategory where [Active]=1 End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO Create procedure spGetProductbyproductId ( @ProductID int ) As Begin set NoCount ON select [Id],[Name],[SalePrice],[Description],[RatingId],[CategoryID],[Image] from tblproduct where [ID]=@productID and [Active]=1 End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE Procedure spGetProducts As Begin Set NoCount ON Select p.[Id],p.[Name],b.[BrandName],p.[SalePrice],p.[Description],p.[PurchasePrice], p.[Quantity],p.[Image] from tblProduct p,tblBrand b where p.[BrandId]=b.[Id] and p.[Active]=1 End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE Procedure spGetProductsByBrandID ( @BrandID int ) As Begin Set NoCount ON Select [Id],[Name],[SalePrice],[Description],[RatingId],[CategoryID],[Image] from tblproduct where BrandID=@BrandID And [Active]=1 End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO Create procedure spGetProductsByCategoryId ( @CategoryID int ) As Begin set NoCount ON select [Id],[Name],[SalePrice],[Description],[RatingId],[CategoryID],[Image] from tblproduct where CategoryID=@CategoryID and [Active]=1 End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE Procedure spGetProductsByID ( @Id int ) As Begin Set NoCount ON Select [Name],[SalePrice],[PurchasePrice],[Description],[Quantity],[Image] from tblproduct where [Id]=@Id And [Active]=1 End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO Create Procedure spGetRoleByUsername ( @Username nvarchar(50) ) As Select Top 1 [RoleID] From tbluserAccount Where ([Username]=@Username) GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spGetShopingCart (@sessionID nvarchar(50)) as begin set nocount on select p.name,p.[Image],s.SessionId,s.ProductId,s.price, s.quantity,(s.quantity)*(s.price) as totalPrice from tblProduct p,tblShoppingCart s where p.[Id]=s.[ProductId]and s.[SessionId]=@sessionID and s.active=1 end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO Create Procedure spGetUserBYUserID ( @UserID int ) As SELECT tblAddress.Address, tblAddress.CityId, tblAddress.StateId, tblAddress.CountryId, tblAddress.ZipCode, tblAddress.AddressId, tblUser.FName as 'FirstName', tblUser.LName as 'LastName', tblUser.DOB, tblUser.ContactNo, tblUser.Gender, tblUser.AccountId, tblUser.EmailID, tblUser.Description, tblUser.UserId, tblCity.Name as 'CityName', tblUserAccount.UserName, tblUserAccount.Password, tblUserAccount.HintQuestion, tblUserAccount.Answer, tblUserAccount.RoleId, tblCountry.Name AS 'CountryName', tblState.Name AS 'StateName', tblRole.Role FROM tblAddress INNER JOIN tblUser ON tblAddress.AddressId = tblUser.AddressID INNER JOIN tblUserAccount ON tblUser.AccountId = tblUserAccount.Id INNER JOIN tblCity ON tblAddress.CityId = tblCity.Id INNER JOIN tblCountry ON tblAddress.CountryId = tblCountry.ID INNER JOIN tblState ON tblAddress.StateId = tblState.Id AND tblCity.StateID = tblState.Id AND tblCountry.ID = tblState.CountryId INNER JOIN tblRole ON tblUserAccount.RoleId = tblRole.Id Where tblUser.UserId=@UserID GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spGetWishList (@username nvarchar(50)) as Begin select distinct(w.ProductId) Id,w.CustomerID,p.SalePrice,p.Name,p.Image from tblwishlist w ,tblProduct p where w.ProductId=p.Id and p.Active=1 and w.[Name]=@username End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spInsertAddress(@firstname nvarchar(20),@lastname nvarchar(20),@Email nvarchar(20),@Gender nvarchar(10), @contactno nvarchar(20),@Address nvarchar(100),@Country nvarchar(10),@State nvarchar(10),@City nvarchar(10), @AID int output,@Cid int output) AS declare @stateid bigint, @countryid bigint, @cityid bigint begin select @stateid= ( Select Id from tblState where Name=@State) select @countryid = (Select ID from tblCountry where Name=@Country) select @cityid= (Select Id from tblCity where Name=@City) Insert into tblAddress(Address,CountryId,StateId,CityId) Values(@Address,@countryid,@stateid,@cityid) set @AID=@@IDENTITY Insert into tblUser(Fname,Lname,EmailID,Gender,ContactNo,AddressId) values(@firstname,@lastname,@Email,@Gender,@contactno,@AID) set @Cid=@@Identity End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spInsertAddressV2 ( @firstname nvarchar(20), @lastname nvarchar(20), @Email nvarchar(20), @Gender nvarchar(10), @contactno nvarchar(20), @Address nvarchar(100), @CountryID int, @StateID int, @CityID int, @AID int output, @Cid int output ) AS begin Insert into tblAddress ( Address, CountryId, StateId, CityId ) Values ( @Address, @CountryID, @StateID, @CityID ) set @AID=@@IDENTITY Insert into tblUser ( Fname, Lname, EmailID, Gender, ContactNo, AddressId ) values ( @firstname, @lastname, @Email, @Gender, @contactno, @AID ) set @Cid=@@Identity End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create procedure spInsertNewBrand (@BrandName nvarchar(200),@Description nvarchar(1000),@Logo nvarchar(100)) as begin set nocount on insert into tblBrand([BrandName],[Description],[Logo]) values(@BrandName,@Description,@Logo) end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create procedure spInsertNewCategories (@Name nvarchar(200),@Description nvarchar(1000),@Image nvarchar(100)) as begin set nocount on insert into tblcategory([Name],[Description],[Image]) values(@Name,@Description,@Image) end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spInsertNewProduct(@name nvarchar(50),@PurchasePrice float, @SalePrice float, @Quantity bigint,@Description nvarchar(200),@Image nvarchar(100),@BrandId int,@CategoryId int) AS declare @cName nvarchar(200), @BrandName nvarchar(200) Begin set nocount on Insert into tblProduct([Name],PurchasePrice,SalePrice,BrandId,CategoryId,Quantity,[Description],[Image]) Values(@Name,@PurchasePrice,@SalePrice,@BrandId,@CategoryId,@Quantity,@Description,@Image) end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE Procedure spInsertWishList(@Uname nvarchar(50), @ProductId bigint) as Declare @UserId bigint, @insertdate datetime Begin Set @UserId= (Select Id from tblUserAccount a where UserName=@Uname) set @insertdate=getdate() Insert into tblWishlist(CustomerId,Name,ProductId,InsertDate) Values(@UserId,@Uname,@ProductId,@insertdate) End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spLogin(@Username nvarchar(50), @Password nvarchar(20)) as if exists(select * from tbluserAccount where Username=@Username and Password=@Password and Active=1) select * from tbluser where AccountId=(select Id from tbluserAccount where Username=@Username and Password=@Password and Active=1) GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spLoginDetails (@username nvarchar(50),@fname nvarchar(50), @lname nvarchar(5),@password nvarchar(50), @HQuestion nvarchar(100),@Answer nvarchar(100), @dob datetime,@No bigint,@gender nvarchar(10), @emailId nvarchar(40),@Address nvarchar(100), @Country nvarchar(50), @state nvarchar(40),@City nvarchar(40), @ZipCode varchar(30)) as begin insert into tblusers(FName,LName,DOB,ContactNo,Gender, EmailID) values (@FName,@lname,@dob,@No,@gender,@emailId) insert into tblAddress(Address,ZipCode) values(@Address,@ZipCode) insert into tbluserAccount(username,[Password],HintQuestion,Answer) values(@username,@password,@HQuestion,@Answer) insert into tblcity([Name]) values(@city) insert into tblState([Name]) values(@State) insert into tblcountry([Name]) values(@Country) end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO Create Procedure spOffer (@ProductID bigint) As Begin Select [OfferPrice] from tblOffers where ProductId=@ProductID and Active=1; End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO Create procedure spPassworddetails (@Username nvarchar(20)) As Begin Select [HintQuestion] from tblUserAccount where UserName=@Username and Active=1 End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO Create procedure spPricebyProductID (@ProductID bigint) as begin select cast(isnull([BrandName],'')as nvarchar)as BrandName ,cast(isnull([salePrice],0)as nvarchar)as SalePrice from tblProduct,tblBrand where tblproduct.[Active]=1 and tblProduct.BrandId=tblBrand.Id and tblProduct.Id=@ProductID end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO Create Procedure spProductAttribute (@ProductId bigint) As Begin select [AttributeName],[AttributeValue] from tblAttributes a,tblProductAttribute b where a.Id=b.AttributeId and b.ProductId=@ProductId and a.Active=1; End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spProductDesc ( @ProductID bigint ) As Begin Select tblRating.[Description] "desc",tblRating.[Image] "img" from tblProduct,tblRating where tblProduct.[Id]=@ProductID and tblProduct.RatingId=tblRating.Id and tblProduct.Active=1; End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE Procedure spProductFeatures (@ProductID bigint) as begin select [BrandName],[SalePrice],[AttributeName],[AttributeValue] from tblProduct a,tblBrand b,tblProductAttribute c,tblAttributes d where a.BrandId=b.Id and a.Id=c.ProductId and c.AttributeId=d.Id and a.Active=1 and c.ProductId=@ProductID; end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO Create procedure spProductnameImage( @ProductID bigint ) As Begin Select [Name],[Image] from tblProduct where Id=@ProductID and Active=1; End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spQuantity (@ProductID int, @p_sessionId nvarchar(50), @p_quantity bigint, @p_price float ) as if(exists(Select ProductID from tblShoppingCart where ProductId=@ProductID And SessionId=@p_sessionId And Active=1)) Update tblShoppingCart Set Quantity=Quantity + @p_quantity where ProductId=@ProductID And SessionId=@p_sessionId else insert into tblShoppingCart( SessionId, Quantity, Price, ProductId, [Date] ) Values ( @p_sessionId, @p_quantity, @p_price, @ProductID, getDate() ) GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE Procedure spRatenow (@ProductId int,@RateId int) As Declare @OldRateId float, @NewRateId float Begin Set @OldRateId=(Select RatingId from tblProduct where Id=@ProductId) Set @NewRateId=(@RateId + @OldRateId)/2 Update tblProduct Set RatingId=round(@NewRateId,0) where Id=@ProductId End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO Create Procedure spRating (@ProductID bigint) As Begin Select a.Name,a.Image from tblRating a ,tblProduct b where b.RatingId=a.Id and b.Id=@ProductID and b.Active=1; End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spRegistration ( @username nvarchar(50), @fname nvarchar(50), @lname nvarchar(50), @password nvarchar(50), @HQuestion nvarchar(100), @Answer nvarchar(100), @dob datetime, @ContactNo nvarchar(20), @gender nvarchar(10), @emailId nvarchar(40), @Address nvarchar(100), @Country bigINT, @state bigINT, @City bigINT, @ZipCode varchar(30) ) as Declare @AID bigint,@AccountID bigInt,@ErrorCode int begin Begin Tran insert into tblAddress(Address,CityID,StateID,CountryID,ZipCode)values (@Address,@City,@state,@Country,@ZipCode) Select @ErrorCode=@@ERROR if @ErrorCode<>0 Goto Error Select @AID=@@IDENTITY insert into tbluserAccount(username,[Password],HintQuestion,Answer,RoleID) values(@username,@password,@HQuestion,@Answer,7) Select @ErrorCode=@@ERROR if @ErrorCode<>0 Goto Error Select @AccountID=@@IDENTITY insert into tbluser(FName,LName,DOB,ContactNo,Gender,EmailID,AccountID,AddressID)values (@FName,@lname,@dob,@ContactNo,@gender,@emailId,@AccountID,@AID) Select @ErrorCode=@@ERROR if @ErrorCode<>0 Goto Error Commit Tran Error: if @ErrorCode<>0 Begin Print 'Transaction Failed' RollBack Tran End End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spRemoveCart(@sessionId nvarchar(50),@ProductId bigint) as begin Update tblShoppingCart set Active=0 --delete from tblshoppingcart where SessionId=@SessionId and ProductId=@ProductId; end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO Create Procedure spRemoveFromWishList (@ProductId bigint) as Delete from tblWishList where ProductId=@ProductId GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE Procedure spRetrieveOrderDetails (@Username nvarchar(50)) as Declare @CustId bigint Begin Set @CustId=(Select [id]from tblUserAccount a,tblUser b where b.AccountId=a.Id and a.UserName=@Username) Select c.CustomerId "CustomerId",b.OrderId "OrderId",c.OrderDate "OrderDate", b.ProductId "ProductId",a.Name "ProductName",a.Image "ProductImage", b.ProductPrice "Price",b.Quantity "Quantity",c.OrderAmount "OrderAmount", c.ShippingAmount "ShippingAmount",c.TaxAmount "TaxAmount", c.NetAmount "NetAmount",d.Description "OrderStatus" from tblProduct a,tblOrderDetails b,tblOrder c,tblOrderStatus d where b.OrderId=c.OrderId and c.StatusID=D.Id and a.Id=b.ProductId and c.CustomerId=@CustId End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE Procedure spRetrieveOrderStatus (@Username nvarchar(50), @OrderId bigint) as Declare @CustId bigint Begin Set @CustId=(Select [id]from tblUserAccount a,tblUser b where b.AccountId=a.Id and a.UserName=@Username) Select c.CustomerId "CustomerId",c.OrderId "OrderId",c.OrderDate "OrderDate", c.OrderAmount "OrderAmount", c.ShippingAmount "ShippingAmount",c.TaxAmount "TaxAmount", c.NetAmount "NetAmount",d.Description "OrderStatus" from tblOrder c,tblOrderStatus d where c.StatusID=D.Id and c.CustomerId=@CustId and c.OrderId=@OrderId End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO Create procedure spRetrievePassword (@UserName nvarchar(20),@Answer nvarchar(50)) as Begin Select Password from tblUserAccount where Answer=@Answer and UserName=@UserName and Active=1 End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spShpRemoveCartitem(@sessionId nvarchar(50),@ProductId bigint) as begin Update tblShoppingCart set Active=0, Quantity=0 where SessionId=@SessionId and ProductId=@ProductId end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spState(@country_name nvarchar(50)) as Declare @country_id bigint Begin set @country_id= (select [ID] from tblCountry where Name=@country_name) select [Name],[Id] from tblState where CountryId=@country_id End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spUpdateAccDetails ( @username nvarchar(50), @fname nvarchar(50), @lname nvarchar(50), @password nvarchar(50), @HQuestion nvarchar(100), @Answer nvarchar(100), @dob datetime, @ContactNo nvarchar(20), @gender nvarchar(10), @emailId nvarchar(40), @Address nvarchar(100), @Country bigINT, @state bigINT, @City bigINT, @ZipCode varchar(30)) as Declare @accountid int,@ErrorCode int,@idUserAccount int,@addressidfromtbluser int Begin Begin Tran Update tblUserAccount set @idUserAccount=[id], [Password]=@password,Answer=@Answer where [UserName]=@username Select @ErrorCode=@@ERROR if @ErrorCode<>0 Goto Error update tbluser set @addressidfromtbluser=AddressID,FName=@fname,LName=@lname,DOB=@dob,ContactNo=@ContactNo,Gender=@gender,EmailID=@emailId where tblUser.AccountId =@idUserAccount Select @ErrorCode=@@ERROR if @ErrorCode<>0 Goto Error update tblAddress set Address=@Address,CityID=@City,StateID= @state,CountryID=@Country,ZipCode=@ZipCode where tblAddress.[AddressId]=@addressidfromtbluser Select @ErrorCode=@@ERROR if @ErrorCode<>0 Goto Error Commit Tran Error: if @ErrorCode<>0 Begin Print 'Transaction Failed' RollBack Tran End End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create procedure spUpdateBrand ( @ID int, @BrandName nvarchar(200), @Description nvarchar(1000), @Logo nvarchar(100) ) as begin set nocount on Update tblBrand Set [BrandName]=@BrandName, [Description]=@Description, [Logo]=@Logo Where [ID]=@ID And Active=1 end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spUpdateCart(@SessionId nvarchar(50),@ProductId bigint, @quantity int) as Begin Update tblShoppingCart set Quantity=@quantity where SessionId=@SessionId and ProductId=@ProductId; End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create procedure spUpdateCategory ( @ID int, @Name nvarchar(200), @Description nvarchar(1000), @Image nvarchar(100) ) as begin set nocount on Update tblcategory Set [Name]=@Name, [Description]=@Description, [Image]=@Image Where [ID]=@ID And Active=1 end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spUpdateDetails ( @username nvarchar(50), @fname nvarchar(50), @lname nvarchar(50), @dob datetime, @ContactNo nvarchar(20), @gender nvarchar(10), @emailId nvarchar(40), @HintQuestion nvarchar(40), @Answer nvarchar(40), @Address nvarchar(100), @Country bigINT, @state bigINT, @City bigINT, @ZipCode varchar(30) ) as Declare @b bigint begin set @b=(select id from tbluseraccount where Username=@username) update tblAddress set Address=@Address,CityID=@City,StateID=@state,CountryID=@Country, ZipCode=@ZipCode where AddressId=(select AddressID from tbluser where AccountId=@b) update tbluser set FName=@FName,LName=@lname,DOB=@dob,ContactNo=@ContactNo,Gender=@gender, EmailID=@emailId where AccountId=@b update tbluseraccount set HintQuestion=@HintQuestion,Answer=@Answer where UserName=@username End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO Create procedure spUpdatePassword(@user nvarchar(20), @newpwd nvarchar(20)) As Begin Update tblUserAccount set password=@newpwd where UserName=@user End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create procedure spUpdateProduct ( @ID int, @Name nvarchar(200), @Description nvarchar(1000),@Quantity bigint, @Image nvarchar(100),@PurchasePrice float,@SalePrice float ) as begin set nocount on Update tblProduct Set [Name]=@Name, [Description]=@Description, [Quantity]=@Quantity, [Image]=@Image, [PurchasePrice]=@PurchasePrice, [SalePrice]=@SalePrice Where [ID]=@ID And Active=1 end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE Procedure spUpdateUserDetails ( @username nvarchar(50), @fname nvarchar(50), @lname nvarchar(50), @dob datetime, @ContactNo nvarchar(20), @gender nvarchar(10), @emailId nvarchar(40), @Address nvarchar(100), @Country bigINT, @state bigINT, @City bigINT, @ZipCode varchar(30), @AddressID int, @UserID int ) as Declare @AID bigint,@AccountID bigInt,@ErrorCode int begin Begin Tran Update tblAddress Set Address=@Address,CityID=@City,StateID=@state,CountryID=@Country,ZipCode=@ZipCode Where AddressID=@AddressID Select @ErrorCode=@@ERROR if @ErrorCode<>0 Goto Error Update tbluser Set FName=@FName,LName=@lname,DOB=@dob,ContactNo=@ContactNo,Gender=@gender,EmailID=@emailId Where UserID=@UserID Select @ErrorCode=@@ERROR if @ErrorCode<>0 Goto Error Commit Tran Error: if @ErrorCode<>0 Begin Print 'Transaction Failed' RollBack Tran End End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE Procedure spUserPwd (@Username nvarchar(20), @pwd nvarchar(20), @newpwd nvarchar(20), @response nvarchar(100) output ) as if exists(Select 'X' from tblUserAccount where UserName=@Username and Password=@pwd) Begin Update tblUserAccount set password=@newpwd where UserName=@Username set @response='Done' End else set @response='Invalid User' GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE proc spWishCustomer(@wish varchar(30) output) as Begin declare @currhour varchar(10) set @currhour = datename(hh,getdate()) if @currhour between 0 and 12 set @wish ='Good Morning' else if @currhour between 12 and 16 set @wish ='Good AfterNoon' else set @wish='Go Home Naresh now' --print @currhour --print @wish end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create proc spadmincancel(@orderid bigint) as select netamount,description from tblorder,tblorderstatus where orderid=@orderid and tblorder.statusId=tblorderstatus.id GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create proc spadmindelete(@orderid bigint) as update tblorder set active=0 where orderid=@orderid GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE proc spchkavail (@username nvarchar(15)) as Begin set nocount on select UserName from tbluseraccount where UserName=@username end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spDeleteBrand @BrandId int as begin Update tblBrand set Active=0 Where [ID]=@BrandId And Active=1 end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE proc spfilterbydate(@from datetime,@to datetime) as select OrderId, OrderDate, isnull((Select [UserName] from tblUserAccount WHERE [Id]=tblorder.CustomerId),'NA')'UserName', isnull(NetAmount,0)'NetAmount', isnull((Select [Description] from tblorderstatus where [Id]=tblorder.statusid),'') Description from tblorder where active=1 and OrderDate between @from and @to GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE proc spfilterbyname(@name varchar(60)) as select OrderId, OrderDate, isnull((Select [UserName] from tblUserAccount WHERE [Id]=tblorder.CustomerId),'NA')'UserName', isnull(NetAmount,0)'NetAmount', isnull((Select [Description] from tblorderstatus where [Id]=tblorder.statusid),'') Description from tblorder where active=1 and tblorder.CustomerId in (Select [Id] from tblUserAccount Where [UserName]=@name) GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE proc spfilterbyorderamnt(@op int,@amnt float) as if @op=1 select OrderId, OrderDate, isnull((Select [UserName] from tblUserAccount WHERE [Id]=tblorder.CustomerId),'NA')'UserName', isnull(NetAmount,0)'NetAmount', isnull((Select [Description] from tblorderstatus where [Id]=tblorder.statusid),'') Description from tblorder where active=1 and NetAmount<@amnt if @op=2 select OrderId, OrderDate, isnull((Select [UserName] from tblUserAccount WHERE [Id]=tblorder.CustomerId),'NA')'UserName', isnull(NetAmount,0)'NetAmount', isnull((Select [Description] from tblorderstatus where [Id]=tblorder.statusid),'') Description from tblorder where active=1 and NetAmount>@amnt if @op=3 select OrderId, OrderDate, isnull((Select [UserName] from tblUserAccount WHERE [Id]=tblorder.CustomerId),'NA')'UserName', isnull(NetAmount,0)'NetAmount', isnull((Select [Description] from tblorderstatus where [Id]=tblorder.statusid),'') Description from tblorder where active=1 and NetAmount=@amnt if @op=4 select OrderId, OrderDate, isnull((Select [UserName] from tblUserAccount WHERE [Id]=tblorder.CustomerId),'NA')'UserName', isnull(NetAmount,0)'NetAmount', isnull((Select [Description] from tblorderstatus where [Id]=tblorder.statusid),'') Description from tblorder where active=1 and NetAmount!=@amnt GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE proc spfilterbyorderno(@orderid int) as select OrderId, OrderDate, isnull((Select [UserName] from tblUserAccount WHERE [Id]=tblorder.CustomerId),'NA')'UserName', isnull(NetAmount,0)'NetAmount', isnull((Select [Description] from tblorderstatus where [Id]=tblorder.statusid),'') Description from tblorder where active=1 And OrderId=@orderid GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE proc spfilterbystatus(@status varchar(60)) as select OrderId, OrderDate, isnull((Select [UserName] from tblUserAccount WHERE [Id]=tblorder.CustomerId),'NA')'UserName', isnull(NetAmount,0)'NetAmount', isnull((Select [Description] from tblorderstatus where [Id]=tblorder.statusid),'') Description from tblorder where active=1 and tblorder.statusid=(Select Top 1 [Id] From tblorderstatus where [Description]=@status) GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE proc spgetadminorder as select OrderId, OrderDate, isnull((Select [UserName] from tblUserAccount WHERE [Id]=tblorder.CustomerId),'NA')'UserName', isnull(NetAmount,0)'NetAmount', isnull((Select [Description] from tblorderstatus where [Id]=tblorder.statusid),'') Description from tblorder where active=1 GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spinsertintoshoppingcart ( @sessionid nvarchar(50), @productid bigint, @price bigint, @Quantity float ) as if exists(Select ProductID from tblShoppingCart where ProductId=@ProductID And SessionId=@sessionId) Update tblShoppingCart Set Quantity=Quantity + @Quantity , Active=1 where ProductId=@ProductID And SessionId=@sessionId else insert into tblShoppingCart(SessionId,Quantity,Price,ProductId,[Date]) values(@sessionId,@Quantity,@price,@productID,getdate()) GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spinsertintoshoppingcartNew ( @sessionid nvarchar(50), @productid bigint, @NewQty float ) as Begin set nocount on update tblShoppingCart set Quantity =@NewQty where SessionId=@sessionid and ProductId=@productid end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spinsertorder(@CustId bigint,@OrderAmnt float,@TaxAmnt float,@NetAmnt float, @ShipAddrId bigint,@BillAddrId bigint,@SessionId nvarchar(50),@BillFname varchar(50),@OId bigint output) as declare @ErrorCode bigint, @Statusid bigint begin begin tran insert into tblOrderStatus(Name) values (@BillFname) Select @ErrorCode=@@ERROR if @ErrorCode<>0 Goto Error select @Statusid=@@Identity insert into tblorder(CustomerId,OrderDate,OrderAmount,TaxAmount,NetAmount,ShippingDate, ShippingAddressID,BillingAddressID,StatusiD) values (@CustId,getdate(),@OrderAmnt,@TaxAmnt,@NetAmnt,dateadd(dd,7,getdate()), @ShipAddrId,@BillAddrId,@Statusid) Select @ErrorCode=@@ERROR if @ErrorCode<>0 Goto Error select @OId=@@Identity declare b cursor for Select p.Id ,s.Quantity,s.Price from tblShoppingCart s,tblProduct p where s.ProductId=p.Id and s.Active=1 and s.SessionId=@SessionId declare @cpid bigint,@cquantity bigint,@cprice float open b fetch next from b into @cpid,@cquantity,@cprice while @@fetch_status=0 begin insert into tblorderdetails(OrderId,ProductId,ProductPrice,Quantity) values(@OId,@cpid,@cprice,@cquantity) fetch next from b into @cpid,@cquantity,@cprice end close b deallocate b Select @ErrorCode=@@ERROR if @ErrorCode<>0 Goto Error Commit Tran Error: if @ErrorCode<>0 Begin Print 'Transaction Failed' RollBack Tran End End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spshoppingcartitems (@Sessionid nvarchar(50),@CartItems bigint output) as begin select @CartItems=sum(quantity) from tblshoppingcart where [Sessionid]=@Sessionid end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spupdateacc ( @username nvarchar(50), @fname nvarchar(50), @lname nvarchar(50), @password nvarchar(50), @Answer nvarchar(100), @dob datetime, @ContactNo nvarchar(20), @gender nvarchar(10), @emailId nvarchar(40), @Address nvarchar(100), @Country bigINT, @state bigINT, @City bigINT, @ZipCode varchar(30), @response nvarchar(100) output ) as Declare @idtblUserAccount bigint,@ErrorCode int begin Begin Tran update tbluserAccount set @idtblUserAccount=[id],[Password]=@password,[Answer]=@Answer where [UserName]=@username Select @ErrorCode=@@ERROR if @ErrorCode<>0 Goto Error Update tbluser set FName=@FName,LName=@lname,DOB=@dob,ContactNo=@ContactNo,Gender=@gender,EmailID=@emailid where [AccountId]=@idtblUserAccount Select @ErrorCode=@@ERROR if @ErrorCode<>0 Goto Error update tblAddress set Address=@Address,CityID=@City,StateID=@state,CountryID=@Country,ZipCode=@ZipCode where AddressId =(Select AddressId from tblUser where Accountid=@idtblUserAccount) Select @ErrorCode=@@ERROR if @ErrorCode<>0 Goto Error Commit Tran set @response='Details Have Been Updated Successfully' Error: if @ErrorCode<>0 --set @response='Details Has Not Been Successfully' Begin Print 'Transaction Failed' RollBack Tran End End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spupdateacctest ( @username nvarchar(50), @fname nvarchar(50), @lname nvarchar(50), @password nvarchar(50), @Answer nvarchar(100), @dob datetime, @ContactNo nvarchar(20), @gender nvarchar(10), @emailId nvarchar(40), @Address nvarchar(100), @Country bigINT, @state bigINT, @City bigINT, @ZipCode varchar(30), @response nvarchar(100) output ) as Declare @idtblUserAccount bigint,@ErrorCode int begin Begin Tran update tbluserAccount set @idtblUserAccount=[id],[Password]=@password,[Answer]=@Answer where [UserName]=@username Select @ErrorCode=@@ERROR if @ErrorCode<>0 Goto Error Update tbluser set FName=@FName,LName=@lname,DOB=@dob,ContactNo=@ContactNo,Gender=@gender,EmailID=@emailid where [AccountId]=@idtblUserAccount Select @ErrorCode=@@ERROR if @ErrorCode<>0 Goto Error update tblAddress set Address=@Address,CityID=@City,StateID=@state,CountryID=@Country,ZipCode=@ZipCode where AddressId =(Select AddressId from tblUser where Accountid=@idtblUserAccount) Select @ErrorCode=@@ERROR if @ErrorCode<>0 Goto Error Commit Tran set @response='Details Have Been Updated Successfully' Error: if @ErrorCode<>0 set @response='Details Has Not Been Successfully' Begin Print 'Transaction Failed' RollBack Tran End End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO create procedure spupdateadminorder(@amount float,@status nvarchar(100),@OrderId bigint) as update tblorder set NetAmount=@amount where OrderId=@OrderId update tblorderstatus set description=@status where Id=(select statusid from tblorder where orderId=@OrderId) GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure spvFindPassword(@answer nvarchar(15),@username varchar(15)) as Begin select ua.[Password], u.[Emailid] from tblUserAccount ua,tblUser u where ua.[Answer]=@answer and ua.[Active]=1 and ua.[UserName]=@username and ua.id=u.accountid end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure test(@Username nvarchar(40), @response nvarchar(100) output) as begin select @response = convert(char(12),dob,20) from tbluser,tbluseraccount where tbluserAccount.Id=tblUser.AccountId and tblUserAccount.UserName=@Username end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE proc testn(@username nvarchar(15),@password nvarchar(15), @answer nvarchar(15)) as begin Update tblUserAccount set [Password]=@password,Answer=@Answer where [UserName]=@username end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE procedure vipin (@username varchar(25)) as begin select username from tbluseraccount where username=@username end GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO

ShoppingCart.BL/ShoppingCart.BL.sln

Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShoppingCart.BL", "ShoppingCart.BL\ShoppingCart.BL.csproj", "{12EA030B-491C-4B80-A2E9-585983E3BECB}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {12EA030B-491C-4B80-A2E9-585983E3BECB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {12EA030B-491C-4B80-A2E9-585983E3BECB}.Debug|Any CPU.Build.0 = Debug|Any CPU {12EA030B-491C-4B80-A2E9-585983E3BECB}.Release|Any CPU.ActiveCfg = Release|Any CPU {12EA030B-491C-4B80-A2E9-585983E3BECB}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal

ShoppingCart.BL/ShoppingCart.BL.suo

ShoppingCart.BL/ShoppingCart.BL/bin/Debug/ShoppingCart.BL.dll

ShoppingCart.BL/ShoppingCart.BL/bin/Debug/ShoppingCart.BL.pdb

ShoppingCart.BL/ShoppingCart.BL/bin/Debug/ShoppingCart.DAL.dll

ShoppingCart.BL/ShoppingCart.BL/bin/Debug/ShoppingCart.DAL.pdb

ShoppingCart.BL/ShoppingCart.BL/ConnectionString.cs

using System; using System.Collections.Generic; using System.Text; using System.Web; using System.Configuration; namespace ShoppingCart.BL { static class ConnectionString { public static string GetConnectionString() { return System.Configuration.ConfigurationSettings.AppSettings["CONSTR"]; } } }

ShoppingCart.BL/ShoppingCart.BL/obj/Debug/ResolveAssemblyReference.cache

ShoppingCart.BL/ShoppingCart.BL/obj/Debug/ShoppingCart.BL.dll

ShoppingCart.BL/ShoppingCart.BL/obj/Debug/ShoppingCart.BL.pdb

ShoppingCart.BL/ShoppingCart.BL/obj/ShoppingCart.BL.csproj.FileList.txt

bin\Debug\ShoppingCart.BL.dll bin\Debug\ShoppingCart.BL.pdb bin\Debug\ShoppingCart.DAL.dll bin\Debug\ShoppingCart.DAL.pdb obj\Debug\ResolveAssemblyReference.cache obj\Debug\ShoppingCart.BL.dll obj\Debug\ShoppingCart.BL.pdb

ShoppingCart.BL/ShoppingCart.BL/ProductController.cs

using System; using System.Collections.Generic; using System.Text; using System.Data; using ShoppingCart.DAL; using System.Data.SqlClient; using ShoppingCart.BL; using System.Configuration; namespace ShoppingCart.BL { public class ProductController { public static DataSet getALLCategories() { return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spGetALLCategories")); } public static DataSet getPopularCategories() { return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spGetPopularCategories")); } public static DataSet getALLBrands() { return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spGetALLBrands")); } public static DataSet getPopularBrands() { return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spGetPopularBrands")); } public static DataSet getPopularTypes() { return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spGetAllTypes")); } public static DataSet GetAllProductsBYBrandID(int BrandID) { SqlParameter p = new SqlParameter("@BrandID", BrandID); return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spGetProductsByBrandID", p)); } public static DataSet GetAllProductsByCategoryID(int CategoryID) { SqlParameter p = new SqlParameter("@CategoryID", CategoryID); return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spGetProductsByCategoryId", p)); } public static DataSet GetProductNameDetails(int ProductID) { SqlParameter p = new SqlParameter("@ProductId", ProductID); return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spBrandProductName", p)); } public static DataSet GetProductAttributes(int ProductID) { SqlParameter p = new SqlParameter("@ProductId", ProductID); return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spProductAttribute", p)); } public static DataSet GetProductNameImage(int ProductID) { SqlParameter p = new SqlParameter("@ProductId", ProductID); return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spProductnameImage", p)); } public static SqlDataReader GetProductDesc(string ProductID) { SqlParameter p = new SqlParameter("@ProductId", ProductID); return (SqlHelper.ExecuteReader(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spProductDesc", p)); } /*public static DataSet GetProductFeatures(int ProductID) { SqlParameter p = new SqlParameter("@ProductId", ProductID); return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spProductFeatures", p)); }*/ public static string GetBrandName(int BrandId) { string s = ""; SqlParameter p = new SqlParameter("@BrandID", BrandId); DataSet ds = SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spBrandNameNew", p); if (ds.Tables[0].Rows.Count > 0) { s = ds.Tables[0].Rows[0][0].ToString(); } return s; } public static DataSet GetOffers(int ProductID) { SqlParameter p = new SqlParameter("@ProductId", ProductID); return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spOffer", p)); } public static DataSet GetRating(int ProductID) { SqlParameter p = new SqlParameter("@ProductId", ProductID); return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spRating", p)); } public static string getBrandName(int ProductID) { string BrandName = ""; SqlDataReader drBrand; SqlParameter p = new SqlParameter("@ProductID", ProductID); drBrand = SqlHelper.ExecuteReader(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spBrandName", p); if (drBrand != null) { if (drBrand.Read()) { BrandName = drBrand["BrandName"].ToString(); } } return (BrandName); } public static string getProductPrice(int ProductID) { string Price = "0"; SqlDataReader drPrice; SqlParameter p = new SqlParameter("@ProductId", ProductID); drPrice = SqlHelper.ExecuteReader(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spGetProductbyproductId", p); if (drPrice != null) { if (drPrice.Read()) Price = drPrice["SalePrice"].ToString(); } return (Price); } public static DataSet GetQuantity(int ProductID, string SessionID, int Quantity, float Price) { SqlParameter p1 = new SqlParameter("@ProductID", ProductID); SqlParameter p2 = new SqlParameter("@p_sessionId", SessionID); SqlParameter p3 = new SqlParameter("@p_quantity", Quantity); SqlParameter p4 = new SqlParameter("@p_price", Price); return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spQuantity", p1, p2, p3, p4)); } //public void EnterShoppingCart(int id, string sessionID, int qty, decimal price) //{ // SqlParameter[] p = new SqlParameter[4]; // p[0] = new SqlParameter("@ProductID", SqlDbType.Int); // p[0].Value = id; // p[1] = new SqlParameter("@p_sessionId", SqlDbType.NVarChar); // p[1].Value = sessionID; // p[2] = new SqlParameter("@p_quantity", SqlDbType.BigInt); // p[2].Value = qty; // p[3] = new SqlParameter("@p_price", SqlDbType.Float); // p[3].Value = price; // SqlHelper.ExecuteNonQuery(ConfigurationSettings.AppSettings["CONSTR"], CommandType.StoredProcedure, "spQuantity", p); //} public static DataSet GetShoppingCartDetails(string SessionID) { SqlParameter p = new SqlParameter("@SessionId", SessionID); return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spCartProducts", p)); } public static void UpdateShoppingCartItem(string SessionId, int ProductId, int Quantity) { SqlParameter p1 = new SqlParameter("@SessionId", SessionId); SqlParameter p2 = new SqlParameter("@ProductId", ProductId); SqlParameter p3 = new SqlParameter("@quantity", Quantity); SqlHelper.ExecuteNonQuery(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spUpdateCart", p1, p2, p3); } public static void RemoveShoppingCartItem(string SessionId, int ProductId) { SqlParameter[] p = new SqlParameter[2]; p[0] = new SqlParameter("@SessionId", SqlDbType.NVarChar); p[0].Value = SessionId; p[1] = new SqlParameter("@ProductId", SqlDbType.BigInt); p[1].Value = ProductId; SqlHelper.ExecuteNonQuery(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spRemoveCart", p); } public static void GetLoginDetails(string p_username, string p_fname, string p_lname, string p_password, string p_question, string p_answer, DateTime p_dob, string p_no, string p_gender, string p_email, string p_address, int p_country, int p_state, int p_city, string p_zcode) { SqlParameter[] p = new SqlParameter[15]; p[0] = new SqlParameter("@username", SqlDbType.NVarChar); p[0].Value = p_username; p[1] = new SqlParameter("@fname", SqlDbType.NVarChar); p[1].Value = p_fname; p[2] = new SqlParameter("@lname", SqlDbType.NVarChar); p[2].Value = p_lname; p[3] = new SqlParameter("@password", SqlDbType.NVarChar); p[3].Value = p_password; p[4] = new SqlParameter("@HQuestion", SqlDbType.NVarChar); p[4].Value = p_question; p[5] = new SqlParameter("@Answer", SqlDbType.NVarChar); p[5].Value = p_answer; p[6] = new SqlParameter("@dob", SqlDbType.DateTime); p[6].Value = p_dob; p[7] = new SqlParameter("@ContactNo", SqlDbType.NVarChar); p[7].Value = p_no; p[8] = new SqlParameter("@gender", SqlDbType.NVarChar); p[8].Value = p_gender; p[9] = new SqlParameter("@emailId", SqlDbType.NVarChar); p[9].Value = p_email; p[10] = new SqlParameter("@Address", SqlDbType.NVarChar); p[10].Value = p_address; p[11] = new SqlParameter("@Country", SqlDbType.BigInt); p[11].Value = p_country; p[12] = new SqlParameter("@state", SqlDbType.BigInt); p[12].Value = p_state; p[13] = new SqlParameter("@City", SqlDbType.BigInt); p[13].Value = p_city; p[14] = new SqlParameter("@ZipCode ", SqlDbType.VarChar); p[14].Value = p_zcode; SqlHelper.ExecuteNonQuery(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spRegistration", p); } public static DataSet getCitydetails() { return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spGetAllCities")); } public static DataSet getCitydetailsByStateID(int StateID) { SqlParameter p = new SqlParameter("@StateID", SqlDbType.Int); p.Value = StateID; return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spGetAllCitiesByStateID", p)); } public static DataSet getCountrydetails() { return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spCountry")); } public static DataSet getAllStatedetails() { return SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spGetAllStates"); } public static DataSet getAllStatesByCountryID(int CountryID) { SqlParameter p = new SqlParameter("@CountryID", SqlDbType.Int); p.Value = CountryID; return SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spGetAllStatesByCountryID", p); } public static float GetCartTotal(string SID) { SqlParameter p = new SqlParameter("@SessionID", SID); return (float.Parse(SqlHelper.ExecuteScalar(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spGetCartTotal", p).ToString())); } public static SqlDataReader GetLogin(string Username, string Password) { SqlParameter[] p = new SqlParameter[2]; p[0] = new SqlParameter("@Username", SqlDbType.NVarChar); p[0].Value = Username; p[1] = new SqlParameter("@Password", SqlDbType.NVarChar); p[1].Value = Password; return (SqlHelper.ExecuteReader(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spLogin", p)); } public static Object GetRoleByUsername(string Username) { SqlParameter p = new SqlParameter("@Username", SqlDbType.NVarChar); p.Value = Username; return (SqlHelper.ExecuteScalar(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spGetRoleByUsername", p)); } public static SqlDataReader getQuestion(string user) { SqlParameter p = new SqlParameter("@UserName", user); return (SqlHelper.ExecuteReader(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spPassworddetails", p)); } public static SqlDataReader getPassword(string username, string answer) { SqlParameter p1 = new SqlParameter("@UserName", username); SqlParameter p2 = new SqlParameter("@Answer", answer); return (SqlHelper.ExecuteReader(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spRetrievePassword", p1, p2)); } public static string getuserpwd(string username, string password, string newpwd) { SqlParameter[] p = new SqlParameter[4]; p[0] = new SqlParameter("@Username", SqlDbType.NVarChar); p[0].Value = username; p[1] = new SqlParameter("@pwd", SqlDbType.NVarChar); p[1].Value = password; p[2] = new SqlParameter("@newpwd", SqlDbType.NVarChar); p[2].Value = newpwd; p[3] = new SqlParameter("@response", SqlDbType.NVarChar, 100); p[3].Direction = ParameterDirection.Output; SqlHelper.ExecuteNonQuery(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spUserPwd", p); return (p[3].Value.ToString()); } public static SqlDataReader getAccountDetails(string username) { SqlParameter p = new SqlParameter("@User", username); return (SqlHelper.ExecuteReader(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spChangeDetails", p)); } public static void getupdate(string username, string fname,string lname, string question, string answer, DateTime dob, string no, string gender, string email,string address, int country, int state, int city, string zcode) { SqlParameter[] p = new SqlParameter[14]; p[0] = new SqlParameter("@username", SqlDbType.NVarChar); p[0].Value = username; p[1] = new SqlParameter("@fname", SqlDbType.NVarChar); p[1].Value = fname; p[2] = new SqlParameter("@lname", SqlDbType.NVarChar); p[2].Value = lname; p[3] = new SqlParameter("@dob", SqlDbType.DateTime); p[3].Value = dob; p[4] = new SqlParameter("@ContactNo", SqlDbType.NVarChar); p[4].Value = no; p[5] = new SqlParameter("@gender", SqlDbType.NVarChar); p[5].Value = gender; p[6] = new SqlParameter("@emailId", SqlDbType.NVarChar); p[6].Value = email; p[7] = new SqlParameter("@HintQuestion", SqlDbType.NVarChar); p[7].Value = question; p[8] = new SqlParameter("@Answer", SqlDbType.NVarChar); p[8].Value = answer; p[9] = new SqlParameter("@Address", SqlDbType.NVarChar); p[9].Value = address; p[10] = new SqlParameter("@Country", SqlDbType.BigInt); p[10].Value = country; p[11] = new SqlParameter("@state", SqlDbType.BigInt); p[11].Value = state; p[12] = new SqlParameter("@City", SqlDbType.BigInt); p[12].Value = city; p[13] = new SqlParameter("@ZipCode", SqlDbType.NVarChar); p[13].Value = zcode; SqlHelper.ExecuteReader(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spUpdateDetails", p); } public static DataSet getHintquestion() { return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "getQuestion")); } public static int[] InsertAddress(string fname, string lname, string email, string gender, string contact, string nadrr, string ncountry, string nstate, string ncity) { int[] a=null; SqlParameter[] p = new SqlParameter[11]; p[0] = new SqlParameter("@firstname", SqlDbType.NVarChar); p[0].Value = fname; p[1] = new SqlParameter("@lastname", SqlDbType.NVarChar); p[1].Value = lname; p[2] = new SqlParameter("@Email", SqlDbType.NVarChar); p[2].Value = email; p[3] = new SqlParameter("@Gender", SqlDbType.NVarChar); p[3].Value = gender; p[4] = new SqlParameter("@contactno", SqlDbType.NVarChar); p[4].Value = contact; p[5] = new SqlParameter("@Address", SqlDbType.NVarChar); p[5].Value = nadrr; p[6] = new SqlParameter("@Country", SqlDbType.NVarChar); p[6].Value = ncountry; p[7] = new SqlParameter("@State", SqlDbType.NVarChar); p[7].Value = nstate; p[8] = new SqlParameter("@City ", SqlDbType.NVarChar); p[8].Value = ncity; p[9] = new SqlParameter("@AID", SqlDbType.BigInt); p[9].Direction = ParameterDirection.Output; p[10] = new SqlParameter("@Cid", SqlDbType.BigInt); p[10].Direction = ParameterDirection.Output; SqlHelper.ExecuteNonQuery(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spInsertAddress", p); if(p[9]!=null) a[0] = int.Parse(p[9].Value.ToString()); if(p[10]!=null) a[1] = int.Parse(p[10].Value.ToString()); return (a); } public static int[] spInsertAddressV2(string fname, string lname, string email, string gender, string contact, string nadrr, int ncountry, int nstate, int ncity) { int[] a=new int[2]; SqlParameter[] p = new SqlParameter[11]; p[0] = new SqlParameter("@firstname", SqlDbType.NVarChar); p[0].Value = fname; p[1] = new SqlParameter("@lastname", SqlDbType.NVarChar); p[1].Value = lname; p[2] = new SqlParameter("@Email", SqlDbType.NVarChar); p[2].Value = email; p[3] = new SqlParameter("@Gender", SqlDbType.NVarChar); p[3].Value = gender; p[4] = new SqlParameter("@contactno", SqlDbType.NVarChar); p[4].Value = contact; p[5] = new SqlParameter("@Address", SqlDbType.NVarChar); p[5].Value = nadrr; p[6] = new SqlParameter("@CountryID", SqlDbType.Int); p[6].Value = ncountry; p[7] = new SqlParameter("@StateID", SqlDbType.Int); p[7].Value = nstate; p[8] = new SqlParameter("@CityID", SqlDbType.Int); p[8].Value = ncity; p[9] = new SqlParameter("@AID", SqlDbType.BigInt); p[9].Direction = ParameterDirection.Output; p[10] = new SqlParameter("@Cid", SqlDbType.BigInt); p[10].Direction = ParameterDirection.Output; SqlHelper.ExecuteNonQuery(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spInsertAddressV2", p); if(p[9]!=null) a[0]= int.Parse(p[9].Value.ToString()); if(p[10]!=null) a[1] = int.Parse(p[10].Value.ToString()); return (a); } public static void Deletecartlogout(string Sessionid) { SqlParameter[] p = new SqlParameter[1]; p[0] = new SqlParameter("@sessionId", SqlDbType.NVarChar); p[0].Value = Sessionid; SqlHelper.ExecuteNonQuery(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spDeleteCartlogout", p); } public static int GetIdFromtblUserAccount(string username) { SqlParameter p = new SqlParameter("@username", username); SqlParameter p1 = new SqlParameter("@customerid",SqlDbType.BigInt); p1.Direction = ParameterDirection.Output; SqlHelper.ExecuteReader(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spGetCustId", p,p1); return(int.Parse(p1.Value.ToString())); } public static int insertorder(int custid,float orderamnt,float taxamnt,float netamnt,int shipaddrId,int billaddrId,string sessionid,string billfname) { SqlParameter[] p = new SqlParameter[9]; p[0] = new SqlParameter("@CustId", custid); p[1] = new SqlParameter("@OrderAmnt", orderamnt); p[2] = new SqlParameter("@TaxAmnt", taxamnt); p[3] = new SqlParameter("@NetAmnt", netamnt); p[4] = new SqlParameter("@ShipAddrId", shipaddrId); p[5] = new SqlParameter("@BillAddrId", billaddrId); p[6] = new SqlParameter("@SessionId", sessionid); p[7] = new SqlParameter("@OId",SqlDbType.BigInt); p[7].Direction = ParameterDirection.Output; p[8] = new SqlParameter("@BillFname",billfname); SqlHelper.ExecuteNonQuery(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spinsertorder", p); return(int.Parse(p[7].Value.ToString())); } public static int shoppingcartitems( string Sessionid) { //SqlParameter[] p = new SqlParameter[2]; SqlParameter p = new SqlParameter("@SessionID", Sessionid); return (int.Parse(SqlHelper.ExecuteScalar(ConnectionString.GetConnectionString(),CommandType.StoredProcedure, "spGetCartItems", p).ToString())); } public static void UpdateRate(string ProductId, int RateId) { SqlParameter[] p = new SqlParameter[2]; p[0] = new SqlParameter("@ProductId", ProductId); p[1] = new SqlParameter("@RateId", RateId); SqlHelper.ExecuteNonQuery(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spRatenow", p); } public static void InsertWishlist(string Username, string ProductId) { SqlParameter[] p = new SqlParameter[2]; p[0] = new SqlParameter("@Uname", Username); p[1] = new SqlParameter("@ProductId", ProductId); SqlHelper.ExecuteNonQuery(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spInsertWishList", p); } public static DataSet GetWishListDetails(string username) { SqlParameter p = new SqlParameter("@username", username); return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spGetWishList", p)); } public static void DeleteWishList(int ProductId) { SqlParameter p = new SqlParameter("@ProductId", ProductId); SqlHelper.ExecuteNonQuery(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spRemoveFromWishList", p); } public static DataSet RetrieveOrderDetails(string User) { SqlParameter p = new SqlParameter("@Username", User); return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spRetrieveOrderDetails", p)); } public static DataSet RetrieveOrderStatus(string User,int OrderId) { SqlParameter[] p = new SqlParameter[2]; p[0]=new SqlParameter("@Username", User); p[1] = new SqlParameter("@OrderId", OrderId); return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spRetrieveOrderStatus", p)); } public static void DeleteOrderDetails(int Ordernum) { SqlParameter p = new SqlParameter("@OrderId", Ordernum); SqlHelper.ExecuteNonQuery(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spDeleteOrder", p); } public static DataSet ViewGallery() { return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spGallery")); } public static DataSet getadminorder() { return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spgetadminorder")); } public static void updateadminorder(float amount, string status, int id) { SqlParameter[] p = new SqlParameter[3]; p[0] = new SqlParameter("@amount", amount); p[1] = new SqlParameter("@status", status); p[2] = new SqlParameter("OrderId", id); SqlHelper.ExecuteNonQuery(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spupdateadminorder", p); } public static SqlDataReader updateadminorder1(int id) { SqlParameter p = new SqlParameter("@orderid", id); return (SqlHelper.ExecuteReader(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spadmincancel", p)); } public static void deleteadminorder(int id) { SqlParameter p = new SqlParameter("@orderid", id); SqlHelper.ExecuteNonQuery(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spadmindelete", p); } public static DataSet CustomFilter(int Operator, double Amount) { SqlParameter[] p = new SqlParameter[2]; p[0] = new SqlParameter("@op", Operator); p[1] = new SqlParameter("@amnt", Amount); return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spfilterbyorderamnt", p)); } public static DataSet filterbydate(DateTime from, DateTime to) { SqlParameter[] p = new SqlParameter[2]; p[0] = new SqlParameter("@from", from); p[1] = new SqlParameter("@to", to); return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spfilterbydate", p)); } public static SqlDataReader filterbyname(string name) { SqlParameter p = new SqlParameter("@name", name); return (SqlHelper.ExecuteReader(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spfilterbyname", p)); } public static DataSet filterbystatus(string status) { SqlParameter p = new SqlParameter("@status", status); return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spfilterbystatus", p)); } public static SqlDataReader filterbyorderno(int id) { SqlParameter p = new SqlParameter("@orderid", id); return (SqlHelper.ExecuteReader(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spfilterbyorderno", p)); } public static DataSet sortbyordernoasc() { return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "sortbyordernoasc")); } public static DataSet sortbyordernodesc() { return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "sortbyordernodesc")); } public static DataSet sortbycustnameasc() { return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "sortbycustnameasc")); } public static DataSet sortbycustnamedesc() { return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "sortbycustnamedesc")); } public static DataSet sortbyorderdateasc() { return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "sortbyorderdateasc")); } public static DataSet sortbyorderdatedesc() { return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "sortbyorderdatedesc")); } public static DataSet getCategoryNames() { return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spGetCategoryName")); } public static DataSet getBrandNames() { return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spGetBrandName")); } public static DataSet GetAllProducts() { return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spGetProducts")); } public static DataSet GetAllProductsBYID(int Id) { SqlParameter p = new SqlParameter("@Id", Id); return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spGetProductsByID", p)); } public static void InsertCategory(string Name, string Description, string Image) { SqlParameter[] p = new SqlParameter[3]; p[0] = new SqlParameter("@Name", Name); p[1] = new SqlParameter("@Description", Description); p[2] = new SqlParameter("@Image", Image); SqlHelper.ExecuteNonQuery(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spInsertNewCategories", p); } public static void InsertBrand(string BrandName, string Discription, string Logo) { SqlParameter[] p = new SqlParameter[3]; p[0] = new SqlParameter("@BrandName", BrandName); p[1] = new SqlParameter("@Description", Discription); p[2] = new SqlParameter("@Logo", Logo); SqlHelper.ExecuteNonQuery(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spInsertNewBrand", p); } public static void UpdateBrand(int BrandId, string BrandName, string Description, string Logo) { SqlParameter[] p = new SqlParameter[4]; p[0] = new SqlParameter("@ID", BrandId); p[1] = new SqlParameter("@BrandName", BrandName); p[2] = new SqlParameter("@Description", Description); p[3] = new SqlParameter("@Logo", Logo); SqlHelper.ExecuteNonQuery(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spUpdateBrand", p); } public static void UpdateCategory(int Id, string Name, string Description, string Image) { SqlParameter[] p = new SqlParameter[4]; p[0] = new SqlParameter("@Id", Id); p[1] = new SqlParameter("@Name", Name); p[2] = new SqlParameter("@Description", Description); p[3] = new SqlParameter("@Image", Image); SqlHelper.ExecuteNonQuery(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spUpdateCategory", p); } public static void UpdateProduct(int Id, string Name, string Description, int Quantity, string Image, float PurchasePrice, float SalePrice) { SqlParameter[] p = new SqlParameter[7]; p[0] = new SqlParameter("@Id", Id); p[1] = new SqlParameter("@Name", Name); p[2] = new SqlParameter("@Description", Description); p[3] = new SqlParameter("@Quantity", Quantity); p[4] = new SqlParameter("@Image", Image); p[5] = new SqlParameter("@PurchasePrice", PurchasePrice); p[6] = new SqlParameter("@SalePrice", SalePrice); SqlHelper.ExecuteNonQuery(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spUpdateProduct", p); } public static void DeleteBrand(int BrandId) { SqlParameter p = new SqlParameter("@BrandId", BrandId); SqlHelper.ExecuteNonQuery(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spDeleteBrand", p); } public static void DeleteCategory(int CatId) { SqlParameter p = new SqlParameter("@CatId", CatId); SqlHelper.ExecuteNonQuery(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spDeleteCategory", p); } public static void DeleteProduct(int Id) { SqlParameter p = new SqlParameter("@Id", Id); SqlHelper.ExecuteNonQuery(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spDeleteProduct", p); } public static void InsertProduct(string name, float PurchasePrice, float SalePrice, int Quantity, string Description, string Image, int BrandId, int CategoryId) { SqlParameter[] p = new SqlParameter[8]; p[0] = new SqlParameter("@name", name); p[1] = new SqlParameter("@PurchasePrice", PurchasePrice); p[2] = new SqlParameter("@SalePrice", SalePrice); p[3] = new SqlParameter("@Quantity", Quantity); p[4] = new SqlParameter("@Description", Description); p[5] = new SqlParameter("@Image", Image); p[6] = new SqlParameter("@BrandId", BrandId); p[7] = new SqlParameter("@CategoryId", CategoryId); SqlHelper.ExecuteNonQuery(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spInsertNewProduct", p); } public static DataSet GetAllBrandBYBrandID(int BrandId) { SqlParameter p = new SqlParameter("@BrandId", BrandId); return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spGetBrandBYBrandID", p)); } public static DataSet GetAllCategoriesBYCategoryID(int CatId) { SqlParameter p = new SqlParameter("@CatId", CatId); return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spGetCategoriesBYCategoryID", p)); } } }

ShoppingCart.BL/ShoppingCart.BL/Properties/AssemblyInfo.cs

using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ShoppingCart.BL")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ShoppingCart.BL")] [assembly: AssemblyCopyright("Copyright © 2005")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("dfd89e3e-a249-4a89-a849-5e4dd6c94ef2")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]

ShoppingCart.BL/ShoppingCart.BL/RegistrationControl.cs

using System; using System.Collections.Generic; using System.Text; namespace ShoppingCart.BL { class RegistrationControl { } }

ShoppingCart.BL/ShoppingCart.BL/ShoppingCart.BL.csproj

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>8.0.50727</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{12EA030B-491C-4B80-A2E9-585983E3BECB}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>ShoppingCart.BL</RootNamespace> <AssemblyName>ShoppingCart.BL</AssemblyName> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="ShoppingCart.DAL, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\ShoppingCart.DAL\ShoppingCart.DAL\bin\Debug\ShoppingCart.DAL.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="ConnectionString.cs" /> <Compile Include="ProductController.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="RegistrationControl.cs" /> <Compile Include="UserController.cs" /> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project>

ShoppingCart.BL/ShoppingCart.BL/UserController.cs

using System; using System.Collections.Generic; using System.Text; using System.Data; using ShoppingCart.DAL; using System.Data.SqlClient; using ShoppingCart.BL; using System.Configuration; namespace ShoppingCart.BL { public class UserController { public static DataSet getALLUsers() { return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spGetALLUsers")); } public static DataSet GetUserBYUserID(int UserID) { SqlParameter p = new SqlParameter("@UserID", UserID); return (SqlHelper.ExecuteDataset(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spGetUserBYUserID",p)); } public static void UpdateUserDetails(string p_username, string p_fname,string p_lname, DateTime p_dob, string p_no, string p_gender, string p_email,string p_address, int p_country, int p_state,int p_city, string p_zcode,int AddrID,int UID) { SqlParameter[] p = new SqlParameter[14]; p[0] = new SqlParameter("@username", SqlDbType.NVarChar); p[0].Value = p_username; p[1] = new SqlParameter("@fname", SqlDbType.NVarChar); p[1].Value = p_fname; p[2] = new SqlParameter("@lname", SqlDbType.NVarChar); p[2].Value = p_lname; p[3] = new SqlParameter("@dob", SqlDbType.DateTime); p[3].Value = p_dob; p[4] = new SqlParameter("@ContactNo", SqlDbType.NVarChar); p[4].Value = p_no; p[5] = new SqlParameter("@gender", SqlDbType.NVarChar); p[5].Value = p_gender; p[6] = new SqlParameter("@emailId", SqlDbType.NVarChar); p[6].Value = p_email; p[7] = new SqlParameter("@Address", SqlDbType.NVarChar); p[7].Value = p_address; p[8] = new SqlParameter("@Country", SqlDbType.BigInt); p[8].Value = p_country; p[9] = new SqlParameter("@state", SqlDbType.BigInt); p[9].Value = p_state; p[10] = new SqlParameter("@City", SqlDbType.BigInt); p[10].Value = p_city; p[11] = new SqlParameter("@ZipCode", SqlDbType.VarChar); p[11].Value = p_zcode; p[12] = new SqlParameter("@AddressID", SqlDbType.Int); p[12].Value = AddrID; p[13] = new SqlParameter("@UserID", SqlDbType.Int); p[13].Value = UID; SqlHelper.ExecuteNonQuery(ConnectionString.GetConnectionString(), CommandType.StoredProcedure,"spUpdateUserDetails", p); } public static void DeleteUserByUserID(int UserID) { SqlParameter p = new SqlParameter("@UserID", UserID); SqlHelper.ExecuteNonQuery(ConnectionString.GetConnectionString(), CommandType.StoredProcedure, "spDeleteUserByUserID", p); } } }

ShoppingCart.DAL/ShoppingCart.DAL.sln

Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShoppingCart.DAL", "ShoppingCart.DAL\ShoppingCart.DAL.csproj", "{E5D25256-DC9A-4A1B-8978-3B79863C511E}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {E5D25256-DC9A-4A1B-8978-3B79863C511E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E5D25256-DC9A-4A1B-8978-3B79863C511E}.Debug|Any CPU.Build.0 = Debug|Any CPU {E5D25256-DC9A-4A1B-8978-3B79863C511E}.Release|Any CPU.ActiveCfg = Release|Any CPU {E5D25256-DC9A-4A1B-8978-3B79863C511E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal

ShoppingCart.DAL/ShoppingCart.DAL.suo

ShoppingCart.DAL/ShoppingCart.DAL/bin/Debug/ShoppingCart.DAL.dll

ShoppingCart.DAL/ShoppingCart.DAL/bin/Debug/ShoppingCart.DAL.pdb

ShoppingCart.DAL/ShoppingCart.DAL/obj/Debug/ShoppingCart.DAL.dll

ShoppingCart.DAL/ShoppingCart.DAL/obj/Debug/ShoppingCart.DAL.pdb

ShoppingCart.DAL/ShoppingCart.DAL/obj/ShoppingCart.DAL.csproj.FileList.txt

bin\Debug\ShoppingCart.DAL.dll bin\Debug\ShoppingCart.DAL.pdb obj\Debug\ResolveAssemblyReference.cache obj\Debug\ShoppingCart.DAL.dll obj\Debug\ShoppingCart.DAL.pdb

ShoppingCart.DAL/ShoppingCart.DAL/Properties/AssemblyInfo.cs

using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ShoppingCart.DAL")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ShoppingCart.DAL")] [assembly: AssemblyCopyright("Copyright © 2005")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("2c640fe4-6cc1-4faf-af77-4e5c742a3232")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]

ShoppingCart.DAL/ShoppingCart.DAL/ShoppingCart.DAL.csproj

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>8.0.50727</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{E5D25256-DC9A-4A1B-8978-3B79863C511E}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>ShoppingCart.DAL</RootNamespace> <AssemblyName>ShoppingCart.DAL</AssemblyName> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="SQLHelper.cs" /> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project>

ShoppingCart.DAL/ShoppingCart.DAL/SQLHelper.cs

//=============================================================================== // SQLHelper.cs // // This file contains the implementations of the SqlHelper and SqlHelperParameterCache // classes. // //============================================================================== using System; using System.Data; using System.Xml; using System.Data.SqlClient; using System.Collections; namespace ShoppingCart.DAL { /// <summary> /// The SqlHelper class is intended to encapsulate high performance, scalable best practices for /// common uses of SqlClient. /// </summary> public sealed class SqlHelper { #region private utility methods & constructors //Since this class provides only static methods, make the default constructor private to prevent //instances from being created with "new SqlHelper()". private SqlHelper() {} /// <summary> /// This method is used to attach array of SqlParameters to a SqlCommand. /// /// This method will assign a value of DbNull to any parameter with a direction of /// InputOutput and a value of null. /// /// This behavior will prevent default values from being used, but /// this will be the less common case than an intended pure output parameter (derived as InputOutput) /// where the user provided no input value. /// </summary> /// <param name="command">The command to which the parameters will be added</param> /// <param name="commandParameters">an array of SqlParameters tho be added to command</param> private static void AttachParameters(SqlCommand command, SqlParameter[] commandParameters) { foreach (SqlParameter p in commandParameters) { //check for derived output value with no value assigned if ((p.Direction == ParameterDirection.InputOutput) && (p.Value == null)) { p.Value = DBNull.Value; } command.Parameters.Add(p); } } /// <summary> /// This method assigns an array of values to an array of SqlParameters. /// </summary> /// <param name="commandParameters">array of SqlParameters to be assigned values</param> /// <param name="parameterValues">array of objects holding the values to be assigned</param> private static void AssignParameterValues(SqlParameter[] commandParameters, object[] parameterValues) { if ((commandParameters == null) || (parameterValues == null)) { //do nothing if we get no data return; } // we must have the same number of values as we pave parameters to put them in if (commandParameters.Length != parameterValues.Length) { throw new ArgumentException("Parameter count does not match Parameter Value count."); } //iterate through the SqlParameters, assigning the values from the corresponding position in the //value array for (int i = 0, j = commandParameters.Length; i < j; i++) { commandParameters[i].Value = parameterValues[i]; } } /// <summary> /// This method opens (if necessary) and assigns a connection, transaction, command type and parameters /// to the provided command. /// </summary> /// <param name="command">the SqlCommand to be prepared</param> /// <param name="connection">a valid SqlConnection, on which to execute this command</param> /// <param name="transaction">a valid SqlTransaction, or 'null'</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command</param> /// <param name="commandParameters">an array of SqlParameters to be associated with the command or 'null' if no parameters are required</param> private static void PrepareCommand(SqlCommand command, SqlConnection connection, SqlTransaction transaction, CommandType commandType, string commandText, SqlParameter[] commandParameters) { //if the provided connection is not open, we will open it if (connection.State != ConnectionState.Open) { connection.Open(); } //associate the connection with the command command.Connection = connection; //set the command text (stored procedure name or SQL statement) command.CommandText = commandText; //if we were provided a transaction, assign it. if (transaction != null) { command.Transaction = transaction; } //set the command type command.CommandType = commandType; //attach the command parameters if they are provided if (commandParameters != null) { AttachParameters(command, commandParameters); } return; } #endregion private utility methods & constructors #region ExecuteNonQuery /// <summary> /// Execute a SqlCommand (that returns no resultset and takes no parameters) against the database specified in /// the connection string. /// </summary> /// <remarks> /// e.g.: /// int result = ExecuteNonQuery(connString, CommandType.StoredProcedure, "PublishOrders"); /// </remarks> /// <param name="connectionString">a valid connection string for a SqlConnection</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command</param> /// <returns>an int representing the number of rows affected by the command</returns> public static int ExecuteNonQuery(string connectionString, CommandType commandType, string commandText) { //pass through the call providing null for the set of SqlParameters return ExecuteNonQuery(connectionString, commandType, commandText, (SqlParameter[])null); } /// <summary> /// Execute a SqlCommand (that returns no resultset) against the database specified in the connection string /// using the provided parameters. /// </summary> /// <remarks> /// e.g.: /// int result = ExecuteNonQuery(connString, CommandType.StoredProcedure, "PublishOrders", new SqlParameter("@prodid", 24)); /// </remarks> /// <param name="connectionString">a valid connection string for a SqlConnection</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command</param> /// <param name="commandParameters">an array of SqlParamters used to execute the command</param> /// <returns>an int representing the number of rows affected by the command</returns> public static int ExecuteNonQuery(string connectionString, CommandType commandType, string commandText, params SqlParameter[] commandParameters) { //create & open a SqlConnection, and dispose of it after we are done. using (SqlConnection cn = new SqlConnection(connectionString)) { cn.Open(); //call the overload that takes a connection in place of the connection string return ExecuteNonQuery(cn, commandType, commandText, commandParameters); } } /// <summary> /// Execute a stored procedure via a SqlCommand (that returns no resultset) against the database specified in /// the connection string using the provided parameter values. This method will query the database to discover the parameters for the /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. /// </summary> /// <remarks> /// This method provides no access to output parameters or the stored procedure's return value parameter. /// /// e.g.: /// int result = ExecuteNonQuery(connString, "PublishOrders", 24, 36); /// </remarks> /// <param name="connectionString">a valid connection string for a SqlConnection</param> /// <param name="spName">the name of the stored prcedure</param> /// <param name="parameterValues">an array of objects to be assigned as the input values of the stored procedure</param> /// <returns>an int representing the number of rows affected by the command</returns> public static int ExecuteNonQuery(string connectionString, string spName, params object[] parameterValues) { //if we receive parameter values, we need to figure out where they go if ((parameterValues != null) && (parameterValues.Length > 0)) { //pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connectionString, spName); //assign the provided values to these parameters based on parameter order AssignParameterValues(commandParameters, parameterValues); //call the overload that takes an array of SqlParameters return ExecuteNonQuery(connectionString, CommandType.StoredProcedure, spName, commandParameters); } //otherwise we can just call the SP without params else { return ExecuteNonQuery(connectionString, CommandType.StoredProcedure, spName); } } /// <summary> /// Execute a SqlCommand (that returns no resultset and takes no parameters) against the provided SqlConnection. /// </summary> /// <remarks> /// e.g.: /// int result = ExecuteNonQuery(conn, CommandType.StoredProcedure, "PublishOrders"); /// </remarks> /// <param name="connection">a valid SqlConnection</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command</param> /// <returns>an int representing the number of rows affected by the command</returns> public static int ExecuteNonQuery(SqlConnection connection, CommandType commandType, string commandText) { //pass through the call providing null for the set of SqlParameters return ExecuteNonQuery(connection, commandType, commandText, (SqlParameter[])null); } /// <summary> /// Execute a SqlCommand (that returns no resultset) against the specified SqlConnection /// using the provided parameters. /// </summary> /// <remarks> /// e.g.: /// int result = ExecuteNonQuery(conn, CommandType.StoredProcedure, "PublishOrders", new SqlParameter("@prodid", 24)); /// </remarks> /// <param name="connection">a valid SqlConnection</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command</param> /// <param name="commandParameters">an array of SqlParamters used to execute the command</param> /// <returns>an int representing the number of rows affected by the command</returns> public static int ExecuteNonQuery(SqlConnection connection, CommandType commandType, string commandText, params SqlParameter[] commandParameters) { //create a command and prepare it for execution SqlCommand cmd = new SqlCommand(); PrepareCommand(cmd, connection, (SqlTransaction)null, commandType, commandText, commandParameters); //finally, execute the command. int retval = cmd.ExecuteNonQuery(); // detach the SqlParameters from the command object, so they can be used again. cmd.Parameters.Clear(); return retval; } /// <summary> /// Execute a stored procedure via a SqlCommand (that returns no resultset) against the specified SqlConnection /// using the provided parameter values. This method will query the database to discover the parameters for the /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. /// </summary> /// <remarks> /// This method provides no access to output parameters or the stored procedure's return value parameter. /// /// e.g.: /// int result = ExecuteNonQuery(conn, "PublishOrders", 24, 36); /// </remarks> /// <param name="connection">a valid SqlConnection</param> /// <param name="spName">the name of the stored procedure</param> /// <param name="parameterValues">an array of objects to be assigned as the input values of the stored procedure</param> /// <returns>an int representing the number of rows affected by the command</returns> public static int ExecuteNonQuery(SqlConnection connection, string spName, params object[] parameterValues) { //if we receive parameter values, we need to figure out where they go if ((parameterValues != null) && (parameterValues.Length > 0)) { //pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connection.ConnectionString, spName); //assign the provided values to these parameters based on parameter order AssignParameterValues(commandParameters, parameterValues); //call the overload that takes an array of SqlParameters return ExecuteNonQuery(connection, CommandType.StoredProcedure, spName, commandParameters); } //otherwise we can just call the SP without params else { return ExecuteNonQuery(connection, CommandType.StoredProcedure, spName); } } /// <summary> /// Execute a SqlCommand (that returns no resultset and takes no parameters) against the provided SqlTransaction. /// </summary> /// <remarks> /// e.g.: /// int result = ExecuteNonQuery(trans, CommandType.StoredProcedure, "PublishOrders"); /// </remarks> /// <param name="transaction">a valid SqlTransaction</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command</param> /// <returns>an int representing the number of rows affected by the command</returns> public static int ExecuteNonQuery(SqlTransaction transaction, CommandType commandType, string commandText) { //pass through the call providing null for the set of SqlParameters return ExecuteNonQuery(transaction, commandType, commandText, (SqlParameter[])null); } /// <summary> /// Execute a SqlCommand (that returns no resultset) against the specified SqlTransaction /// using the provided parameters. /// </summary> /// <remarks> /// e.g.: /// int result = ExecuteNonQuery(trans, CommandType.StoredProcedure, "GetOrders", new SqlParameter("@prodid", 24)); /// </remarks> /// <param name="transaction">a valid SqlTransaction</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command</param> /// <param name="commandParameters">an array of SqlParamters used to execute the command</param> /// <returns>an int representing the number of rows affected by the command</returns> public static int ExecuteNonQuery(SqlTransaction transaction, CommandType commandType, string commandText, params SqlParameter[] commandParameters) { //create a command and prepare it for execution SqlCommand cmd = new SqlCommand(); PrepareCommand(cmd, transaction.Connection, transaction, commandType, commandText, commandParameters); //finally, execute the command. int retval = cmd.ExecuteNonQuery(); // detach the SqlParameters from the command object, so they can be used again. cmd.Parameters.Clear(); return retval; } /// <summary> /// Execute a stored procedure via a SqlCommand (that returns no resultset) against the specified /// SqlTransaction using the provided parameter values. This method will query the database to discover the parameters for the /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. /// </summary> /// <remarks> /// This method provides no access to output parameters or the stored procedure's return value parameter. /// /// e.g.: /// int result = ExecuteNonQuery(conn, trans, "PublishOrders", 24, 36); /// </remarks> /// <param name="transaction">a valid SqlTransaction</param> /// <param name="spName">the name of the stored procedure</param> /// <param name="parameterValues">an array of objects to be assigned as the input values of the stored procedure</param> /// <returns>an int representing the number of rows affected by the command</returns> public static int ExecuteNonQuery(SqlTransaction transaction, string spName, params object[] parameterValues) { //if we receive parameter values, we need to figure out where they go if ((parameterValues != null) && (parameterValues.Length > 0)) { //pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(transaction.Connection.ConnectionString, spName); //assign the provided values to these parameters based on parameter order AssignParameterValues(commandParameters, parameterValues); //call the overload that takes an array of SqlParameters return ExecuteNonQuery(transaction, CommandType.StoredProcedure, spName, commandParameters); } //otherwise we can just call the SP without params else { return ExecuteNonQuery(transaction, CommandType.StoredProcedure, spName); } } #endregion ExecuteNonQuery #region ExecuteDataSet /// <summary> /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the database specified in /// the connection string. /// </summary> /// <remarks> /// e.g.: /// DataSet ds = ExecuteDataset(connString, CommandType.StoredProcedure, "GetOrders"); /// </remarks> /// <param name="connectionString">a valid connection string for a SqlConnection</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command</param> /// <returns>a dataset containing the resultset generated by the command</returns> public static DataSet ExecuteDataset(string connectionString, CommandType commandType, string commandText) { //pass through the call providing null for the set of SqlParameters return ExecuteDataset(connectionString, commandType, commandText, (SqlParameter[])null); } /// <summary> /// Execute a SqlCommand (that returns a resultset) against the database specified in the connection string /// using the provided parameters. /// </summary> /// <remarks> /// e.g.: /// DataSet ds = ExecuteDataset(connString, CommandType.StoredProcedure, "GetOrders", new SqlParameter("@prodid", 24)); /// </remarks> /// <param name="connectionString">a valid connection string for a SqlConnection</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command</param> /// <param name="commandParameters">an array of SqlParamters used to execute the command</param> /// <returns>a dataset containing the resultset generated by the command</returns> public static DataSet ExecuteDataset(string connectionString, CommandType commandType, string commandText, params SqlParameter[] commandParameters) { //create & open a SqlConnection, and dispose of it after we are done. using (SqlConnection cn = new SqlConnection(connectionString)) { cn.Open(); //call the overload that takes a connection in place of the connection string return ExecuteDataset(cn, commandType, commandText, commandParameters); } } /// <summary> /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the database specified in /// the connection string using the provided parameter values. This method will query the database to discover the parameters for the /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. /// </summary> /// <remarks> /// This method provides no access to output parameters or the stored procedure's return value parameter. /// /// e.g.: /// DataSet ds = ExecuteDataset(connString, "GetOrders", 24, 36); /// </remarks> /// <param name="connectionString">a valid connection string for a SqlConnection</param> /// <param name="spName">the name of the stored procedure</param> /// <param name="parameterValues">an array of objects to be assigned as the input values of the stored procedure</param> /// <returns>a dataset containing the resultset generated by the command</returns> public static DataSet ExecuteDataset(string connectionString, string spName, params object[] parameterValues) { //if we receive parameter values, we need to figure out where they go if ((parameterValues != null) && (parameterValues.Length > 0)) { //pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connectionString, spName); //assign the provided values to these parameters based on parameter order AssignParameterValues(commandParameters, parameterValues); //call the overload that takes an array of SqlParameters return ExecuteDataset(connectionString, CommandType.StoredProcedure, spName, commandParameters); } //otherwise we can just call the SP without params else { return ExecuteDataset(connectionString, CommandType.StoredProcedure, spName); } } /// <summary> /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlConnection. /// </summary> /// <remarks> /// e.g.: /// DataSet ds = ExecuteDataset(conn, CommandType.StoredProcedure, "GetOrders"); /// </remarks> /// <param name="connection">a valid SqlConnection</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command</param> /// <returns>a dataset containing the resultset generated by the command</returns> public static DataSet ExecuteDataset(SqlConnection connection, CommandType commandType, string commandText) { //pass through the call providing null for the set of SqlParameters return ExecuteDataset(connection, commandType, commandText, (SqlParameter[])null); } /// <summary> /// Execute a SqlCommand (that returns a resultset) against the specified SqlConnection /// using the provided parameters. /// </summary> /// <remarks> /// e.g.: /// DataSet ds = ExecuteDataset(conn, CommandType.StoredProcedure, "GetOrders", new SqlParameter("@prodid", 24)); /// </remarks> /// <param name="connection">a valid SqlConnection</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command</param> /// <param name="commandParameters">an array of SqlParamters used to execute the command</param> /// <returns>a dataset containing the resultset generated by the command</returns> public static DataSet ExecuteDataset(SqlConnection connection, CommandType commandType, string commandText, params SqlParameter[] commandParameters) { //create a command and prepare it for execution SqlCommand cmd = new SqlCommand(); PrepareCommand(cmd, connection, (SqlTransaction)null, commandType, commandText, commandParameters); //create the DataAdapter & DataSet SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); //fill the DataSet using default values for DataTable names, etc. da.Fill(ds); // detach the SqlParameters from the command object, so they can be used again. cmd.Parameters.Clear(); //return the dataset return ds; } /// <summary> /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlConnection /// using the provided parameter values. This method will query the database to discover the parameters for the /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. /// </summary> /// <remarks> /// This method provides no access to output parameters or the stored procedure's return value parameter. /// /// e.g.: /// DataSet ds = ExecuteDataset(conn, "GetOrders", 24, 36); /// </remarks> /// <param name="connection">a valid SqlConnection</param> /// <param name="spName">the name of the stored procedure</param> /// <param name="parameterValues">an array of objects to be assigned as the input values of the stored procedure</param> /// <returns>a dataset containing the resultset generated by the command</returns> public static DataSet ExecuteDataset(SqlConnection connection, string spName, params object[] parameterValues) { //if we receive parameter values, we need to figure out where they go if ((parameterValues != null) && (parameterValues.Length > 0)) { //pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connection.ConnectionString, spName); //assign the provided values to these parameters based on parameter order AssignParameterValues(commandParameters, parameterValues); //call the overload that takes an array of SqlParameters return ExecuteDataset(connection, CommandType.StoredProcedure, spName, commandParameters); } //otherwise we can just call the SP without params else { return ExecuteDataset(connection, CommandType.StoredProcedure, spName); } } /// <summary> /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlTransaction. /// </summary> /// <remarks> /// e.g.: /// DataSet ds = ExecuteDataset(trans, CommandType.StoredProcedure, "GetOrders"); /// </remarks> /// <param name="transaction">a valid SqlTransaction</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command</param> /// <returns>a dataset containing the resultset generated by the command</returns> public static DataSet ExecuteDataset(SqlTransaction transaction, CommandType commandType, string commandText) { //pass through the call providing null for the set of SqlParameters return ExecuteDataset(transaction, commandType, commandText, (SqlParameter[])null); } /// <summary> /// Execute a SqlCommand (that returns a resultset) against the specified SqlTransaction /// using the provided parameters. /// </summary> /// <remarks> /// e.g.: /// DataSet ds = ExecuteDataset(trans, CommandType.StoredProcedure, "GetOrders", new SqlParameter("@prodid", 24)); /// </remarks> /// <param name="transaction">a valid SqlTransaction</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command</param> /// <param name="commandParameters">an array of SqlParamters used to execute the command</param> /// <returns>a dataset containing the resultset generated by the command</returns> public static DataSet ExecuteDataset(SqlTransaction transaction, CommandType commandType, string commandText, params SqlParameter[] commandParameters) { //create a command and prepare it for execution SqlCommand cmd = new SqlCommand(); PrepareCommand(cmd, transaction.Connection, transaction, commandType, commandText, commandParameters); //create the DataAdapter & DataSet SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); //fill the DataSet using default values for DataTable names, etc. da.Fill(ds); // detach the SqlParameters from the command object, so they can be used again. cmd.Parameters.Clear(); //return the dataset return ds; } /// <summary> /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified /// SqlTransaction using the provided parameter values. This method will query the database to discover the parameters for the /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. /// </summary> /// <remarks> /// This method provides no access to output parameters or the stored procedure's return value parameter. /// /// e.g.: /// DataSet ds = ExecuteDataset(trans, "GetOrders", 24, 36); /// </remarks> /// <param name="transaction">a valid SqlTransaction</param> /// <param name="spName">the name of the stored procedure</param> /// <param name="parameterValues">an array of objects to be assigned as the input values of the stored procedure</param> /// <returns>a dataset containing the resultset generated by the command</returns> public static DataSet ExecuteDataset(SqlTransaction transaction, string spName, params object[] parameterValues) { //if we receive parameter values, we need to figure out where they go if ((parameterValues != null) && (parameterValues.Length > 0)) { //pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(transaction.Connection.ConnectionString, spName); //assign the provided values to these parameters based on parameter order AssignParameterValues(commandParameters, parameterValues); //call the overload that takes an array of SqlParameters return ExecuteDataset(transaction, CommandType.StoredProcedure, spName, commandParameters); } //otherwise we can just call the SP without params else { return ExecuteDataset(transaction, CommandType.StoredProcedure, spName); } } #endregion ExecuteDataSet #region ExecuteReader /// <summary> /// this enum is used to indicate whether the connection was provided by the caller, or created by SqlHelper, so that /// we can set the appropriate CommandBehavior when calling ExecuteReader() /// </summary> private enum SqlConnectionOwnership { /// <summary>Connection is owned and managed by SqlHelper</summary> Internal, /// <summary>Connection is owned and managed by the caller</summary> External } /// <summary> /// Create and prepare a SqlCommand, and call ExecuteReader with the appropriate CommandBehavior. /// </summary> /// <remarks> /// If we created and opened the connection, we want the connection to be closed when the DataReader is closed. /// /// If the caller provided the connection, we want to leave it to them to manage. /// </remarks> /// <param name="connection">a valid SqlConnection, on which to execute this command</param> /// <param name="transaction">a valid SqlTransaction, or 'null'</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command</param> /// <param name="commandParameters">an array of SqlParameters to be associated with the command or 'null' if no parameters are required</param> /// <param name="connectionOwnership">indicates whether the connection parameter was provided by the caller, or created by SqlHelper</param> /// <returns>SqlDataReader containing the results of the command</returns> private static SqlDataReader ExecuteReader(SqlConnection connection, SqlTransaction transaction, CommandType commandType, string commandText, SqlParameter[] commandParameters, SqlConnectionOwnership connectionOwnership) { //create a command and prepare it for execution SqlCommand cmd = new SqlCommand(); PrepareCommand(cmd, connection, transaction, commandType, commandText, commandParameters); //create a reader SqlDataReader dr; // call ExecuteReader with the appropriate CommandBehavior if (connectionOwnership == SqlConnectionOwnership.External) { dr = cmd.ExecuteReader(); } else { dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); } // detach the SqlParameters from the command object, so they can be used again. cmd.Parameters.Clear(); return dr; } /// <summary> /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the database specified in /// the connection string. /// </summary> /// <remarks> /// e.g.: /// SqlDataReader dr = ExecuteReader(connString, CommandType.StoredProcedure, "GetOrders"); /// </remarks> /// <param name="connectionString">a valid connection string for a SqlConnection</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command</param> /// <returns>a SqlDataReader containing the resultset generated by the command</returns> public static SqlDataReader ExecuteReader(string connectionString, CommandType commandType, string commandText) { //pass through the call providing null for the set of SqlParameters return ExecuteReader(connectionString, commandType, commandText, (SqlParameter[])null); } /// <summary> /// Execute a SqlCommand (that returns a resultset) against the database specified in the connection string /// using the provided parameters. /// </summary> /// <remarks> /// e.g.: /// SqlDataReader dr = ExecuteReader(connString, CommandType.StoredProcedure, "GetOrders", new SqlParameter("@prodid", 24)); /// </remarks> /// <param name="connectionString">a valid connection string for a SqlConnection</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command</param> /// <param name="commandParameters">an array of SqlParamters used to execute the command</param> /// <returns>a SqlDataReader containing the resultset generated by the command</returns> public static SqlDataReader ExecuteReader(string connectionString, CommandType commandType, string commandText, params SqlParameter[] commandParameters) { //create & open a SqlConnection SqlConnection cn = new SqlConnection(connectionString); cn.Open(); try { //call the private overload that takes an internally owned connection in place of the connection string return ExecuteReader(cn, null, commandType, commandText, commandParameters,SqlConnectionOwnership.Internal); } catch { //if we fail to return the SqlDatReader, we need to close the connection ourselves cn.Close(); throw; } } /// <summary> /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the database specified in /// the connection string using the provided parameter values. This method will query the database to discover the parameters for the /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. /// </summary> /// <remarks> /// This method provides no access to output parameters or the stored procedure's return value parameter. /// /// e.g.: /// SqlDataReader dr = ExecuteReader(connString, "GetOrders", 24, 36); /// </remarks> /// <param name="connectionString">a valid connection string for a SqlConnection</param> /// <param name="spName">the name of the stored procedure</param> /// <param name="parameterValues">an array of objects to be assigned as the input values of the stored procedure</param> /// <returns>a SqlDataReader containing the resultset generated by the command</returns> public static SqlDataReader ExecuteReader(string connectionString, string spName, params object[] parameterValues) { //if we receive parameter values, we need to figure out where they go if ((parameterValues != null) && (parameterValues.Length > 0)) { //pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connectionString, spName); //assign the provided values to these parameters based on parameter order AssignParameterValues(commandParameters, parameterValues); //call the overload that takes an array of SqlParameters return ExecuteReader(connectionString, CommandType.StoredProcedure, spName, commandParameters); } //otherwise we can just call the SP without params else { return ExecuteReader(connectionString, CommandType.StoredProcedure, spName); } } /// <summary> /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlConnection. /// </summary> /// <remarks> /// e.g.: /// SqlDataReader dr = ExecuteReader(conn, CommandType.StoredProcedure, "GetOrders"); /// </remarks> /// <param name="connection">a valid SqlConnection</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command</param> /// <returns>a SqlDataReader containing the resultset generated by the command</returns> public static SqlDataReader ExecuteReader(SqlConnection connection, CommandType commandType, string commandText) { //pass through the call providing null for the set of SqlParameters return ExecuteReader(connection, commandType, commandText, (SqlParameter[])null); } /// <summary> /// Execute a SqlCommand (that returns a resultset) against the specified SqlConnection /// using the provided parameters. /// </summary> /// <remarks> /// e.g.: /// SqlDataReader dr = ExecuteReader(conn, CommandType.StoredProcedure, "GetOrders", new SqlParameter("@prodid", 24)); /// </remarks> /// <param name="connection">a valid SqlConnection</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command</param> /// <param name="commandParameters">an array of SqlParamters used to execute the command</param> /// <returns>a SqlDataReader containing the resultset generated by the command</returns> public static SqlDataReader ExecuteReader(SqlConnection connection, CommandType commandType, string commandText, params SqlParameter[] commandParameters) { //pass through the call to the private overload using a null transaction value and an externally owned connection return ExecuteReader(connection, (SqlTransaction)null, commandType, commandText, commandParameters, SqlConnectionOwnership.External); } /// <summary> /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlConnection /// using the provided parameter values. This method will query the database to discover the parameters for the /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. /// </summary> /// <remarks> /// This method provides no access to output parameters or the stored procedure's return value parameter. /// /// e.g.: /// SqlDataReader dr = ExecuteReader(conn, "GetOrders", 24, 36); /// </remarks> /// <param name="connection">a valid SqlConnection</param> /// <param name="spName">the name of the stored procedure</param> /// <param name="parameterValues">an array of objects to be assigned as the input values of the stored procedure</param> /// <returns>a SqlDataReader containing the resultset generated by the command</returns> public static SqlDataReader ExecuteReader(SqlConnection connection, string spName, params object[] parameterValues) { //if we receive parameter values, we need to figure out where they go if ((parameterValues != null) && (parameterValues.Length > 0)) { SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connection.ConnectionString, spName); AssignParameterValues(commandParameters, parameterValues); return ExecuteReader(connection, CommandType.StoredProcedure, spName, commandParameters); } //otherwise we can just call the SP without params else { return ExecuteReader(connection, CommandType.StoredProcedure, spName); } } /// <summary> /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlTransaction. /// </summary> /// <remarks> /// e.g.: /// SqlDataReader dr = ExecuteReader(trans, CommandType.StoredProcedure, "GetOrders"); /// </remarks> /// <param name="transaction">a valid SqlTransaction</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command</param> /// <returns>a SqlDataReader containing the resultset generated by the command</returns> public static SqlDataReader ExecuteReader(SqlTransaction transaction, CommandType commandType, string commandText) { //pass through the call providing null for the set of SqlParameters return ExecuteReader(transaction, commandType, commandText, (SqlParameter[])null); } /// <summary> /// Execute a SqlCommand (that returns a resultset) against the specified SqlTransaction /// using the provided parameters. /// </summary> /// <remarks> /// e.g.: /// SqlDataReader dr = ExecuteReader(trans, CommandType.StoredProcedure, "GetOrders", new SqlParameter("@prodid", 24)); /// </remarks> /// <param name="transaction">a valid SqlTransaction</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command</param> /// <param name="commandParameters">an array of SqlParamters used to execute the command</param> /// <returns>a SqlDataReader containing the resultset generated by the command</returns> public static SqlDataReader ExecuteReader(SqlTransaction transaction, CommandType commandType, string commandText, params SqlParameter[] commandParameters) { //pass through to private overload, indicating that the connection is owned by the caller return ExecuteReader(transaction.Connection, transaction, commandType, commandText, commandParameters, SqlConnectionOwnership.External); } /// <summary> /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified /// SqlTransaction using the provided parameter values. This method will query the database to discover the parameters for the /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. /// </summary> /// <remarks> /// This method provides no access to output parameters or the stored procedure's return value parameter. /// /// e.g.: /// SqlDataReader dr = ExecuteReader(trans, "GetOrders", 24, 36); /// </remarks> /// <param name="transaction">a valid SqlTransaction</param> /// <param name="spName">the name of the stored procedure</param> /// <param name="parameterValues">an array of objects to be assigned as the input values of the stored procedure</param> /// <returns>a SqlDataReader containing the resultset generated by the command</returns> public static SqlDataReader ExecuteReader(SqlTransaction transaction, string spName, params object[] parameterValues) { //if we receive parameter values, we need to figure out where they go if ((parameterValues != null) && (parameterValues.Length > 0)) { SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(transaction.Connection.ConnectionString, spName); AssignParameterValues(commandParameters, parameterValues); return ExecuteReader(transaction, CommandType.StoredProcedure, spName, commandParameters); } //otherwise we can just call the SP without params else { return ExecuteReader(transaction, CommandType.StoredProcedure, spName); } } #endregion ExecuteReader #region ExecuteScalar /// <summary> /// Execute a SqlCommand (that returns a 1x1 resultset and takes no parameters) against the database specified in /// the connection string. /// </summary> /// <remarks> /// e.g.: /// int orderCount = (int)ExecuteScalar(connString, CommandType.StoredProcedure, "GetOrderCount"); /// </remarks> /// <param name="connectionString">a valid connection string for a SqlConnection</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command</param> /// <returns>an object containing the value in the 1x1 resultset generated by the command</returns> public static object ExecuteScalar(string connectionString, CommandType commandType, string commandText) { //pass through the call providing null for the set of SqlParameters return ExecuteScalar(connectionString, commandType, commandText, (SqlParameter[])null); } /// <summary> /// Execute a SqlCommand (that returns a 1x1 resultset) against the database specified in the connection string /// using the provided parameters. /// </summary> /// <remarks> /// e.g.: /// int orderCount = (int)ExecuteScalar(connString, CommandType.StoredProcedure, "GetOrderCount", new SqlParameter("@prodid", 24)); /// </remarks> /// <param name="connectionString">a valid connection string for a SqlConnection</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command</param> /// <param name="commandParameters">an array of SqlParamters used to execute the command</param> /// <returns>an object containing the value in the 1x1 resultset generated by the command</returns> public static object ExecuteScalar(string connectionString, CommandType commandType, string commandText, params SqlParameter[] commandParameters) { //create & open a SqlConnection, and dispose of it after we are done. using (SqlConnection cn = new SqlConnection(connectionString)) { cn.Open(); //call the overload that takes a connection in place of the connection string return ExecuteScalar(cn, commandType, commandText, commandParameters); } } /// <summary> /// Execute a stored procedure via a SqlCommand (that returns a 1x1 resultset) against the database specified in /// the connection string using the provided parameter values. This method will query the database to discover the parameters for the /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. /// </summary> /// <remarks> /// This method provides no access to output parameters or the stored procedure's return value parameter. /// /// e.g.: /// int orderCount = (int)ExecuteScalar(connString, "GetOrderCount", 24, 36); /// </remarks> /// <param name="connectionString">a valid connection string for a SqlConnection</param> /// <param name="spName">the name of the stored procedure</param> /// <param name="parameterValues">an array of objects to be assigned as the input values of the stored procedure</param> /// <returns>an object containing the value in the 1x1 resultset generated by the command</returns> public static object ExecuteScalar(string connectionString, string spName, params object[] parameterValues) { //if we receive parameter values, we need to figure out where they go if ((parameterValues != null) && (parameterValues.Length > 0)) { //pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connectionString, spName); //assign the provided values to these parameters based on parameter order AssignParameterValues(commandParameters, parameterValues); //call the overload that takes an array of SqlParameters return ExecuteScalar(connectionString, CommandType.StoredProcedure, spName, commandParameters); } //otherwise we can just call the SP without params else { return ExecuteScalar(connectionString, CommandType.StoredProcedure, spName); } } /// <summary> /// Execute a SqlCommand (that returns a 1x1 resultset and takes no parameters) against the provided SqlConnection. /// </summary> /// <remarks> /// e.g.: /// int orderCount = (int)ExecuteScalar(conn, CommandType.StoredProcedure, "GetOrderCount"); /// </remarks> /// <param name="connection">a valid SqlConnection</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command</param> /// <returns>an object containing the value in the 1x1 resultset generated by the command</returns> public static object ExecuteScalar(SqlConnection connection, CommandType commandType, string commandText) { //pass through the call providing null for the set of SqlParameters return ExecuteScalar(connection, commandType, commandText, (SqlParameter[])null); } /// <summary> /// Execute a SqlCommand (that returns a 1x1 resultset) against the specified SqlConnection /// using the provided parameters. /// </summary> /// <remarks> /// e.g.: /// int orderCount = (int)ExecuteScalar(conn, CommandType.StoredProcedure, "GetOrderCount", new SqlParameter("@prodid", 24)); /// </remarks> /// <param name="connection">a valid SqlConnection</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command</param> /// <param name="commandParameters">an array of SqlParamters used to execute the command</param> /// <returns>an object containing the value in the 1x1 resultset generated by the command</returns> public static object ExecuteScalar(SqlConnection connection, CommandType commandType, string commandText, params SqlParameter[] commandParameters) { //create a command and prepare it for execution SqlCommand cmd = new SqlCommand(); PrepareCommand(cmd, connection, (SqlTransaction)null, commandType, commandText, commandParameters); //execute the command & return the results object retval = cmd.ExecuteScalar(); // detach the SqlParameters from the command object, so they can be used again. cmd.Parameters.Clear(); return retval; } /// <summary> /// Execute a stored procedure via a SqlCommand (that returns a 1x1 resultset) against the specified SqlConnection /// using the provided parameter values. This method will query the database to discover the parameters for the /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. /// </summary> /// <remarks> /// This method provides no access to output parameters or the stored procedure's return value parameter. /// /// e.g.: /// int orderCount = (int)ExecuteScalar(conn, "GetOrderCount", 24, 36); /// </remarks> /// <param name="connection">a valid SqlConnection</param> /// <param name="spName">the name of the stored procedure</param> /// <param name="parameterValues">an array of objects to be assigned as the input values of the stored procedure</param> /// <returns>an object containing the value in the 1x1 resultset generated by the command</returns> public static object ExecuteScalar(SqlConnection connection, string spName, params object[] parameterValues) { //if we receive parameter values, we need to figure out where they go if ((parameterValues != null) && (parameterValues.Length > 0)) { //pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connection.ConnectionString, spName); //assign the provided values to these parameters based on parameter order AssignParameterValues(commandParameters, parameterValues); //call the overload that takes an array of SqlParameters return ExecuteScalar(connection, CommandType.StoredProcedure, spName, commandParameters); } //otherwise we can just call the SP without params else { return ExecuteScalar(connection, CommandType.StoredProcedure, spName); } } /// <summary> /// Execute a SqlCommand (that returns a 1x1 resultset and takes no parameters) against the provided SqlTransaction. /// </summary> /// <remarks> /// e.g.: /// int orderCount = (int)ExecuteScalar(trans, CommandType.StoredProcedure, "GetOrderCount"); /// </remarks> /// <param name="transaction">a valid SqlTransaction</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command</param> /// <returns>an object containing the value in the 1x1 resultset generated by the command</returns> public static object ExecuteScalar(SqlTransaction transaction, CommandType commandType, string commandText) { //pass through the call providing null for the set of SqlParameters return ExecuteScalar(transaction, commandType, commandText, (SqlParameter[])null); } /// <summary> /// Execute a SqlCommand (that returns a 1x1 resultset) against the specified SqlTransaction /// using the provided parameters. /// </summary> /// <remarks> /// e.g.: /// int orderCount = (int)ExecuteScalar(trans, CommandType.StoredProcedure, "GetOrderCount", new SqlParameter("@prodid", 24)); /// </remarks> /// <param name="transaction">a valid SqlTransaction</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command</param> /// <param name="commandParameters">an array of SqlParamters used to execute the command</param> /// <returns>an object containing the value in the 1x1 resultset generated by the command</returns> public static object ExecuteScalar(SqlTransaction transaction, CommandType commandType, string commandText, params SqlParameter[] commandParameters) { //create a command and prepare it for execution SqlCommand cmd = new SqlCommand(); PrepareCommand(cmd, transaction.Connection, transaction, commandType, commandText, commandParameters); //execute the command & return the results object retval = cmd.ExecuteScalar(); // detach the SqlParameters from the command object, so they can be used again. cmd.Parameters.Clear(); return retval; } /// <summary> /// Execute a stored procedure via a SqlCommand (that returns a 1x1 resultset) against the specified /// SqlTransaction using the provided parameter values. This method will query the database to discover the parameters for the /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. /// </summary> /// <remarks> /// This method provides no access to output parameters or the stored procedure's return value parameter. /// /// e.g.: /// int orderCount = (int)ExecuteScalar(trans, "GetOrderCount", 24, 36); /// </remarks> /// <param name="transaction">a valid SqlTransaction</param> /// <param name="spName">the name of the stored procedure</param> /// <param name="parameterValues">an array of objects to be assigned as the input values of the stored procedure</param> /// <returns>an object containing the value in the 1x1 resultset generated by the command</returns> public static object ExecuteScalar(SqlTransaction transaction, string spName, params object[] parameterValues) { //if we receive parameter values, we need to figure out where they go if ((parameterValues != null) && (parameterValues.Length > 0)) { //pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(transaction.Connection.ConnectionString, spName); //assign the provided values to these parameters based on parameter order AssignParameterValues(commandParameters, parameterValues); //call the overload that takes an array of SqlParameters return ExecuteScalar(transaction, CommandType.StoredProcedure, spName, commandParameters); } //otherwise we can just call the SP without params else { return ExecuteScalar(transaction, CommandType.StoredProcedure, spName); } } #endregion ExecuteScalar #region ExecuteXmlReader /// <summary> /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlConnection. /// </summary> /// <remarks> /// e.g.: /// XmlReader r = ExecuteXmlReader(conn, CommandType.StoredProcedure, "GetOrders"); /// </remarks> /// <param name="connection">a valid SqlConnection</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command using "FOR XML AUTO"</param> /// <returns>an XmlReader containing the resultset generated by the command</returns> public static XmlReader ExecuteXmlReader(SqlConnection connection, CommandType commandType, string commandText) { //pass through the call providing null for the set of SqlParameters return ExecuteXmlReader(connection, commandType, commandText, (SqlParameter[])null); } /// <summary> /// Execute a SqlCommand (that returns a resultset) against the specified SqlConnection /// using the provided parameters. /// </summary> /// <remarks> /// e.g.: /// XmlReader r = ExecuteXmlReader(conn, CommandType.StoredProcedure, "GetOrders", new SqlParameter("@prodid", 24)); /// </remarks> /// <param name="connection">a valid SqlConnection</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command using "FOR XML AUTO"</param> /// <param name="commandParameters">an array of SqlParamters used to execute the command</param> /// <returns>an XmlReader containing the resultset generated by the command</returns> public static XmlReader ExecuteXmlReader(SqlConnection connection, CommandType commandType, string commandText, params SqlParameter[] commandParameters) { //create a command and prepare it for execution SqlCommand cmd = new SqlCommand(); PrepareCommand(cmd, connection, (SqlTransaction)null, commandType, commandText, commandParameters); //create the DataAdapter & DataSet XmlReader retval = cmd.ExecuteXmlReader(); // detach the SqlParameters from the command object, so they can be used again. cmd.Parameters.Clear(); return retval; } /// <summary> /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlConnection /// using the provided parameter values. This method will query the database to discover the parameters for the /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. /// </summary> /// <remarks> /// This method provides no access to output parameters or the stored procedure's return value parameter. /// /// e.g.: /// XmlReader r = ExecuteXmlReader(conn, "GetOrders", 24, 36); /// </remarks> /// <param name="connection">a valid SqlConnection</param> /// <param name="spName">the name of the stored procedure using "FOR XML AUTO"</param> /// <param name="parameterValues">an array of objects to be assigned as the input values of the stored procedure</param> /// <returns>an XmlReader containing the resultset generated by the command</returns> public static XmlReader ExecuteXmlReader(SqlConnection connection, string spName, params object[] parameterValues) { //if we receive parameter values, we need to figure out where they go if ((parameterValues != null) && (parameterValues.Length > 0)) { //pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connection.ConnectionString, spName); //assign the provided values to these parameters based on parameter order AssignParameterValues(commandParameters, parameterValues); //call the overload that takes an array of SqlParameters return ExecuteXmlReader(connection, CommandType.StoredProcedure, spName, commandParameters); } //otherwise we can just call the SP without params else { return ExecuteXmlReader(connection, CommandType.StoredProcedure, spName); } } /// <summary> /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlTransaction. /// </summary> /// <remarks> /// e.g.: /// XmlReader r = ExecuteXmlReader(trans, CommandType.StoredProcedure, "GetOrders"); /// </remarks> /// <param name="transaction">a valid SqlTransaction</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command using "FOR XML AUTO"</param> /// <returns>an XmlReader containing the resultset generated by the command</returns> public static XmlReader ExecuteXmlReader(SqlTransaction transaction, CommandType commandType, string commandText) { //pass through the call providing null for the set of SqlParameters return ExecuteXmlReader(transaction, commandType, commandText, (SqlParameter[])null); } /// <summary> /// Execute a SqlCommand (that returns a resultset) against the specified SqlTransaction /// using the provided parameters. /// </summary> /// <remarks> /// e.g.: /// XmlReader r = ExecuteXmlReader(trans, CommandType.StoredProcedure, "GetOrders", new SqlParameter("@prodid", 24)); /// </remarks> /// <param name="transaction">a valid SqlTransaction</param> /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param> /// <param name="commandText">the stored procedure name or T-SQL command using "FOR XML AUTO"</param> /// <param name="commandParameters">an array of SqlParamters used to execute the command</param> /// <returns>an XmlReader containing the resultset generated by the command</returns> public static XmlReader ExecuteXmlReader(SqlTransaction transaction, CommandType commandType, string commandText, params SqlParameter[] commandParameters) { //create a command and prepare it for execution SqlCommand cmd = new SqlCommand(); PrepareCommand(cmd, transaction.Connection, transaction, commandType, commandText, commandParameters); //create the DataAdapter & DataSet XmlReader retval = cmd.ExecuteXmlReader(); // detach the SqlParameters from the command object, so they can be used again. cmd.Parameters.Clear(); return retval; } /// <summary> /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified /// SqlTransaction using the provided parameter values. This method will query the database to discover the parameters for the /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order. /// </summary> /// <remarks> /// This method provides no access to output parameters or the stored procedure's return value parameter. /// /// e.g.: /// XmlReader r = ExecuteXmlReader(trans, "GetOrders", 24, 36); /// </remarks> /// <param name="transaction">a valid SqlTransaction</param> /// <param name="spName">the name of the stored procedure</param> /// <param name="parameterValues">an array of objects to be assigned as the input values of the stored procedure</param> /// <returns>a dataset containing the resultset generated by the command</returns> public static XmlReader ExecuteXmlReader(SqlTransaction transaction, string spName, params object[] parameterValues) { //if we receive parameter values, we need to figure out where they go if ((parameterValues != null) && (parameterValues.Length > 0)) { //pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache) SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(transaction.Connection.ConnectionString, spName); //assign the provided values to these parameters based on parameter order AssignParameterValues(commandParameters, parameterValues); //call the overload that takes an array of SqlParameters return ExecuteXmlReader(transaction, CommandType.StoredProcedure, spName, commandParameters); } //otherwise we can just call the SP without params else { return ExecuteXmlReader(transaction, CommandType.StoredProcedure, spName); } } #endregion ExecuteXmlReader } /// <summary> /// SqlHelperParameterCache provides functions to leverage a static cache of procedure parameters, and the /// ability to discover parameters for stored procedures at run-time. /// </summary> public sealed class SqlHelperParameterCache { #region private methods, variables, and constructors //Since this class provides only static methods, make the default constructor private to prevent //instances from being created with "new SqlHelperParameterCache()". private SqlHelperParameterCache() {} private static Hashtable paramCache = Hashtable.Synchronized(new Hashtable()); /// <summary> /// resolve at run time the appropriate set of SqlParameters for a stored procedure /// </summary> /// <param name="connectionString">a valid connection string for a SqlConnection</param> /// <param name="spName">the name of the stored procedure</param> /// <param name="includeReturnValueParameter">whether or not to include their return value parameter</param> /// <returns></returns> private static SqlParameter[] DiscoverSpParameterSet(string connectionString, string spName, bool includeReturnValueParameter) { using (SqlConnection cn = new SqlConnection(connectionString)) using (SqlCommand cmd = new SqlCommand(spName,cn)) { cn.Open(); cmd.CommandType = CommandType.StoredProcedure; SqlCommandBuilder.DeriveParameters(cmd); if (!includeReturnValueParameter) { cmd.Parameters.RemoveAt(0); } SqlParameter[] discoveredParameters = new SqlParameter[cmd.Parameters.Count];; cmd.Parameters.CopyTo(discoveredParameters, 0); return discoveredParameters; } } //deep copy of cached SqlParameter array private static SqlParameter[] CloneParameters(SqlParameter[] originalParameters) { SqlParameter[] clonedParameters = new SqlParameter[originalParameters.Length]; for (int i = 0, j = originalParameters.Length; i < j; i++) { clonedParameters[i] = (SqlParameter)((ICloneable)originalParameters[i]).Clone(); } return clonedParameters; } #endregion private methods, variables, and constructors #region caching functions /// <summary> /// add parameter array to the cache /// </summary> /// <param name="connectionString">a valid connection string for a SqlConnection</param> /// <param name="commandText">the stored procedure name or T-SQL command</param> /// <param name="commandParameters">an array of SqlParamters to be cached</param> public static void CacheParameterSet(string connectionString, string commandText, params SqlParameter[] commandParameters) { string hashKey = connectionString + ":" + commandText; paramCache[hashKey] = commandParameters; } /// <summary> /// retrieve a parameter array from the cache /// </summary> /// <param name="connectionString">a valid connection string for a SqlConnection</param> /// <param name="commandText">the stored procedure name or T-SQL command</param> /// <returns>an array of SqlParamters</returns> public static SqlParameter[] GetCachedParameterSet(string connectionString, string commandText) { string hashKey = connectionString + ":" + commandText; SqlParameter[] cachedParameters = (SqlParameter[])paramCache[hashKey]; if (cachedParameters == null) { return null; } else { return CloneParameters(cachedParameters); } } #endregion caching functions #region Parameter Discovery Functions /// <summary> /// Retrieves the set of SqlParameters appropriate for the stored procedure /// </summary> /// <remarks> /// This method will query the database for this information, and then store it in a cache for future requests. /// </remarks> /// <param name="connectionString">a valid connection string for a SqlConnection</param> /// <param name="spName">the name of the stored procedure</param> /// <returns>an array of SqlParameters</returns> public static SqlParameter[] GetSpParameterSet(string connectionString, string spName) { return GetSpParameterSet(connectionString, spName, false); } /// <summary> /// Retrieves the set of SqlParameters appropriate for the stored procedure /// </summary> /// <remarks> /// This method will query the database for this information, and then store it in a cache for future requests. /// </remarks> /// <param name="connectionString">a valid connection string for a SqlConnection</param> /// <param name="spName">the name of the stored procedure</param> /// <param name="includeReturnValueParameter">a bool value indicating whether the return value parameter should be included in the results</param> /// <returns>an array of SqlParameters</returns> public static SqlParameter[] GetSpParameterSet(string connectionString, string spName, bool includeReturnValueParameter) { string hashKey = connectionString + ":" + spName + (includeReturnValueParameter ? ":include ReturnValue Parameter":""); SqlParameter[] cachedParameters; cachedParameters = (SqlParameter[])paramCache[hashKey]; if (cachedParameters == null) { cachedParameters = (SqlParameter[])(paramCache[hashKey] = DiscoverSpParameterSet(connectionString, spName, includeReturnValueParameter)); } return CloneParameters(cachedParameters); } #endregion Parameter Discovery Functions } }