namespace Ecommerce.BLL
{
public class AddCart
{
public void BLL_AddItem( Products objBol)
{
ShoppingCart cart = new ShoppingCart();
String cartID = cart.GetShoppingCartId();
Int16 lintCartItemID = 0;
//Declare a datatable to be used as shopping cart
DataTable objDT;
DataRow objDR;
if (System.Web.HttpContext.Current.Session["SessionCart"] == null)
{
//Data table to be used as cart
objDT = new DataTable("Cart");
//Declaring Primary Key For Table
objDT.Columns.Add("ID", System.Type.GetType("System.Int32"));
DataColumn[] ldataColPK = new DataColumn[2];
ldataColPK[0] = objDT.Columns["ID"];
ldataColPK[0].AutoIncrement = true;
ldataColPK[0].AutoIncrementSeed = 1;
objDT.PrimaryKey = ldataColPK;
//Adding columns to datatable
objDT.Columns.Add("CartID", System.Type.GetType("System.String"));
objDT.Columns.Add("ProductID", System.Type.GetType("System.Int32"));
objDT.Columns.Add("Products_Name", System.Type.GetType("System.String"));
objDT.Columns.Add("Model", System.Type.GetType("System.String"));
objDT.Columns.Add("Size", System.Type.GetType("System.String"));
objDT.Columns.Add("Colour", System.Type.GetType("System.String"));
objDT.Columns.Add("ImageUrl", System.Type.GetType("System.String"));
objDT.Columns.Add("Price", System.Type.GetType("System.Double"));
objDT.Columns.Add("Description", System.Type.GetType("System.String"));
objDT.Columns.Add("Quantity", System.Type.GetType("System.Int32"));
objDT.Columns.Add("Stock", System.Type.GetType("System.Int32"));
objDT.Columns.Add("Amount", System.Type.GetType("System.Double"));
objDT.Columns["Amount"].Expression = "Price * Quantity";
}
else
{
objDT = (DataTable)System.Web.HttpContext.Current.Session["SessionCart"];
}
objDR = objDT.NewRow();
objDR["CartID"] = cartID;
objDR["ProductID"] = objBol.ProductsID;
objDR["Products_Name"] = objBol.Products_Name;
objDR["Model"] = objBol.Model;
objDR["Size"] = objBol.attributes_values_name;
objDR["Colour"] = objBol.Colour_name;
objDR["ImageUrl"] = objBol.Icon_image;
objDR["Price"] = objBol.Price;
objDR["Description"] = objBol.Products_Description;
objDR["Quantity"] = objBol.Quantity;
objDR["Stock"] = objBol.Stock;
System.Web.HttpContext.Current.Session["CartItemID"] = objDR["ID"].ToString();
lintCartItemID = Convert.ToInt16(objDR["ID"]);
objDT.Rows.Add(objDR);
//Add the datatable in a session variable
System.Web.HttpContext.Current.Session["SessionCart"] = objDT;
}
=======================================
shopping cart:
public String GetShoppingCartId()
{
// Obtain current HttpContext of ASP+ Request
System.Web.HttpContext context = System.Web.HttpContext.Current;
// If the user is authenticated, use their customerId as a permanent shopping cart id
if (context.User.Identity.Name != "")
{
return context.User.Identity.Name.ToString();
}
// If user is not authenticated, either fetch (or issue) a new temporary cartID
if (context.Request.Cookies["ASPNETCommerce_CartID"] != null)
{
return context.Request.Cookies["ASPNETCommerce_CartID"].Value;
}
else
{
// Generate a new random GUID using System.Guid Class
Guid tempCartId = Guid.NewGuid();
// Send tempCartId back to client as a cookie
context.Response.Cookies["ASPNETCommerce_CartID"].Value = tempCartId.ToString();
// Return tempCartId
return tempCartId.ToString();
}
}
9.1.11
Save Image as small, medium and large
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Drawing;
using System.Web.UI;
using System.Drawing.Imaging;
namespace Ecommerce.BLL
{
public class ImagesManager
{
///
/// This method is used to upload images according to height width
///
///
///
///
///
public void Bll_UploadImages(string FileName,int width, int height, string SaveName)
{
Bitmap oCounter;
Graphics oGraphics;
oCounter = new Bitmap(width ,height);
oGraphics = Graphics.FromImage(oCounter);
FileStream fs = new FileStream(FileName, FileMode.OpenOrCreate);
fs.ReadByte();
Bitmap objImage = new Bitmap(fs);
oGraphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
oGraphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
oGraphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
oGraphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
oGraphics.DrawImage(objImage, 0, 0, width, height);
oCounter.Save(SaveName);
objImage.Dispose();
oCounter.Dispose();
fs.Dispose();
File.Delete(FileName);
}
}
}
================================================================
protected void imgSubmit_Click(object sender, ImageClickEventArgs e)
{
if (ViewState["ImageID"].ToString() == "")
{
objBol.Products_imageID = -1;
}
else
{
objBol.Products_imageID = Convert.ToInt32(ViewState["ImageID"]);
}
objBol.ProductsID = Convert.ToInt32(ViewState["ProductsID"]);
objBol.ColourID = Convert.ToInt32(DropColour.SelectedValue);
objBol.Colour_name = DropColour.SelectedItem.Text;
objBol.Icon_image = "";
objBol.Medium_image = "";
objBol.Large_image = "";
objBol.default_style = false;
int retval= objBll.BLL_InsUpdProductsImages (objBol);
if (retval > 0)
{
string strImagePath, strSavepath;
strImagePath = retval.ToString() + "1.jpg";
strSavepath = retval.ToString() + ".jpg";
if (ProductImageUpload .FileName != "")
{
// small icon
string strsmalliconPath = Server.MapPath("~/ProductsImages/Small/" + strImagePath);
string strsmalliconsavePath = Server.MapPath("~/ProductsImages/Small/" + strSavepath);
ProductImageUpload.SaveAs(strsmalliconPath);
objImg.Bll_UploadImages(strsmalliconPath, 50, 50, strsmalliconsavePath);
//icon image
string striconPath = Server.MapPath("~/ProductsImages/Icon/" + strImagePath);
string striconsavePath = Server.MapPath("~/ProductsImages/Icon/" + strSavepath);
ProductImageUpload.SaveAs(striconPath);
objImg.Bll_UploadImages(striconPath, 120, 120, striconsavePath);
//medium image
string strMediumPath = Server.MapPath("~/ProductsImages/Medium/" + strImagePath);
string strMediumsavePath = Server.MapPath("~/ProductsImages/Medium/" + strSavepath);
ProductImageUpload.SaveAs(strMediumPath);
objImg.Bll_UploadImages(strMediumPath,288, 360, strMediumsavePath);
//large image
string strLargePath = Server.MapPath("~/ProductsImages/Large/" + strImagePath);
string strLargesavePath = Server.MapPath("~/ProductsImages/Large/" + strSavepath);
ProductImageUpload.SaveAs(strLargePath);
objImg.Bll_UploadImages(strLargePath, 576, 720, strLargesavePath);
}
}
DisplayProductsImages();
ViewState["ImageID"] = "";
}
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Drawing;
using System.Web.UI;
using System.Drawing.Imaging;
namespace Ecommerce.BLL
{
public class ImagesManager
{
///
/// This method is used to upload images according to height width
///
///
///
///
///
public void Bll_UploadImages(string FileName,int width, int height, string SaveName)
{
Bitmap oCounter;
Graphics oGraphics;
oCounter = new Bitmap(width ,height);
oGraphics = Graphics.FromImage(oCounter);
FileStream fs = new FileStream(FileName, FileMode.OpenOrCreate);
fs.ReadByte();
Bitmap objImage = new Bitmap(fs);
oGraphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
oGraphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
oGraphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
oGraphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
oGraphics.DrawImage(objImage, 0, 0, width, height);
oCounter.Save(SaveName);
objImage.Dispose();
oCounter.Dispose();
fs.Dispose();
File.Delete(FileName);
}
}
}
================================================================
protected void imgSubmit_Click(object sender, ImageClickEventArgs e)
{
if (ViewState["ImageID"].ToString() == "")
{
objBol.Products_imageID = -1;
}
else
{
objBol.Products_imageID = Convert.ToInt32(ViewState["ImageID"]);
}
objBol.ProductsID = Convert.ToInt32(ViewState["ProductsID"]);
objBol.ColourID = Convert.ToInt32(DropColour.SelectedValue);
objBol.Colour_name = DropColour.SelectedItem.Text;
objBol.Icon_image = "";
objBol.Medium_image = "";
objBol.Large_image = "";
objBol.default_style = false;
int retval= objBll.BLL_InsUpdProductsImages (objBol);
if (retval > 0)
{
string strImagePath, strSavepath;
strImagePath = retval.ToString() + "1.jpg";
strSavepath = retval.ToString() + ".jpg";
if (ProductImageUpload .FileName != "")
{
// small icon
string strsmalliconPath = Server.MapPath("~/ProductsImages/Small/" + strImagePath);
string strsmalliconsavePath = Server.MapPath("~/ProductsImages/Small/" + strSavepath);
ProductImageUpload.SaveAs(strsmalliconPath);
objImg.Bll_UploadImages(strsmalliconPath, 50, 50, strsmalliconsavePath);
//icon image
string striconPath = Server.MapPath("~/ProductsImages/Icon/" + strImagePath);
string striconsavePath = Server.MapPath("~/ProductsImages/Icon/" + strSavepath);
ProductImageUpload.SaveAs(striconPath);
objImg.Bll_UploadImages(striconPath, 120, 120, striconsavePath);
//medium image
string strMediumPath = Server.MapPath("~/ProductsImages/Medium/" + strImagePath);
string strMediumsavePath = Server.MapPath("~/ProductsImages/Medium/" + strSavepath);
ProductImageUpload.SaveAs(strMediumPath);
objImg.Bll_UploadImages(strMediumPath,288, 360, strMediumsavePath);
//large image
string strLargePath = Server.MapPath("~/ProductsImages/Large/" + strImagePath);
string strLargesavePath = Server.MapPath("~/ProductsImages/Large/" + strSavepath);
ProductImageUpload.SaveAs(strLargePath);
objImg.Bll_UploadImages(strLargePath, 576, 720, strLargesavePath);
}
}
DisplayProductsImages();
ViewState["ImageID"] = "";
}
28.12.10
Adding a Javascript onclick event to a Radio Button List Item on DataBound
http://www.siphilp.co.uk/archive/2007/11/08/adding-a-javascript-onclick-event-to-a-radio-button-list.aspx
Rad-Combobox databind at Clientside using javascript
http://www.telerik.com/community/forums/aspnet-ajax/combobox/rad-combobox-databind-at-clientside-using-javascript.aspx
JavaScript Split String Function
http://programming.top54u.com/Samples/Javascript/String-Object/Split-String-Function/Default.aspx
Rad-Combobox databind at Clientside using javascript
http://www.telerik.com/community/forums/aspnet-ajax/combobox/rad-combobox-databind-at-clientside-using-javascript.aspx
JavaScript Split String Function
http://programming.top54u.com/Samples/Javascript/String-Object/Split-String-Function/Default.aspx
25.12.10
rotate images
http://fancybox.net/
http://www.huddletogether.com/projects/lightbox2/
http://www.efectorelativo.net/laboratory/noobSlide/
carousse:
http://www.paulvanroekel.nl/picasa/caroussel/
http://demo.tutorialzine.com/2010/11/rotating-slideshow-jquery-css3/
http://www.1stwebdesigner.com/design/fresh-jquery-image-gallery-display-solutions/
http://www.huddletogether.com/projects/lightbox2/
http://www.efectorelativo.net/laboratory/noobSlide/
carousse:
http://www.paulvanroekel.nl/picasa/caroussel/
http://demo.tutorialzine.com/2010/11/rotating-slideshow-jquery-css3/
http://www.1stwebdesigner.com/design/fresh-jquery-image-gallery-display-solutions/
22.12.10
jquery zoom and Thumbnail rotate
http://leandrovieira.com/projects/jquery/lightbox/#
http://www.javascriptphotogallery.com/jquery-image-gallery-zoom-asp-net.html
http://www.professorcloud.com/mainsite/cloud-zoom.htm
http://www.dfc-e.com/metiers/multimedia/opensource/jquery-fancyzoom/
http://www.ajax-zoom.com/index.php?cid=home
http://jquerylightbox.com/asp-net-mvc-jquery-popup.html
http://www.dynamicdrive.com/dynamicindex4/imagemagnify.htm
http://www.dynamicdrive.com/dynamicindex4/imagemagnify.htm
http://www.ajax-zoom.com/demo/magento/index.php/ottoman.html
http://www.catosplace.net/jquery_sandbox/galleryview/index.html
http://web.enavu.com/tutorials/10-best-jquery-gallery-and-slider-plugins/
http://demos.telerik.com/aspnet-ajax/rotator/examples/gallery/defaultcs.aspx
http://www.javascriptphotogallery.com/jquery-image-gallery-zoom-asp-net.html
http://www.professorcloud.com/mainsite/cloud-zoom.htm
http://www.dfc-e.com/metiers/multimedia/opensource/jquery-fancyzoom/
http://www.ajax-zoom.com/index.php?cid=home
http://jquerylightbox.com/asp-net-mvc-jquery-popup.html
http://www.dynamicdrive.com/dynamicindex4/imagemagnify.htm
http://www.dynamicdrive.com/dynamicindex4/imagemagnify.htm
http://www.ajax-zoom.com/demo/magento/index.php/ottoman.html
http://www.catosplace.net/jquery_sandbox/galleryview/index.html
http://web.enavu.com/tutorials/10-best-jquery-gallery-and-slider-plugins/
http://demos.telerik.com/aspnet-ajax/rotator/examples/gallery/defaultcs.aspx
13.12.10
12.12.10
Dynamically Output A List of YouTube Videos In ASP.NET
http://surinder.computing-studio.com/post/2009/05/Dynamically-Output-A-List-of-YouTube-Videos-In-ASPNET.aspx
AI39si50OOMnhiZKAqaYo9EaxOH900UCbvwkGbUVDhfxuOjFEg7wR2gC8nXsoZuc_MfHvBznmrzL5Qn-L30AA6jKkXL6IKoANA
http://code.google.com/apis/youtube/2.0/developers_guide_dotnet.html
AI39si50OOMnhiZKAqaYo9EaxOH900UCbvwkGbUVDhfxuOjFEg7wR2gC8nXsoZuc_MfHvBznmrzL5Qn-L30AA6jKkXL6IKoANA
http://code.google.com/apis/youtube/2.0/developers_guide_dotnet.html
Subscribe to:
Posts (Atom)