using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Data.SqlClient; using System.Globalization; using System.Threading; public partial class Clearing : System.Web.UI.Page { //string Name; //string Phone; //string PostCode; //string Email; //string Add; //string ISEnd; //string EndTime; public string totle_fee; string OID; public static string UserID = null; SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["con"].ConnectionString.ToString()); protected void Page_Load(object sender, EventArgs e) { string UserName; try { System.Data.DataTable dt = (DataTable)Session["member"]; UserName = dt.Rows[0]["nickname"].ToString(); } catch { Response.Redirect("default.aspx"); } if (Session["Lang"] != null) { if (Session["Lang"].ToString() == "zh-cn") { ImageButton1.ImageUrl = "images/shengcheng.jpg"; } else if (Session["Lang"].ToString() == "en-us") { ImageButton1.ImageUrl = "images/checkout.jpg"; } } UserID = Request.QueryString["p"].ToString(); string sqlstr = " SELECT * FROM v3_pay_the_bill WHERE cID = '" + Request.QueryString["p"].ToString() + "' and IsEnd =0"; DataSet ds = new common().ExcuteReader(sqlstr); if (ds.Tables[0].Rows.Count == 0) { this.Repeater1.Visible = false; this.Panel1.Visible = true; } else { this.Repeater1.DataSource = ds; this.Repeater1.DataBind(); this.Panel1.Visible = false; this.Repeater1.Visible = true; } } protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { if (Session["member"] != null) { DataTable dt = (DataTable)Session["member"]; UserID = dt.Rows[0]["Cid"].ToString(); } OID = "D" + DateTime.Now.ToString("yyMMdd") + Convert.ToString(new Random().Next(0, 10000)).PadLeft(8, '0'); Session["dingdan"] = OID; string sqlstr = "INSERT INTO v3_order(cid,oid,oname,tel,code,mail,address)values ('" + UserID + "','" + OID + "','" + this.txtName.Text.Trim().Replace("'", "‘") + "','" + this.txtPhone.Text.Trim().Replace("'", "‘") + "','" + this.txtPostCode.Text.Trim().Replace("'", "‘") + "','" + this.txtEmail.Text.Trim().Replace("'", "‘") + "','" + this.txtadd.Text.Trim().Replace("'", "‘") + "')"; bool result = new common().ExcuteNoneQuery(sqlstr, null); string SelectPid = " select car.pid as pid, car.amount as [count] from v3_shoppingcar as car where cid = '" + UserID + "'"; DataSet ds = new common().ExcuteReader(SelectPid); bool b = false; foreach (System.Data.DataRow row in ds.Tables[0].Rows) { string InsertItem = " insert into v3_order_Item (cid,pID,OID,amount,IsEnd,EndTime,addtime) values('" + UserID + "','" + row[0].ToString() + "','" + Session["dingdan"].ToString() + " ','" + row[1].ToString() + "',0,0,'"+DateTime.Now.ToString()+"')"; b = new common().ExcuteNoneQuery(InsertItem, null); } if (result && b) { string DelCar = "delete from v3_shoppingcar where cid ='" + UserID + "'"; bool Del = new common().ExcuteNoneQuery(DelCar, null); string DelCle = "update v3_pay_the_bill set Isend =1 where cid = '" + UserID + "'"; bool Cle = new common().ExcuteNoneQuery(DelCle, null); if (Del && Cle) { Response.Redirect("DingDan.aspx?Cid=" + UserID + "&OrderId=" + OID + "&fee=" + common.Encode(totle_fee,"84186899")); } } } protected override void InitializeCulture() { if (Session["lang"] != null) { string lang = Session["lang"].ToString(); if (!String.IsNullOrEmpty(lang)) { //UICulture - 决定了采用哪一种本地化资源,也就是使用哪种语言 //Culture - 决定各种数据类型是如何组织,如数字与日期 Thread.CurrentThread.CurrentUICulture = new CultureInfo(lang); Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(lang); base.InitializeCulture(); } } } protected void LinkButton2_Click(object sender, EventArgs e) { Session["Lang"] = "en-us"; Response.Redirect(Request.Url.ToString()); } protected void LinkButton1_Click(object sender, EventArgs e) { Session["Lang"] = "zh-cn"; Response.Redirect(Request.Url.ToString()); } }