11.12.11
Best Practices for Speeding Up Your Web Site
http://developer.yahoo.com/performance/rules.html#expires
19.10.11
17.10.11
10.10.11
Tip/Trick: Enabling SSL on IIS 7.0 Using Self-Signed Certificates
http://weblogs.asp.net/scottgu/archive/2007/04/06/tip-trick-enabling-ssl-on-iis7-using-self-signed-certificates.aspx
28.9.11
24.9.11
Consuming WCF / ASMX / REST service using JQueryConsuming WCF / ASMX / REST service using JQuery
http://www.codeproject.com/KB/aspnet/WCF_JQUERY_ASMX.aspx
http://www.c-sharpcorner.com/UploadFile/sridhar_subra/116/
http://www.c-sharpcorner.com/UploadFile/sridhar_subra/116/
23.9.11
Forms Authentication in ASP.NET with C#: Advance
http://www.dotnetfunda.com/articles/article141.aspx
17.9.11
10 Ways to Instantly Increase Your jQuery Performance
http://www.tvidesign.co.uk/blog/improve-your-jquery-25-excellent-tips.aspx
http://jonraasch.com/blog/10-advanced-jquery-performance-tuning-tips-from-paul-irish
http://jonraasch.com/blog/10-advanced-jquery-performance-tuning-tips-from-paul-irish
30.4.11
How to use append correctly
http://www.learningjquery.com/2009/03/43439-reasons-to-use-append-correctly
28.4.11
23.4.11
Sql Queries Information
1.)if you want to check, last 7 days sp created in database use this..
SELECT * FROM sys.objects WHERE type = 'P' AND DATEDIFF(D,create_date, GETDATE()) < 7
2.)Find Text In Store Procedure:
SELECT ROUTINE_NAME, ROUTINE_DEFINITION
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE '%Users%'
AND ROUTINE_TYPE='PROCEDURE'
3.) Check tables created in database last 7 days:
SELECT * FROM sys.tables WHERE type = 'U' AND DATEDIFF(D,create_date, GETDATE()) < 14
4.) List of All tables in Database:
SELECT * from sys.tables where type_desc = 'USER_TABLE'
5.) List of All users Sps in Database.
SELECT * FROM sys.objects WHERE type = 'P'
SELECT * FROM sys.objects WHERE type = 'P' AND DATEDIFF(D,create_date, GETDATE()) < 7
2.)Find Text In Store Procedure:
SELECT ROUTINE_NAME, ROUTINE_DEFINITION
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE '%Users%'
AND ROUTINE_TYPE='PROCEDURE'
3.) Check tables created in database last 7 days:
SELECT * FROM sys.tables WHERE type = 'U' AND DATEDIFF(D,create_date, GETDATE()) < 14
4.) List of All tables in Database:
SELECT * from sys.tables where type_desc = 'USER_TABLE'
5.) List of All users Sps in Database.
SELECT * FROM sys.objects WHERE type = 'P'
20.4.11
Load Content On scrolling
http://www.go4coding.com/post/2011/04/11/Auto-loading-content-on-page-scroll-in-aspnet-using-jquery.aspx
14.4.11
Datalist with custom paging
http://www.dotnetfunda.com/articles/article456-custom-seo-friendly-paging-with-aspnet-repeater-or-datalist-control-.aspx
22.3.11
Url Rewriting
http://www.myprotein.com/uk/pages/home
http://www.deevelop.com/en/web-design-company/blog/12/Multilingual-website.html
http://www.deevelop.com/en/web-design-company/blog/12/Multilingual-website.html
20.3.11
Apply Indexes on sql server
http://www.youtube.com/watch?v=P97_oFfD218&feature=fvwrel
Writing Faster SQL Server Queries
http://www.youtube.com/watch?v=H7tPyVA7tRY&feature=related
Writing Faster SQL Server Queries
http://www.youtube.com/watch?v=H7tPyVA7tRY&feature=related
15.3.11
setting session on iis
http://www.youtube.com/watch?v=O4ef6GWBzys
session or cookie
http://www.youtube.com/watch?v=LdFVybHluqE
session or cookie
http://www.youtube.com/watch?v=LdFVybHluqE
Google Like Search textbox
Ajax
http://www.codeproject.com/KB/aspnet/Search_SuggestTextBox.aspx
Jquery:
http://www.eggheadcafe.com/tutorials/aspnet/18b6a1fa-a7cf-4507-84f2-15056fe65bb7/autocompletion-with-jque.aspx
webservice:
http://www.dotnetspider.com/forum/266496-Create-application-ASP-net-like-Google-search.aspx
http://www.codeproject.com/KB/aspnet/Search_SuggestTextBox.aspx
Jquery:
http://www.eggheadcafe.com/tutorials/aspnet/18b6a1fa-a7cf-4507-84f2-15056fe65bb7/autocompletion-with-jque.aspx
webservice:
http://www.dotnetspider.com/forum/266496-Create-application-ASP-net-like-Google-search.aspx
13.3.11
Call server side function using JQuery in Asp.Net
Call server side function using JQuery in Asp.Net
http://www.dotnetspark.com/kb/1453-call-server-side-function-using-jquery-asp-net.aspx
Using jQuery with ASP .NET
http://dotnetslackers.com/articles/ajax/Using-jQuery-with-ASP-NET.aspx
http://www.dotnetspark.com/kb/1453-call-server-side-function-using-jquery-asp-net.aspx
Using jQuery with ASP .NET
http://dotnetslackers.com/articles/ajax/Using-jQuery-with-ASP-NET.aspx
WCF Videos
http://www.youtube.com/watch?v=D3GbTYuwSy4&feature=related
http://www.youtube.com/watch?v=0mORV2Tovb8
demo:
http://carvingcode.blogspot.com/2010/04/creating-wcf-web-service-with-vs2010.html
http://www.youtube.com/watch?v=0mORV2Tovb8
demo:
http://carvingcode.blogspot.com/2010/04/creating-wcf-web-service-with-vs2010.html
1.3.11
web service
Create and Use ASP.NET Web Service in Visual Studio 2008
http://www.youtube.com/watch?v=qOqEKpYbTzw&feature=related
http://www.youtube.com/watch?v=qOqEKpYbTzw&feature=related
Window Service
part1: http://www.youtube.com/watch?v=RSHWX2jPMyA&feature=related
part2:http://www.youtube.com/watch?v=31WtOj0lpVU
=================================================================
http://www.youtube.com/watch?v=a2J_XZW2S4I
---------------------------------------------------------------
example:
Birthday Wish Scheduler in C#:
http://www.c-sharpcorner.com/UploadFile/prvn_131971/BirthdayWishScheduler02022006012557AM/BirthdayWishScheduler.aspx
part2:http://www.youtube.com/watch?v=31WtOj0lpVU
=================================================================
http://www.youtube.com/watch?v=a2J_XZW2S4I
---------------------------------------------------------------
example:
Birthday Wish Scheduler in C#:
http://www.c-sharpcorner.com/UploadFile/prvn_131971/BirthdayWishScheduler02022006012557AM/BirthdayWishScheduler.aspx
26.2.11
new things
1.)logout user when login from another place.
2.)2 different website attach.one website is as a a pluggable.
2.)2 different website attach.one website is as a a pluggable.
25.2.11
How to use Global.asax file to redirect the user ?
http://ipaddressextensions.codeplex.com/
http://stackoverflow.com/questions/5083794/how-to-use-global-asax-file-to-redirect-the-user
Geolocation error with IP address 127.0.0.1
http://stackoverflow.com/questions/3690278/geolocation-error-with-ip-address-127-0-0-1
http://stackoverflow.com/questions/5083794/how-to-use-global-asax-file-to-redirect-the-user
Geolocation error with IP address 127.0.0.1
http://stackoverflow.com/questions/3690278/geolocation-error-with-ip-address-127-0-0-1
24.2.11
global.asax
<%@ Application Language="C#" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.Net.Mail" %>
<%@ Import Namespace="SRMS.Bll" %>
<%@ Import Namespace="SRMS.BO" %>
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)
{
// Exception err = (Exception)Server.GetLastError().InnerException;
//Log the error details
//string errorText = "
// "
//MailMessage message = new MailMessage();
//message.From = new MailAddress("post@gmailcom");
//message.To.Add(new MailAddress("x@gmail.com"));
//message.CC.Add(new MailAddress("p@gmail.com"));
//message.Subject = "U Error Detail";
//message.Body = errorText;
//message.IsBodyHtml = true;
//SmtpClient client = new SmtpClient("smtp.u.com");
//client.Credentials = new System.Net.NetworkCredential("post@.com", "Tony1234");
//try
//{
//client.Send(message);
//}
//catch (Exception ex)
//{
// ex.Message.ToString();
//}
}
void Session_Start(object sender, EventArgs e)
{
// Code that runs when a new session is started
}
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.
}
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.Net.Mail" %>
<%@ Import Namespace="SRMS.Bll" %>
<%@ Import Namespace="SRMS.BO" %>
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)
{
// Exception err = (Exception)Server.GetLastError().InnerException;
//Log the error details
//string errorText = "
Error Message:" +
// err.Message.ToString() +
// "
Stack Trace: " +
// err.StackTrace.ToString() +
// "
// "
Error in: " +
// Request.Url.ToString() +
// "
Location ID(Location Name) is: " + Session["Session:LocationID"] + "(" + Session["Session:LocationName"] + ")" + "
";//MailMessage message = new MailMessage();
//message.From = new MailAddress("post@gmailcom");
//message.To.Add(new MailAddress("x@gmail.com"));
//message.CC.Add(new MailAddress("p@gmail.com"));
//message.Subject = "U Error Detail";
//message.Body = errorText;
//message.IsBodyHtml = true;
//SmtpClient client = new SmtpClient("smtp.u.com");
//client.Credentials = new System.Net.NetworkCredential("post@.com", "Tony1234");
//try
//{
//client.Send(message);
//}
//catch (Exception ex)
//{
// ex.Message.ToString();
//}
}
void Session_Start(object sender, EventArgs e)
{
// Code that runs when a new session is started
}
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.
}
10.2.11
Android
How To:Install Android SDK on Win7
http://www.youtube.com/watch?v=YeWH6Bj1DYw&feature=related
Google I/O 2008 - An Introduction to Android
http://www.youtube.com/watch?v=yqCj83leYRE&feature=relmfu
http://www.youtube.com/watch?v=x1ZZ-R3p_w8
http://www.youtube.com/watch?v=j8XseabG5j0&feature=relmfu
demo
http://www.youtube.com/watch?v=1FJHYqE0RDg
http://www.youtube.com/watch?v=YeWH6Bj1DYw&feature=related
Google I/O 2008 - An Introduction to Android
http://www.youtube.com/watch?v=yqCj83leYRE&feature=relmfu
http://www.youtube.com/watch?v=x1ZZ-R3p_w8
http://www.youtube.com/watch?v=j8XseabG5j0&feature=relmfu
demo
http://www.youtube.com/watch?v=1FJHYqE0RDg
6.2.11
Installing sharepoint Easy
sharepoint on window server 2008:
1.)Sharepoint 2010 Beta Installation: Step 1 - Download and Installing Windows 2008 Updates
2.)SharePoint 2010 Beta Installation: Step 2 - Disabling Internet Explorer Security on Windows 2008
3.)SharePoint 2010 Beta Installation: Step 3 - Add Server Roles & .NET Framework 3.5.1
4.)SharePoint 2010 Beta Installation: Step 4 - Installing SQL Server 2008 64-bit
5.)SharePoint 2010 Beta Installation: Step 5 - Downloading and Installing SQL 2008 64-bit Service Pack
6.)SharePoint 2010 Beta Installation: Step 6 - Download Cumulative Update Package 2
7._SharePoint 2010 Beta Installation: Steps 7, 8, 9 - Installing additional prerequisites
8.)SharePoint 2010 Beta Installation: Step 10 - Installing SharePoint 2010 Beta on a single server
9.)Step 11 - Create a SharePoint 2010 Web Application and a Site Collection
-------------------------------------------------
step:1
How to download and install Vmware Workstation 7 for free (32bit and 64bit
-
https://www.vmware.com/tryvmware/?p=vmware-workstation&lp=1
http://www.youtube.com/watch?v=fnCf7sDpVXo&feature=related
-----------------------------------------------------
step:2
How to Install Windows Server 2008 on a Virtual Machine
http://www.microsoft.com/windowsserver2008/en/us/trial-software.aspx
https://profile.microsoft.com/RegSysProfileCenter/wizard.aspx?wizid=209d831f-96fe-4434-ae0b-29a0f5df0f67&lcid=1033
http://www.youtube.com/watch?v=fdyMyw1W2xc
----------------------------
step:3
Create a SharePoint 2010 Web Application
Create a SharePoint 2010 Web Application and a Site Collection
http://www.microsoft.com/downloads/en/confirmation.aspx?FamilyID=43325e40-8934-4c78-ac44-5f0eeb1d42a5&DisplayLang=EN&hash=XZxQ35QPW%2beTzCWZNoegCJncTSV%2bKqSpaB30FAXP39zAcrdm9oLfTrgpclkql/9hD3Zy%2bJ56wwemilVTqEB8XQ%3d%3d
http://www.youtube.com/watch?v=Itcq_VOEAn4&feature=related
---------------------------
step:4
Lesson 1 Creating a new sharepoint site
http://www.youtube.com/watch?v=oBpprYu8tz8&feature=related
1.2.11
window service and mail
1.)Sending Many emails through Window Service.
2.)use of POP3 to read Mails from gmail.
2.)use of POP3 to read Mails from gmail.
Sharepoint
intall:
http://www.youtube.com/watch?v=vuR0SVMjTwg&feature=related
http://www.youtube.com/watch?v=tJWT1EMMx2s&feature=related
-------------------------------------------------------------
http://www.youtube.com/watch?v=tF23-OceUc0
http://www.youtube.com/watch?v=19NLKQBXxoM&feature=related
http://www.youtube.com/watch?v=vuR0SVMjTwg&feature=related
http://www.youtube.com/watch?v=tJWT1EMMx2s&feature=related
-------------------------------------------------------------
http://www.youtube.com/watch?v=tF23-OceUc0
http://www.youtube.com/watch?v=19NLKQBXxoM&feature=related
26.1.11
Calling web service using jQuery in ASP.NET
Calling web service using jQuery in ASP.NET
http://codeasp.net/articles/asp-net/217/calling-web-service-using-jquery-in-asp-net
Introduction to WCF Service, remoting,webservice
http://beyondrelational.com/blogs/dinesh/archive/2010/07/11/introduction-to-wcf-service.aspx
ASP.NET and Ajax - using XmlHttpRequest
http://aspdotnetcodebook.blogspot.com/2009/04/aspnet-and-ajax-using-xmlhttprequest.html
Implement: Paging in Repeater or Datalist Control
http://codeasp.net/articles/asp-net/140/implement-paging-in-repeater-or-datalist-control
http://codeasp.net/articles/asp-net/217/calling-web-service-using-jquery-in-asp-net
Introduction to WCF Service, remoting,webservice
http://beyondrelational.com/blogs/dinesh/archive/2010/07/11/introduction-to-wcf-service.aspx
ASP.NET and Ajax - using XmlHttpRequest
http://aspdotnetcodebook.blogspot.com/2009/04/aspnet-and-ajax-using-xmlhttprequest.html
Implement: Paging in Repeater or Datalist Control
http://codeasp.net/articles/asp-net/140/implement-paging-in-repeater-or-datalist-control
9.1.11
Add Cart
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();
}
}
{
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();
}
}
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"] = "";
}
Subscribe to:
Posts (Atom)