part-2 AuthorizeNetFields.cs
AuthorizeNetFields.cs
AuthorizeNetRequest.cs
AuthorizeNetResponse.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
///
/// Summary description for AuthorizeNetFields
///
public class AuthorizeNetFields
{
public AuthorizeNetFields()
{
//
// TODO: Add constructor logic here
//
}
private string x_description = string.Empty;
public string x_Description
{
get { return x_description; }
set { x_description = value; }
}
private string x_first_name = string.Empty;
public string x_First_Name
{
get { return x_first_name; }
set { x_first_name = value; }
}
private string x_last_name = string.Empty;
public string x_Last_Name
{
get { return x_last_name; }
set { x_last_name = value; }
}
private string x_address = string.Empty;
public string x_Address
{
get { return x_address; }
set { x_address = value; }
}
private string x_city = string.Empty;
public string x_City
{
get { return x_city; }
set { x_city = value; }
}
private string x_state = string.Empty;
public string x_State
{
get { return x_state; }
set { x_state = value; }
}
private string x_zip = string.Empty;
public string x_Zip
{
get { return x_zip; }
set { x_zip = value; }
}
private string x_country = string.Empty;
public string x_Country
{
get { return x_country; }
set { x_country = value; }
}
private string x_phone = string.Empty;
public string x_Phone
{
get { return x_phone; }
set { x_phone = value; }
}
private string x_fax = string.Empty;
public string x_Fax
{
get { return x_fax; }
set { x_fax = value; }
}
private string x_email = string.Empty;
public string x_Email
{
get { return x_email; }
set { x_email = value; }
}
private string x_ship_to_first_name = string.Empty;
public string x_Ship_to_first_name
{
get { return x_ship_to_first_name; }
set { x_ship_to_first_name = value; }
}
private string x_ship_to_last_name = string.Empty;
public string x_Ship_to_last_name
{
get { return x_ship_to_last_name; }
set { x_ship_to_last_name = value; }
}
private string x_ship_to_company = string.Empty;
public string x_Ship_to_company
{
get { return x_ship_to_company; }
set { x_ship_to_company = value; }
}
private string x_ship_to_address = string.Empty;
public string x_Ship_to_address
{
get { return x_ship_to_address; }
set { x_ship_to_address = value; }
}
private string x_ship_to_city = string.Empty;
public string x_Ship_to_city
{
get { return x_ship_to_city; }
set { x_ship_to_city = value; }
}
private string x_ship_to_state = string.Empty;
public string x_Ship_to_state
{
get { return x_ship_to_state; }
set { x_ship_to_state = value; }
}
private string x_ship_to_zip = string.Empty;
public string x_Ship_to_zip
{
get { return x_ship_to_zip; }
set { x_ship_to_zip = value; }
}
private string x_ship_to_phone = string.Empty;
public string x_Ship_to_phone
{
get { return x_ship_to_phone; }
set { x_ship_to_phone = value; }
}
private string x_ship_to_country = string.Empty;
public string x_Ship_to_country
{
get { return x_ship_to_country; }
set { x_ship_to_country = value; }
}
private string x_tax = string.Empty;
public string x_Tax
{
get { return x_tax; }
set { x_tax = value; }
}
}
Part-I AuthorizeNet.cs
AuthorizeNetFields.cs
AuthorizeNetRequest.cs
AuthorizeNetResponse.cs
Javascript function to set cookies
{
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );
/*
if the expires variable is set, make the correct
expires time, the current script below will set
it for x number of days, to make it for hours,
delete * 24, for minutes, delete * 60 * 24
*/
if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );
document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}
Recursion in sql stored procedure
set QUOTED_IDENTIFIER ON
GO
ALTER proc [dbo].[uspGetCardsByCatID] (@catId int)
as
BEGIN
/*Recursion*/
with RecursionCTE (iCategoryId_PK,iParentCategoryId_FK,sTitle, bIsActive)
as
(
select *
from vwCategory
where iParentCategoryId_FK = @catId and bIsActive = 1
union all
select R1.*
from vwCategory as R1
join RecursionCTE as R2 on R1.iParentCategoryId_FK = R2.iCategoryId_PK
)
/*End Recusion*/
Select * from dbo.vwCard where iCategoryId_FK = @catId or iCategoryId_FK in (select iCategoryId_PK from RecursionCTE) order by (iTotalCustomizeOrders + iTotalBlankOrders) DESC
END
javascript to change group name
get youtube video's publish date, view count, title and other data
{
string sTitle = string.Empty;
bool bPublished = false;
bool bTitle = false;
try
{
XmlTextReader reader = new XmlTextReader("http://gdata.youtube.com/feed/api/videos/" + videoId);
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element:
{
switch (reader.Name)
{
case "published":
bPublished = true;
break;
case "yt:statistics":
{
while (reader.MoveToNextAttribute())
{
if (reader.Name.ToLower().Equals("viewcount"))
sViewCount = reader.Value;
}
}
break;
case "media:title":
bTitle = true;
break;
}
break;
}
case XmlNodeType.Text:
if (bPublished)
{
dtPublishDate = Convert.ToDateTime(reader.Value);
}
else if (bTitle)
{
sTitle = reader.Value;
}
break;
case XmlNodeType.EndElement:
{
bPublished = false;
bTitle = false;
break;
}
}
}
reader.Close();
Response.Write("Published on: " + dtPublishDate.ToLongDateString() + "");
Response.Write("View Count: " + sViewCount + "");
Response.Write("Title: " + sTitle + "");
}
catch { }
}
PNG Fix
<!--[if lt IE 7]>
<script language="JavaScript">
function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])
if ((version >= 5.5) && (document.body.filters))
{
for(var i=0; i<document.images.length; i++)
{
var img = document.images[i]
var imgName = img.src.toUpperCase()
if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
{
var imgID = (img.id) ? "id='" + img.id + "' " : ""
var imgClass = (img.className) ? "class='" + img.className + "' " : ""
var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
var imgStyle = "display:inline-block;" + img.style.cssText
if (img.align == "left") imgStyle = "float:left;" + imgStyle
if (img.align == "right") imgStyle = "float:right;" + imgStyle
if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
var strNewHTML = "<span " + imgID + imgClass + imgTitle
+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
img.outerHTML = strNewHTML
i = i-1
}
}
}
}
window.attachEvent("onload", correctPNG);
</script>
<![endif]-->