PDA

View Full Version : پروفایل برای راه اندازی کارت خرید



fatemeh eskandari
سه شنبه 28 تیر 1390, 10:51 صبح
سلام دوستان
خواهش میکنم بفرمایید که برای راه اندازی کارت خرید واسه خرید آنلاین چه تنظیماتی باید در web.configانجام بدم و اینکه چه کلاسی باید بنویسم؟
خواهش میکنم جواب بدید خیلی خیلی فوریه
اتنم کداییه که نوشتم و پروفال نوشته شده در web.config تو صفحات دیگه شناخته نمیشه و ارور میده
////////////////////////////////web.config

<system.web>
<roleManager enabled ="true"/>
<anonymousIdentification enabled ="true"/>
<profile enabled ="true">
<properties>
<add name ="membername"/>
<add name ="name" allowAnonymous="true"/>
<add name ="address"/>
<add name ="city"/>
<add name ="deliverycountry"/>
<add name ="postcode"/>
<add name ="country"/>
<add name="mailing" type ="System.Boolean"/>
<add name ="email"/>
<add name="theme"/>
<add name ="Cart" serializeAs="Binary"
type ="final1.ShoppingCart"
allowAnonymous = "true "/>
</properties>
</profile>
</system.web>
shopping class//////
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 Microsoft.VisualBasic;
using System.Data.SqlClient;
using System.Collections.Generic;

namespace final1
{
[Serializable]
public class CartItem
{
private string _id;
private string _model;
// private string _picture;
private int _quantity;
private int _price;
private int _lineTotal;
public void New()
{
}
public void New(string id, string model, int quantity, int price)
{
_id = id;
_model = model;
// _picture = picture;
_quantity = quantity;
_price = price;
_lineTotal = quantity * price;

}
public string id
{
get
{
return _id;
}
set
{
_id = value;
}
}
public string model
{
get
{
return _model;
}
set
{
_model = value;
}
}
//public string picture
//{
// get
// {
// return _picture;
// }
// set
// {
// _picture = value;
// }
//}
public int quantity
{
get
{
return _quantity;
}
set
{
_quantity = value;
}
}
public int price
{
get
{
return _price;
}
set
{
_price = value;
}
}
public int lineTotal
{
get
{
return _lineTotal;
}
set
{
_lineTotal = value;
}
}
}
[Serializable]
public class ShoppingCart
{
private DateTime _dateCreated;
private DateTime _lastUpdate;
private List<CartItem> _items;
public ShoppingCart()
{
if (this._items == null)
{
this._items = new List<CartItem>();
this._dateCreated = System.DateTime.Now;
}
}
public List<CartItem> items
{
get
{
return _items;
}
set
{
_items = value;
}
}
public void insert(string id, int price, int quantity, string model)
{
int itemindex = ItemIndexOfID(id);
if (itemindex == -1)
{
CartItem newitem = new CartItem();
newitem.id = id;
newitem.quantity = quantity;
newitem.price = price;
newitem.model = model;
_items.Add(newitem);
}
else
_items[itemindex].quantity += 1;
_lastUpdate = DateTime.Now;
}

private int ItemIndexOfID(string id)
{
int index = 0;
foreach (CartItem item in _items)
{
if (item.id == id)
return index;
index++;
}
return -1;
}
public void update(int RowID, string id, int quantity, int price)
{
CartItem item = _items[RowID];
item.id = id;
item.quantity = quantity;
item.price = price;
_lastUpdate = DateTime.Now;
}
public void deleteitem(int RowID)
{
_items.RemoveAt(RowID);
_lastUpdate = DateTime.Now;
}
public int Total
{
get
{
int t = 0;
if (_items == null)
return 0;
foreach (CartItem item in _items)
t += item.lineTotal;
return t;
}
}
}

}

Saman Hashemi
سه شنبه 28 تیر 1390, 12:08 عصر
1- كدهاتو بذار تو تگ كد
2-يه ذره توضيح بده دقيق ميخوايي چيكار كني براي من يه ذره نامفهوم بود مشكلت:متفکر:

hjran abdpor
سه شنبه 28 تیر 1390, 14:18 عصر
در مورد سبد خرید اساتید محترم خیلی بحث کردن . بهتر شما از تاپیک استفاده کنید که مشکلتون حل بشه :
www.barnamenevis.org/showthread.php?159632