protected void btorder_ServerClick(object sender, EventArgs e) { try { if (Session["infoUser"] != null) { string name = txtname.Value.Trim(); string address = txtaddess.Value.Trim(); string email = txtemail.Value.Trim(); string mobile = txtmobile.Value.Trim(); string homephone = txthome.Value.Trim(); int idPost = int.Parse(slPos.Value); int NumDay = int.Parse(slNumberDay.Value); string City=""; string Zipcode=""; string Country=""; name = name.Replace('<', ' '); name = name.Replace('>', ' '); address = address.Replace('<', ' '); address = address.Replace('>', ' '); mobile = mobile.Replace('<', ' '); mobile = mobile.Replace('>', ' '); homephone = homephone.Replace('<', ' '); homephone = homephone.Replace('>', ' '); string note=""; if (homephone.Length > 0) { mobile += ", " + homephone; } CManageError error = Validate(name, address, email, mobile,idPost); if (error.GetNumberErr() > 0) { divErrors.Disabled = false; divErrors.InnerHtml = "<br /><div class='diverror'>" + error.GetAllError() + "</div>"; } else { DateTime timeNow=new DateTime(); timeNow=DateTime.Now; string[] arrInfo = (string[])Session["infoUser"]; int idCurrency=0; float Rate=0; //InsertValue: string codenumber = ManagerUser.getOrderNumber(); DataSet dsInfo = ManagerUser.SelectInformationForOrder(int.Parse(arrInfo[0]), Application["currency"].ToString()); try { if (dsInfo.Tables.Count > 0) { if (dsInfo.Tables[0].Rows.Count > 0) { City = dsInfo.Tables[0].Rows[0]["ShippingCity"].ToString(); Zipcode = dsInfo.Tables[0].Rows[0]["ShippingZipcode"].ToString(); Country = dsInfo.Tables[0].Rows[0]["ShippingCountry"].ToString(); } } } catch { } try { if (dsInfo.Tables.Count > 0) { if (dsInfo.Tables[1].Rows.Count > 0) { idCurrency = int.Parse(dsInfo.Tables[1].Rows[0]["id"].ToString()); Rate = float.Parse(dsInfo.Tables[1].Rows[0]["Rate"].ToString()); } } } catch { } int Idorder=ManagerUser.OrderInsertNew(codenumber, 0, timeNow, 0, int.Parse(arrInfo[0]), idPost, 1, 4, NumDay, 0, "", 0, idCurrency, Rate, name, address, City, Zipcode, Country, mobile, email, note); if (Idorder>0) { ArrayList listvalue = new ArrayList(); ManagerCart = (ManagerProcart)Session["ProductInCart"]; int Num = ManagerCart.getLengList(); for (int i = 0; i < Num; i++) { string[] arrvalue = new string[6]; proIncart = (ProInCart)ManagerCart.GetProIndex(i); arrvalue[0] = proIncart.id.ToString(); if (proIncart.type == 2) { arrvalue[1] = "0"; } else { arrvalue[1] = "1"; } //seri: arrvalue[2] = ""; arrvalue[3] = proIncart.number.ToString(); arrvalue[4] = proIncart.price.ToString(); arrvalue[5] = proIncart.rate.ToString(); listvalue.Add(arrvalue); } float discount=0; float tax=0; Boolean test= ManagerUser.InsertOrderDetail(Idorder, Rate, discount, tax, listvalue); if (test) { Session["ProductInCart"] = null; Session["ssListOrder"] = null; Response.Redirect("Default.aspx?menu=yesorder"); } else { divErrors.Disabled = false; divErrors.InnerHtml = "<br /><div class='diverror'>" + terrOrder + "</div>"; } } else { divErrors.Disabled = false; divErrors.InnerHtml = "<br /><div class='diverror'>" + terrOrder + "</div>"; } } } else { divErrors.Disabled = false; divErrors.InnerHtml = "<br /><div class='diverror'>" + tmessageinfo + "</div>"; } } catch { } }
protected void Page_Load(object sender, EventArgs e) { if (Session["ProductInCart"] != null) { ManagerCart = (ManagerProcart)Session["ProductInCart"]; numberincart = ManagerCart.getLengList().ToString(); } try { Hashtable hash = (Hashtable)Application[Session["langcurrent"].ToString()]; currentAccess = hash["currentpage"].ToString(); thome = hash["home"].ToString(); blCart = hash["blcart"].ToString(); nohave = hash["mnothave"].ToString(); tnumber = hash["mnumber"].ToString(); tTatal = hash["mtotal"].ToString(); twarranty=hash["twarranty"].ToString(); tmonth = hash["tmonth"].ToString(); tprice = hash["tprice"].ToString(); tinfopro = hash["tinfop"].ToString(); bcon = hash["bcon"].ToString(); bupdate = hash["bupdate"].ToString(); btUpdate.Value = bupdate; torder = hash["torder"].ToString(); currentAccess += ": <a href='?menu=home'>" + thome + "</a> » " + blCart; } catch { } if (!IsPostBack) { tablePro = ShowCart(); if (numberincart.Equals("0")) { divbutton.Visible = false; } } }