using System;

using System.Data;

using System.Configuration;

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.Profile;

public class Cartmanager

{

 

      public Cart GetCart()

      {

HttpPersonalizationBaseclass profile = HttpContext.Current.Profile;

return (profile.GetPropertyValue("Cart") as Cart);

 

      }

     

      public void Delete(int ProductId)

      {

            Cart mycart= this.GetCart();

            mycart.Remove(ProductId);

      }

public void Update(int ProductId, String name, int count, decimal Unitprice)

      {

            Cart mycart=this.GetCart();

            ProductItem item = mycart.FindItemByProductId(ProductId);

 

            if (item != null)

            {

                  item.Name = name;

                  item.Count = count;

                  item.unitprice = Unitprice;

            }

            }

public void Insert(int ProductId, string Name, int Count, decimal Unitprice)

      {

            Cart mycart = this.GetCart();

            mycart.Add(new ProductItem(ProductId, Name, Count,Unitprice));

      }

}