protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string sql = "select id,name,ip,mac,'' as status from terminals"; DataTable dt = GobalTools.Select(sql); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { string ip = dt.Rows[i]["ip"].ToString(); if (FT.Commons.Tools.WindowExHelper.CanConnectionTo(ip)) { dt.Rows[i]["status"] = "在线"; } else { dt.Rows[i]["status"] = "下线"; } } this.GridView1.DataSource = dt; this.GridView1.DataBind(); } } }
protected void repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "buyAndPrint") { } else if (e.CommandName == "addToStore") { DataTable dt = GobalTools.Select("select * from yuantuo_product_info where id=" + Request.Params["id"] + ""); object obj = Session["Store"]; if (obj == null) { Session["Store"] = dt; } else { DataTable dt2 = Session["Store"] as DataTable; dt.Merge(dt2); Session["Store"] = dt; } Label lb = e.Item.FindControl("lbMsg") as Label; // lb.Text = "加入购物车成功,共"+dt.Rows.Count+"件商品"; } }