308 lines
14 KiB
C#
308 lines
14 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 ShoppingCart1
|
|||
|
|
{
|
|||
|
|
static user_Goods daoGoods = new user_Goods();
|
|||
|
|
static order_info daoorder = new order_info();
|
|||
|
|
public static int TotalNum(HttpContext context)
|
|||
|
|
{
|
|||
|
|
int intTotalNum = 0;
|
|||
|
|
if(context.Request.Cookies["0x120xxx1"]!=null)
|
|||
|
|
{
|
|||
|
|
HttpCookie myCookie = context.Request.Cookies["0x120xxx1"];
|
|||
|
|
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 == 2)
|
|||
|
|
{
|
|||
|
|
if (strA[1] != "")
|
|||
|
|
{
|
|||
|
|
intTotalNum = intTotalNum + Convert.ToInt32(strA[1]);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return intTotalNum;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
//<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(HttpContext context)
|
|||
|
|
{
|
|||
|
|
//<2F><>Cookie<69>л<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ﳵ<EFBFBD>еĻ<D0B5><C4BB><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>Ϣ
|
|||
|
|
DataTable dt=new DataTable();
|
|||
|
|
if (context.Request.Cookies["0x120xxx1"] != null)
|
|||
|
|
{
|
|||
|
|
HttpCookie myCookie = context.Request.Cookies["0x120xxx1"];
|
|||
|
|
string strCookie=myCookie.Value;
|
|||
|
|
if (strCookie.Trim() != "")
|
|||
|
|
{
|
|||
|
|
string[] strACookie;
|
|||
|
|
dt = new DataTable("0x120xxx1");
|
|||
|
|
|
|||
|
|
strACookie = strCookie.Split('|');
|
|||
|
|
dt = new DataTable("0x120xxx1"); //<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><>ƷͼƬprodimg
|
|||
|
|
dc = new DataColumn("prodimg", System.Type.GetType("System.String"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>3<EFBFBD><33>,<2C><>ƷIDprodid
|
|||
|
|
dc = new DataColumn("prodid", System.Type.GetType("System.String"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4<EFBFBD><34>,<2C><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>prodPrice
|
|||
|
|
dc = new DataColumn("prodPrice", System.Type.GetType("System.Double"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4<EFBFBD><34>,<2C><>ƷPVprodPrice2
|
|||
|
|
dc = new DataColumn("prodPrice2", System.Type.GetType("System.Double"));
|
|||
|
|
dt.Columns.Add(dc);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>5<EFBFBD><35>,<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>6<EFBFBD><36>,<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>7<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>7<EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>Ϊ<EFBFBD><CEAA>Ʒ<EFBFBD><C6B7>PV * <20><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
|||
|
|
dc = new DataColumn("SubTotal2", System.Type.GetType("System.Double"), "prodPrice2*prodNum");
|
|||
|
|
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>Ƿ<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>9<EFBFBD>У<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>10<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>11<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>12<31><32>,<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><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 == 2)
|
|||
|
|
{
|
|||
|
|
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>
|
|||
|
|
//context.Response.Write(strA[0]);
|
|||
|
|
Mtxfw.Model.user_Goods ModelGoods = daoGoods.GetModel(int.Parse(strA[0]));
|
|||
|
|
if (ModelGoods != null)
|
|||
|
|
{
|
|||
|
|
dr["prodName"] = ModelGoods.GoodsName; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
|||
|
|
dr["prodimg"] = ModelGoods.GoodsPic; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
|||
|
|
dr["prodid"] = ModelGoods.Id; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
|||
|
|
dr["SUserID"] = 0; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
dr["TotalNum"] = 10000; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒʣ<C6B7><CAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
dr["prodPrice"] = ModelGoods.GoodsPrices;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD>ۿۼ۸<DBBC>
|
|||
|
|
dr["prodPrice2"] = ModelGoods.GoodsPrices2;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD>ۿۼ۸<DBBC>
|
|||
|
|
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];
|
|||
|
|
}
|
|||
|
|
//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><C3BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>жϸ<D0B6><CFB8><EFBFBD>Ʒ<EFBFBD>Ƿ<EFBFBD><C7B7>Ѿ<EFBFBD><D1BE>ڹ<EFBFBD><DAB9>ﳵ<EFBFBD><EFB3B5>
|
|||
|
|
public static bool IsExist(HttpContext context,string strProdId)
|
|||
|
|
{
|
|||
|
|
//<2F><>Cookie<69>л<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ﳵ<EFBFBD>еĻ<D0B5><C4BB><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>Ϣ
|
|||
|
|
string strCookie = "";
|
|||
|
|
bool b = false;
|
|||
|
|
if (context.Request.Cookies["0x120xxx1"] != null)
|
|||
|
|
{
|
|||
|
|
HttpCookie myCookie = context.Request.Cookies["0x120xxx1"];
|
|||
|
|
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 == 2)
|
|||
|
|
{
|
|||
|
|
if (strA[0] != "")
|
|||
|
|
{
|
|||
|
|
if (strA[0] == strProdId)
|
|||
|
|
{
|
|||
|
|
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(HttpContext context, string strProdId, int num)
|
|||
|
|
{
|
|||
|
|
//<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("0x120xxx1");
|
|||
|
|
if (IsExist(context, AProdId[j]))
|
|||
|
|
{
|
|||
|
|
if (context.Request.Cookies["0x120xxx1"] != null)
|
|||
|
|
{
|
|||
|
|
myCookie = context.Request.Cookies["0x120xxx1"];
|
|||
|
|
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 == 2)
|
|||
|
|
{
|
|||
|
|
if (strA[0] != "")
|
|||
|
|
{
|
|||
|
|
if (strA[0] == AProdId[j])
|
|||
|
|
{
|
|||
|
|
strCookie = strCookie.Replace(strA[0] + "," + strA[1], strA[0] + "," + (Convert.ToInt32(strA[1]) + num).ToString());
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (context.Request.Cookies["0x120xxx1"] != null)
|
|||
|
|
{
|
|||
|
|
myCookie = context.Request.Cookies["0x120xxx1"];
|
|||
|
|
strCookie = myCookie.Value;
|
|||
|
|
}
|
|||
|
|
strCookie += AProdId[j] + ",1|";
|
|||
|
|
}
|
|||
|
|
//<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);
|
|||
|
|
context.Response.Cookies.Add(myCookie);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD>Ĺ<EFBFBD><C4B9>ﳵ<EFBFBD>еĻ<D0B5><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
public static void UpdateProd(HttpContext context, string strProdId, string intprodNum)
|
|||
|
|
{
|
|||
|
|
HttpCookie myCookie = new HttpCookie("0x120xxx1");
|
|||
|
|
|
|||
|
|
//<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] != "")
|
|||
|
|
{
|
|||
|
|
if (context.Request.Cookies["0x120xxx1"] != null)
|
|||
|
|
{
|
|||
|
|
myCookie = context.Request.Cookies["0x120xxx1"];
|
|||
|
|
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 == 2)
|
|||
|
|
{
|
|||
|
|
if (strA[0] != "")
|
|||
|
|
{
|
|||
|
|
if (strA[0] == AProdId[j])
|
|||
|
|
{
|
|||
|
|
if (intprodNum == "" || intprodNum == "0")
|
|||
|
|
{
|
|||
|
|
strCookie = strCookie.Replace(strACookie[i] + "|", "");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
strCookie = strCookie.Replace(strA[0] + "," + strA[1] + "|", strA[0] + "," + intprodNum + "|");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
//<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);
|
|||
|
|
context.Response.Cookies.Add(myCookie);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|