535 lines
25 KiB
C#
535 lines
25 KiB
C#
|
|
using System;
|
|||
|
|
using System.Security.Cryptography;
|
|||
|
|
using System.IO;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Web;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Data.SqlClient;
|
|||
|
|
namespace Mtxfw.DAL
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
public class ShoppingCart
|
|||
|
|
{
|
|||
|
|
static P_Product daoProduct = new P_Product();
|
|||
|
|
static order_info daoorder = new order_info();
|
|||
|
|
public static int TotalNum()
|
|||
|
|
{
|
|||
|
|
int intTotalNum = 0;
|
|||
|
|
if(HttpContext.Current.Request.Cookies["0x120xxx"]!=null)
|
|||
|
|
{
|
|||
|
|
HttpCookie myCookie = HttpContext.Current.Request.Cookies["0x120xxx"];
|
|||
|
|
string strCookie=myCookie.Value;
|
|||
|
|
string[] strACookie;
|
|||
|
|
strACookie=strCookie.Split('|');
|
|||
|
|
intTotalNum = 0;
|
|||
|
|
for(int i=0;i<strACookie.LongLength-1;i++)
|
|||
|
|
{
|
|||
|
|
string[] strA=strACookie[i].Split(',');
|
|||
|
|
if (strA.LongLength == 3)
|
|||
|
|
{
|
|||
|
|
if (strA[1] != "")
|
|||
|
|
{
|
|||
|
|
intTotalNum = intTotalNum + Convert.ToInt32(strA[1]);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return intTotalNum;
|
|||
|
|
}
|
|||
|
|
public static int BTotalNum()
|
|||
|
|
{
|
|||
|
|
int intTotalNum = 0;
|
|||
|
|
if (HttpContext.Current.Request.Cookies["0x120xxx"] != null)
|
|||
|
|
{
|
|||
|
|
HttpCookie myCookie = HttpContext.Current.Request.Cookies["0x120xxx"];
|
|||
|
|
string strCookie = myCookie.Value;
|
|||
|
|
string[] strACookie = strCookie.Split('|');
|
|||
|
|
intTotalNum = strACookie.Length - 1;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
return intTotalNum;
|
|||
|
|
}
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ع<EFBFBD><D8B9><EFBFBD><EFBFBD>ܽ<EFBFBD><DCBD><EFBFBD>
|
|||
|
|
public static Double TotalMoney()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
Double sglTotalMoney = 0;
|
|||
|
|
if(HttpContext.Current.Request.Cookies["0x120xxx"]!=null)
|
|||
|
|
{
|
|||
|
|
HttpCookie myCookie = HttpContext.Current.Request.Cookies["0x120xxx"];
|
|||
|
|
string strCookie=myCookie.Value;
|
|||
|
|
string[] strACookie;
|
|||
|
|
strACookie=strCookie.Split('|');
|
|||
|
|
for(int i=0;i<strACookie.LongLength-1;i++)
|
|||
|
|
{
|
|||
|
|
string[] strA=strACookie[i].Split(',');
|
|||
|
|
if (strA.LongLength == 3)
|
|||
|
|
{
|
|||
|
|
if (strA[0] != "")
|
|||
|
|
{
|
|||
|
|
Mtxfw.Model.P_Product ModelProduct = daoProduct.GetModel(int.Parse(strA[0]));
|
|||
|
|
if (ModelProduct != null)
|
|||
|
|
{
|
|||
|
|
sglTotalMoney = sglTotalMoney + ModelProduct.P_VIP_P * Convert.ToInt32(strA[1]);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return sglTotalMoney;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
//<2F>ù<EFBFBD><C3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ع<EFBFBD><D8B9>ﳵ<EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>ע<EFBFBD>⣬<EFBFBD><E2A3AC><EFBFBD><EFBFBD><EFBFBD>ǽ<EFBFBD>HashTable<6C>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>DataTable<6C>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>DataView<65><77><EFBFBD><EFBFBD>
|
|||
|
|
//ת<><D7AA><EFBFBD><EFBFBD>DataTable<6C><65>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>ﳵʱ<EFB3B5><CAB1><EFBFBD><EFBFBD><EFBFBD>İﶨ<C4B0><EFB6A8>DataGrid<69>ؼ<EFBFBD>
|
|||
|
|
public static DataView Getprod(int IFStores)
|
|||
|
|
{
|
|||
|
|
//<2F><>Cookie<69>л<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ﳵ<EFBFBD>еĻ<D0B5><C4BB><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>Ϣ
|
|||
|
|
DataTable dt=new DataTable();
|
|||
|
|
if(HttpContext.Current.Request.Cookies["0x120xxx"]!=null)
|
|||
|
|
{
|
|||
|
|
HttpCookie myCookie = HttpContext.Current.Request.Cookies["0x120xxx"];
|
|||
|
|
string strCookie=myCookie.Value;
|
|||
|
|
if (strCookie.Trim() != "")
|
|||
|
|
{
|
|||
|
|
string[] strACookie;
|
|||
|
|
dt = new DataTable("0x120xxx");
|
|||
|
|
|
|||
|
|
strACookie = strCookie.Split('|');
|
|||
|
|
dt = new DataTable("0x120xxx"); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DataTable<6C><65><EFBFBD><EFBFBD><F3A3ACB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ Books
|
|||
|
|
DataColumn dc; //<2F><><EFBFBD><EFBFBD>DataColumn<6D><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
DataRow dr; //<2F><><EFBFBD><EFBFBD>DataRow<6F><77><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
//<2F><><EFBFBD>濪ʼ<E6BFAA><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľṹ
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30>,<2C><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>id
|
|||
|
|
dc = new DataColumn("id", System.Type.GetType("System.Int32"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><31>,<2C><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>prodName
|
|||
|
|
dc = new DataColumn("prodName", System.Type.GetType("System.String"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><32>,<2C><>Ʒ<EFBFBD><C6B7>ɫselcolor
|
|||
|
|
dc = new DataColumn("selcolor", System.Type.GetType("System.String"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>3<EFBFBD><33>,<2C><>ƷͼƬprodimg
|
|||
|
|
dc = new DataColumn("prodimg", System.Type.GetType("System.String"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4<EFBFBD><34>,<2C><>ƷIDprodid
|
|||
|
|
dc = new DataColumn("prodid", System.Type.GetType("System.String"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>5<EFBFBD><35>,<2C><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>prodPrice
|
|||
|
|
dc = new DataColumn("prodPrice", System.Type.GetType("System.Double"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>6<EFBFBD><36>,<2C><><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>prodNum
|
|||
|
|
dc = new DataColumn("prodNum", System.Type.GetType("System.Int32"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>7<EFBFBD><37>,<2C><><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>TotalNum
|
|||
|
|
dc = new DataColumn("TotalNum", System.Type.GetType("System.Int32"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>8<EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>Ϊ<EFBFBD><CEAA>Ʒ<EFBFBD>ļ۸<C4BC> * <20><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
|||
|
|
dc = new DataColumn("SubTotal", System.Type.GetType("System.Double"), "prodPrice*prodNum");
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>9<EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>Ϊ<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ҳе<D2B3><D0B5>˷<EFBFBD>
|
|||
|
|
dc = new DataColumn("IFMJCDYH", System.Type.GetType("System.String"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>10<31>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>Ϊ<EFBFBD><CEAA>Ʒ<EFBFBD>˷<EFBFBD>1
|
|||
|
|
dc = new DataColumn("SPYH1", System.Type.GetType("System.String"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>11<31>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>Ϊ<EFBFBD><CEAA>Ʒ<EFBFBD>˷<EFBFBD>2
|
|||
|
|
dc = new DataColumn("SPYH2", System.Type.GetType("System.String"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>12<31>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>Ϊ<EFBFBD><CEAA>Ʒ<EFBFBD>˷<EFBFBD>3
|
|||
|
|
dc = new DataColumn("SPYH3", System.Type.GetType("System.String"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>13<31><33>,<2C><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
dc = new DataColumn("SUserID", System.Type.GetType("System.String"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>14<31><34>,<2C><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
|||
|
|
dc = new DataColumn("utype", System.Type.GetType("System.String"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>15<31><35>,<2C>ײ<EFBFBD><D7B2><EFBFBD>Ʒ<EFBFBD>б<EFBFBD>
|
|||
|
|
dc = new DataColumn("P_CATEGORYs", System.Type.GetType("System.String"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>16<31><36>,<2C><>Ʒ<EFBFBD>ɱ<EFBFBD>
|
|||
|
|
dc = new DataColumn("TotalCB", System.Type.GetType("System.Double"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>17<31><37>,<2C><><EFBFBD><EFBFBD>
|
|||
|
|
dc = new DataColumn("prodPrice0", System.Type.GetType("System.Int32"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>HashTable<6C>е<EFBFBD><D0B5><EFBFBD>Ʒ<EFBFBD><C6B7>Ŀ<EFBFBD><C4BF>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>ÿһ<C3BF><D2BB>
|
|||
|
|
if (strACookie.LongLength > 0)
|
|||
|
|
{
|
|||
|
|
for (int i = 0; i < strACookie.Length - 1; i++)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD>и<EFBFBD>ֵ
|
|||
|
|
string[] strA = strACookie[i].Split(',');
|
|||
|
|
if (strA.Length == 3)
|
|||
|
|
{
|
|||
|
|
dr = dt.NewRow(); //<2F>½<EFBFBD>1<EFBFBD>У<EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD><C2BD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
if (strA[0] != "")
|
|||
|
|
{
|
|||
|
|
dr["id"] = strA[0]; //<2F><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
|||
|
|
//HttpContext.Current.Response.Write(strA[0]);
|
|||
|
|
int TNum = 0;
|
|||
|
|
Mtxfw.Model.P_Product ModelProduct = daoProduct.GetModel(int.Parse(strA[0]));
|
|||
|
|
if (ModelProduct != null)
|
|||
|
|
{
|
|||
|
|
TNum = ModelProduct.P_Orders; //<2F><><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
dr["prodName"] = ModelProduct.P_NAME; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
|||
|
|
dr["selcolor"] = strA[2]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>ɫ
|
|||
|
|
dr["prodimg"] = ModelProduct.P_images; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
|||
|
|
dr["prodid"] = ModelProduct.P_ID; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
|||
|
|
dr["SUserID"] = ModelProduct.P_UserID; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
dr["utype"] = ModelProduct.utype; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
|||
|
|
dr["P_CATEGORYs"] = ModelProduct.P_CATEGORYs; //<2F><><EFBFBD><EFBFBD><EFBFBD>ײ<EFBFBD><D7B2><EFBFBD>Ʒ<EFBFBD>б<EFBFBD>
|
|||
|
|
dr["TotalCB"] = ModelProduct.P_CB_P; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD>ɱ<EFBFBD>
|
|||
|
|
int intNum = ModelProduct.P_Inventory;
|
|||
|
|
if (intNum == 0)
|
|||
|
|
{
|
|||
|
|
dr["TotalNum"] = 0; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒʣ<C6B7><CAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
dr["TotalNum"] = intNum - TNum; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒʣ<C6B7><CAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
}
|
|||
|
|
dr["prodPrice"] = ModelProduct.P_VIP_P;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD>ۿۼ۸<DBBC>
|
|||
|
|
dr["prodPrice0"] = ModelProduct.P_JiangLi;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
|||
|
|
/*if (IFStores == 1)
|
|||
|
|
{
|
|||
|
|
dr["prodPrice"] = ModelProduct.P_VIP_P1;//<2F><><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>Ʒ<EFBFBD>۸<EFBFBD>
|
|||
|
|
}
|
|||
|
|
else if (IFStores == 2)
|
|||
|
|
{
|
|||
|
|
dr["prodPrice"] = ModelProduct.P_VIP_P2;//<2F><><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>Ʒ<EFBFBD>۸<EFBFBD>
|
|||
|
|
}
|
|||
|
|
else if (IFStores == 3)
|
|||
|
|
{
|
|||
|
|
dr["prodPrice"] = ModelProduct.P_VIP_P3;//<2F><><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>Ʒ<EFBFBD>۸<EFBFBD>
|
|||
|
|
}*/
|
|||
|
|
//string[] strAuthor = dv.Table.Rows[0]["N_Author"].ToString().Split('|');//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD>˷<EFBFBD>
|
|||
|
|
string[] strAuthor = "1|0|0|0".Split('|');; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD>˷<EFBFBD>
|
|||
|
|
dr["IFMJCDYH"] = strAuthor[0];
|
|||
|
|
dr["SPYH1"] = ModelProduct.P_YH_P;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD>˷<EFBFBD>strAuthor[1]
|
|||
|
|
dr["SPYH2"] = strAuthor[2];
|
|||
|
|
dr["SPYH3"] = strAuthor[3];
|
|||
|
|
}
|
|||
|
|
//dv.Table.Clear();
|
|||
|
|
}
|
|||
|
|
dr["prodNum"] = 0;
|
|||
|
|
if (strA[1] != "")//<2F><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
|||
|
|
{
|
|||
|
|
dr["prodNum"] = Convert.ToInt32(strA[1]);
|
|||
|
|
}
|
|||
|
|
dt.Rows.Add(dr); //<2F><><EFBFBD><EFBFBD><EFBFBD>мӵ<D0BC><D3B5><EFBFBD>dt<64><74>
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
//<2F><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>ֵ<EFBFBD><D6B5>ע<EFBFBD>ⷵ<EFBFBD>ص<EFBFBD><D8B5><EFBFBD>DataView
|
|||
|
|
}
|
|||
|
|
return dt.DefaultView;
|
|||
|
|
}
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ
|
|||
|
|
public static DataTable GetViewedProd()
|
|||
|
|
{
|
|||
|
|
//<2F><>Cookie<69>л<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ﳵ<EFBFBD>еĻ<D0B5><C4BB><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>Ϣ
|
|||
|
|
DataTable dt = new DataTable();
|
|||
|
|
if (HttpContext.Current.Request.Cookies["view_id"] != null)
|
|||
|
|
{
|
|||
|
|
HttpCookie myCookie = HttpContext.Current.Request.Cookies["view_id"];
|
|||
|
|
string strCookie = myCookie.Value;
|
|||
|
|
if (strCookie.Trim() != "")
|
|||
|
|
{
|
|||
|
|
string[] strACookie;
|
|||
|
|
|
|||
|
|
strACookie = strCookie.Split(',');
|
|||
|
|
dt = new DataTable("view_id"); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DataTable<6C><65><EFBFBD><EFBFBD><F3A3ACB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ Books
|
|||
|
|
DataColumn dc; //<2F><><EFBFBD><EFBFBD>DataColumn<6D><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
DataRow dr; //<2F><><EFBFBD><EFBFBD>DataRow<6F><77><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
//<2F><><EFBFBD>濪ʼ<E6BFAA><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľṹ
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30>,<2C><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>id
|
|||
|
|
dc = new DataColumn("id", System.Type.GetType("System.Int32"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><31>,<2C><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>prodName
|
|||
|
|
dc = new DataColumn("prodName", System.Type.GetType("System.String"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><32>,<2C><>Ʒ<EFBFBD><C6B7>ɫselcolor
|
|||
|
|
dc = new DataColumn("selcolor", System.Type.GetType("System.String"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>3<EFBFBD><33>,<2C><>ƷͼƬprodimg
|
|||
|
|
dc = new DataColumn("prodimg", System.Type.GetType("System.String"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4<EFBFBD><34>,<2C><>ƷIDprodid
|
|||
|
|
dc = new DataColumn("prodid", System.Type.GetType("System.String"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>5<EFBFBD><35>,<2C><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>prodPrice
|
|||
|
|
dc = new DataColumn("prodPrice", System.Type.GetType("System.Double"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>6<EFBFBD><36>,<2C><><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>prodNum
|
|||
|
|
dc = new DataColumn("prodNum", System.Type.GetType("System.Int32"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>7<EFBFBD><37>,<2C><><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>TotalNum
|
|||
|
|
dc = new DataColumn("TotalNum", System.Type.GetType("System.Int32"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>8<EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>Ϊ<EFBFBD><CEAA>Ʒ<EFBFBD>ļ۸<C4BC> * <20><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
|||
|
|
dc = new DataColumn("SubTotal", System.Type.GetType("System.Double"), "prodPrice*prodNum");
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>9<EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>Ϊ<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ҳе<D2B3><D0B5>˷<EFBFBD>
|
|||
|
|
dc = new DataColumn("IFMJCDYH", System.Type.GetType("System.String"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>10<31>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>Ϊ<EFBFBD><CEAA>Ʒ<EFBFBD>˷<EFBFBD>1
|
|||
|
|
dc = new DataColumn("SPYH1", System.Type.GetType("System.String"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>11<31>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>Ϊ<EFBFBD><CEAA>Ʒ<EFBFBD>˷<EFBFBD>2
|
|||
|
|
dc = new DataColumn("SPYH2", System.Type.GetType("System.String"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>12<31>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>Ϊ<EFBFBD><CEAA>Ʒ<EFBFBD>˷<EFBFBD>3
|
|||
|
|
dc = new DataColumn("SPYH3", System.Type.GetType("System.String"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>13<31><33>,<2C><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
dc = new DataColumn("SUserID", System.Type.GetType("System.String"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>14<31><34>,<2C><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
|||
|
|
dc = new DataColumn("utype", System.Type.GetType("System.String"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>15<31><35>,<2C>ײ<EFBFBD><D7B2><EFBFBD>Ʒ<EFBFBD>б<EFBFBD>
|
|||
|
|
dc = new DataColumn("P_CATEGORYs", System.Type.GetType("System.String"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>HashTable<6C>е<EFBFBD><D0B5><EFBFBD>Ʒ<EFBFBD><C6B7>Ŀ<EFBFBD><C4BF>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>ÿһ<C3BF><D2BB>
|
|||
|
|
if (strACookie.LongLength > 0)
|
|||
|
|
{
|
|||
|
|
int jj = 0;
|
|||
|
|
for (int i = strACookie.Length - 1; i > 0; i--)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD>и<EFBFBD>ֵ
|
|||
|
|
if (strACookie[i] != "" && jj<5)
|
|||
|
|
{
|
|||
|
|
dr = dt.NewRow(); //<2F>½<EFBFBD>1<EFBFBD>У<EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD><C2BD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|
|||
|
|
dr["id"] = strACookie[i]; //<2F><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
|||
|
|
//HttpContext.Current.Response.Write(strA[0]);
|
|||
|
|
int TNum = 0;
|
|||
|
|
Mtxfw.Model.P_Product ModelProduct = daoProduct.GetModel(int.Parse(strACookie[i]));
|
|||
|
|
if (ModelProduct != null)
|
|||
|
|
{
|
|||
|
|
TNum = ModelProduct.P_Orders; //<2F><><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
dr["prodName"] = ModelProduct.P_NAME; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
|||
|
|
dr["selcolor"] = ""; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>ɫ
|
|||
|
|
dr["prodimg"] = ModelProduct.P_images; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
|||
|
|
dr["prodid"] = ModelProduct.P_ID; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
|||
|
|
dr["SUserID"] = ModelProduct.P_UserID; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
dr["utype"] = ModelProduct.utype; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
|||
|
|
dr["P_CATEGORYs"] = ModelProduct.P_CATEGORYs; //<2F><><EFBFBD><EFBFBD><EFBFBD>ײ<EFBFBD><D7B2><EFBFBD>Ʒ<EFBFBD>б<EFBFBD>
|
|||
|
|
int intNum = ModelProduct.P_Inventory;
|
|||
|
|
if (intNum == 0)
|
|||
|
|
{
|
|||
|
|
dr["TotalNum"] = 0; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒʣ<C6B7><CAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
dr["TotalNum"] = intNum - TNum; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒʣ<C6B7><CAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
}
|
|||
|
|
dr["prodPrice"] = ModelProduct.P_VIP_P;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD>ۿۼ۸<DBBC>
|
|||
|
|
//string[] strAuthor = dv.Table.Rows[0]["N_Author"].ToString().Split('|');//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD>˷<EFBFBD>
|
|||
|
|
string[] strAuthor = "1|0|0|0".Split('|'); ; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD>˷<EFBFBD>
|
|||
|
|
dr["IFMJCDYH"] = strAuthor[0];
|
|||
|
|
dr["SPYH1"] = strAuthor[1];
|
|||
|
|
dr["SPYH2"] = strAuthor[2];
|
|||
|
|
dr["SPYH3"] = strAuthor[3];
|
|||
|
|
}
|
|||
|
|
dr["prodNum"] = 0;
|
|||
|
|
dt.Rows.Add(dr);
|
|||
|
|
jj += 1;
|
|||
|
|
}
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>мӵ<D0BC><D3B5><EFBFBD>dt<64><74>
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
//<2F><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>ֵ<EFBFBD><D6B5>ע<EFBFBD>ⷵ<EFBFBD>ص<EFBFBD><D8B5><EFBFBD>DataView
|
|||
|
|
}
|
|||
|
|
return dt;
|
|||
|
|
}
|
|||
|
|
//<2F>ú<EFBFBD><C3BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>жϸ<D0B6><CFB8><EFBFBD>Ʒ<EFBFBD>Ƿ<EFBFBD><C7B7>Ѿ<EFBFBD><D1BE>ڹ<EFBFBD><DAB9>ﳵ<EFBFBD><EFB3B5>
|
|||
|
|
public static bool IsExist(string strProdId, string selcolor)
|
|||
|
|
{
|
|||
|
|
//<2F><>Cookie<69>л<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ﳵ<EFBFBD>еĻ<D0B5><C4BB><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>Ϣ
|
|||
|
|
string strCookie = "";
|
|||
|
|
bool b = false;
|
|||
|
|
if (HttpContext.Current.Request.Cookies["0x120xxx"] != null)
|
|||
|
|
{
|
|||
|
|
HttpCookie myCookie = HttpContext.Current.Request.Cookies["0x120xxx"];
|
|||
|
|
strCookie = myCookie.Value;
|
|||
|
|
}
|
|||
|
|
string[] strACookie = strCookie.Split('|');
|
|||
|
|
if (strACookie.LongLength > 0)
|
|||
|
|
{
|
|||
|
|
for (int i = 0; i < strACookie.Length - 1; i++)
|
|||
|
|
{
|
|||
|
|
string[] strA = strACookie[i].Split(',');
|
|||
|
|
if (strA.Length == 3)
|
|||
|
|
{
|
|||
|
|
if (strA[0] != "")
|
|||
|
|
{
|
|||
|
|
string stra = strA[2];
|
|||
|
|
if (strA[0] == strProdId && selcolor == stra)
|
|||
|
|
{
|
|||
|
|
b = true; //<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>Ʒ<EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return b;
|
|||
|
|
}
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ﳵ<EFBFBD><EFB3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ڣ<EFBFBD>ֻҪ<D6BB><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
|
|||
|
|
public static void Addprod(string strProdId, int num, string selcolor)
|
|||
|
|
{
|
|||
|
|
//<2F><>Cookie<69>л<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ﳵ<EFBFBD>еĻ<D0B5><C4BB><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>Ϣ
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
string[] AProdId = strProdId.Split(',');
|
|||
|
|
for (int j = 0; j < AProdId.Length; j++)
|
|||
|
|
{
|
|||
|
|
string strCookie = "";
|
|||
|
|
if (AProdId.Length > 0)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
if (AProdId[j] != "")
|
|||
|
|
{
|
|||
|
|
HttpCookie myCookie = new HttpCookie("0x120xxx");
|
|||
|
|
if (IsExist(AProdId[j], selcolor))
|
|||
|
|
{
|
|||
|
|
if (HttpContext.Current.Request.Cookies["0x120xxx"] != null)
|
|||
|
|
{
|
|||
|
|
myCookie = HttpContext.Current.Request.Cookies["0x120xxx"];
|
|||
|
|
strCookie = myCookie.Value;
|
|||
|
|
string[] strACookie;
|
|||
|
|
strACookie = strCookie.Split('|');
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>HashTable<6C>е<EFBFBD><D0B5><EFBFBD>Ʒ<EFBFBD><C6B7>Ŀ<EFBFBD><C4BF>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>ÿһ<C3BF><D2BB>
|
|||
|
|
for (int i = 0; i < strACookie.Length - 1; i++)
|
|||
|
|
{
|
|||
|
|
string[] strA = strACookie[i].Split(',');
|
|||
|
|
if (strA.Length == 3)
|
|||
|
|
{
|
|||
|
|
if (strA[0] != "")
|
|||
|
|
{
|
|||
|
|
if (strA[0] == AProdId[j] && strA[2] == selcolor)
|
|||
|
|
{
|
|||
|
|
strCookie = strCookie.Replace(strA[0] + "," + strA[1] + "," + strA[2], strA[0] + "," + (Convert.ToInt32(strA[1]) + num).ToString() + "," + strA[2]);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (HttpContext.Current.Request.Cookies["0x120xxx"] != null)
|
|||
|
|
{
|
|||
|
|
myCookie = HttpContext.Current.Request.Cookies["0x120xxx"];
|
|||
|
|
strCookie = myCookie.Value;
|
|||
|
|
}
|
|||
|
|
strCookie += AProdId[j] + ",1," + selcolor + "|";
|
|||
|
|
}
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µĹ<C2B5><C4B9><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>Ϣ<EFBFBD><CFA2><EFBFBD>浽Cookie<69><65>
|
|||
|
|
myCookie.Value = strCookie;
|
|||
|
|
myCookie.Expires = DateTime.Now.AddYears(1);
|
|||
|
|
HttpContext.Current.Response.Cookies.Add(myCookie);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F>ӹ<EFBFBD><D3B9>ﳵ<EFBFBD><EFB3B5>ɾ<EFBFBD><C9BE>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>
|
|||
|
|
public static void RemoveProd(string strProdId, string selcolor)
|
|||
|
|
{
|
|||
|
|
HttpCookie myCookie=new HttpCookie("0x120xxx");
|
|||
|
|
string strCookie="";
|
|||
|
|
//<2F><>Cookie<69>л<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ﳵ<EFBFBD>еĻ<D0B5><C4BB><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>Ϣ
|
|||
|
|
if (HttpContext.Current.Request.Cookies["0x120xxx"] != null)
|
|||
|
|
{
|
|||
|
|
myCookie = HttpContext.Current.Request.Cookies["0x120xxx"];
|
|||
|
|
strCookie = myCookie.Value;
|
|||
|
|
string[] strACookie = strCookie.Split('|');
|
|||
|
|
string[] ProdIdA = strProdId.Split(',');
|
|||
|
|
string[] selcolorA = selcolor.Split(',');
|
|||
|
|
for (int j = 0; j < ProdIdA.Length - 1; j++)
|
|||
|
|
{
|
|||
|
|
if (ProdIdA[j] != "")
|
|||
|
|
{
|
|||
|
|
for (int i = 0; i < strACookie.Length - 1; i++)
|
|||
|
|
{
|
|||
|
|
string[] strA = strACookie[i].Split(',');
|
|||
|
|
if (strA.Length == 3)
|
|||
|
|
{
|
|||
|
|
if (strA[0] != "")
|
|||
|
|
{
|
|||
|
|
string stra = strA[2];
|
|||
|
|
if (strA[0] == ProdIdA[j] && stra == selcolorA[j])
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
strCookie = strCookie.Replace(strACookie[i] + "|", "");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µĹ<C2B5><C4B9><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>Ϣ<EFBFBD><CFA2><EFBFBD>浽Cookie<69><65>
|
|||
|
|
myCookie.Value = strCookie;
|
|||
|
|
myCookie.Expires=DateTime.Now.AddYears(1);
|
|||
|
|
HttpContext.Current.Response.Cookies.Add(myCookie);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>Ĺ<EFBFBD><C4B9>ﳵ<EFBFBD>еĻ<D0B5><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
public static void UpdateProd(string strProdId, string intprodNum, string selcolor)
|
|||
|
|
{
|
|||
|
|
HttpCookie myCookie=new HttpCookie("0x120xxx");
|
|||
|
|
string strCookie="";
|
|||
|
|
//<2F><>Cookie<69>л<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ﳵ<EFBFBD>еĻ<D0B5><C4BB><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>Ϣ
|
|||
|
|
if(HttpContext.Current.Request.Cookies["0x120xxx"]!=null)
|
|||
|
|
{
|
|||
|
|
myCookie = HttpContext.Current.Request.Cookies["0x120xxx"];
|
|||
|
|
strCookie=myCookie.Value;
|
|||
|
|
string[] strACookie;
|
|||
|
|
strACookie=strCookie.Split('|');
|
|||
|
|
for(int i=0;i<strACookie.Length-1;i++)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
string[] strA = strACookie[i].Split(',');
|
|||
|
|
if (strA.Length == 3)
|
|||
|
|
{
|
|||
|
|
if (strA[0] != "")
|
|||
|
|
{
|
|||
|
|
string stra = strA[2];
|
|||
|
|
if (strA[0] == strProdId && stra == selcolor)
|
|||
|
|
{
|
|||
|
|
if (intprodNum == "" || intprodNum == "0")
|
|||
|
|
{
|
|||
|
|
strCookie = strCookie.Replace(strACookie[i] + "|", "");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
strCookie = strCookie.Replace(strA[0] + "," + strA[1] + "," + strA[2], strA[0] + "," + intprodNum + "," + strA[2]);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µĹ<C2B5><C4B9><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>Ϣ<EFBFBD><CFA2><EFBFBD>浽Cookie<69><65>
|
|||
|
|
myCookie.Value = strCookie;
|
|||
|
|
myCookie.Expires=DateTime.Now.AddYears(1);
|
|||
|
|
HttpContext.Current.Response.Cookies.Add(myCookie);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|