/*
*
* This DLL was compiled using VS.NET, however you can build this DLL using the C# Command
* Line Compiler to attain the same output DLL.
*
* In a typical .NET Framework installation, you can find the C# Compiler in the location
* shown below, where <version_number> is your installed version of the .NET Framework:
*
* C:\WINDOWS\Microsoft.NET\Framework\v<version_number>\csc.exe
*
* */
using System;
using System.Web;
namespace DesignStudioMag.DsmCookies
{
/// <summary>
/// Object used in storing and reading app user data
/// </summary>
public class AppCookie
{
//
// Constructors
//
/// <summary>
/// Creates a new instance of an AppCookie Object
/// </summary>
public AppCookie ()
{
// Local Variables
// Begin
if ( HttpContext.Current.Request.Cookies[this._cookieName] != null )
{
this._cookie = HttpContext.Current.Request.Cookies[this._cookieName];
}// end if
else
{
this._cookie = new HttpCookie(this._cookieName);
// Set Base values
this.EmailAddress = "";
this.FirstName = "";
this.LastName = "";
this.CartID = "";
this.LanguageCulture = "";
}// end else
}// end AppCookie
//
// Methods
//
/// <summary>
/// Saves the AppCookie object to the Response stream
/// </summary>
public void Save ()
{
// Local Variables
// Begin
this._cookie.Expires = DateTime.Now.AddDays(30.0);
HttpContext.Current.Response.Cookies.Add(this._cookie);
}// end Save
//
// Properties
//
/// <summary>
/// Property used to expose the first name of a visitor
/// </summary>
public string FirstName
{
get { return this._cookie["FirstName"].ToString(); }
set { this._cookie["FirstName"] = value; }
}// end FirstName
/// <summary>
/// Property used to expose the last name of a visitor
/// </summary>
public string LastName
{
get { return this._cookie["LastName"].ToString(); }
set { this._cookie["LastName"] = value; }
}// end LastName
/// <summary>
/// Property used to expose the email address of a visitor
/// </summary>
public string EmailAddress
{
get { return this._cookie["EmailAddress"].ToString(); }
set { this._cookie["EmailAddress"] = value; }
}// end EmailAddress
/// <summary>
/// Gets or sets the ID of the cart
/// </summary>
public string CartID
{
get { return this._cookie["CartID"].ToString(); }
set { this._cookie["CartID"] = value; }
}// end CartID
/// <summary>
/// Gets or sets the language/culture code for the user
/// </summary>
public string LanguageCulture
{
get { return this._cookie["LanguageCulture"].ToString(); }
set { this._cookie["LanguageCulture"] = value; }
}// end LanguageCulture
//
// Fields
//
private HttpCookie _cookie = null;
private string _cookieName = "DesignStudioMag_Cookie";
}// end class AppCookie
}// end namespace DesignStudioMag.DsmCookies